google-cloud-functions-v1 0.8.1 → 0.9.0

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