google-cloud-run-v2 0.6.0 → 0.7.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 (39) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/lib/google/cloud/run/v2/executions/client.rb +8 -10
  4. data/lib/google/cloud/run/v2/executions/operations.rb +12 -14
  5. data/lib/google/cloud/run/v2/executions/rest/client.rb +533 -0
  6. data/lib/google/cloud/run/v2/executions/rest/operations.rb +935 -0
  7. data/lib/google/cloud/run/v2/executions/rest/service_stub.rb +225 -0
  8. data/lib/google/cloud/run/v2/executions/rest.rb +53 -0
  9. data/lib/google/cloud/run/v2/executions.rb +6 -0
  10. data/lib/google/cloud/run/v2/jobs/client.rb +20 -22
  11. data/lib/google/cloud/run/v2/jobs/operations.rb +12 -14
  12. data/lib/google/cloud/run/v2/jobs/rest/client.rb +998 -0
  13. data/lib/google/cloud/run/v2/jobs/rest/operations.rb +935 -0
  14. data/lib/google/cloud/run/v2/jobs/rest/service_stub.rb +584 -0
  15. data/lib/google/cloud/run/v2/jobs/rest.rb +53 -0
  16. data/lib/google/cloud/run/v2/jobs.rb +6 -0
  17. data/lib/google/cloud/run/v2/rest.rb +41 -0
  18. data/lib/google/cloud/run/v2/revisions/client.rb +8 -10
  19. data/lib/google/cloud/run/v2/revisions/operations.rb +12 -14
  20. data/lib/google/cloud/run/v2/revisions/rest/client.rb +531 -0
  21. data/lib/google/cloud/run/v2/revisions/rest/operations.rb +935 -0
  22. data/lib/google/cloud/run/v2/revisions/rest/service_stub.rb +225 -0
  23. data/lib/google/cloud/run/v2/revisions/rest.rb +53 -0
  24. data/lib/google/cloud/run/v2/revisions.rb +6 -0
  25. data/lib/google/cloud/run/v2/services/client.rb +16 -18
  26. data/lib/google/cloud/run/v2/services/operations.rb +12 -14
  27. data/lib/google/cloud/run/v2/services/rest/client.rb +940 -0
  28. data/lib/google/cloud/run/v2/services/rest/operations.rb +935 -0
  29. data/lib/google/cloud/run/v2/services/rest/service_stub.rb +524 -0
  30. data/lib/google/cloud/run/v2/services/rest.rb +53 -0
  31. data/lib/google/cloud/run/v2/services.rb +6 -0
  32. data/lib/google/cloud/run/v2/tasks/client.rb +4 -6
  33. data/lib/google/cloud/run/v2/tasks/rest/client.rb +440 -0
  34. data/lib/google/cloud/run/v2/tasks/rest/service_stub.rb +166 -0
  35. data/lib/google/cloud/run/v2/tasks/rest.rb +52 -0
  36. data/lib/google/cloud/run/v2/tasks.rb +6 -0
  37. data/lib/google/cloud/run/v2/version.rb +1 -1
  38. data/lib/google/cloud/run/v2.rb +5 -0
  39. metadata +32 -9
@@ -0,0 +1,940 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2023 Google LLC
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # https://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ # Auto-generated by gapic-generator-ruby. DO NOT EDIT!
18
+
19
+ require "google/cloud/errors"
20
+ require "google/cloud/run/v2/service_pb"
21
+ require "google/cloud/run/v2/services/rest/service_stub"
22
+ require "google/cloud/location/rest"
23
+
24
+ module Google
25
+ module Cloud
26
+ module Run
27
+ module V2
28
+ module Services
29
+ module Rest
30
+ ##
31
+ # REST client for the Services service.
32
+ #
33
+ # Cloud Run Service Control Plane API
34
+ #
35
+ class Client
36
+ include Paths
37
+
38
+ # @private
39
+ attr_reader :services_stub
40
+
41
+ ##
42
+ # Configure the Services Client class.
43
+ #
44
+ # See {::Google::Cloud::Run::V2::Services::Rest::Client::Configuration}
45
+ # for a description of the configuration fields.
46
+ #
47
+ # @example
48
+ #
49
+ # # Modify the configuration for all Services clients
50
+ # ::Google::Cloud::Run::V2::Services::Rest::Client.configure do |config|
51
+ # config.timeout = 10.0
52
+ # end
53
+ #
54
+ # @yield [config] Configure the Client client.
55
+ # @yieldparam config [Client::Configuration]
56
+ #
57
+ # @return [Client::Configuration]
58
+ #
59
+ def self.configure
60
+ @configure ||= begin
61
+ namespace = ["Google", "Cloud", "Run", "V2"]
62
+ parent_config = while namespace.any?
63
+ parent_name = namespace.join "::"
64
+ parent_const = const_get parent_name
65
+ break parent_const.configure if parent_const.respond_to? :configure
66
+ namespace.pop
67
+ end
68
+ default_config = Client::Configuration.new parent_config
69
+
70
+ default_config.rpcs.create_service.timeout = 15.0
71
+
72
+ default_config.rpcs.get_service.timeout = 10.0
73
+ default_config.rpcs.get_service.retry_policy = {
74
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
75
+ }
76
+
77
+ default_config.rpcs.list_services.timeout = 10.0
78
+ default_config.rpcs.list_services.retry_policy = {
79
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
80
+ }
81
+
82
+ default_config.rpcs.update_service.timeout = 15.0
83
+
84
+ default_config.rpcs.delete_service.timeout = 10.0
85
+
86
+ default_config
87
+ end
88
+ yield @configure if block_given?
89
+ @configure
90
+ end
91
+
92
+ ##
93
+ # Configure the Services Client instance.
94
+ #
95
+ # The configuration is set to the derived mode, meaning that values can be changed,
96
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
97
+ # should be made on {Client.configure}.
98
+ #
99
+ # See {::Google::Cloud::Run::V2::Services::Rest::Client::Configuration}
100
+ # for a description of the configuration fields.
101
+ #
102
+ # @yield [config] Configure the Client client.
103
+ # @yieldparam config [Client::Configuration]
104
+ #
105
+ # @return [Client::Configuration]
106
+ #
107
+ def configure
108
+ yield @config if block_given?
109
+ @config
110
+ end
111
+
112
+ ##
113
+ # Create a new Services REST client object.
114
+ #
115
+ # @example
116
+ #
117
+ # # Create a client using the default configuration
118
+ # client = ::Google::Cloud::Run::V2::Services::Rest::Client.new
119
+ #
120
+ # # Create a client using a custom configuration
121
+ # client = ::Google::Cloud::Run::V2::Services::Rest::Client.new do |config|
122
+ # config.timeout = 10.0
123
+ # end
124
+ #
125
+ # @yield [config] Configure the Services client.
126
+ # @yieldparam config [Client::Configuration]
127
+ #
128
+ def initialize
129
+ # Create the configuration object
130
+ @config = Configuration.new Client.configure
131
+
132
+ # Yield the configuration if needed
133
+ yield @config if block_given?
134
+
135
+ # Create credentials
136
+ credentials = @config.credentials
137
+ # Use self-signed JWT if the endpoint is unchanged from default,
138
+ # but only if the default endpoint does not have a region prefix.
139
+ enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
140
+ !@config.endpoint.split(".").first.include?("-")
141
+ credentials ||= Credentials.default scope: @config.scope,
142
+ enable_self_signed_jwt: enable_self_signed_jwt
143
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
144
+ credentials = Credentials.new credentials, scope: @config.scope
145
+ end
146
+
147
+ @quota_project_id = @config.quota_project
148
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
149
+
150
+ @operations_client = ::Google::Cloud::Run::V2::Services::Rest::Operations.new do |config|
151
+ config.credentials = credentials
152
+ config.quota_project = @quota_project_id
153
+ config.endpoint = @config.endpoint
154
+ end
155
+
156
+ @location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config|
157
+ config.credentials = credentials
158
+ config.quota_project = @quota_project_id
159
+ config.endpoint = @config.endpoint
160
+ end
161
+
162
+ @services_stub = ::Google::Cloud::Run::V2::Services::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials
163
+ end
164
+
165
+ ##
166
+ # Get the associated client for long-running operations.
167
+ #
168
+ # @return [::Google::Cloud::Run::V2::Services::Rest::Operations]
169
+ #
170
+ attr_reader :operations_client
171
+
172
+ ##
173
+ # Get the associated client for mix-in of the Locations.
174
+ #
175
+ # @return [Google::Cloud::Location::Locations::Rest::Client]
176
+ #
177
+ attr_reader :location_client
178
+
179
+ # Service calls
180
+
181
+ ##
182
+ # Creates a new Service in a given project and location.
183
+ #
184
+ # @overload create_service(request, options = nil)
185
+ # Pass arguments to `create_service` via a request object, either of type
186
+ # {::Google::Cloud::Run::V2::CreateServiceRequest} or an equivalent Hash.
187
+ #
188
+ # @param request [::Google::Cloud::Run::V2::CreateServiceRequest, ::Hash]
189
+ # A request object representing the call parameters. Required. To specify no
190
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
191
+ # @param options [::Gapic::CallOptions, ::Hash]
192
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
193
+ #
194
+ # @overload create_service(parent: nil, service: nil, service_id: nil, validate_only: nil)
195
+ # Pass arguments to `create_service` via keyword arguments. Note that at
196
+ # least one keyword argument is required. To specify no parameters, or to keep all
197
+ # the default parameter values, pass an empty Hash as a request object (see above).
198
+ #
199
+ # @param parent [::String]
200
+ # Required. The location and project in which this service should be created.
201
+ # Format: projects/\\{project}/locations/\\{location}, where \\{project} can be
202
+ # project id or number. Only lowercase characters, digits, and hyphens.
203
+ # @param service [::Google::Cloud::Run::V2::Service, ::Hash]
204
+ # Required. The Service instance to create.
205
+ # @param service_id [::String]
206
+ # Required. The unique identifier for the Service. It must begin with letter,
207
+ # and cannot end with hyphen; must contain fewer than 50 characters.
208
+ # The name of the service becomes \\{parent}/services/\\{service_id}.
209
+ # @param validate_only [::Boolean]
210
+ # Indicates that the request should be validated and default values
211
+ # populated, without persisting the request or creating any resources.
212
+ # @yield [result, operation] Access the result along with the TransportOperation object
213
+ # @yieldparam result [::Gapic::Operation]
214
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
215
+ #
216
+ # @return [::Gapic::Operation]
217
+ #
218
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
219
+ def create_service request, options = nil
220
+ raise ::ArgumentError, "request must be provided" if request.nil?
221
+
222
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Run::V2::CreateServiceRequest
223
+
224
+ # Converts hash and nil to an options object
225
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
226
+
227
+ # Customize the options with defaults
228
+ call_metadata = @config.rpcs.create_service.metadata.to_h
229
+
230
+ # Set x-goog-api-client and x-goog-user-project headers
231
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
232
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
233
+ gapic_version: ::Google::Cloud::Run::V2::VERSION,
234
+ transports_version_send: [:rest]
235
+
236
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
237
+
238
+ options.apply_defaults timeout: @config.rpcs.create_service.timeout,
239
+ metadata: call_metadata,
240
+ retry_policy: @config.rpcs.create_service.retry_policy
241
+
242
+ options.apply_defaults timeout: @config.timeout,
243
+ metadata: @config.metadata,
244
+ retry_policy: @config.retry_policy
245
+
246
+ @services_stub.create_service request, options do |result, operation|
247
+ result = ::Gapic::Operation.new result, @operations_client, options: options
248
+ yield result, operation if block_given?
249
+ return result
250
+ end
251
+ rescue ::Gapic::Rest::Error => e
252
+ raise ::Google::Cloud::Error.from_error(e)
253
+ end
254
+
255
+ ##
256
+ # Gets information about a Service.
257
+ #
258
+ # @overload get_service(request, options = nil)
259
+ # Pass arguments to `get_service` via a request object, either of type
260
+ # {::Google::Cloud::Run::V2::GetServiceRequest} or an equivalent Hash.
261
+ #
262
+ # @param request [::Google::Cloud::Run::V2::GetServiceRequest, ::Hash]
263
+ # A request object representing the call parameters. Required. To specify no
264
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
265
+ # @param options [::Gapic::CallOptions, ::Hash]
266
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
267
+ #
268
+ # @overload get_service(name: nil)
269
+ # Pass arguments to `get_service` via keyword arguments. Note that at
270
+ # least one keyword argument is required. To specify no parameters, or to keep all
271
+ # the default parameter values, pass an empty Hash as a request object (see above).
272
+ #
273
+ # @param name [::String]
274
+ # Required. The full name of the Service.
275
+ # Format: projects/\\{project}/locations/\\{location}/services/\\{service}, where
276
+ # \\{project} can be project id or number.
277
+ # @yield [result, operation] Access the result along with the TransportOperation object
278
+ # @yieldparam result [::Google::Cloud::Run::V2::Service]
279
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
280
+ #
281
+ # @return [::Google::Cloud::Run::V2::Service]
282
+ #
283
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
284
+ def get_service request, options = nil
285
+ raise ::ArgumentError, "request must be provided" if request.nil?
286
+
287
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Run::V2::GetServiceRequest
288
+
289
+ # Converts hash and nil to an options object
290
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
291
+
292
+ # Customize the options with defaults
293
+ call_metadata = @config.rpcs.get_service.metadata.to_h
294
+
295
+ # Set x-goog-api-client and x-goog-user-project headers
296
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
297
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
298
+ gapic_version: ::Google::Cloud::Run::V2::VERSION,
299
+ transports_version_send: [:rest]
300
+
301
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
302
+
303
+ options.apply_defaults timeout: @config.rpcs.get_service.timeout,
304
+ metadata: call_metadata,
305
+ retry_policy: @config.rpcs.get_service.retry_policy
306
+
307
+ options.apply_defaults timeout: @config.timeout,
308
+ metadata: @config.metadata,
309
+ retry_policy: @config.retry_policy
310
+
311
+ @services_stub.get_service request, options do |result, operation|
312
+ yield result, operation if block_given?
313
+ return result
314
+ end
315
+ rescue ::Gapic::Rest::Error => e
316
+ raise ::Google::Cloud::Error.from_error(e)
317
+ end
318
+
319
+ ##
320
+ # Lists Services.
321
+ #
322
+ # @overload list_services(request, options = nil)
323
+ # Pass arguments to `list_services` via a request object, either of type
324
+ # {::Google::Cloud::Run::V2::ListServicesRequest} or an equivalent Hash.
325
+ #
326
+ # @param request [::Google::Cloud::Run::V2::ListServicesRequest, ::Hash]
327
+ # A request object representing the call parameters. Required. To specify no
328
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
329
+ # @param options [::Gapic::CallOptions, ::Hash]
330
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
331
+ #
332
+ # @overload list_services(parent: nil, page_size: nil, page_token: nil, show_deleted: nil)
333
+ # Pass arguments to `list_services` via keyword arguments. Note that at
334
+ # least one keyword argument is required. To specify no parameters, or to keep all
335
+ # the default parameter values, pass an empty Hash as a request object (see above).
336
+ #
337
+ # @param parent [::String]
338
+ # Required. The location and project to list resources on.
339
+ # Location must be a valid Google Cloud region, and cannot be the "-"
340
+ # wildcard. Format: projects/\\{project}/locations/\\{location}, where \\{project}
341
+ # can be project id or number.
342
+ # @param page_size [::Integer]
343
+ # Maximum number of Services to return in this call.
344
+ # @param page_token [::String]
345
+ # A page token received from a previous call to ListServices.
346
+ # All other parameters must match.
347
+ # @param show_deleted [::Boolean]
348
+ # If true, returns deleted (but unexpired) resources along with active ones.
349
+ # @yield [result, operation] Access the result along with the TransportOperation object
350
+ # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Run::V2::Service>]
351
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
352
+ #
353
+ # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Run::V2::Service>]
354
+ #
355
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
356
+ def list_services request, options = nil
357
+ raise ::ArgumentError, "request must be provided" if request.nil?
358
+
359
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Run::V2::ListServicesRequest
360
+
361
+ # Converts hash and nil to an options object
362
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
363
+
364
+ # Customize the options with defaults
365
+ call_metadata = @config.rpcs.list_services.metadata.to_h
366
+
367
+ # Set x-goog-api-client and x-goog-user-project headers
368
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
369
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
370
+ gapic_version: ::Google::Cloud::Run::V2::VERSION,
371
+ transports_version_send: [:rest]
372
+
373
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
374
+
375
+ options.apply_defaults timeout: @config.rpcs.list_services.timeout,
376
+ metadata: call_metadata,
377
+ retry_policy: @config.rpcs.list_services.retry_policy
378
+
379
+ options.apply_defaults timeout: @config.timeout,
380
+ metadata: @config.metadata,
381
+ retry_policy: @config.retry_policy
382
+
383
+ @services_stub.list_services request, options do |result, operation|
384
+ result = ::Gapic::Rest::PagedEnumerable.new @services_stub, :list_services, "services", request, result, options
385
+ yield result, operation if block_given?
386
+ return result
387
+ end
388
+ rescue ::Gapic::Rest::Error => e
389
+ raise ::Google::Cloud::Error.from_error(e)
390
+ end
391
+
392
+ ##
393
+ # Updates a Service.
394
+ #
395
+ # @overload update_service(request, options = nil)
396
+ # Pass arguments to `update_service` via a request object, either of type
397
+ # {::Google::Cloud::Run::V2::UpdateServiceRequest} or an equivalent Hash.
398
+ #
399
+ # @param request [::Google::Cloud::Run::V2::UpdateServiceRequest, ::Hash]
400
+ # A request object representing the call parameters. Required. To specify no
401
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
402
+ # @param options [::Gapic::CallOptions, ::Hash]
403
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
404
+ #
405
+ # @overload update_service(service: nil, validate_only: nil, allow_missing: nil)
406
+ # Pass arguments to `update_service` via keyword arguments. Note that at
407
+ # least one keyword argument is required. To specify no parameters, or to keep all
408
+ # the default parameter values, pass an empty Hash as a request object (see above).
409
+ #
410
+ # @param service [::Google::Cloud::Run::V2::Service, ::Hash]
411
+ # Required. The Service to be updated.
412
+ # @param validate_only [::Boolean]
413
+ # Indicates that the request should be validated and default values
414
+ # populated, without persisting the request or updating any resources.
415
+ # @param allow_missing [::Boolean]
416
+ # If set to true, and if the Service does not exist, it will create a new
417
+ # one. Caller must have both create and update permissions for this call if
418
+ # this is set to true.
419
+ # @yield [result, operation] Access the result along with the TransportOperation object
420
+ # @yieldparam result [::Gapic::Operation]
421
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
422
+ #
423
+ # @return [::Gapic::Operation]
424
+ #
425
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
426
+ def update_service request, options = nil
427
+ raise ::ArgumentError, "request must be provided" if request.nil?
428
+
429
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Run::V2::UpdateServiceRequest
430
+
431
+ # Converts hash and nil to an options object
432
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
433
+
434
+ # Customize the options with defaults
435
+ call_metadata = @config.rpcs.update_service.metadata.to_h
436
+
437
+ # Set x-goog-api-client and x-goog-user-project headers
438
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
439
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
440
+ gapic_version: ::Google::Cloud::Run::V2::VERSION,
441
+ transports_version_send: [:rest]
442
+
443
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
444
+
445
+ options.apply_defaults timeout: @config.rpcs.update_service.timeout,
446
+ metadata: call_metadata,
447
+ retry_policy: @config.rpcs.update_service.retry_policy
448
+
449
+ options.apply_defaults timeout: @config.timeout,
450
+ metadata: @config.metadata,
451
+ retry_policy: @config.retry_policy
452
+
453
+ @services_stub.update_service request, options do |result, operation|
454
+ result = ::Gapic::Operation.new result, @operations_client, options: options
455
+ yield result, operation if block_given?
456
+ return result
457
+ end
458
+ rescue ::Gapic::Rest::Error => e
459
+ raise ::Google::Cloud::Error.from_error(e)
460
+ end
461
+
462
+ ##
463
+ # Deletes a Service.
464
+ # This will cause the Service to stop serving traffic and will delete all
465
+ # revisions.
466
+ #
467
+ # @overload delete_service(request, options = nil)
468
+ # Pass arguments to `delete_service` via a request object, either of type
469
+ # {::Google::Cloud::Run::V2::DeleteServiceRequest} or an equivalent Hash.
470
+ #
471
+ # @param request [::Google::Cloud::Run::V2::DeleteServiceRequest, ::Hash]
472
+ # A request object representing the call parameters. Required. To specify no
473
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
474
+ # @param options [::Gapic::CallOptions, ::Hash]
475
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
476
+ #
477
+ # @overload delete_service(name: nil, validate_only: nil, etag: nil)
478
+ # Pass arguments to `delete_service` via keyword arguments. Note that at
479
+ # least one keyword argument is required. To specify no parameters, or to keep all
480
+ # the default parameter values, pass an empty Hash as a request object (see above).
481
+ #
482
+ # @param name [::String]
483
+ # Required. The full name of the Service.
484
+ # Format: projects/\\{project}/locations/\\{location}/services/\\{service}, where
485
+ # \\{project} can be project id or number.
486
+ # @param validate_only [::Boolean]
487
+ # Indicates that the request should be validated without actually
488
+ # deleting any resources.
489
+ # @param etag [::String]
490
+ # A system-generated fingerprint for this version of the
491
+ # resource. May be used to detect modification conflict during updates.
492
+ # @yield [result, operation] Access the result along with the TransportOperation object
493
+ # @yieldparam result [::Gapic::Operation]
494
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
495
+ #
496
+ # @return [::Gapic::Operation]
497
+ #
498
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
499
+ def delete_service request, options = nil
500
+ raise ::ArgumentError, "request must be provided" if request.nil?
501
+
502
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Run::V2::DeleteServiceRequest
503
+
504
+ # Converts hash and nil to an options object
505
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
506
+
507
+ # Customize the options with defaults
508
+ call_metadata = @config.rpcs.delete_service.metadata.to_h
509
+
510
+ # Set x-goog-api-client and x-goog-user-project headers
511
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
512
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
513
+ gapic_version: ::Google::Cloud::Run::V2::VERSION,
514
+ transports_version_send: [:rest]
515
+
516
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
517
+
518
+ options.apply_defaults timeout: @config.rpcs.delete_service.timeout,
519
+ metadata: call_metadata,
520
+ retry_policy: @config.rpcs.delete_service.retry_policy
521
+
522
+ options.apply_defaults timeout: @config.timeout,
523
+ metadata: @config.metadata,
524
+ retry_policy: @config.retry_policy
525
+
526
+ @services_stub.delete_service request, options do |result, operation|
527
+ result = ::Gapic::Operation.new result, @operations_client, options: options
528
+ yield result, operation if block_given?
529
+ return result
530
+ end
531
+ rescue ::Gapic::Rest::Error => e
532
+ raise ::Google::Cloud::Error.from_error(e)
533
+ end
534
+
535
+ ##
536
+ # Gets the IAM Access Control policy currently in effect for the given
537
+ # Cloud Run Service. This result does not include any inherited policies.
538
+ #
539
+ # @overload get_iam_policy(request, options = nil)
540
+ # Pass arguments to `get_iam_policy` via a request object, either of type
541
+ # {::Google::Iam::V1::GetIamPolicyRequest} or an equivalent Hash.
542
+ #
543
+ # @param request [::Google::Iam::V1::GetIamPolicyRequest, ::Hash]
544
+ # A request object representing the call parameters. Required. To specify no
545
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
546
+ # @param options [::Gapic::CallOptions, ::Hash]
547
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
548
+ #
549
+ # @overload get_iam_policy(resource: nil, options: nil)
550
+ # Pass arguments to `get_iam_policy` via keyword arguments. Note that at
551
+ # least one keyword argument is required. To specify no parameters, or to keep all
552
+ # the default parameter values, pass an empty Hash as a request object (see above).
553
+ #
554
+ # @param resource [::String]
555
+ # REQUIRED: The resource for which the policy is being requested.
556
+ # See the operation documentation for the appropriate value for this field.
557
+ # @param options [::Google::Iam::V1::GetPolicyOptions, ::Hash]
558
+ # OPTIONAL: A `GetPolicyOptions` object for specifying options to
559
+ # `GetIamPolicy`.
560
+ # @yield [result, operation] Access the result along with the TransportOperation object
561
+ # @yieldparam result [::Google::Iam::V1::Policy]
562
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
563
+ #
564
+ # @return [::Google::Iam::V1::Policy]
565
+ #
566
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
567
+ def get_iam_policy request, options = nil
568
+ raise ::ArgumentError, "request must be provided" if request.nil?
569
+
570
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Iam::V1::GetIamPolicyRequest
571
+
572
+ # Converts hash and nil to an options object
573
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
574
+
575
+ # Customize the options with defaults
576
+ call_metadata = @config.rpcs.get_iam_policy.metadata.to_h
577
+
578
+ # Set x-goog-api-client and x-goog-user-project headers
579
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
580
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
581
+ gapic_version: ::Google::Cloud::Run::V2::VERSION,
582
+ transports_version_send: [:rest]
583
+
584
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
585
+
586
+ options.apply_defaults timeout: @config.rpcs.get_iam_policy.timeout,
587
+ metadata: call_metadata,
588
+ retry_policy: @config.rpcs.get_iam_policy.retry_policy
589
+
590
+ options.apply_defaults timeout: @config.timeout,
591
+ metadata: @config.metadata,
592
+ retry_policy: @config.retry_policy
593
+
594
+ @services_stub.get_iam_policy request, options do |result, operation|
595
+ yield result, operation if block_given?
596
+ return result
597
+ end
598
+ rescue ::Gapic::Rest::Error => e
599
+ raise ::Google::Cloud::Error.from_error(e)
600
+ end
601
+
602
+ ##
603
+ # Sets the IAM Access control policy for the specified Service. Overwrites
604
+ # any existing policy.
605
+ #
606
+ # @overload set_iam_policy(request, options = nil)
607
+ # Pass arguments to `set_iam_policy` via a request object, either of type
608
+ # {::Google::Iam::V1::SetIamPolicyRequest} or an equivalent Hash.
609
+ #
610
+ # @param request [::Google::Iam::V1::SetIamPolicyRequest, ::Hash]
611
+ # A request object representing the call parameters. Required. To specify no
612
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
613
+ # @param options [::Gapic::CallOptions, ::Hash]
614
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
615
+ #
616
+ # @overload set_iam_policy(resource: nil, policy: nil, update_mask: nil)
617
+ # Pass arguments to `set_iam_policy` via keyword arguments. Note that at
618
+ # least one keyword argument is required. To specify no parameters, or to keep all
619
+ # the default parameter values, pass an empty Hash as a request object (see above).
620
+ #
621
+ # @param resource [::String]
622
+ # REQUIRED: The resource for which the policy is being specified.
623
+ # See the operation documentation for the appropriate value for this field.
624
+ # @param policy [::Google::Iam::V1::Policy, ::Hash]
625
+ # REQUIRED: The complete policy to be applied to the `resource`. The size of
626
+ # the policy is limited to a few 10s of KB. An empty policy is a
627
+ # valid policy but certain Cloud Platform services (such as Projects)
628
+ # might reject them.
629
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
630
+ # OPTIONAL: A FieldMask specifying which fields of the policy to modify. Only
631
+ # the fields in the mask will be modified. If no mask is provided, the
632
+ # following default mask is used:
633
+ #
634
+ # `paths: "bindings, etag"`
635
+ # @yield [result, operation] Access the result along with the TransportOperation object
636
+ # @yieldparam result [::Google::Iam::V1::Policy]
637
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
638
+ #
639
+ # @return [::Google::Iam::V1::Policy]
640
+ #
641
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
642
+ def set_iam_policy request, options = nil
643
+ raise ::ArgumentError, "request must be provided" if request.nil?
644
+
645
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Iam::V1::SetIamPolicyRequest
646
+
647
+ # Converts hash and nil to an options object
648
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
649
+
650
+ # Customize the options with defaults
651
+ call_metadata = @config.rpcs.set_iam_policy.metadata.to_h
652
+
653
+ # Set x-goog-api-client and x-goog-user-project headers
654
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
655
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
656
+ gapic_version: ::Google::Cloud::Run::V2::VERSION,
657
+ transports_version_send: [:rest]
658
+
659
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
660
+
661
+ options.apply_defaults timeout: @config.rpcs.set_iam_policy.timeout,
662
+ metadata: call_metadata,
663
+ retry_policy: @config.rpcs.set_iam_policy.retry_policy
664
+
665
+ options.apply_defaults timeout: @config.timeout,
666
+ metadata: @config.metadata,
667
+ retry_policy: @config.retry_policy
668
+
669
+ @services_stub.set_iam_policy request, options do |result, operation|
670
+ yield result, operation if block_given?
671
+ return result
672
+ end
673
+ rescue ::Gapic::Rest::Error => e
674
+ raise ::Google::Cloud::Error.from_error(e)
675
+ end
676
+
677
+ ##
678
+ # Returns permissions that a caller has on the specified Project.
679
+ #
680
+ # There are no permissions required for making this API call.
681
+ #
682
+ # @overload test_iam_permissions(request, options = nil)
683
+ # Pass arguments to `test_iam_permissions` via a request object, either of type
684
+ # {::Google::Iam::V1::TestIamPermissionsRequest} or an equivalent Hash.
685
+ #
686
+ # @param request [::Google::Iam::V1::TestIamPermissionsRequest, ::Hash]
687
+ # A request object representing the call parameters. Required. To specify no
688
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
689
+ # @param options [::Gapic::CallOptions, ::Hash]
690
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
691
+ #
692
+ # @overload test_iam_permissions(resource: nil, permissions: nil)
693
+ # Pass arguments to `test_iam_permissions` via keyword arguments. Note that at
694
+ # least one keyword argument is required. To specify no parameters, or to keep all
695
+ # the default parameter values, pass an empty Hash as a request object (see above).
696
+ #
697
+ # @param resource [::String]
698
+ # REQUIRED: The resource for which the policy detail is being requested.
699
+ # See the operation documentation for the appropriate value for this field.
700
+ # @param permissions [::Array<::String>]
701
+ # The set of permissions to check for the `resource`. Permissions with
702
+ # wildcards (such as '*' or 'storage.*') are not allowed. For more
703
+ # information see
704
+ # [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions).
705
+ # @yield [result, operation] Access the result along with the TransportOperation object
706
+ # @yieldparam result [::Google::Iam::V1::TestIamPermissionsResponse]
707
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
708
+ #
709
+ # @return [::Google::Iam::V1::TestIamPermissionsResponse]
710
+ #
711
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
712
+ def test_iam_permissions request, options = nil
713
+ raise ::ArgumentError, "request must be provided" if request.nil?
714
+
715
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Iam::V1::TestIamPermissionsRequest
716
+
717
+ # Converts hash and nil to an options object
718
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
719
+
720
+ # Customize the options with defaults
721
+ call_metadata = @config.rpcs.test_iam_permissions.metadata.to_h
722
+
723
+ # Set x-goog-api-client and x-goog-user-project headers
724
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
725
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
726
+ gapic_version: ::Google::Cloud::Run::V2::VERSION,
727
+ transports_version_send: [:rest]
728
+
729
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
730
+
731
+ options.apply_defaults timeout: @config.rpcs.test_iam_permissions.timeout,
732
+ metadata: call_metadata,
733
+ retry_policy: @config.rpcs.test_iam_permissions.retry_policy
734
+
735
+ options.apply_defaults timeout: @config.timeout,
736
+ metadata: @config.metadata,
737
+ retry_policy: @config.retry_policy
738
+
739
+ @services_stub.test_iam_permissions request, options do |result, operation|
740
+ yield result, operation if block_given?
741
+ return result
742
+ end
743
+ rescue ::Gapic::Rest::Error => e
744
+ raise ::Google::Cloud::Error.from_error(e)
745
+ end
746
+
747
+ ##
748
+ # Configuration class for the Services REST API.
749
+ #
750
+ # This class represents the configuration for Services REST,
751
+ # providing control over timeouts, retry behavior, logging, transport
752
+ # parameters, and other low-level controls. Certain parameters can also be
753
+ # applied individually to specific RPCs. See
754
+ # {::Google::Cloud::Run::V2::Services::Rest::Client::Configuration::Rpcs}
755
+ # for a list of RPCs that can be configured independently.
756
+ #
757
+ # Configuration can be applied globally to all clients, or to a single client
758
+ # on construction.
759
+ #
760
+ # @example
761
+ #
762
+ # # Modify the global config, setting the timeout for
763
+ # # create_service to 20 seconds,
764
+ # # and all remaining timeouts to 10 seconds.
765
+ # ::Google::Cloud::Run::V2::Services::Rest::Client.configure do |config|
766
+ # config.timeout = 10.0
767
+ # config.rpcs.create_service.timeout = 20.0
768
+ # end
769
+ #
770
+ # # Apply the above configuration only to a new client.
771
+ # client = ::Google::Cloud::Run::V2::Services::Rest::Client.new do |config|
772
+ # config.timeout = 10.0
773
+ # config.rpcs.create_service.timeout = 20.0
774
+ # end
775
+ #
776
+ # @!attribute [rw] endpoint
777
+ # The hostname or hostname:port of the service endpoint.
778
+ # Defaults to `"run.googleapis.com"`.
779
+ # @return [::String]
780
+ # @!attribute [rw] credentials
781
+ # Credentials to send with calls. You may provide any of the following types:
782
+ # * (`String`) The path to a service account key file in JSON format
783
+ # * (`Hash`) A service account key as a Hash
784
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
785
+ # (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
786
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
787
+ # (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
788
+ # * (`nil`) indicating no credentials
789
+ # @return [::Object]
790
+ # @!attribute [rw] scope
791
+ # The OAuth scopes
792
+ # @return [::Array<::String>]
793
+ # @!attribute [rw] lib_name
794
+ # The library name as recorded in instrumentation and logging
795
+ # @return [::String]
796
+ # @!attribute [rw] lib_version
797
+ # The library version as recorded in instrumentation and logging
798
+ # @return [::String]
799
+ # @!attribute [rw] timeout
800
+ # The call timeout in seconds.
801
+ # @return [::Numeric]
802
+ # @!attribute [rw] metadata
803
+ # Additional headers to be sent with the call.
804
+ # @return [::Hash{::Symbol=>::String}]
805
+ # @!attribute [rw] retry_policy
806
+ # The retry policy. The value is a hash with the following keys:
807
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
808
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
809
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
810
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
811
+ # trigger a retry.
812
+ # @return [::Hash]
813
+ # @!attribute [rw] quota_project
814
+ # A separate project against which to charge quota.
815
+ # @return [::String]
816
+ #
817
+ class Configuration
818
+ extend ::Gapic::Config
819
+
820
+ config_attr :endpoint, "run.googleapis.com", ::String
821
+ config_attr :credentials, nil do |value|
822
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
823
+ allowed.any? { |klass| klass === value }
824
+ end
825
+ config_attr :scope, nil, ::String, ::Array, nil
826
+ config_attr :lib_name, nil, ::String, nil
827
+ config_attr :lib_version, nil, ::String, nil
828
+ config_attr :timeout, nil, ::Numeric, nil
829
+ config_attr :metadata, nil, ::Hash, nil
830
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
831
+ config_attr :quota_project, nil, ::String, nil
832
+
833
+ # @private
834
+ def initialize parent_config = nil
835
+ @parent_config = parent_config unless parent_config.nil?
836
+
837
+ yield self if block_given?
838
+ end
839
+
840
+ ##
841
+ # Configurations for individual RPCs
842
+ # @return [Rpcs]
843
+ #
844
+ def rpcs
845
+ @rpcs ||= begin
846
+ parent_rpcs = nil
847
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
848
+ Rpcs.new parent_rpcs
849
+ end
850
+ end
851
+
852
+ ##
853
+ # Configuration RPC class for the Services API.
854
+ #
855
+ # Includes fields providing the configuration for each RPC in this service.
856
+ # Each configuration object is of type `Gapic::Config::Method` and includes
857
+ # the following configuration fields:
858
+ #
859
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
860
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
861
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
862
+ # include the following keys:
863
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
864
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
865
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
866
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
867
+ # trigger a retry.
868
+ #
869
+ class Rpcs
870
+ ##
871
+ # RPC-specific configuration for `create_service`
872
+ # @return [::Gapic::Config::Method]
873
+ #
874
+ attr_reader :create_service
875
+ ##
876
+ # RPC-specific configuration for `get_service`
877
+ # @return [::Gapic::Config::Method]
878
+ #
879
+ attr_reader :get_service
880
+ ##
881
+ # RPC-specific configuration for `list_services`
882
+ # @return [::Gapic::Config::Method]
883
+ #
884
+ attr_reader :list_services
885
+ ##
886
+ # RPC-specific configuration for `update_service`
887
+ # @return [::Gapic::Config::Method]
888
+ #
889
+ attr_reader :update_service
890
+ ##
891
+ # RPC-specific configuration for `delete_service`
892
+ # @return [::Gapic::Config::Method]
893
+ #
894
+ attr_reader :delete_service
895
+ ##
896
+ # RPC-specific configuration for `get_iam_policy`
897
+ # @return [::Gapic::Config::Method]
898
+ #
899
+ attr_reader :get_iam_policy
900
+ ##
901
+ # RPC-specific configuration for `set_iam_policy`
902
+ # @return [::Gapic::Config::Method]
903
+ #
904
+ attr_reader :set_iam_policy
905
+ ##
906
+ # RPC-specific configuration for `test_iam_permissions`
907
+ # @return [::Gapic::Config::Method]
908
+ #
909
+ attr_reader :test_iam_permissions
910
+
911
+ # @private
912
+ def initialize parent_rpcs = nil
913
+ create_service_config = parent_rpcs.create_service if parent_rpcs.respond_to? :create_service
914
+ @create_service = ::Gapic::Config::Method.new create_service_config
915
+ get_service_config = parent_rpcs.get_service if parent_rpcs.respond_to? :get_service
916
+ @get_service = ::Gapic::Config::Method.new get_service_config
917
+ list_services_config = parent_rpcs.list_services if parent_rpcs.respond_to? :list_services
918
+ @list_services = ::Gapic::Config::Method.new list_services_config
919
+ update_service_config = parent_rpcs.update_service if parent_rpcs.respond_to? :update_service
920
+ @update_service = ::Gapic::Config::Method.new update_service_config
921
+ delete_service_config = parent_rpcs.delete_service if parent_rpcs.respond_to? :delete_service
922
+ @delete_service = ::Gapic::Config::Method.new delete_service_config
923
+ get_iam_policy_config = parent_rpcs.get_iam_policy if parent_rpcs.respond_to? :get_iam_policy
924
+ @get_iam_policy = ::Gapic::Config::Method.new get_iam_policy_config
925
+ set_iam_policy_config = parent_rpcs.set_iam_policy if parent_rpcs.respond_to? :set_iam_policy
926
+ @set_iam_policy = ::Gapic::Config::Method.new set_iam_policy_config
927
+ test_iam_permissions_config = parent_rpcs.test_iam_permissions if parent_rpcs.respond_to? :test_iam_permissions
928
+ @test_iam_permissions = ::Gapic::Config::Method.new test_iam_permissions_config
929
+
930
+ yield self if block_given?
931
+ end
932
+ end
933
+ end
934
+ end
935
+ end
936
+ end
937
+ end
938
+ end
939
+ end
940
+ end