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