google-cloud-run-v2 0.24.1 → 0.26.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.
Files changed (32) hide show
  1. checksums.yaml +4 -4
  2. data/lib/google/cloud/run/v2/build_pb.rb +1 -1
  3. data/lib/google/cloud/run/v2/builds/paths.rb +2 -2
  4. data/lib/google/cloud/run/v2/instance_split_pb.rb +46 -0
  5. data/lib/google/cloud/run/v2/rest.rb +1 -0
  6. data/lib/google/cloud/run/v2/revision_pb.rb +1 -1
  7. data/lib/google/cloud/run/v2/revisions/rest/service_stub.rb +21 -0
  8. data/lib/google/cloud/run/v2/services/paths.rb +19 -19
  9. data/lib/google/cloud/run/v2/task_pb.rb +1 -1
  10. data/lib/google/cloud/run/v2/task_template_pb.rb +1 -1
  11. data/lib/google/cloud/run/v2/vendor_settings_pb.rb +2 -1
  12. data/lib/google/cloud/run/v2/version.rb +1 -1
  13. data/lib/google/cloud/run/v2/worker_pool_pb.rb +70 -0
  14. data/lib/google/cloud/run/v2/worker_pool_revision_template_pb.rb +51 -0
  15. data/lib/google/cloud/run/v2/worker_pool_services_pb.rb +63 -0
  16. data/lib/google/cloud/run/v2/worker_pools/client.rb +1258 -0
  17. data/lib/google/cloud/run/v2/worker_pools/credentials.rb +47 -0
  18. data/lib/google/cloud/run/v2/worker_pools/operations.rb +821 -0
  19. data/lib/google/cloud/run/v2/worker_pools/paths.rb +218 -0
  20. data/lib/google/cloud/run/v2/worker_pools/rest/client.rb +1161 -0
  21. data/lib/google/cloud/run/v2/worker_pools/rest/operations.rb +1082 -0
  22. data/lib/google/cloud/run/v2/worker_pools/rest/service_stub.rb +573 -0
  23. data/lib/google/cloud/run/v2/worker_pools/rest.rb +53 -0
  24. data/lib/google/cloud/run/v2/worker_pools.rb +56 -0
  25. data/lib/google/cloud/run/v2.rb +1 -0
  26. data/proto_docs/google/cloud/run/v2/instance_split.rb +71 -0
  27. data/proto_docs/google/cloud/run/v2/task.rb +12 -0
  28. data/proto_docs/google/cloud/run/v2/task_template.rb +3 -0
  29. data/proto_docs/google/cloud/run/v2/vendor_settings.rb +9 -0
  30. data/proto_docs/google/cloud/run/v2/worker_pool.rb +351 -0
  31. data/proto_docs/google/cloud/run/v2/worker_pool_revision_template.rb +117 -0
  32. metadata +17 -1
@@ -0,0 +1,1258 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2025 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/run/v2/worker_pool_pb"
21
+ require "google/cloud/location"
22
+
23
+ module Google
24
+ module Cloud
25
+ module Run
26
+ module V2
27
+ module WorkerPools
28
+ ##
29
+ # Client for the WorkerPools service.
30
+ #
31
+ # Cloud Run WorkerPool Control Plane API.
32
+ #
33
+ class Client
34
+ # @private
35
+ API_VERSION = ""
36
+
37
+ # @private
38
+ DEFAULT_ENDPOINT_TEMPLATE = "run.$UNIVERSE_DOMAIN$"
39
+
40
+ include Paths
41
+
42
+ # @private
43
+ attr_reader :worker_pools_stub
44
+
45
+ ##
46
+ # Configure the WorkerPools Client class.
47
+ #
48
+ # See {::Google::Cloud::Run::V2::WorkerPools::Client::Configuration}
49
+ # for a description of the configuration fields.
50
+ #
51
+ # @example
52
+ #
53
+ # # Modify the configuration for all WorkerPools clients
54
+ # ::Google::Cloud::Run::V2::WorkerPools::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", "Run", "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 WorkerPools 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::Run::V2::WorkerPools::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
+ # The effective universe domain
102
+ #
103
+ # @return [String]
104
+ #
105
+ def universe_domain
106
+ @worker_pools_stub.universe_domain
107
+ end
108
+
109
+ ##
110
+ # Create a new WorkerPools client object.
111
+ #
112
+ # @example
113
+ #
114
+ # # Create a client using the default configuration
115
+ # client = ::Google::Cloud::Run::V2::WorkerPools::Client.new
116
+ #
117
+ # # Create a client using a custom configuration
118
+ # client = ::Google::Cloud::Run::V2::WorkerPools::Client.new do |config|
119
+ # config.timeout = 10.0
120
+ # end
121
+ #
122
+ # @yield [config] Configure the WorkerPools client.
123
+ # @yieldparam config [Client::Configuration]
124
+ #
125
+ def initialize
126
+ # These require statements are intentionally placed here to initialize
127
+ # the gRPC module only when it's required.
128
+ # See https://github.com/googleapis/toolkit/issues/446
129
+ require "gapic/grpc"
130
+ require "google/cloud/run/v2/worker_pool_services_pb"
131
+
132
+ # Create the configuration object
133
+ @config = Configuration.new Client.configure
134
+
135
+ # Yield the configuration if needed
136
+ yield @config if block_given?
137
+
138
+ # Create credentials
139
+ credentials = @config.credentials
140
+ # Use self-signed JWT if the endpoint is unchanged from default,
141
+ # but only if the default endpoint does not have a region prefix.
142
+ enable_self_signed_jwt = @config.endpoint.nil? ||
143
+ (@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
144
+ !@config.endpoint.split(".").first.include?("-"))
145
+ credentials ||= Credentials.default scope: @config.scope,
146
+ enable_self_signed_jwt: enable_self_signed_jwt
147
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
148
+ credentials = Credentials.new credentials, scope: @config.scope
149
+ end
150
+ @quota_project_id = @config.quota_project
151
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
152
+
153
+ @operations_client = Operations.new do |config|
154
+ config.credentials = credentials
155
+ config.quota_project = @quota_project_id
156
+ config.endpoint = @config.endpoint
157
+ config.universe_domain = @config.universe_domain
158
+ end
159
+
160
+ @worker_pools_stub = ::Gapic::ServiceStub.new(
161
+ ::Google::Cloud::Run::V2::WorkerPools::Stub,
162
+ credentials: credentials,
163
+ endpoint: @config.endpoint,
164
+ endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
165
+ universe_domain: @config.universe_domain,
166
+ channel_args: @config.channel_args,
167
+ interceptors: @config.interceptors,
168
+ channel_pool_config: @config.channel_pool,
169
+ logger: @config.logger
170
+ )
171
+
172
+ @worker_pools_stub.stub_logger&.info do |entry|
173
+ entry.set_system_name
174
+ entry.set_service
175
+ entry.message = "Created client for #{entry.service}"
176
+ entry.set_credentials_fields credentials
177
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
178
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
179
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
180
+ end
181
+
182
+ @location_client = Google::Cloud::Location::Locations::Client.new do |config|
183
+ config.credentials = credentials
184
+ config.quota_project = @quota_project_id
185
+ config.endpoint = @worker_pools_stub.endpoint
186
+ config.universe_domain = @worker_pools_stub.universe_domain
187
+ config.logger = @worker_pools_stub.logger if config.respond_to? :logger=
188
+ end
189
+ end
190
+
191
+ ##
192
+ # Get the associated client for long-running operations.
193
+ #
194
+ # @return [::Google::Cloud::Run::V2::WorkerPools::Operations]
195
+ #
196
+ attr_reader :operations_client
197
+
198
+ ##
199
+ # Get the associated client for mix-in of the Locations.
200
+ #
201
+ # @return [Google::Cloud::Location::Locations::Client]
202
+ #
203
+ attr_reader :location_client
204
+
205
+ ##
206
+ # The logger used for request/response debug logging.
207
+ #
208
+ # @return [Logger]
209
+ #
210
+ def logger
211
+ @worker_pools_stub.logger
212
+ end
213
+
214
+ # Service calls
215
+
216
+ ##
217
+ # Creates a new WorkerPool in a given project and location.
218
+ #
219
+ # @overload create_worker_pool(request, options = nil)
220
+ # Pass arguments to `create_worker_pool` via a request object, either of type
221
+ # {::Google::Cloud::Run::V2::CreateWorkerPoolRequest} or an equivalent Hash.
222
+ #
223
+ # @param request [::Google::Cloud::Run::V2::CreateWorkerPoolRequest, ::Hash]
224
+ # A request object representing the call parameters. Required. To specify no
225
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
226
+ # @param options [::Gapic::CallOptions, ::Hash]
227
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
228
+ #
229
+ # @overload create_worker_pool(parent: nil, worker_pool: nil, worker_pool_id: nil, validate_only: nil)
230
+ # Pass arguments to `create_worker_pool` via keyword arguments. Note that at
231
+ # least one keyword argument is required. To specify no parameters, or to keep all
232
+ # the default parameter values, pass an empty Hash as a request object (see above).
233
+ #
234
+ # @param parent [::String]
235
+ # Required. The location and project in which this worker pool should be
236
+ # created. Format: `projects/{project}/locations/{location}`, where
237
+ # `{project}` can be project id or number. Only lowercase characters, digits,
238
+ # and hyphens.
239
+ # @param worker_pool [::Google::Cloud::Run::V2::WorkerPool, ::Hash]
240
+ # Required. The WorkerPool instance to create.
241
+ # @param worker_pool_id [::String]
242
+ # Required. The unique identifier for the WorkerPool. It must begin with
243
+ # letter, and cannot end with hyphen; must contain fewer than 50 characters.
244
+ # The name of the worker pool becomes
245
+ # `{parent}/workerPools/{worker_pool_id}`.
246
+ # @param validate_only [::Boolean]
247
+ # Optional. Indicates that the request should be validated and default values
248
+ # populated, without persisting the request or creating any resources.
249
+ #
250
+ # @yield [response, operation] Access the result along with the RPC operation
251
+ # @yieldparam response [::Gapic::Operation]
252
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
253
+ #
254
+ # @return [::Gapic::Operation]
255
+ #
256
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
257
+ #
258
+ # @example Basic example
259
+ # require "google/cloud/run/v2"
260
+ #
261
+ # # Create a client object. The client can be reused for multiple calls.
262
+ # client = Google::Cloud::Run::V2::WorkerPools::Client.new
263
+ #
264
+ # # Create a request. To set request fields, pass in keyword arguments.
265
+ # request = Google::Cloud::Run::V2::CreateWorkerPoolRequest.new
266
+ #
267
+ # # Call the create_worker_pool method.
268
+ # result = client.create_worker_pool request
269
+ #
270
+ # # The returned object is of type Gapic::Operation. You can use it to
271
+ # # check the status of an operation, cancel it, or wait for results.
272
+ # # Here is how to wait for a response.
273
+ # result.wait_until_done! timeout: 60
274
+ # if result.response?
275
+ # p result.response
276
+ # else
277
+ # puts "No response received."
278
+ # end
279
+ #
280
+ def create_worker_pool request, options = nil
281
+ raise ::ArgumentError, "request must be provided" if request.nil?
282
+
283
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Run::V2::CreateWorkerPoolRequest
284
+
285
+ # Converts hash and nil to an options object
286
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
287
+
288
+ # Customize the options with defaults
289
+ metadata = @config.rpcs.create_worker_pool.metadata.to_h
290
+
291
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
292
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
293
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
294
+ gapic_version: ::Google::Cloud::Run::V2::VERSION
295
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
296
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
297
+
298
+ header_params = {}
299
+ if request.parent
300
+ regex_match = %r{^projects/[^/]+/locations/(?<location>[^/]+)/?$}.match request.parent
301
+ if regex_match
302
+ header_params["location"] = regex_match["location".to_s]
303
+ end
304
+ end
305
+
306
+ request_params_header = URI.encode_www_form header_params
307
+ metadata[:"x-goog-request-params"] ||= request_params_header
308
+
309
+ options.apply_defaults timeout: @config.rpcs.create_worker_pool.timeout,
310
+ metadata: metadata,
311
+ retry_policy: @config.rpcs.create_worker_pool.retry_policy
312
+
313
+ options.apply_defaults timeout: @config.timeout,
314
+ metadata: @config.metadata,
315
+ retry_policy: @config.retry_policy
316
+
317
+ @worker_pools_stub.call_rpc :create_worker_pool, request, options: options do |response, operation|
318
+ response = ::Gapic::Operation.new response, @operations_client, options: options
319
+ yield response, operation if block_given?
320
+ throw :response, response
321
+ end
322
+ rescue ::GRPC::BadStatus => e
323
+ raise ::Google::Cloud::Error.from_error(e)
324
+ end
325
+
326
+ ##
327
+ # Gets information about a WorkerPool.
328
+ #
329
+ # @overload get_worker_pool(request, options = nil)
330
+ # Pass arguments to `get_worker_pool` via a request object, either of type
331
+ # {::Google::Cloud::Run::V2::GetWorkerPoolRequest} or an equivalent Hash.
332
+ #
333
+ # @param request [::Google::Cloud::Run::V2::GetWorkerPoolRequest, ::Hash]
334
+ # A request object representing the call parameters. Required. To specify no
335
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
336
+ # @param options [::Gapic::CallOptions, ::Hash]
337
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
338
+ #
339
+ # @overload get_worker_pool(name: nil)
340
+ # Pass arguments to `get_worker_pool` via keyword arguments. Note that at
341
+ # least one keyword argument is required. To specify no parameters, or to keep all
342
+ # the default parameter values, pass an empty Hash as a request object (see above).
343
+ #
344
+ # @param name [::String]
345
+ # Required. The full name of the WorkerPool.
346
+ # Format:
347
+ # `projects/{project}/locations/{location}/workerPools/{worker_pool}`, where
348
+ # `{project}` can be project id or number.
349
+ #
350
+ # @yield [response, operation] Access the result along with the RPC operation
351
+ # @yieldparam response [::Google::Cloud::Run::V2::WorkerPool]
352
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
353
+ #
354
+ # @return [::Google::Cloud::Run::V2::WorkerPool]
355
+ #
356
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
357
+ #
358
+ # @example Basic example
359
+ # require "google/cloud/run/v2"
360
+ #
361
+ # # Create a client object. The client can be reused for multiple calls.
362
+ # client = Google::Cloud::Run::V2::WorkerPools::Client.new
363
+ #
364
+ # # Create a request. To set request fields, pass in keyword arguments.
365
+ # request = Google::Cloud::Run::V2::GetWorkerPoolRequest.new
366
+ #
367
+ # # Call the get_worker_pool method.
368
+ # result = client.get_worker_pool request
369
+ #
370
+ # # The returned object is of type Google::Cloud::Run::V2::WorkerPool.
371
+ # p result
372
+ #
373
+ def get_worker_pool request, options = nil
374
+ raise ::ArgumentError, "request must be provided" if request.nil?
375
+
376
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Run::V2::GetWorkerPoolRequest
377
+
378
+ # Converts hash and nil to an options object
379
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
380
+
381
+ # Customize the options with defaults
382
+ metadata = @config.rpcs.get_worker_pool.metadata.to_h
383
+
384
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
385
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
386
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
387
+ gapic_version: ::Google::Cloud::Run::V2::VERSION
388
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
389
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
390
+
391
+ header_params = {}
392
+ if request.name
393
+ regex_match = %r{^projects/[^/]+/locations/(?<location>[^/]+)(?:/.*)?$}.match request.name
394
+ if regex_match
395
+ header_params["location"] = regex_match["location".to_s]
396
+ end
397
+ end
398
+
399
+ request_params_header = URI.encode_www_form header_params
400
+ metadata[:"x-goog-request-params"] ||= request_params_header
401
+
402
+ options.apply_defaults timeout: @config.rpcs.get_worker_pool.timeout,
403
+ metadata: metadata,
404
+ retry_policy: @config.rpcs.get_worker_pool.retry_policy
405
+
406
+ options.apply_defaults timeout: @config.timeout,
407
+ metadata: @config.metadata,
408
+ retry_policy: @config.retry_policy
409
+
410
+ @worker_pools_stub.call_rpc :get_worker_pool, request, options: options do |response, operation|
411
+ yield response, operation if block_given?
412
+ end
413
+ rescue ::GRPC::BadStatus => e
414
+ raise ::Google::Cloud::Error.from_error(e)
415
+ end
416
+
417
+ ##
418
+ # Lists WorkerPools. Results are sorted by creation time, descending.
419
+ #
420
+ # @overload list_worker_pools(request, options = nil)
421
+ # Pass arguments to `list_worker_pools` via a request object, either of type
422
+ # {::Google::Cloud::Run::V2::ListWorkerPoolsRequest} or an equivalent Hash.
423
+ #
424
+ # @param request [::Google::Cloud::Run::V2::ListWorkerPoolsRequest, ::Hash]
425
+ # A request object representing the call parameters. Required. To specify no
426
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
427
+ # @param options [::Gapic::CallOptions, ::Hash]
428
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
429
+ #
430
+ # @overload list_worker_pools(parent: nil, page_size: nil, page_token: nil, show_deleted: nil)
431
+ # Pass arguments to `list_worker_pools` via keyword arguments. Note that at
432
+ # least one keyword argument is required. To specify no parameters, or to keep all
433
+ # the default parameter values, pass an empty Hash as a request object (see above).
434
+ #
435
+ # @param parent [::String]
436
+ # Required. The location and project to list resources on.
437
+ # Location must be a valid Google Cloud region, and cannot be the "-"
438
+ # wildcard. Format: `projects/{project}/locations/{location}`, where
439
+ # `{project}` can be project id or number.
440
+ # @param page_size [::Integer]
441
+ # Maximum number of WorkerPools to return in this call.
442
+ # @param page_token [::String]
443
+ # A page token received from a previous call to ListWorkerPools.
444
+ # All other parameters must match.
445
+ # @param show_deleted [::Boolean]
446
+ # If true, returns deleted (but unexpired) resources along with active ones.
447
+ #
448
+ # @yield [response, operation] Access the result along with the RPC operation
449
+ # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Run::V2::WorkerPool>]
450
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
451
+ #
452
+ # @return [::Gapic::PagedEnumerable<::Google::Cloud::Run::V2::WorkerPool>]
453
+ #
454
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
455
+ #
456
+ # @example Basic example
457
+ # require "google/cloud/run/v2"
458
+ #
459
+ # # Create a client object. The client can be reused for multiple calls.
460
+ # client = Google::Cloud::Run::V2::WorkerPools::Client.new
461
+ #
462
+ # # Create a request. To set request fields, pass in keyword arguments.
463
+ # request = Google::Cloud::Run::V2::ListWorkerPoolsRequest.new
464
+ #
465
+ # # Call the list_worker_pools method.
466
+ # result = client.list_worker_pools request
467
+ #
468
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
469
+ # # over elements, and API calls will be issued to fetch pages as needed.
470
+ # result.each do |item|
471
+ # # Each element is of type ::Google::Cloud::Run::V2::WorkerPool.
472
+ # p item
473
+ # end
474
+ #
475
+ def list_worker_pools request, options = nil
476
+ raise ::ArgumentError, "request must be provided" if request.nil?
477
+
478
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Run::V2::ListWorkerPoolsRequest
479
+
480
+ # Converts hash and nil to an options object
481
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
482
+
483
+ # Customize the options with defaults
484
+ metadata = @config.rpcs.list_worker_pools.metadata.to_h
485
+
486
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
487
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
488
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
489
+ gapic_version: ::Google::Cloud::Run::V2::VERSION
490
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
491
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
492
+
493
+ header_params = {}
494
+ if request.parent
495
+ regex_match = %r{^projects/[^/]+/locations/(?<location>[^/]+)/?$}.match request.parent
496
+ if regex_match
497
+ header_params["location"] = regex_match["location".to_s]
498
+ end
499
+ end
500
+
501
+ request_params_header = URI.encode_www_form header_params
502
+ metadata[:"x-goog-request-params"] ||= request_params_header
503
+
504
+ options.apply_defaults timeout: @config.rpcs.list_worker_pools.timeout,
505
+ metadata: metadata,
506
+ retry_policy: @config.rpcs.list_worker_pools.retry_policy
507
+
508
+ options.apply_defaults timeout: @config.timeout,
509
+ metadata: @config.metadata,
510
+ retry_policy: @config.retry_policy
511
+
512
+ @worker_pools_stub.call_rpc :list_worker_pools, request, options: options do |response, operation|
513
+ response = ::Gapic::PagedEnumerable.new @worker_pools_stub, :list_worker_pools, request, response, operation, options
514
+ yield response, operation if block_given?
515
+ throw :response, response
516
+ end
517
+ rescue ::GRPC::BadStatus => e
518
+ raise ::Google::Cloud::Error.from_error(e)
519
+ end
520
+
521
+ ##
522
+ # Updates a WorkerPool.
523
+ #
524
+ # @overload update_worker_pool(request, options = nil)
525
+ # Pass arguments to `update_worker_pool` via a request object, either of type
526
+ # {::Google::Cloud::Run::V2::UpdateWorkerPoolRequest} or an equivalent Hash.
527
+ #
528
+ # @param request [::Google::Cloud::Run::V2::UpdateWorkerPoolRequest, ::Hash]
529
+ # A request object representing the call parameters. Required. To specify no
530
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
531
+ # @param options [::Gapic::CallOptions, ::Hash]
532
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
533
+ #
534
+ # @overload update_worker_pool(update_mask: nil, worker_pool: nil, validate_only: nil, allow_missing: nil, force_new_revision: nil)
535
+ # Pass arguments to `update_worker_pool` via keyword arguments. Note that at
536
+ # least one keyword argument is required. To specify no parameters, or to keep all
537
+ # the default parameter values, pass an empty Hash as a request object (see above).
538
+ #
539
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
540
+ # Optional. The list of fields to be updated.
541
+ # @param worker_pool [::Google::Cloud::Run::V2::WorkerPool, ::Hash]
542
+ # Required. The WorkerPool to be updated.
543
+ # @param validate_only [::Boolean]
544
+ # Optional. Indicates that the request should be validated and default values
545
+ # populated, without persisting the request or updating any resources.
546
+ # @param allow_missing [::Boolean]
547
+ # Optional. If set to true, and if the WorkerPool does not exist, it will
548
+ # create a new one. The caller must have 'run.workerpools.create' permissions
549
+ # if this is set to true and the WorkerPool does not exist.
550
+ # @param force_new_revision [::Boolean]
551
+ # Optional. If set to true, a new revision will be created from the template
552
+ # even if the system doesn't detect any changes from the previously deployed
553
+ # revision.
554
+ #
555
+ # This may be useful for cases where the underlying resources need to be
556
+ # recreated or reinitialized. For example if the image is specified by label,
557
+ # but the underlying image digest has changed) or if the container performs
558
+ # deployment initialization work that needs to be performed again.
559
+ #
560
+ # @yield [response, operation] Access the result along with the RPC operation
561
+ # @yieldparam response [::Gapic::Operation]
562
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
563
+ #
564
+ # @return [::Gapic::Operation]
565
+ #
566
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
567
+ #
568
+ # @example Basic example
569
+ # require "google/cloud/run/v2"
570
+ #
571
+ # # Create a client object. The client can be reused for multiple calls.
572
+ # client = Google::Cloud::Run::V2::WorkerPools::Client.new
573
+ #
574
+ # # Create a request. To set request fields, pass in keyword arguments.
575
+ # request = Google::Cloud::Run::V2::UpdateWorkerPoolRequest.new
576
+ #
577
+ # # Call the update_worker_pool method.
578
+ # result = client.update_worker_pool request
579
+ #
580
+ # # The returned object is of type Gapic::Operation. You can use it to
581
+ # # check the status of an operation, cancel it, or wait for results.
582
+ # # Here is how to wait for a response.
583
+ # result.wait_until_done! timeout: 60
584
+ # if result.response?
585
+ # p result.response
586
+ # else
587
+ # puts "No response received."
588
+ # end
589
+ #
590
+ def update_worker_pool request, options = nil
591
+ raise ::ArgumentError, "request must be provided" if request.nil?
592
+
593
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Run::V2::UpdateWorkerPoolRequest
594
+
595
+ # Converts hash and nil to an options object
596
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
597
+
598
+ # Customize the options with defaults
599
+ metadata = @config.rpcs.update_worker_pool.metadata.to_h
600
+
601
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
602
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
603
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
604
+ gapic_version: ::Google::Cloud::Run::V2::VERSION
605
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
606
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
607
+
608
+ header_params = {}
609
+ if request.worker_pool&.name
610
+ regex_match = %r{^projects/[^/]+/locations/(?<location>[^/]+)(?:/.*)?$}.match request.worker_pool.name
611
+ if regex_match
612
+ header_params["location"] = regex_match["location".to_s]
613
+ end
614
+ end
615
+
616
+ request_params_header = URI.encode_www_form header_params
617
+ metadata[:"x-goog-request-params"] ||= request_params_header
618
+
619
+ options.apply_defaults timeout: @config.rpcs.update_worker_pool.timeout,
620
+ metadata: metadata,
621
+ retry_policy: @config.rpcs.update_worker_pool.retry_policy
622
+
623
+ options.apply_defaults timeout: @config.timeout,
624
+ metadata: @config.metadata,
625
+ retry_policy: @config.retry_policy
626
+
627
+ @worker_pools_stub.call_rpc :update_worker_pool, request, options: options do |response, operation|
628
+ response = ::Gapic::Operation.new response, @operations_client, options: options
629
+ yield response, operation if block_given?
630
+ throw :response, response
631
+ end
632
+ rescue ::GRPC::BadStatus => e
633
+ raise ::Google::Cloud::Error.from_error(e)
634
+ end
635
+
636
+ ##
637
+ # Deletes a WorkerPool.
638
+ #
639
+ # @overload delete_worker_pool(request, options = nil)
640
+ # Pass arguments to `delete_worker_pool` via a request object, either of type
641
+ # {::Google::Cloud::Run::V2::DeleteWorkerPoolRequest} or an equivalent Hash.
642
+ #
643
+ # @param request [::Google::Cloud::Run::V2::DeleteWorkerPoolRequest, ::Hash]
644
+ # A request object representing the call parameters. Required. To specify no
645
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
646
+ # @param options [::Gapic::CallOptions, ::Hash]
647
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
648
+ #
649
+ # @overload delete_worker_pool(name: nil, validate_only: nil, etag: nil)
650
+ # Pass arguments to `delete_worker_pool` via keyword arguments. Note that at
651
+ # least one keyword argument is required. To specify no parameters, or to keep all
652
+ # the default parameter values, pass an empty Hash as a request object (see above).
653
+ #
654
+ # @param name [::String]
655
+ # Required. The full name of the WorkerPool.
656
+ # Format:
657
+ # `projects/{project}/locations/{location}/workerPools/{worker_pool}`, where
658
+ # `{project}` can be project id or number.
659
+ # @param validate_only [::Boolean]
660
+ # Optional. Indicates that the request should be validated without actually
661
+ # deleting any resources.
662
+ # @param etag [::String]
663
+ # A system-generated fingerprint for this version of the
664
+ # resource. May be used to detect modification conflict during updates.
665
+ #
666
+ # @yield [response, operation] Access the result along with the RPC operation
667
+ # @yieldparam response [::Gapic::Operation]
668
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
669
+ #
670
+ # @return [::Gapic::Operation]
671
+ #
672
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
673
+ #
674
+ # @example Basic example
675
+ # require "google/cloud/run/v2"
676
+ #
677
+ # # Create a client object. The client can be reused for multiple calls.
678
+ # client = Google::Cloud::Run::V2::WorkerPools::Client.new
679
+ #
680
+ # # Create a request. To set request fields, pass in keyword arguments.
681
+ # request = Google::Cloud::Run::V2::DeleteWorkerPoolRequest.new
682
+ #
683
+ # # Call the delete_worker_pool method.
684
+ # result = client.delete_worker_pool request
685
+ #
686
+ # # The returned object is of type Gapic::Operation. You can use it to
687
+ # # check the status of an operation, cancel it, or wait for results.
688
+ # # Here is how to wait for a response.
689
+ # result.wait_until_done! timeout: 60
690
+ # if result.response?
691
+ # p result.response
692
+ # else
693
+ # puts "No response received."
694
+ # end
695
+ #
696
+ def delete_worker_pool request, options = nil
697
+ raise ::ArgumentError, "request must be provided" if request.nil?
698
+
699
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Run::V2::DeleteWorkerPoolRequest
700
+
701
+ # Converts hash and nil to an options object
702
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
703
+
704
+ # Customize the options with defaults
705
+ metadata = @config.rpcs.delete_worker_pool.metadata.to_h
706
+
707
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
708
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
709
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
710
+ gapic_version: ::Google::Cloud::Run::V2::VERSION
711
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
712
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
713
+
714
+ header_params = {}
715
+ if request.name
716
+ regex_match = %r{^projects/[^/]+/locations/(?<location>[^/]+)(?:/.*)?$}.match request.name
717
+ if regex_match
718
+ header_params["location"] = regex_match["location".to_s]
719
+ end
720
+ end
721
+
722
+ request_params_header = URI.encode_www_form header_params
723
+ metadata[:"x-goog-request-params"] ||= request_params_header
724
+
725
+ options.apply_defaults timeout: @config.rpcs.delete_worker_pool.timeout,
726
+ metadata: metadata,
727
+ retry_policy: @config.rpcs.delete_worker_pool.retry_policy
728
+
729
+ options.apply_defaults timeout: @config.timeout,
730
+ metadata: @config.metadata,
731
+ retry_policy: @config.retry_policy
732
+
733
+ @worker_pools_stub.call_rpc :delete_worker_pool, request, options: options do |response, operation|
734
+ response = ::Gapic::Operation.new response, @operations_client, options: options
735
+ yield response, operation if block_given?
736
+ throw :response, response
737
+ end
738
+ rescue ::GRPC::BadStatus => e
739
+ raise ::Google::Cloud::Error.from_error(e)
740
+ end
741
+
742
+ ##
743
+ # Gets the IAM Access Control policy currently in effect for the given
744
+ # Cloud Run WorkerPool. This result does not include any inherited policies.
745
+ #
746
+ # @overload get_iam_policy(request, options = nil)
747
+ # Pass arguments to `get_iam_policy` via a request object, either of type
748
+ # {::Google::Iam::V1::GetIamPolicyRequest} or an equivalent Hash.
749
+ #
750
+ # @param request [::Google::Iam::V1::GetIamPolicyRequest, ::Hash]
751
+ # A request object representing the call parameters. Required. To specify no
752
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
753
+ # @param options [::Gapic::CallOptions, ::Hash]
754
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
755
+ #
756
+ # @overload get_iam_policy(resource: nil, options: nil)
757
+ # Pass arguments to `get_iam_policy` via keyword arguments. Note that at
758
+ # least one keyword argument is required. To specify no parameters, or to keep all
759
+ # the default parameter values, pass an empty Hash as a request object (see above).
760
+ #
761
+ # @param resource [::String]
762
+ # REQUIRED: The resource for which the policy is being requested.
763
+ # See the operation documentation for the appropriate value for this field.
764
+ # @param options [::Google::Iam::V1::GetPolicyOptions, ::Hash]
765
+ # OPTIONAL: A `GetPolicyOptions` object for specifying options to
766
+ # `GetIamPolicy`.
767
+ #
768
+ # @yield [response, operation] Access the result along with the RPC operation
769
+ # @yieldparam response [::Google::Iam::V1::Policy]
770
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
771
+ #
772
+ # @return [::Google::Iam::V1::Policy]
773
+ #
774
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
775
+ #
776
+ # @example Basic example
777
+ # require "google/cloud/run/v2"
778
+ #
779
+ # # Create a client object. The client can be reused for multiple calls.
780
+ # client = Google::Cloud::Run::V2::WorkerPools::Client.new
781
+ #
782
+ # # Create a request. To set request fields, pass in keyword arguments.
783
+ # request = Google::Iam::V1::GetIamPolicyRequest.new
784
+ #
785
+ # # Call the get_iam_policy method.
786
+ # result = client.get_iam_policy request
787
+ #
788
+ # # The returned object is of type Google::Iam::V1::Policy.
789
+ # p result
790
+ #
791
+ def get_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::GetIamPolicyRequest
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
+ metadata = @config.rpcs.get_iam_policy.metadata.to_h
801
+
802
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
803
+ 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::Run::V2::VERSION
806
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
807
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
808
+
809
+ header_params = {}
810
+ if request.resource
811
+ header_params["resource"] = request.resource
812
+ end
813
+
814
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
815
+ metadata[:"x-goog-request-params"] ||= request_params_header
816
+
817
+ options.apply_defaults timeout: @config.rpcs.get_iam_policy.timeout,
818
+ metadata: metadata,
819
+ retry_policy: @config.rpcs.get_iam_policy.retry_policy
820
+
821
+ options.apply_defaults timeout: @config.timeout,
822
+ metadata: @config.metadata,
823
+ retry_policy: @config.retry_policy
824
+
825
+ @worker_pools_stub.call_rpc :get_iam_policy, request, options: options do |response, operation|
826
+ yield response, operation if block_given?
827
+ end
828
+ rescue ::GRPC::BadStatus => e
829
+ raise ::Google::Cloud::Error.from_error(e)
830
+ end
831
+
832
+ ##
833
+ # Sets the IAM Access control policy for the specified WorkerPool. Overwrites
834
+ # any existing policy.
835
+ #
836
+ # @overload set_iam_policy(request, options = nil)
837
+ # Pass arguments to `set_iam_policy` via a request object, either of type
838
+ # {::Google::Iam::V1::SetIamPolicyRequest} or an equivalent Hash.
839
+ #
840
+ # @param request [::Google::Iam::V1::SetIamPolicyRequest, ::Hash]
841
+ # A request object representing the call parameters. Required. To specify no
842
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
843
+ # @param options [::Gapic::CallOptions, ::Hash]
844
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
845
+ #
846
+ # @overload set_iam_policy(resource: nil, policy: nil, update_mask: nil)
847
+ # Pass arguments to `set_iam_policy` via keyword arguments. Note that at
848
+ # least one keyword argument is required. To specify no parameters, or to keep all
849
+ # the default parameter values, pass an empty Hash as a request object (see above).
850
+ #
851
+ # @param resource [::String]
852
+ # REQUIRED: The resource for which the policy is being specified.
853
+ # See the operation documentation for the appropriate value for this field.
854
+ # @param policy [::Google::Iam::V1::Policy, ::Hash]
855
+ # REQUIRED: The complete policy to be applied to the `resource`. The size of
856
+ # the policy is limited to a few 10s of KB. An empty policy is a
857
+ # valid policy but certain Cloud Platform services (such as Projects)
858
+ # might reject them.
859
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
860
+ # OPTIONAL: A FieldMask specifying which fields of the policy to modify. Only
861
+ # the fields in the mask will be modified. If no mask is provided, the
862
+ # following default mask is used:
863
+ #
864
+ # `paths: "bindings, etag"`
865
+ #
866
+ # @yield [response, operation] Access the result along with the RPC operation
867
+ # @yieldparam response [::Google::Iam::V1::Policy]
868
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
869
+ #
870
+ # @return [::Google::Iam::V1::Policy]
871
+ #
872
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
873
+ #
874
+ # @example Basic example
875
+ # require "google/cloud/run/v2"
876
+ #
877
+ # # Create a client object. The client can be reused for multiple calls.
878
+ # client = Google::Cloud::Run::V2::WorkerPools::Client.new
879
+ #
880
+ # # Create a request. To set request fields, pass in keyword arguments.
881
+ # request = Google::Iam::V1::SetIamPolicyRequest.new
882
+ #
883
+ # # Call the set_iam_policy method.
884
+ # result = client.set_iam_policy request
885
+ #
886
+ # # The returned object is of type Google::Iam::V1::Policy.
887
+ # p result
888
+ #
889
+ def set_iam_policy request, options = nil
890
+ raise ::ArgumentError, "request must be provided" if request.nil?
891
+
892
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Iam::V1::SetIamPolicyRequest
893
+
894
+ # Converts hash and nil to an options object
895
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
896
+
897
+ # Customize the options with defaults
898
+ metadata = @config.rpcs.set_iam_policy.metadata.to_h
899
+
900
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
901
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
902
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
903
+ gapic_version: ::Google::Cloud::Run::V2::VERSION
904
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
905
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
906
+
907
+ header_params = {}
908
+ if request.resource
909
+ header_params["resource"] = request.resource
910
+ end
911
+
912
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
913
+ metadata[:"x-goog-request-params"] ||= request_params_header
914
+
915
+ options.apply_defaults timeout: @config.rpcs.set_iam_policy.timeout,
916
+ metadata: metadata,
917
+ retry_policy: @config.rpcs.set_iam_policy.retry_policy
918
+
919
+ options.apply_defaults timeout: @config.timeout,
920
+ metadata: @config.metadata,
921
+ retry_policy: @config.retry_policy
922
+
923
+ @worker_pools_stub.call_rpc :set_iam_policy, request, options: options do |response, operation|
924
+ yield response, operation if block_given?
925
+ end
926
+ rescue ::GRPC::BadStatus => e
927
+ raise ::Google::Cloud::Error.from_error(e)
928
+ end
929
+
930
+ ##
931
+ # Returns permissions that a caller has on the specified Project.
932
+ #
933
+ # There are no permissions required for making this API call.
934
+ #
935
+ # @overload test_iam_permissions(request, options = nil)
936
+ # Pass arguments to `test_iam_permissions` via a request object, either of type
937
+ # {::Google::Iam::V1::TestIamPermissionsRequest} or an equivalent Hash.
938
+ #
939
+ # @param request [::Google::Iam::V1::TestIamPermissionsRequest, ::Hash]
940
+ # A request object representing the call parameters. Required. To specify no
941
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
942
+ # @param options [::Gapic::CallOptions, ::Hash]
943
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
944
+ #
945
+ # @overload test_iam_permissions(resource: nil, permissions: nil)
946
+ # Pass arguments to `test_iam_permissions` via keyword arguments. Note that at
947
+ # least one keyword argument is required. To specify no parameters, or to keep all
948
+ # the default parameter values, pass an empty Hash as a request object (see above).
949
+ #
950
+ # @param resource [::String]
951
+ # REQUIRED: The resource for which the policy detail is being requested.
952
+ # See the operation documentation for the appropriate value for this field.
953
+ # @param permissions [::Array<::String>]
954
+ # The set of permissions to check for the `resource`. Permissions with
955
+ # wildcards (such as '*' or 'storage.*') are not allowed. For more
956
+ # information see
957
+ # [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions).
958
+ #
959
+ # @yield [response, operation] Access the result along with the RPC operation
960
+ # @yieldparam response [::Google::Iam::V1::TestIamPermissionsResponse]
961
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
962
+ #
963
+ # @return [::Google::Iam::V1::TestIamPermissionsResponse]
964
+ #
965
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
966
+ #
967
+ # @example Basic example
968
+ # require "google/cloud/run/v2"
969
+ #
970
+ # # Create a client object. The client can be reused for multiple calls.
971
+ # client = Google::Cloud::Run::V2::WorkerPools::Client.new
972
+ #
973
+ # # Create a request. To set request fields, pass in keyword arguments.
974
+ # request = Google::Iam::V1::TestIamPermissionsRequest.new
975
+ #
976
+ # # Call the test_iam_permissions method.
977
+ # result = client.test_iam_permissions request
978
+ #
979
+ # # The returned object is of type Google::Iam::V1::TestIamPermissionsResponse.
980
+ # p result
981
+ #
982
+ def test_iam_permissions request, options = nil
983
+ raise ::ArgumentError, "request must be provided" if request.nil?
984
+
985
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Iam::V1::TestIamPermissionsRequest
986
+
987
+ # Converts hash and nil to an options object
988
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
989
+
990
+ # Customize the options with defaults
991
+ metadata = @config.rpcs.test_iam_permissions.metadata.to_h
992
+
993
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
994
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
995
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
996
+ gapic_version: ::Google::Cloud::Run::V2::VERSION
997
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
998
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
999
+
1000
+ header_params = {}
1001
+ if request.resource
1002
+ header_params["resource"] = request.resource
1003
+ end
1004
+
1005
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1006
+ metadata[:"x-goog-request-params"] ||= request_params_header
1007
+
1008
+ options.apply_defaults timeout: @config.rpcs.test_iam_permissions.timeout,
1009
+ metadata: metadata,
1010
+ retry_policy: @config.rpcs.test_iam_permissions.retry_policy
1011
+
1012
+ options.apply_defaults timeout: @config.timeout,
1013
+ metadata: @config.metadata,
1014
+ retry_policy: @config.retry_policy
1015
+
1016
+ @worker_pools_stub.call_rpc :test_iam_permissions, request, options: options do |response, operation|
1017
+ yield response, operation if block_given?
1018
+ end
1019
+ rescue ::GRPC::BadStatus => e
1020
+ raise ::Google::Cloud::Error.from_error(e)
1021
+ end
1022
+
1023
+ ##
1024
+ # Configuration class for the WorkerPools API.
1025
+ #
1026
+ # This class represents the configuration for WorkerPools,
1027
+ # providing control over timeouts, retry behavior, logging, transport
1028
+ # parameters, and other low-level controls. Certain parameters can also be
1029
+ # applied individually to specific RPCs. See
1030
+ # {::Google::Cloud::Run::V2::WorkerPools::Client::Configuration::Rpcs}
1031
+ # for a list of RPCs that can be configured independently.
1032
+ #
1033
+ # Configuration can be applied globally to all clients, or to a single client
1034
+ # on construction.
1035
+ #
1036
+ # @example
1037
+ #
1038
+ # # Modify the global config, setting the timeout for
1039
+ # # create_worker_pool to 20 seconds,
1040
+ # # and all remaining timeouts to 10 seconds.
1041
+ # ::Google::Cloud::Run::V2::WorkerPools::Client.configure do |config|
1042
+ # config.timeout = 10.0
1043
+ # config.rpcs.create_worker_pool.timeout = 20.0
1044
+ # end
1045
+ #
1046
+ # # Apply the above configuration only to a new client.
1047
+ # client = ::Google::Cloud::Run::V2::WorkerPools::Client.new do |config|
1048
+ # config.timeout = 10.0
1049
+ # config.rpcs.create_worker_pool.timeout = 20.0
1050
+ # end
1051
+ #
1052
+ # @!attribute [rw] endpoint
1053
+ # A custom service endpoint, as a hostname or hostname:port. The default is
1054
+ # nil, indicating to use the default endpoint in the current universe domain.
1055
+ # @return [::String,nil]
1056
+ # @!attribute [rw] credentials
1057
+ # Credentials to send with calls. You may provide any of the following types:
1058
+ # * (`String`) The path to a service account key file in JSON format
1059
+ # * (`Hash`) A service account key as a Hash
1060
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
1061
+ # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
1062
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
1063
+ # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
1064
+ # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
1065
+ # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
1066
+ # * (`nil`) indicating no credentials
1067
+ #
1068
+ # Warning: If you accept a credential configuration (JSON file or Hash) from an
1069
+ # external source for authentication to Google Cloud, you must validate it before
1070
+ # providing it to a Google API client library. Providing an unvalidated credential
1071
+ # configuration to Google APIs can compromise the security of your systems and data.
1072
+ # For more information, refer to [Validate credential configurations from external
1073
+ # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
1074
+ # @return [::Object]
1075
+ # @!attribute [rw] scope
1076
+ # The OAuth scopes
1077
+ # @return [::Array<::String>]
1078
+ # @!attribute [rw] lib_name
1079
+ # The library name as recorded in instrumentation and logging
1080
+ # @return [::String]
1081
+ # @!attribute [rw] lib_version
1082
+ # The library version as recorded in instrumentation and logging
1083
+ # @return [::String]
1084
+ # @!attribute [rw] channel_args
1085
+ # Extra parameters passed to the gRPC channel. Note: this is ignored if a
1086
+ # `GRPC::Core::Channel` object is provided as the credential.
1087
+ # @return [::Hash]
1088
+ # @!attribute [rw] interceptors
1089
+ # An array of interceptors that are run before calls are executed.
1090
+ # @return [::Array<::GRPC::ClientInterceptor>]
1091
+ # @!attribute [rw] timeout
1092
+ # The call timeout in seconds.
1093
+ # @return [::Numeric]
1094
+ # @!attribute [rw] metadata
1095
+ # Additional gRPC headers to be sent with the call.
1096
+ # @return [::Hash{::Symbol=>::String}]
1097
+ # @!attribute [rw] retry_policy
1098
+ # The retry policy. The value is a hash with the following keys:
1099
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
1100
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
1101
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
1102
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
1103
+ # trigger a retry.
1104
+ # @return [::Hash]
1105
+ # @!attribute [rw] quota_project
1106
+ # A separate project against which to charge quota.
1107
+ # @return [::String]
1108
+ # @!attribute [rw] universe_domain
1109
+ # The universe domain within which to make requests. This determines the
1110
+ # default endpoint URL. The default value of nil uses the environment
1111
+ # universe (usually the default "googleapis.com" universe).
1112
+ # @return [::String,nil]
1113
+ # @!attribute [rw] logger
1114
+ # A custom logger to use for request/response debug logging, or the value
1115
+ # `:default` (the default) to construct a default logger, or `nil` to
1116
+ # explicitly disable logging.
1117
+ # @return [::Logger,:default,nil]
1118
+ #
1119
+ class Configuration
1120
+ extend ::Gapic::Config
1121
+
1122
+ # @private
1123
+ # The endpoint specific to the default "googleapis.com" universe. Deprecated.
1124
+ DEFAULT_ENDPOINT = "run.googleapis.com"
1125
+
1126
+ config_attr :endpoint, nil, ::String, nil
1127
+ config_attr :credentials, nil do |value|
1128
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil]
1129
+ allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC::Core::Channel
1130
+ allowed.any? { |klass| klass === value }
1131
+ end
1132
+ config_attr :scope, nil, ::String, ::Array, nil
1133
+ config_attr :lib_name, nil, ::String, nil
1134
+ config_attr :lib_version, nil, ::String, nil
1135
+ config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
1136
+ config_attr :interceptors, nil, ::Array, nil
1137
+ config_attr :timeout, nil, ::Numeric, nil
1138
+ config_attr :metadata, nil, ::Hash, nil
1139
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
1140
+ config_attr :quota_project, nil, ::String, nil
1141
+ config_attr :universe_domain, nil, ::String, nil
1142
+ config_attr :logger, :default, ::Logger, nil, :default
1143
+
1144
+ # @private
1145
+ def initialize parent_config = nil
1146
+ @parent_config = parent_config unless parent_config.nil?
1147
+
1148
+ yield self if block_given?
1149
+ end
1150
+
1151
+ ##
1152
+ # Configurations for individual RPCs
1153
+ # @return [Rpcs]
1154
+ #
1155
+ def rpcs
1156
+ @rpcs ||= begin
1157
+ parent_rpcs = nil
1158
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
1159
+ Rpcs.new parent_rpcs
1160
+ end
1161
+ end
1162
+
1163
+ ##
1164
+ # Configuration for the channel pool
1165
+ # @return [::Gapic::ServiceStub::ChannelPool::Configuration]
1166
+ #
1167
+ def channel_pool
1168
+ @channel_pool ||= ::Gapic::ServiceStub::ChannelPool::Configuration.new
1169
+ end
1170
+
1171
+ ##
1172
+ # Configuration RPC class for the WorkerPools API.
1173
+ #
1174
+ # Includes fields providing the configuration for each RPC in this service.
1175
+ # Each configuration object is of type `Gapic::Config::Method` and includes
1176
+ # the following configuration fields:
1177
+ #
1178
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
1179
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
1180
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
1181
+ # include the following keys:
1182
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
1183
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
1184
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
1185
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
1186
+ # trigger a retry.
1187
+ #
1188
+ class Rpcs
1189
+ ##
1190
+ # RPC-specific configuration for `create_worker_pool`
1191
+ # @return [::Gapic::Config::Method]
1192
+ #
1193
+ attr_reader :create_worker_pool
1194
+ ##
1195
+ # RPC-specific configuration for `get_worker_pool`
1196
+ # @return [::Gapic::Config::Method]
1197
+ #
1198
+ attr_reader :get_worker_pool
1199
+ ##
1200
+ # RPC-specific configuration for `list_worker_pools`
1201
+ # @return [::Gapic::Config::Method]
1202
+ #
1203
+ attr_reader :list_worker_pools
1204
+ ##
1205
+ # RPC-specific configuration for `update_worker_pool`
1206
+ # @return [::Gapic::Config::Method]
1207
+ #
1208
+ attr_reader :update_worker_pool
1209
+ ##
1210
+ # RPC-specific configuration for `delete_worker_pool`
1211
+ # @return [::Gapic::Config::Method]
1212
+ #
1213
+ attr_reader :delete_worker_pool
1214
+ ##
1215
+ # RPC-specific configuration for `get_iam_policy`
1216
+ # @return [::Gapic::Config::Method]
1217
+ #
1218
+ attr_reader :get_iam_policy
1219
+ ##
1220
+ # RPC-specific configuration for `set_iam_policy`
1221
+ # @return [::Gapic::Config::Method]
1222
+ #
1223
+ attr_reader :set_iam_policy
1224
+ ##
1225
+ # RPC-specific configuration for `test_iam_permissions`
1226
+ # @return [::Gapic::Config::Method]
1227
+ #
1228
+ attr_reader :test_iam_permissions
1229
+
1230
+ # @private
1231
+ def initialize parent_rpcs = nil
1232
+ create_worker_pool_config = parent_rpcs.create_worker_pool if parent_rpcs.respond_to? :create_worker_pool
1233
+ @create_worker_pool = ::Gapic::Config::Method.new create_worker_pool_config
1234
+ get_worker_pool_config = parent_rpcs.get_worker_pool if parent_rpcs.respond_to? :get_worker_pool
1235
+ @get_worker_pool = ::Gapic::Config::Method.new get_worker_pool_config
1236
+ list_worker_pools_config = parent_rpcs.list_worker_pools if parent_rpcs.respond_to? :list_worker_pools
1237
+ @list_worker_pools = ::Gapic::Config::Method.new list_worker_pools_config
1238
+ update_worker_pool_config = parent_rpcs.update_worker_pool if parent_rpcs.respond_to? :update_worker_pool
1239
+ @update_worker_pool = ::Gapic::Config::Method.new update_worker_pool_config
1240
+ delete_worker_pool_config = parent_rpcs.delete_worker_pool if parent_rpcs.respond_to? :delete_worker_pool
1241
+ @delete_worker_pool = ::Gapic::Config::Method.new delete_worker_pool_config
1242
+ get_iam_policy_config = parent_rpcs.get_iam_policy if parent_rpcs.respond_to? :get_iam_policy
1243
+ @get_iam_policy = ::Gapic::Config::Method.new get_iam_policy_config
1244
+ set_iam_policy_config = parent_rpcs.set_iam_policy if parent_rpcs.respond_to? :set_iam_policy
1245
+ @set_iam_policy = ::Gapic::Config::Method.new set_iam_policy_config
1246
+ test_iam_permissions_config = parent_rpcs.test_iam_permissions if parent_rpcs.respond_to? :test_iam_permissions
1247
+ @test_iam_permissions = ::Gapic::Config::Method.new test_iam_permissions_config
1248
+
1249
+ yield self if block_given?
1250
+ end
1251
+ end
1252
+ end
1253
+ end
1254
+ end
1255
+ end
1256
+ end
1257
+ end
1258
+ end