google-cloud-functions-v1 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (33) hide show
  1. checksums.yaml +7 -0
  2. data/.yardopts +12 -0
  3. data/AUTHENTICATION.md +169 -0
  4. data/LICENSE.md +203 -0
  5. data/README.md +75 -0
  6. data/lib/google-cloud-functions-v1.rb +21 -0
  7. data/lib/google/cloud/functions/v1.rb +35 -0
  8. data/lib/google/cloud/functions/v1/cloud_functions_service.rb +50 -0
  9. data/lib/google/cloud/functions/v1/cloud_functions_service/client.rb +1196 -0
  10. data/lib/google/cloud/functions/v1/cloud_functions_service/credentials.rb +51 -0
  11. data/lib/google/cloud/functions/v1/cloud_functions_service/operations.rb +570 -0
  12. data/lib/google/cloud/functions/v1/cloud_functions_service/paths.rb +69 -0
  13. data/lib/google/cloud/functions/v1/functions_pb.rb +163 -0
  14. data/lib/google/cloud/functions/v1/functions_services_pb.rb +106 -0
  15. data/lib/google/cloud/functions/v1/operations_pb.rb +37 -0
  16. data/lib/google/cloud/functions/v1/version.rb +28 -0
  17. data/proto_docs/README.md +4 -0
  18. data/proto_docs/google/api/field_behavior.rb +59 -0
  19. data/proto_docs/google/api/resource.rb +247 -0
  20. data/proto_docs/google/cloud/functions/v1/functions.rb +491 -0
  21. data/proto_docs/google/cloud/functions/v1/operations.rb +68 -0
  22. data/proto_docs/google/iam/v1/iam_policy.rb +80 -0
  23. data/proto_docs/google/iam/v1/options.rb +40 -0
  24. data/proto_docs/google/iam/v1/policy.rb +248 -0
  25. data/proto_docs/google/longrunning/operations.rb +150 -0
  26. data/proto_docs/google/protobuf/any.rb +138 -0
  27. data/proto_docs/google/protobuf/duration.rb +98 -0
  28. data/proto_docs/google/protobuf/empty.rb +36 -0
  29. data/proto_docs/google/protobuf/field_mask.rb +229 -0
  30. data/proto_docs/google/protobuf/timestamp.rb +120 -0
  31. data/proto_docs/google/rpc/status.rb +46 -0
  32. data/proto_docs/google/type/expr.rb +52 -0
  33. metadata +234 -0
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2020 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
+ # This gem does not autoload during Bundler.require. To load this gem,
20
+ # issue explicit require statements for the packages desired, e.g.:
21
+ # require "google/cloud/functions/v1"
@@ -0,0 +1,35 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2020 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 "google/cloud/functions/v1/cloud_functions_service"
20
+ require "google/cloud/functions/v1/version"
21
+
22
+ module Google
23
+ module Cloud
24
+ module Functions
25
+ ##
26
+ # To load this package, including all its services, and instantiate a client:
27
+ #
28
+ # require "google/cloud/functions/v1"
29
+ # client = ::Google::Cloud::Functions::V1::CloudFunctionsService::Client.new
30
+ #
31
+ module V1
32
+ end
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,50 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2020 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/common"
20
+ require "gapic/config"
21
+ require "gapic/config/method"
22
+
23
+ require "google/cloud/functions/v1/version"
24
+
25
+ require "google/cloud/functions/v1/cloud_functions_service/credentials"
26
+ require "google/cloud/functions/v1/cloud_functions_service/paths"
27
+ require "google/cloud/functions/v1/cloud_functions_service/operations"
28
+ require "google/cloud/functions/v1/cloud_functions_service/client"
29
+
30
+ module Google
31
+ module Cloud
32
+ module Functions
33
+ module V1
34
+ ##
35
+ # A service that application uses to manipulate triggers and functions.
36
+ #
37
+ # To load this service and instantiate a client:
38
+ #
39
+ # require "google/cloud/functions/v1/cloud_functions_service"
40
+ # client = ::Google::Cloud::Functions::V1::CloudFunctionsService::Client.new
41
+ #
42
+ module CloudFunctionsService
43
+ end
44
+ end
45
+ end
46
+ end
47
+ end
48
+
49
+ helper_path = ::File.join __dir__, "cloud_functions_service", "helpers.rb"
50
+ require "google/cloud/functions/v1/cloud_functions_service/helpers" if ::File.file? helper_path
@@ -0,0 +1,1196 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2020 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 "google/cloud/errors"
20
+ require "google/cloud/functions/v1/functions_pb"
21
+
22
+ module Google
23
+ module Cloud
24
+ module Functions
25
+ module V1
26
+ module CloudFunctionsService
27
+ ##
28
+ # Client for the CloudFunctionsService service.
29
+ #
30
+ # A service that application uses to manipulate triggers and functions.
31
+ #
32
+ class Client
33
+ include Paths
34
+
35
+ # @private
36
+ attr_reader :cloud_functions_service_stub
37
+
38
+ ##
39
+ # Configure the CloudFunctionsService Client class.
40
+ #
41
+ # See {::Google::Cloud::Functions::V1::CloudFunctionsService::Client::Configuration}
42
+ # for a description of the configuration fields.
43
+ #
44
+ # ## Example
45
+ #
46
+ # To modify the configuration for all CloudFunctionsService clients:
47
+ #
48
+ # ::Google::Cloud::Functions::V1::CloudFunctionsService::Client.configure do |config|
49
+ # config.timeout = 10.0
50
+ # end
51
+ #
52
+ # @yield [config] Configure the Client client.
53
+ # @yieldparam config [Client::Configuration]
54
+ #
55
+ # @return [Client::Configuration]
56
+ #
57
+ def self.configure
58
+ @configure ||= begin
59
+ namespace = ["Google", "Cloud", "Functions", "V1"]
60
+ parent_config = while namespace.any?
61
+ parent_name = namespace.join "::"
62
+ parent_const = const_get parent_name
63
+ break parent_const.configure if parent_const&.respond_to? :configure
64
+ namespace.pop
65
+ end
66
+ default_config = Client::Configuration.new parent_config
67
+
68
+ default_config
69
+ end
70
+ yield @configure if block_given?
71
+ @configure
72
+ end
73
+
74
+ ##
75
+ # Configure the CloudFunctionsService Client instance.
76
+ #
77
+ # The configuration is set to the derived mode, meaning that values can be changed,
78
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
79
+ # should be made on {Client.configure}.
80
+ #
81
+ # See {::Google::Cloud::Functions::V1::CloudFunctionsService::Client::Configuration}
82
+ # for a description of the configuration fields.
83
+ #
84
+ # @yield [config] Configure the Client client.
85
+ # @yieldparam config [Client::Configuration]
86
+ #
87
+ # @return [Client::Configuration]
88
+ #
89
+ def configure
90
+ yield @config if block_given?
91
+ @config
92
+ end
93
+
94
+ ##
95
+ # Create a new CloudFunctionsService client object.
96
+ #
97
+ # ## Examples
98
+ #
99
+ # To create a new CloudFunctionsService client with the default
100
+ # configuration:
101
+ #
102
+ # client = ::Google::Cloud::Functions::V1::CloudFunctionsService::Client.new
103
+ #
104
+ # To create a new CloudFunctionsService client with a custom
105
+ # configuration:
106
+ #
107
+ # client = ::Google::Cloud::Functions::V1::CloudFunctionsService::Client.new do |config|
108
+ # config.timeout = 10.0
109
+ # end
110
+ #
111
+ # @yield [config] Configure the CloudFunctionsService client.
112
+ # @yieldparam config [Client::Configuration]
113
+ #
114
+ def initialize
115
+ # These require statements are intentionally placed here to initialize
116
+ # the gRPC module only when it's required.
117
+ # See https://github.com/googleapis/toolkit/issues/446
118
+ require "gapic/grpc"
119
+ require "google/cloud/functions/v1/functions_services_pb"
120
+
121
+ # Create the configuration object
122
+ @config = Configuration.new Client.configure
123
+
124
+ # Yield the configuration if needed
125
+ yield @config if block_given?
126
+
127
+ # Create credentials
128
+ credentials = @config.credentials
129
+ credentials ||= Credentials.default scope: @config.scope
130
+ if credentials.is_a?(String) || credentials.is_a?(Hash)
131
+ credentials = Credentials.new credentials, scope: @config.scope
132
+ end
133
+ @quota_project_id = @config.quota_project
134
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
135
+
136
+ @operations_client = Operations.new do |config|
137
+ config.credentials = credentials
138
+ config.endpoint = @config.endpoint
139
+ end
140
+
141
+ @cloud_functions_service_stub = ::Gapic::ServiceStub.new(
142
+ ::Google::Cloud::Functions::V1::CloudFunctionsService::Stub,
143
+ credentials: credentials,
144
+ endpoint: @config.endpoint,
145
+ channel_args: @config.channel_args,
146
+ interceptors: @config.interceptors
147
+ )
148
+ end
149
+
150
+ ##
151
+ # Get the associated client for long-running operations.
152
+ #
153
+ # @return [::Google::Cloud::Functions::V1::CloudFunctionsService::Operations]
154
+ #
155
+ attr_reader :operations_client
156
+
157
+ # Service calls
158
+
159
+ ##
160
+ # Returns a list of functions that belong to the requested project.
161
+ #
162
+ # @overload list_functions(request, options = nil)
163
+ # Pass arguments to `list_functions` via a request object, either of type
164
+ # {::Google::Cloud::Functions::V1::ListFunctionsRequest} or an equivalent Hash.
165
+ #
166
+ # @param request [::Google::Cloud::Functions::V1::ListFunctionsRequest, ::Hash]
167
+ # A request object representing the call parameters. Required. To specify no
168
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
169
+ # @param options [::Gapic::CallOptions, ::Hash]
170
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
171
+ #
172
+ # @overload list_functions(parent: nil, page_size: nil, page_token: nil)
173
+ # Pass arguments to `list_functions` via keyword arguments. Note that at
174
+ # least one keyword argument is required. To specify no parameters, or to keep all
175
+ # the default parameter values, pass an empty Hash as a request object (see above).
176
+ #
177
+ # @param parent [::String]
178
+ # The project and location from which the function should be listed,
179
+ # specified in the format `projects/*/locations/*`
180
+ # If you want to list functions in all locations, use "-" in place of a
181
+ # location. When listing functions in all locations, if one or more
182
+ # location(s) are unreachable, the response will contain functions from all
183
+ # reachable locations along with the names of any unreachable locations.
184
+ # @param page_size [::Integer]
185
+ # Maximum number of functions to return per call.
186
+ # @param page_token [::String]
187
+ # The value returned by the last
188
+ # `ListFunctionsResponse`; indicates that
189
+ # this is a continuation of a prior `ListFunctions` call, and that the
190
+ # system should return the next page of data.
191
+ #
192
+ # @yield [response, operation] Access the result along with the RPC operation
193
+ # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Functions::V1::CloudFunction>]
194
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
195
+ #
196
+ # @return [::Gapic::PagedEnumerable<::Google::Cloud::Functions::V1::CloudFunction>]
197
+ #
198
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
199
+ #
200
+ def list_functions request, options = nil
201
+ raise ::ArgumentError, "request must be provided" if request.nil?
202
+
203
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Functions::V1::ListFunctionsRequest
204
+
205
+ # Converts hash and nil to an options object
206
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
207
+
208
+ # Customize the options with defaults
209
+ metadata = @config.rpcs.list_functions.metadata.to_h
210
+
211
+ # Set x-goog-api-client and x-goog-user-project headers
212
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
213
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
214
+ gapic_version: ::Google::Cloud::Functions::V1::VERSION
215
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
216
+
217
+ header_params = {
218
+ "parent" => request.parent
219
+ }
220
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
221
+ metadata[:"x-goog-request-params"] ||= request_params_header
222
+
223
+ options.apply_defaults timeout: @config.rpcs.list_functions.timeout,
224
+ metadata: metadata,
225
+ retry_policy: @config.rpcs.list_functions.retry_policy
226
+ options.apply_defaults metadata: @config.metadata,
227
+ retry_policy: @config.retry_policy
228
+
229
+ @cloud_functions_service_stub.call_rpc :list_functions, request, options: options do |response, operation|
230
+ response = ::Gapic::PagedEnumerable.new @cloud_functions_service_stub, :list_functions, request, response, operation, options
231
+ yield response, operation if block_given?
232
+ return response
233
+ end
234
+ rescue ::GRPC::BadStatus => e
235
+ raise ::Google::Cloud::Error.from_error(e)
236
+ end
237
+
238
+ ##
239
+ # Returns a function with the given name from the requested project.
240
+ #
241
+ # @overload get_function(request, options = nil)
242
+ # Pass arguments to `get_function` via a request object, either of type
243
+ # {::Google::Cloud::Functions::V1::GetFunctionRequest} or an equivalent Hash.
244
+ #
245
+ # @param request [::Google::Cloud::Functions::V1::GetFunctionRequest, ::Hash]
246
+ # A request object representing the call parameters. Required. To specify no
247
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
248
+ # @param options [::Gapic::CallOptions, ::Hash]
249
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
250
+ #
251
+ # @overload get_function(name: nil)
252
+ # Pass arguments to `get_function` via keyword arguments. Note that at
253
+ # least one keyword argument is required. To specify no parameters, or to keep all
254
+ # the default parameter values, pass an empty Hash as a request object (see above).
255
+ #
256
+ # @param name [::String]
257
+ # Required. The name of the function which details should be obtained.
258
+ #
259
+ # @yield [response, operation] Access the result along with the RPC operation
260
+ # @yieldparam response [::Google::Cloud::Functions::V1::CloudFunction]
261
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
262
+ #
263
+ # @return [::Google::Cloud::Functions::V1::CloudFunction]
264
+ #
265
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
266
+ #
267
+ def get_function request, options = nil
268
+ raise ::ArgumentError, "request must be provided" if request.nil?
269
+
270
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Functions::V1::GetFunctionRequest
271
+
272
+ # Converts hash and nil to an options object
273
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
274
+
275
+ # Customize the options with defaults
276
+ metadata = @config.rpcs.get_function.metadata.to_h
277
+
278
+ # Set x-goog-api-client and x-goog-user-project headers
279
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
280
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
281
+ gapic_version: ::Google::Cloud::Functions::V1::VERSION
282
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
283
+
284
+ header_params = {
285
+ "name" => request.name
286
+ }
287
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
288
+ metadata[:"x-goog-request-params"] ||= request_params_header
289
+
290
+ options.apply_defaults timeout: @config.rpcs.get_function.timeout,
291
+ metadata: metadata,
292
+ retry_policy: @config.rpcs.get_function.retry_policy
293
+ options.apply_defaults metadata: @config.metadata,
294
+ retry_policy: @config.retry_policy
295
+
296
+ @cloud_functions_service_stub.call_rpc :get_function, request, options: options do |response, operation|
297
+ yield response, operation if block_given?
298
+ return response
299
+ end
300
+ rescue ::GRPC::BadStatus => e
301
+ raise ::Google::Cloud::Error.from_error(e)
302
+ end
303
+
304
+ ##
305
+ # Creates a new function. If a function with the given name already exists in
306
+ # the specified project, the long running operation will return
307
+ # `ALREADY_EXISTS` error.
308
+ #
309
+ # @overload create_function(request, options = nil)
310
+ # Pass arguments to `create_function` via a request object, either of type
311
+ # {::Google::Cloud::Functions::V1::CreateFunctionRequest} or an equivalent Hash.
312
+ #
313
+ # @param request [::Google::Cloud::Functions::V1::CreateFunctionRequest, ::Hash]
314
+ # A request object representing the call parameters. Required. To specify no
315
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
316
+ # @param options [::Gapic::CallOptions, ::Hash]
317
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
318
+ #
319
+ # @overload create_function(location: nil, function: nil)
320
+ # Pass arguments to `create_function` via keyword arguments. Note that at
321
+ # least one keyword argument is required. To specify no parameters, or to keep all
322
+ # the default parameter values, pass an empty Hash as a request object (see above).
323
+ #
324
+ # @param location [::String]
325
+ # Required. The project and location in which the function should be created, specified
326
+ # in the format `projects/*/locations/*`
327
+ # @param function [::Google::Cloud::Functions::V1::CloudFunction, ::Hash]
328
+ # Required. Function to be created.
329
+ #
330
+ # @yield [response, operation] Access the result along with the RPC operation
331
+ # @yieldparam response [::Gapic::Operation]
332
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
333
+ #
334
+ # @return [::Gapic::Operation]
335
+ #
336
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
337
+ #
338
+ def create_function request, options = nil
339
+ raise ::ArgumentError, "request must be provided" if request.nil?
340
+
341
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Functions::V1::CreateFunctionRequest
342
+
343
+ # Converts hash and nil to an options object
344
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
345
+
346
+ # Customize the options with defaults
347
+ metadata = @config.rpcs.create_function.metadata.to_h
348
+
349
+ # Set x-goog-api-client and x-goog-user-project headers
350
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
351
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
352
+ gapic_version: ::Google::Cloud::Functions::V1::VERSION
353
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
354
+
355
+ header_params = {
356
+ "location" => request.location
357
+ }
358
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
359
+ metadata[:"x-goog-request-params"] ||= request_params_header
360
+
361
+ options.apply_defaults timeout: @config.rpcs.create_function.timeout,
362
+ metadata: metadata,
363
+ retry_policy: @config.rpcs.create_function.retry_policy
364
+ options.apply_defaults metadata: @config.metadata,
365
+ retry_policy: @config.retry_policy
366
+
367
+ @cloud_functions_service_stub.call_rpc :create_function, request, options: options do |response, operation|
368
+ response = ::Gapic::Operation.new response, @operations_client, options: options
369
+ yield response, operation if block_given?
370
+ return response
371
+ end
372
+ rescue ::GRPC::BadStatus => e
373
+ raise ::Google::Cloud::Error.from_error(e)
374
+ end
375
+
376
+ ##
377
+ # Updates existing function.
378
+ #
379
+ # @overload update_function(request, options = nil)
380
+ # Pass arguments to `update_function` via a request object, either of type
381
+ # {::Google::Cloud::Functions::V1::UpdateFunctionRequest} or an equivalent Hash.
382
+ #
383
+ # @param request [::Google::Cloud::Functions::V1::UpdateFunctionRequest, ::Hash]
384
+ # A request object representing the call parameters. Required. To specify no
385
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
386
+ # @param options [::Gapic::CallOptions, ::Hash]
387
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
388
+ #
389
+ # @overload update_function(function: nil, update_mask: nil)
390
+ # Pass arguments to `update_function` via keyword arguments. Note that at
391
+ # least one keyword argument is required. To specify no parameters, or to keep all
392
+ # the default parameter values, pass an empty Hash as a request object (see above).
393
+ #
394
+ # @param function [::Google::Cloud::Functions::V1::CloudFunction, ::Hash]
395
+ # Required. New version of the function.
396
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
397
+ # Required list of fields to be updated in this request.
398
+ #
399
+ # @yield [response, operation] Access the result along with the RPC operation
400
+ # @yieldparam response [::Gapic::Operation]
401
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
402
+ #
403
+ # @return [::Gapic::Operation]
404
+ #
405
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
406
+ #
407
+ def update_function request, options = nil
408
+ raise ::ArgumentError, "request must be provided" if request.nil?
409
+
410
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Functions::V1::UpdateFunctionRequest
411
+
412
+ # Converts hash and nil to an options object
413
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
414
+
415
+ # Customize the options with defaults
416
+ metadata = @config.rpcs.update_function.metadata.to_h
417
+
418
+ # Set x-goog-api-client and x-goog-user-project headers
419
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
420
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
421
+ gapic_version: ::Google::Cloud::Functions::V1::VERSION
422
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
423
+
424
+ header_params = {
425
+ "function.name" => request.function.name
426
+ }
427
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
428
+ metadata[:"x-goog-request-params"] ||= request_params_header
429
+
430
+ options.apply_defaults timeout: @config.rpcs.update_function.timeout,
431
+ metadata: metadata,
432
+ retry_policy: @config.rpcs.update_function.retry_policy
433
+ options.apply_defaults metadata: @config.metadata,
434
+ retry_policy: @config.retry_policy
435
+
436
+ @cloud_functions_service_stub.call_rpc :update_function, request, options: options do |response, operation|
437
+ response = ::Gapic::Operation.new response, @operations_client, options: options
438
+ yield response, operation if block_given?
439
+ return response
440
+ end
441
+ rescue ::GRPC::BadStatus => e
442
+ raise ::Google::Cloud::Error.from_error(e)
443
+ end
444
+
445
+ ##
446
+ # Deletes a function with the given name from the specified project. If the
447
+ # given function is used by some trigger, the trigger will be updated to
448
+ # remove this function.
449
+ #
450
+ # @overload delete_function(request, options = nil)
451
+ # Pass arguments to `delete_function` via a request object, either of type
452
+ # {::Google::Cloud::Functions::V1::DeleteFunctionRequest} or an equivalent Hash.
453
+ #
454
+ # @param request [::Google::Cloud::Functions::V1::DeleteFunctionRequest, ::Hash]
455
+ # A request object representing the call parameters. Required. To specify no
456
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
457
+ # @param options [::Gapic::CallOptions, ::Hash]
458
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
459
+ #
460
+ # @overload delete_function(name: nil)
461
+ # Pass arguments to `delete_function` via keyword arguments. Note that at
462
+ # least one keyword argument is required. To specify no parameters, or to keep all
463
+ # the default parameter values, pass an empty Hash as a request object (see above).
464
+ #
465
+ # @param name [::String]
466
+ # Required. The name of the function which should be deleted.
467
+ #
468
+ # @yield [response, operation] Access the result along with the RPC operation
469
+ # @yieldparam response [::Gapic::Operation]
470
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
471
+ #
472
+ # @return [::Gapic::Operation]
473
+ #
474
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
475
+ #
476
+ def delete_function request, options = nil
477
+ raise ::ArgumentError, "request must be provided" if request.nil?
478
+
479
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Functions::V1::DeleteFunctionRequest
480
+
481
+ # Converts hash and nil to an options object
482
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
483
+
484
+ # Customize the options with defaults
485
+ metadata = @config.rpcs.delete_function.metadata.to_h
486
+
487
+ # Set x-goog-api-client and x-goog-user-project headers
488
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
489
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
490
+ gapic_version: ::Google::Cloud::Functions::V1::VERSION
491
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
492
+
493
+ header_params = {
494
+ "name" => request.name
495
+ }
496
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
497
+ metadata[:"x-goog-request-params"] ||= request_params_header
498
+
499
+ options.apply_defaults timeout: @config.rpcs.delete_function.timeout,
500
+ metadata: metadata,
501
+ retry_policy: @config.rpcs.delete_function.retry_policy
502
+ options.apply_defaults metadata: @config.metadata,
503
+ retry_policy: @config.retry_policy
504
+
505
+ @cloud_functions_service_stub.call_rpc :delete_function, request, options: options do |response, operation|
506
+ response = ::Gapic::Operation.new response, @operations_client, options: options
507
+ yield response, operation if block_given?
508
+ return response
509
+ end
510
+ rescue ::GRPC::BadStatus => e
511
+ raise ::Google::Cloud::Error.from_error(e)
512
+ end
513
+
514
+ ##
515
+ # Synchronously invokes a deployed Cloud Function. To be used for testing
516
+ # purposes as very limited traffic is allowed. For more information on
517
+ # the actual limits, refer to
518
+ # [Rate Limits](https://cloud.google.com/functions/quotas#rate_limits).
519
+ #
520
+ # @overload call_function(request, options = nil)
521
+ # Pass arguments to `call_function` via a request object, either of type
522
+ # {::Google::Cloud::Functions::V1::CallFunctionRequest} or an equivalent Hash.
523
+ #
524
+ # @param request [::Google::Cloud::Functions::V1::CallFunctionRequest, ::Hash]
525
+ # A request object representing the call parameters. Required. To specify no
526
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
527
+ # @param options [::Gapic::CallOptions, ::Hash]
528
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
529
+ #
530
+ # @overload call_function(name: nil, data: nil)
531
+ # Pass arguments to `call_function` via keyword arguments. Note that at
532
+ # least one keyword argument is required. To specify no parameters, or to keep all
533
+ # the default parameter values, pass an empty Hash as a request object (see above).
534
+ #
535
+ # @param name [::String]
536
+ # Required. The name of the function to be called.
537
+ # @param data [::String]
538
+ # Required. Input to be passed to the function.
539
+ #
540
+ # @yield [response, operation] Access the result along with the RPC operation
541
+ # @yieldparam response [::Google::Cloud::Functions::V1::CallFunctionResponse]
542
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
543
+ #
544
+ # @return [::Google::Cloud::Functions::V1::CallFunctionResponse]
545
+ #
546
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
547
+ #
548
+ def call_function request, options = nil
549
+ raise ::ArgumentError, "request must be provided" if request.nil?
550
+
551
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Functions::V1::CallFunctionRequest
552
+
553
+ # Converts hash and nil to an options object
554
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
555
+
556
+ # Customize the options with defaults
557
+ metadata = @config.rpcs.call_function.metadata.to_h
558
+
559
+ # Set x-goog-api-client and x-goog-user-project headers
560
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
561
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
562
+ gapic_version: ::Google::Cloud::Functions::V1::VERSION
563
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
564
+
565
+ header_params = {
566
+ "name" => request.name
567
+ }
568
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
569
+ metadata[:"x-goog-request-params"] ||= request_params_header
570
+
571
+ options.apply_defaults timeout: @config.rpcs.call_function.timeout,
572
+ metadata: metadata,
573
+ retry_policy: @config.rpcs.call_function.retry_policy
574
+ options.apply_defaults metadata: @config.metadata,
575
+ retry_policy: @config.retry_policy
576
+
577
+ @cloud_functions_service_stub.call_rpc :call_function, request, options: options do |response, operation|
578
+ yield response, operation if block_given?
579
+ return response
580
+ end
581
+ rescue ::GRPC::BadStatus => e
582
+ raise ::Google::Cloud::Error.from_error(e)
583
+ end
584
+
585
+ ##
586
+ # Returns a signed URL for uploading a function source code.
587
+ # For more information about the signed URL usage see:
588
+ # https://cloud.google.com/storage/docs/access-control/signed-urls.
589
+ # Once the function source code upload is complete, the used signed
590
+ # URL should be provided in CreateFunction or UpdateFunction request
591
+ # as a reference to the function source code.
592
+ #
593
+ # When uploading source code to the generated signed URL, please follow
594
+ # these restrictions:
595
+ #
596
+ # * Source file type should be a zip file.
597
+ # * Source file size should not exceed 100MB limit.
598
+ # * No credentials should be attached - the signed URLs provide access to the
599
+ # target bucket using internal service identity; if credentials were
600
+ # attached, the identity from the credentials would be used, but that
601
+ # identity does not have permissions to upload files to the URL.
602
+ #
603
+ # When making a HTTP PUT request, these two headers need to be specified:
604
+ #
605
+ # * `content-type: application/zip`
606
+ # * `x-goog-content-length-range: 0,104857600`
607
+ #
608
+ # And this header SHOULD NOT be specified:
609
+ #
610
+ # * `Authorization: Bearer YOUR_TOKEN`
611
+ #
612
+ # @overload generate_upload_url(request, options = nil)
613
+ # Pass arguments to `generate_upload_url` via a request object, either of type
614
+ # {::Google::Cloud::Functions::V1::GenerateUploadUrlRequest} or an equivalent Hash.
615
+ #
616
+ # @param request [::Google::Cloud::Functions::V1::GenerateUploadUrlRequest, ::Hash]
617
+ # A request object representing the call parameters. Required. To specify no
618
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
619
+ # @param options [::Gapic::CallOptions, ::Hash]
620
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
621
+ #
622
+ # @overload generate_upload_url(parent: nil)
623
+ # Pass arguments to `generate_upload_url` via keyword arguments. Note that at
624
+ # least one keyword argument is required. To specify no parameters, or to keep all
625
+ # the default parameter values, pass an empty Hash as a request object (see above).
626
+ #
627
+ # @param parent [::String]
628
+ # The project and location in which the Google Cloud Storage signed URL
629
+ # should be generated, specified in the format `projects/*/locations/*`.
630
+ #
631
+ # @yield [response, operation] Access the result along with the RPC operation
632
+ # @yieldparam response [::Google::Cloud::Functions::V1::GenerateUploadUrlResponse]
633
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
634
+ #
635
+ # @return [::Google::Cloud::Functions::V1::GenerateUploadUrlResponse]
636
+ #
637
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
638
+ #
639
+ def generate_upload_url request, options = nil
640
+ raise ::ArgumentError, "request must be provided" if request.nil?
641
+
642
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Functions::V1::GenerateUploadUrlRequest
643
+
644
+ # Converts hash and nil to an options object
645
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
646
+
647
+ # Customize the options with defaults
648
+ metadata = @config.rpcs.generate_upload_url.metadata.to_h
649
+
650
+ # Set x-goog-api-client and x-goog-user-project headers
651
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
652
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
653
+ gapic_version: ::Google::Cloud::Functions::V1::VERSION
654
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
655
+
656
+ header_params = {
657
+ "parent" => request.parent
658
+ }
659
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
660
+ metadata[:"x-goog-request-params"] ||= request_params_header
661
+
662
+ options.apply_defaults timeout: @config.rpcs.generate_upload_url.timeout,
663
+ metadata: metadata,
664
+ retry_policy: @config.rpcs.generate_upload_url.retry_policy
665
+ options.apply_defaults metadata: @config.metadata,
666
+ retry_policy: @config.retry_policy
667
+
668
+ @cloud_functions_service_stub.call_rpc :generate_upload_url, request, options: options do |response, operation|
669
+ yield response, operation if block_given?
670
+ return response
671
+ end
672
+ rescue ::GRPC::BadStatus => e
673
+ raise ::Google::Cloud::Error.from_error(e)
674
+ end
675
+
676
+ ##
677
+ # Returns a signed URL for downloading deployed function source code.
678
+ # The URL is only valid for a limited period and should be used within
679
+ # minutes after generation.
680
+ # For more information about the signed URL usage see:
681
+ # https://cloud.google.com/storage/docs/access-control/signed-urls
682
+ #
683
+ # @overload generate_download_url(request, options = nil)
684
+ # Pass arguments to `generate_download_url` via a request object, either of type
685
+ # {::Google::Cloud::Functions::V1::GenerateDownloadUrlRequest} or an equivalent Hash.
686
+ #
687
+ # @param request [::Google::Cloud::Functions::V1::GenerateDownloadUrlRequest, ::Hash]
688
+ # A request object representing the call parameters. Required. To specify no
689
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
690
+ # @param options [::Gapic::CallOptions, ::Hash]
691
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
692
+ #
693
+ # @overload generate_download_url(name: nil, version_id: nil)
694
+ # Pass arguments to `generate_download_url` via keyword arguments. Note that at
695
+ # least one keyword argument is required. To specify no parameters, or to keep all
696
+ # the default parameter values, pass an empty Hash as a request object (see above).
697
+ #
698
+ # @param name [::String]
699
+ # The name of function for which source code Google Cloud Storage signed
700
+ # URL should be generated.
701
+ # @param version_id [::Integer]
702
+ # The optional version of function. If not set, default, current version
703
+ # is used.
704
+ #
705
+ # @yield [response, operation] Access the result along with the RPC operation
706
+ # @yieldparam response [::Google::Cloud::Functions::V1::GenerateDownloadUrlResponse]
707
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
708
+ #
709
+ # @return [::Google::Cloud::Functions::V1::GenerateDownloadUrlResponse]
710
+ #
711
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
712
+ #
713
+ def generate_download_url request, options = nil
714
+ raise ::ArgumentError, "request must be provided" if request.nil?
715
+
716
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Functions::V1::GenerateDownloadUrlRequest
717
+
718
+ # Converts hash and nil to an options object
719
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
720
+
721
+ # Customize the options with defaults
722
+ metadata = @config.rpcs.generate_download_url.metadata.to_h
723
+
724
+ # Set x-goog-api-client and x-goog-user-project headers
725
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
726
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
727
+ gapic_version: ::Google::Cloud::Functions::V1::VERSION
728
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
729
+
730
+ header_params = {
731
+ "name" => request.name
732
+ }
733
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
734
+ metadata[:"x-goog-request-params"] ||= request_params_header
735
+
736
+ options.apply_defaults timeout: @config.rpcs.generate_download_url.timeout,
737
+ metadata: metadata,
738
+ retry_policy: @config.rpcs.generate_download_url.retry_policy
739
+ options.apply_defaults metadata: @config.metadata,
740
+ retry_policy: @config.retry_policy
741
+
742
+ @cloud_functions_service_stub.call_rpc :generate_download_url, request, options: options do |response, operation|
743
+ yield response, operation if block_given?
744
+ return response
745
+ end
746
+ rescue ::GRPC::BadStatus => e
747
+ raise ::Google::Cloud::Error.from_error(e)
748
+ end
749
+
750
+ ##
751
+ # Sets the IAM access control policy on the specified function.
752
+ # Replaces any existing policy.
753
+ #
754
+ # @overload set_iam_policy(request, options = nil)
755
+ # Pass arguments to `set_iam_policy` via a request object, either of type
756
+ # {::Google::Iam::V1::SetIamPolicyRequest} or an equivalent Hash.
757
+ #
758
+ # @param request [::Google::Iam::V1::SetIamPolicyRequest, ::Hash]
759
+ # A request object representing the call parameters. Required. To specify no
760
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
761
+ # @param options [::Gapic::CallOptions, ::Hash]
762
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
763
+ #
764
+ # @overload set_iam_policy(resource: nil, policy: nil)
765
+ # Pass arguments to `set_iam_policy` via keyword arguments. Note that at
766
+ # least one keyword argument is required. To specify no parameters, or to keep all
767
+ # the default parameter values, pass an empty Hash as a request object (see above).
768
+ #
769
+ # @param resource [::String]
770
+ # REQUIRED: The resource for which the policy is being specified.
771
+ # See the operation documentation for the appropriate value for this field.
772
+ # @param policy [::Google::Iam::V1::Policy, ::Hash]
773
+ # REQUIRED: The complete policy to be applied to the `resource`. The size of
774
+ # the policy is limited to a few 10s of KB. An empty policy is a
775
+ # valid policy but certain Cloud Platform services (such as Projects)
776
+ # might reject them.
777
+ #
778
+ # @yield [response, operation] Access the result along with the RPC operation
779
+ # @yieldparam response [::Google::Iam::V1::Policy]
780
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
781
+ #
782
+ # @return [::Google::Iam::V1::Policy]
783
+ #
784
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
785
+ #
786
+ def set_iam_policy request, options = nil
787
+ raise ::ArgumentError, "request must be provided" if request.nil?
788
+
789
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Iam::V1::SetIamPolicyRequest
790
+
791
+ # Converts hash and nil to an options object
792
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
793
+
794
+ # Customize the options with defaults
795
+ metadata = @config.rpcs.set_iam_policy.metadata.to_h
796
+
797
+ # Set x-goog-api-client and x-goog-user-project headers
798
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
799
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
800
+ gapic_version: ::Google::Cloud::Functions::V1::VERSION
801
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
802
+
803
+ header_params = {
804
+ "resource" => request.resource
805
+ }
806
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
807
+ metadata[:"x-goog-request-params"] ||= request_params_header
808
+
809
+ options.apply_defaults timeout: @config.rpcs.set_iam_policy.timeout,
810
+ metadata: metadata,
811
+ retry_policy: @config.rpcs.set_iam_policy.retry_policy
812
+ options.apply_defaults metadata: @config.metadata,
813
+ retry_policy: @config.retry_policy
814
+
815
+ @cloud_functions_service_stub.call_rpc :set_iam_policy, request, options: options do |response, operation|
816
+ yield response, operation if block_given?
817
+ return response
818
+ end
819
+ rescue ::GRPC::BadStatus => e
820
+ raise ::Google::Cloud::Error.from_error(e)
821
+ end
822
+
823
+ ##
824
+ # Gets the IAM access control policy for a function.
825
+ # Returns an empty policy if the function exists and does not have a policy
826
+ # set.
827
+ #
828
+ # @overload get_iam_policy(request, options = nil)
829
+ # Pass arguments to `get_iam_policy` via a request object, either of type
830
+ # {::Google::Iam::V1::GetIamPolicyRequest} or an equivalent Hash.
831
+ #
832
+ # @param request [::Google::Iam::V1::GetIamPolicyRequest, ::Hash]
833
+ # A request object representing the call parameters. Required. To specify no
834
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
835
+ # @param options [::Gapic::CallOptions, ::Hash]
836
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
837
+ #
838
+ # @overload get_iam_policy(resource: nil, options: nil)
839
+ # Pass arguments to `get_iam_policy` via keyword arguments. Note that at
840
+ # least one keyword argument is required. To specify no parameters, or to keep all
841
+ # the default parameter values, pass an empty Hash as a request object (see above).
842
+ #
843
+ # @param resource [::String]
844
+ # REQUIRED: The resource for which the policy is being requested.
845
+ # See the operation documentation for the appropriate value for this field.
846
+ # @param options [::Google::Iam::V1::GetPolicyOptions, ::Hash]
847
+ # OPTIONAL: A `GetPolicyOptions` object for specifying options to
848
+ # `GetIamPolicy`. This field is only used by Cloud IAM.
849
+ #
850
+ # @yield [response, operation] Access the result along with the RPC operation
851
+ # @yieldparam response [::Google::Iam::V1::Policy]
852
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
853
+ #
854
+ # @return [::Google::Iam::V1::Policy]
855
+ #
856
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
857
+ #
858
+ def get_iam_policy request, options = nil
859
+ raise ::ArgumentError, "request must be provided" if request.nil?
860
+
861
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Iam::V1::GetIamPolicyRequest
862
+
863
+ # Converts hash and nil to an options object
864
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
865
+
866
+ # Customize the options with defaults
867
+ metadata = @config.rpcs.get_iam_policy.metadata.to_h
868
+
869
+ # Set x-goog-api-client and x-goog-user-project headers
870
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
871
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
872
+ gapic_version: ::Google::Cloud::Functions::V1::VERSION
873
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
874
+
875
+ header_params = {
876
+ "resource" => request.resource
877
+ }
878
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
879
+ metadata[:"x-goog-request-params"] ||= request_params_header
880
+
881
+ options.apply_defaults timeout: @config.rpcs.get_iam_policy.timeout,
882
+ metadata: metadata,
883
+ retry_policy: @config.rpcs.get_iam_policy.retry_policy
884
+ options.apply_defaults metadata: @config.metadata,
885
+ retry_policy: @config.retry_policy
886
+
887
+ @cloud_functions_service_stub.call_rpc :get_iam_policy, request, options: options do |response, operation|
888
+ yield response, operation if block_given?
889
+ return response
890
+ end
891
+ rescue ::GRPC::BadStatus => e
892
+ raise ::Google::Cloud::Error.from_error(e)
893
+ end
894
+
895
+ ##
896
+ # Tests the specified permissions against the IAM access control policy
897
+ # for a function.
898
+ # If the function does not exist, this will return an empty set of
899
+ # permissions, not a NOT_FOUND error.
900
+ #
901
+ # @overload test_iam_permissions(request, options = nil)
902
+ # Pass arguments to `test_iam_permissions` via a request object, either of type
903
+ # {::Google::Iam::V1::TestIamPermissionsRequest} or an equivalent Hash.
904
+ #
905
+ # @param request [::Google::Iam::V1::TestIamPermissionsRequest, ::Hash]
906
+ # A request object representing the call parameters. Required. To specify no
907
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
908
+ # @param options [::Gapic::CallOptions, ::Hash]
909
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
910
+ #
911
+ # @overload test_iam_permissions(resource: nil, permissions: nil)
912
+ # Pass arguments to `test_iam_permissions` via keyword arguments. Note that at
913
+ # least one keyword argument is required. To specify no parameters, or to keep all
914
+ # the default parameter values, pass an empty Hash as a request object (see above).
915
+ #
916
+ # @param resource [::String]
917
+ # REQUIRED: The resource for which the policy detail is being requested.
918
+ # See the operation documentation for the appropriate value for this field.
919
+ # @param permissions [::Array<::String>]
920
+ # The set of permissions to check for the `resource`. Permissions with
921
+ # wildcards (such as '*' or 'storage.*') are not allowed. For more
922
+ # information see
923
+ # [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions).
924
+ #
925
+ # @yield [response, operation] Access the result along with the RPC operation
926
+ # @yieldparam response [::Google::Iam::V1::TestIamPermissionsResponse]
927
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
928
+ #
929
+ # @return [::Google::Iam::V1::TestIamPermissionsResponse]
930
+ #
931
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
932
+ #
933
+ def test_iam_permissions request, options = nil
934
+ raise ::ArgumentError, "request must be provided" if request.nil?
935
+
936
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Iam::V1::TestIamPermissionsRequest
937
+
938
+ # Converts hash and nil to an options object
939
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
940
+
941
+ # Customize the options with defaults
942
+ metadata = @config.rpcs.test_iam_permissions.metadata.to_h
943
+
944
+ # Set x-goog-api-client and x-goog-user-project headers
945
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
946
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
947
+ gapic_version: ::Google::Cloud::Functions::V1::VERSION
948
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
949
+
950
+ header_params = {
951
+ "resource" => request.resource
952
+ }
953
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
954
+ metadata[:"x-goog-request-params"] ||= request_params_header
955
+
956
+ options.apply_defaults timeout: @config.rpcs.test_iam_permissions.timeout,
957
+ metadata: metadata,
958
+ retry_policy: @config.rpcs.test_iam_permissions.retry_policy
959
+ options.apply_defaults metadata: @config.metadata,
960
+ retry_policy: @config.retry_policy
961
+
962
+ @cloud_functions_service_stub.call_rpc :test_iam_permissions, request, options: options do |response, operation|
963
+ yield response, operation if block_given?
964
+ return response
965
+ end
966
+ rescue ::GRPC::BadStatus => e
967
+ raise ::Google::Cloud::Error.from_error(e)
968
+ end
969
+
970
+ ##
971
+ # Configuration class for the CloudFunctionsService API.
972
+ #
973
+ # This class represents the configuration for CloudFunctionsService,
974
+ # providing control over timeouts, retry behavior, logging, transport
975
+ # parameters, and other low-level controls. Certain parameters can also be
976
+ # applied individually to specific RPCs. See
977
+ # {::Google::Cloud::Functions::V1::CloudFunctionsService::Client::Configuration::Rpcs}
978
+ # for a list of RPCs that can be configured independently.
979
+ #
980
+ # Configuration can be applied globally to all clients, or to a single client
981
+ # on construction.
982
+ #
983
+ # # Examples
984
+ #
985
+ # To modify the global config, setting the timeout for list_functions
986
+ # to 20 seconds, and all remaining timeouts to 10 seconds:
987
+ #
988
+ # ::Google::Cloud::Functions::V1::CloudFunctionsService::Client.configure do |config|
989
+ # config.timeout = 10.0
990
+ # config.rpcs.list_functions.timeout = 20.0
991
+ # end
992
+ #
993
+ # To apply the above configuration only to a new client:
994
+ #
995
+ # client = ::Google::Cloud::Functions::V1::CloudFunctionsService::Client.new do |config|
996
+ # config.timeout = 10.0
997
+ # config.rpcs.list_functions.timeout = 20.0
998
+ # end
999
+ #
1000
+ # @!attribute [rw] endpoint
1001
+ # The hostname or hostname:port of the service endpoint.
1002
+ # Defaults to `"cloudfunctions.googleapis.com"`.
1003
+ # @return [::String]
1004
+ # @!attribute [rw] credentials
1005
+ # Credentials to send with calls. You may provide any of the following types:
1006
+ # * (`String`) The path to a service account key file in JSON format
1007
+ # * (`Hash`) A service account key as a Hash
1008
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
1009
+ # (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
1010
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
1011
+ # (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
1012
+ # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
1013
+ # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
1014
+ # * (`nil`) indicating no credentials
1015
+ # @return [::Object]
1016
+ # @!attribute [rw] scope
1017
+ # The OAuth scopes
1018
+ # @return [::Array<::String>]
1019
+ # @!attribute [rw] lib_name
1020
+ # The library name as recorded in instrumentation and logging
1021
+ # @return [::String]
1022
+ # @!attribute [rw] lib_version
1023
+ # The library version as recorded in instrumentation and logging
1024
+ # @return [::String]
1025
+ # @!attribute [rw] channel_args
1026
+ # Extra parameters passed to the gRPC channel. Note: this is ignored if a
1027
+ # `GRPC::Core::Channel` object is provided as the credential.
1028
+ # @return [::Hash]
1029
+ # @!attribute [rw] interceptors
1030
+ # An array of interceptors that are run before calls are executed.
1031
+ # @return [::Array<::GRPC::ClientInterceptor>]
1032
+ # @!attribute [rw] timeout
1033
+ # The call timeout in seconds.
1034
+ # @return [::Numeric]
1035
+ # @!attribute [rw] metadata
1036
+ # Additional gRPC headers to be sent with the call.
1037
+ # @return [::Hash{::Symbol=>::String}]
1038
+ # @!attribute [rw] retry_policy
1039
+ # The retry policy. The value is a hash with the following keys:
1040
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
1041
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
1042
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
1043
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
1044
+ # trigger a retry.
1045
+ # @return [::Hash]
1046
+ # @!attribute [rw] quota_project
1047
+ # A separate project against which to charge quota.
1048
+ # @return [::String]
1049
+ #
1050
+ class Configuration
1051
+ extend ::Gapic::Config
1052
+
1053
+ config_attr :endpoint, "cloudfunctions.googleapis.com", ::String
1054
+ config_attr :credentials, nil do |value|
1055
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
1056
+ allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
1057
+ allowed.any? { |klass| klass === value }
1058
+ end
1059
+ config_attr :scope, nil, ::String, ::Array, nil
1060
+ config_attr :lib_name, nil, ::String, nil
1061
+ config_attr :lib_version, nil, ::String, nil
1062
+ config_attr(:channel_args, { "grpc.service_config_disable_resolution"=>1 }, ::Hash, nil)
1063
+ config_attr :interceptors, nil, ::Array, nil
1064
+ config_attr :timeout, nil, ::Numeric, nil
1065
+ config_attr :metadata, nil, ::Hash, nil
1066
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
1067
+ config_attr :quota_project, nil, ::String, nil
1068
+
1069
+ # @private
1070
+ def initialize parent_config = nil
1071
+ @parent_config = parent_config unless parent_config.nil?
1072
+
1073
+ yield self if block_given?
1074
+ end
1075
+
1076
+ ##
1077
+ # Configurations for individual RPCs
1078
+ # @return [Rpcs]
1079
+ #
1080
+ def rpcs
1081
+ @rpcs ||= begin
1082
+ parent_rpcs = nil
1083
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config&.respond_to?(:rpcs)
1084
+ Rpcs.new parent_rpcs
1085
+ end
1086
+ end
1087
+
1088
+ ##
1089
+ # Configuration RPC class for the CloudFunctionsService API.
1090
+ #
1091
+ # Includes fields providing the configuration for each RPC in this service.
1092
+ # Each configuration object is of type `Gapic::Config::Method` and includes
1093
+ # the following configuration fields:
1094
+ #
1095
+ # * `timeout` (*type:* `Numeric`) - The call timeout in milliseconds
1096
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
1097
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
1098
+ # include the following keys:
1099
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
1100
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
1101
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
1102
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
1103
+ # trigger a retry.
1104
+ #
1105
+ class Rpcs
1106
+ ##
1107
+ # RPC-specific configuration for `list_functions`
1108
+ # @return [::Gapic::Config::Method]
1109
+ #
1110
+ attr_reader :list_functions
1111
+ ##
1112
+ # RPC-specific configuration for `get_function`
1113
+ # @return [::Gapic::Config::Method]
1114
+ #
1115
+ attr_reader :get_function
1116
+ ##
1117
+ # RPC-specific configuration for `create_function`
1118
+ # @return [::Gapic::Config::Method]
1119
+ #
1120
+ attr_reader :create_function
1121
+ ##
1122
+ # RPC-specific configuration for `update_function`
1123
+ # @return [::Gapic::Config::Method]
1124
+ #
1125
+ attr_reader :update_function
1126
+ ##
1127
+ # RPC-specific configuration for `delete_function`
1128
+ # @return [::Gapic::Config::Method]
1129
+ #
1130
+ attr_reader :delete_function
1131
+ ##
1132
+ # RPC-specific configuration for `call_function`
1133
+ # @return [::Gapic::Config::Method]
1134
+ #
1135
+ attr_reader :call_function
1136
+ ##
1137
+ # RPC-specific configuration for `generate_upload_url`
1138
+ # @return [::Gapic::Config::Method]
1139
+ #
1140
+ attr_reader :generate_upload_url
1141
+ ##
1142
+ # RPC-specific configuration for `generate_download_url`
1143
+ # @return [::Gapic::Config::Method]
1144
+ #
1145
+ attr_reader :generate_download_url
1146
+ ##
1147
+ # RPC-specific configuration for `set_iam_policy`
1148
+ # @return [::Gapic::Config::Method]
1149
+ #
1150
+ attr_reader :set_iam_policy
1151
+ ##
1152
+ # RPC-specific configuration for `get_iam_policy`
1153
+ # @return [::Gapic::Config::Method]
1154
+ #
1155
+ attr_reader :get_iam_policy
1156
+ ##
1157
+ # RPC-specific configuration for `test_iam_permissions`
1158
+ # @return [::Gapic::Config::Method]
1159
+ #
1160
+ attr_reader :test_iam_permissions
1161
+
1162
+ # @private
1163
+ def initialize parent_rpcs = nil
1164
+ list_functions_config = parent_rpcs&.list_functions if parent_rpcs&.respond_to? :list_functions
1165
+ @list_functions = ::Gapic::Config::Method.new list_functions_config
1166
+ get_function_config = parent_rpcs&.get_function if parent_rpcs&.respond_to? :get_function
1167
+ @get_function = ::Gapic::Config::Method.new get_function_config
1168
+ create_function_config = parent_rpcs&.create_function if parent_rpcs&.respond_to? :create_function
1169
+ @create_function = ::Gapic::Config::Method.new create_function_config
1170
+ update_function_config = parent_rpcs&.update_function if parent_rpcs&.respond_to? :update_function
1171
+ @update_function = ::Gapic::Config::Method.new update_function_config
1172
+ delete_function_config = parent_rpcs&.delete_function if parent_rpcs&.respond_to? :delete_function
1173
+ @delete_function = ::Gapic::Config::Method.new delete_function_config
1174
+ call_function_config = parent_rpcs&.call_function if parent_rpcs&.respond_to? :call_function
1175
+ @call_function = ::Gapic::Config::Method.new call_function_config
1176
+ generate_upload_url_config = parent_rpcs&.generate_upload_url if parent_rpcs&.respond_to? :generate_upload_url
1177
+ @generate_upload_url = ::Gapic::Config::Method.new generate_upload_url_config
1178
+ generate_download_url_config = parent_rpcs&.generate_download_url if parent_rpcs&.respond_to? :generate_download_url
1179
+ @generate_download_url = ::Gapic::Config::Method.new generate_download_url_config
1180
+ set_iam_policy_config = parent_rpcs&.set_iam_policy if parent_rpcs&.respond_to? :set_iam_policy
1181
+ @set_iam_policy = ::Gapic::Config::Method.new set_iam_policy_config
1182
+ get_iam_policy_config = parent_rpcs&.get_iam_policy if parent_rpcs&.respond_to? :get_iam_policy
1183
+ @get_iam_policy = ::Gapic::Config::Method.new get_iam_policy_config
1184
+ test_iam_permissions_config = parent_rpcs&.test_iam_permissions if parent_rpcs&.respond_to? :test_iam_permissions
1185
+ @test_iam_permissions = ::Gapic::Config::Method.new test_iam_permissions_config
1186
+
1187
+ yield self if block_given?
1188
+ end
1189
+ end
1190
+ end
1191
+ end
1192
+ end
1193
+ end
1194
+ end
1195
+ end
1196
+ end