google-cloud-functions-v2 0.1.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3d6b6e6359bf56a99485078111cc1ee38d6412d7ef0ae3aeb4cd683254b6d998
4
- data.tar.gz: d87b48663959f691ae3f9ea496f045a2081beb09c5cfacf7f91f50bc8fc4cf2a
3
+ metadata.gz: 60a81c1d07f91c14470579fea2f02c13b9cdc460546439a3fe7e8bf431bc5795
4
+ data.tar.gz: 6e832526b2b135a129c99ce511f39317faf39d3cfffb1f3fc82c239fcc844027
5
5
  SHA512:
6
- metadata.gz: 9bd6cdf8df9ee900afb2de7e9dfce20d520acb8dcccd8d9a21024c46575d5d1845c2ce63cfa21076927300bd45789b4d93851907b97254ea7abcbfb74ebde82f
7
- data.tar.gz: aef1bb6e4653a7e1b6b3916e29a33cde4e753d8b2e6e8661dc5c1a0d1324465192ee7ee6a82aea5b8fcd2d7b74caacd9d1cf2543230fdc2cbca6d545798eb986
6
+ metadata.gz: 0e6df6babde60d6e014dc9b40982cddd2f076be628e4474f3093727fd151940b3fe6a0facc29e450a3c52532bd82fafc15598e3d1d1f643647f8d34a3cc02c10
7
+ data.tar.gz: f5275ce31e58401c21b165779200dfe86f0e37d2357f076550a1ba18c75cf73a973caec3cebef92e91b41e8c05a2fbfbc66773c040033454f8f7c4df96bb59eb
data/AUTHENTICATION.md CHANGED
@@ -114,7 +114,7 @@ credentials are discovered.
114
114
  To configure your system for this, simply:
115
115
 
116
116
  1. [Download and install the Cloud SDK](https://cloud.google.com/sdk)
117
- 2. Authenticate using OAuth 2.0 `$ gcloud auth login`
117
+ 2. Authenticate using OAuth 2.0 `$ gcloud auth application-default login`
118
118
  3. Write code as if already authenticated.
119
119
 
120
120
  **NOTE:** This is _not_ recommended for running in production. The Cloud SDK
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Ruby Client for the Cloud Functions V2 API
2
2
 
3
- API Client library for the Cloud Functions V2 API
3
+ Manages lightweight user-provided functions executed in response to events.
4
4
 
5
5
  The Cloud Functions API manages lightweight user-provided functions executed in response to events.
6
6
 
@@ -46,8 +46,8 @@ for general usage information.
46
46
  ## Enabling Logging
47
47
 
48
48
  To enable logging for this library, set the logger for the underlying [gRPC](https://github.com/grpc/grpc/tree/master/src/ruby) library.
49
- The logger that you set may be a Ruby stdlib [`Logger`](https://ruby-doc.org/stdlib/libdoc/logger/rdoc/Logger.html) as shown below,
50
- or a [`Google::Cloud::Logging::Logger`](https://googleapis.dev/ruby/google-cloud-logging/latest)
49
+ The logger that you set may be a Ruby stdlib [`Logger`](https://ruby-doc.org/current/stdlibs/logger/Logger.html) as shown below,
50
+ or a [`Google::Cloud::Logging::Logger`](https://cloud.google.com/ruby/docs/reference/google-cloud-logging/latest)
51
51
  that will write logs to [Cloud Logging](https://cloud.google.com/logging/). See [grpc/logconfig.rb](https://github.com/grpc/grpc/blob/master/src/ruby/lib/grpc/logconfig.rb)
52
52
  and the gRPC [spec_helper.rb](https://github.com/grpc/grpc/blob/master/src/ruby/spec/spec_helper.rb) for additional information.
53
53
 
@@ -0,0 +1,124 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2023 Google LLC
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # https://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ # Auto-generated by gapic-generator-ruby. DO NOT EDIT!
18
+
19
+ require "gapic/config"
20
+
21
+ module Google
22
+ module Cloud
23
+ module Functions
24
+ ##
25
+ # @example Loading just the REST part of this package, including all its services, and instantiating a REST client
26
+ #
27
+ # require "google/cloud/functions/v2/rest"
28
+ # client = ::Google::Cloud::Functions::V2::FunctionService::Rest::Client.new
29
+ #
30
+ module V2
31
+ ##
32
+ # @private
33
+ # Initialize the mixin bindings configuration
34
+ #
35
+ def self.configure
36
+ @configure ||= begin
37
+ namespace = ["Google", "Cloud", "Functions"]
38
+ parent_config = while namespace.any?
39
+ parent_name = namespace.join "::"
40
+ parent_const = const_get parent_name
41
+ break parent_const.configure if parent_const.respond_to? :configure
42
+ namespace.pop
43
+ end
44
+
45
+ default_config = Configuration.new parent_config
46
+ default_config.bindings_override["google.cloud.location.Locations.ListLocations"] = [
47
+ Gapic::Rest::GrpcTranscoder::HttpBinding.create_with_validation(
48
+ uri_method: :get,
49
+ uri_template: "/v2/{name}/locations",
50
+ matches: [
51
+ ["name", %r{^projects/[^/]+/?$}, false]
52
+ ],
53
+ body: nil
54
+ )
55
+ ]
56
+ default_config.bindings_override["google.iam.v1.IAMPolicy.GetIamPolicy"] = [
57
+
58
+ Gapic::Rest::GrpcTranscoder::HttpBinding.create_with_validation(
59
+ uri_method: :get,
60
+ uri_template: "/v2/{resource}:getIamPolicy",
61
+ matches: [
62
+ ["resource", %r{^projects/[^/]+/locations/[^/]+/functions/[^/]+/?$}, false]
63
+ ],
64
+ body: nil
65
+ )
66
+ ]
67
+ default_config.bindings_override["google.iam.v1.IAMPolicy.SetIamPolicy"] = [
68
+
69
+ Gapic::Rest::GrpcTranscoder::HttpBinding.create_with_validation(
70
+ uri_method: :post,
71
+ uri_template: "/v2/{resource}:setIamPolicy",
72
+ matches: [
73
+ ["resource", %r{^projects/[^/]+/locations/[^/]+/functions/[^/]+/?$}, false]
74
+ ],
75
+ body: "*"
76
+ )
77
+ ]
78
+ default_config.bindings_override["google.iam.v1.IAMPolicy.TestIamPermissions"] = [
79
+
80
+ Gapic::Rest::GrpcTranscoder::HttpBinding.create_with_validation(
81
+ uri_method: :post,
82
+ uri_template: "/v2/{resource}:testIamPermissions",
83
+ matches: [
84
+ ["resource", %r{^projects/[^/]+/locations/[^/]+/functions/[^/]+/?$}, false]
85
+ ],
86
+ body: "*"
87
+ )
88
+ ]
89
+ default_config
90
+ end
91
+ yield @configure if block_given?
92
+ @configure
93
+ end
94
+
95
+ ##
96
+ # @private
97
+ # Configuration class for the google.cloud.functions.v2 package.
98
+ #
99
+ # This class contains common configuration for all services
100
+ # of the google.cloud.functions.v2 package.
101
+ #
102
+ # This configuration is for internal use of the client library classes,
103
+ # and it is not intended that the end-users will read or change it.
104
+ #
105
+ class Configuration
106
+ extend ::Gapic::Config
107
+
108
+ # @private
109
+ # Overrides for http bindings for the RPC of the mixins for this package.
110
+ # Services in this package should use these when creating clients for the mixin services.
111
+ # @return [::Hash{::Symbol=>::Array<::Gapic::Rest::GrpcTranscoder::HttpBinding>}]
112
+ config_attr :bindings_override, {}, ::Hash, nil
113
+
114
+ # @private
115
+ def initialize parent_config = nil
116
+ @parent_config = parent_config unless parent_config.nil?
117
+
118
+ yield self if block_given?
119
+ end
120
+ end
121
+ end
122
+ end
123
+ end
124
+ end
@@ -294,14 +294,17 @@ module Google
294
294
  # the default parameter values, pass an empty Hash as a request object (see above).
295
295
  #
296
296
  # @param parent [::String]
297
- # Required. The project and location from which the function should be listed,
298
- # specified in the format `projects/*/locations/*`
299
- # If you want to list functions in all locations, use "-" in place of a
300
- # location. When listing functions in all locations, if one or more
301
- # location(s) are unreachable, the response will contain functions from all
302
- # reachable locations along with the names of any unreachable locations.
297
+ # Required. The project and location from which the function should be
298
+ # listed, specified in the format `projects/*/locations/*` If you want to
299
+ # list functions in all locations, use "-" in place of a location. When
300
+ # listing functions in all locations, if one or more location(s) are
301
+ # unreachable, the response will contain functions from all reachable
302
+ # locations along with the names of any unreachable locations.
303
303
  # @param page_size [::Integer]
304
- # Maximum number of functions to return per call.
304
+ # Maximum number of functions to return per call. The largest allowed
305
+ # page_size is 1,000, if the page_size is omitted or specified as greater
306
+ # than 1,000 then it will be replaced as 1,000. The size of the list
307
+ # response can be less than specified when used with filters.
305
308
  # @param page_token [::String]
306
309
  # The value returned by the last
307
310
  # `ListFunctionsResponse`; indicates that
@@ -335,13 +338,11 @@ module Google
335
338
  # # Call the list_functions method.
336
339
  # result = client.list_functions request
337
340
  #
338
- # # The returned object is of type Gapic::PagedEnumerable. You can
339
- # # iterate over all elements by calling #each, and the enumerable
340
- # # will lazily make API calls to fetch subsequent pages. Other
341
- # # methods are also available for managing paging directly.
342
- # result.each do |response|
341
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
342
+ # # over elements, and API calls will be issued to fetch pages as needed.
343
+ # result.each do |item|
343
344
  # # Each element is of type ::Google::Cloud::Functions::V2::Function.
344
- # p response
345
+ # p item
345
346
  # end
346
347
  #
347
348
  def list_functions request, options = nil
@@ -407,8 +408,8 @@ module Google
407
408
  # the default parameter values, pass an empty Hash as a request object (see above).
408
409
  #
409
410
  # @param parent [::String]
410
- # Required. The project and location in which the function should be created, specified
411
- # in the format `projects/*/locations/*`
411
+ # Required. The project and location in which the function should be created,
412
+ # specified in the format `projects/*/locations/*`
412
413
  # @param function [::Google::Cloud::Functions::V2::Function, ::Hash]
413
414
  # Required. Function to be created.
414
415
  # @param function_id [::String]
@@ -438,14 +439,14 @@ module Google
438
439
  # # Call the create_function method.
439
440
  # result = client.create_function request
440
441
  #
441
- # # The returned object is of type Gapic::Operation. You can use this
442
- # # object to check the status of an operation, cancel it, or wait
443
- # # for results. Here is how to block until completion:
442
+ # # The returned object is of type Gapic::Operation. You can use it to
443
+ # # check the status of an operation, cancel it, or wait for results.
444
+ # # Here is how to wait for a response.
444
445
  # result.wait_until_done! timeout: 60
445
446
  # if result.response?
446
447
  # p result.response
447
448
  # else
448
- # puts "Error!"
449
+ # puts "No response received."
449
450
  # end
450
451
  #
451
452
  def create_function request, options = nil
@@ -535,14 +536,14 @@ module Google
535
536
  # # Call the update_function method.
536
537
  # result = client.update_function request
537
538
  #
538
- # # The returned object is of type Gapic::Operation. You can use this
539
- # # object to check the status of an operation, cancel it, or wait
540
- # # for results. Here is how to block until completion:
539
+ # # The returned object is of type Gapic::Operation. You can use it to
540
+ # # check the status of an operation, cancel it, or wait for results.
541
+ # # Here is how to wait for a response.
541
542
  # result.wait_until_done! timeout: 60
542
543
  # if result.response?
543
544
  # p result.response
544
545
  # else
545
- # puts "Error!"
546
+ # puts "No response received."
546
547
  # end
547
548
  #
548
549
  def update_function request, options = nil
@@ -630,14 +631,14 @@ module Google
630
631
  # # Call the delete_function method.
631
632
  # result = client.delete_function request
632
633
  #
633
- # # The returned object is of type Gapic::Operation. You can use this
634
- # # object to check the status of an operation, cancel it, or wait
635
- # # for results. Here is how to block until completion:
634
+ # # The returned object is of type Gapic::Operation. You can use it to
635
+ # # check the status of an operation, cancel it, or wait for results.
636
+ # # Here is how to wait for a response.
636
637
  # result.wait_until_done! timeout: 60
637
638
  # if result.response?
638
639
  # p result.response
639
640
  # else
640
- # puts "Error!"
641
+ # puts "No response received."
641
642
  # end
642
643
  #
643
644
  def delete_function request, options = nil
@@ -717,14 +718,30 @@ module Google
717
718
  # @param options [::Gapic::CallOptions, ::Hash]
718
719
  # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
719
720
  #
720
- # @overload generate_upload_url(parent: nil)
721
+ # @overload generate_upload_url(parent: nil, kms_key_name: nil)
721
722
  # Pass arguments to `generate_upload_url` via keyword arguments. Note that at
722
723
  # least one keyword argument is required. To specify no parameters, or to keep all
723
724
  # the default parameter values, pass an empty Hash as a request object (see above).
724
725
  #
725
726
  # @param parent [::String]
726
- # Required. The project and location in which the Google Cloud Storage signed URL
727
- # should be generated, specified in the format `projects/*/locations/*`.
727
+ # Required. The project and location in which the Google Cloud Storage signed
728
+ # URL should be generated, specified in the format `projects/*/locations/*`.
729
+ # @param kms_key_name [::String]
730
+ # Resource name of a KMS crypto key (managed by the user) used to
731
+ # encrypt/decrypt function source code objects in intermediate Cloud Storage
732
+ # buckets. When you generate an upload url and upload your source code, it
733
+ # gets copied to an intermediate Cloud Storage bucket. The source code is
734
+ # then copied to a versioned directory in the sources bucket in the consumer
735
+ # project during the function deployment.
736
+ #
737
+ # It must match the pattern
738
+ # `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`.
739
+ #
740
+ # The Google Cloud Functions service account
741
+ # (service-\\{project_number}@gcf-admin-robot.iam.gserviceaccount.com) must be
742
+ # granted the role 'Cloud KMS CryptoKey Encrypter/Decrypter
743
+ # (roles/cloudkms.cryptoKeyEncrypterDecrypter)' on the
744
+ # Key/KeyRing/Project/Organization (least access preferred).
728
745
  #
729
746
  # @yield [response, operation] Access the result along with the RPC operation
730
747
  # @yieldparam response [::Google::Cloud::Functions::V2::GenerateUploadUrlResponse]
@@ -813,8 +830,8 @@ module Google
813
830
  # the default parameter values, pass an empty Hash as a request object (see above).
814
831
  #
815
832
  # @param name [::String]
816
- # Required. The name of function for which source code Google Cloud Storage signed
817
- # URL should be generated.
833
+ # Required. The name of function for which source code Google Cloud Storage
834
+ # signed URL should be generated.
818
835
  #
819
836
  # @yield [response, operation] Access the result along with the RPC operation
820
837
  # @yieldparam response [::Google::Cloud::Functions::V2::GenerateDownloadUrlResponse]
@@ -899,8 +916,8 @@ module Google
899
916
  # the default parameter values, pass an empty Hash as a request object (see above).
900
917
  #
901
918
  # @param parent [::String]
902
- # Required. The project and location from which the runtimes should be listed,
903
- # specified in the format `projects/*/locations/*`
919
+ # Required. The project and location from which the runtimes should be
920
+ # listed, specified in the format `projects/*/locations/*`
904
921
  # @param filter [::String]
905
922
  # The filter for Runtimes that match the filter expression,
906
923
  # following the syntax outlined in https://google.aip.dev/160.
@@ -1007,9 +1024,9 @@ module Google
1007
1024
  # * (`String`) The path to a service account key file in JSON format
1008
1025
  # * (`Hash`) A service account key as a Hash
1009
1026
  # * (`Google::Auth::Credentials`) A googleauth credentials object
1010
- # (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
1027
+ # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
1011
1028
  # * (`Signet::OAuth2::Client`) A signet oauth2 client object
1012
- # (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
1029
+ # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
1013
1030
  # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
1014
1031
  # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
1015
1032
  # * (`nil`) indicating no credentials
@@ -158,13 +158,11 @@ module Google
158
158
  # # Call the list_operations method.
159
159
  # result = client.list_operations request
160
160
  #
161
- # # The returned object is of type Gapic::PagedEnumerable. You can
162
- # # iterate over all elements by calling #each, and the enumerable
163
- # # will lazily make API calls to fetch subsequent pages. Other
164
- # # methods are also available for managing paging directly.
165
- # result.each do |response|
161
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
162
+ # # over elements, and API calls will be issued to fetch pages as needed.
163
+ # result.each do |item|
166
164
  # # Each element is of type ::Google::Longrunning::Operation.
167
- # p response
165
+ # p item
168
166
  # end
169
167
  #
170
168
  def list_operations request, options = nil
@@ -253,14 +251,14 @@ module Google
253
251
  # # Call the get_operation method.
254
252
  # result = client.get_operation request
255
253
  #
256
- # # The returned object is of type Gapic::Operation. You can use this
257
- # # object to check the status of an operation, cancel it, or wait
258
- # # for results. Here is how to block until completion:
254
+ # # The returned object is of type Gapic::Operation. You can use it to
255
+ # # check the status of an operation, cancel it, or wait for results.
256
+ # # Here is how to wait for a response.
259
257
  # result.wait_until_done! timeout: 60
260
258
  # if result.response?
261
259
  # p result.response
262
260
  # else
263
- # puts "Error!"
261
+ # puts "No response received."
264
262
  # end
265
263
  #
266
264
  def get_operation request, options = nil
@@ -540,14 +538,14 @@ module Google
540
538
  # # Call the wait_operation method.
541
539
  # result = client.wait_operation request
542
540
  #
543
- # # The returned object is of type Gapic::Operation. You can use this
544
- # # object to check the status of an operation, cancel it, or wait
545
- # # for results. Here is how to block until completion:
541
+ # # The returned object is of type Gapic::Operation. You can use it to
542
+ # # check the status of an operation, cancel it, or wait for results.
543
+ # # Here is how to wait for a response.
546
544
  # result.wait_until_done! timeout: 60
547
545
  # if result.response?
548
546
  # p result.response
549
547
  # else
550
- # puts "Error!"
548
+ # puts "No response received."
551
549
  # end
552
550
  #
553
551
  def wait_operation request, options = nil
@@ -622,9 +620,9 @@ module Google
622
620
  # * (`String`) The path to a service account key file in JSON format
623
621
  # * (`Hash`) A service account key as a Hash
624
622
  # * (`Google::Auth::Credentials`) A googleauth credentials object
625
- # (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
623
+ # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
626
624
  # * (`Signet::OAuth2::Client`) A signet oauth2 client object
627
- # (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
625
+ # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
628
626
  # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
629
627
  # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
630
628
  # * (`nil`) indicating no credentials
@@ -81,6 +81,27 @@ module Google
81
81
  "projects/#{project}/locations/#{location}/connectors/#{connector}"
82
82
  end
83
83
 
84
+ ##
85
+ # Create a fully-qualified CryptoKey resource string.
86
+ #
87
+ # The resource will be in the following format:
88
+ #
89
+ # `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`
90
+ #
91
+ # @param project [String]
92
+ # @param location [String]
93
+ # @param key_ring [String]
94
+ # @param crypto_key [String]
95
+ #
96
+ # @return [::String]
97
+ def crypto_key_path project:, location:, key_ring:, crypto_key:
98
+ raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
99
+ raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"
100
+ raise ::ArgumentError, "key_ring cannot contain /" if key_ring.to_s.include? "/"
101
+
102
+ "projects/#{project}/locations/#{location}/keyRings/#{key_ring}/cryptoKeys/#{crypto_key}"
103
+ end
104
+
84
105
  ##
85
106
  # Create a fully-qualified Function resource string.
86
107
  #