google-cloud-functions-v2 0.1.0

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