google-cloud-dataproc-v1 0.16.0 → 0.17.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 (36) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/lib/google/cloud/dataproc/v1/autoscaling_policy_service/rest/client.rb +711 -0
  4. data/lib/google/cloud/dataproc/v1/autoscaling_policy_service/rest/service_stub.rb +382 -0
  5. data/lib/google/cloud/dataproc/v1/autoscaling_policy_service/rest.rb +54 -0
  6. data/lib/google/cloud/dataproc/v1/autoscaling_policy_service.rb +6 -0
  7. data/lib/google/cloud/dataproc/v1/batch_controller/rest/client.rb +640 -0
  8. data/lib/google/cloud/dataproc/v1/batch_controller/rest/operations.rb +820 -0
  9. data/lib/google/cloud/dataproc/v1/batch_controller/rest/service_stub.rb +285 -0
  10. data/lib/google/cloud/dataproc/v1/batch_controller/rest.rb +54 -0
  11. data/lib/google/cloud/dataproc/v1/batch_controller.rb +6 -0
  12. data/lib/google/cloud/dataproc/v1/bindings_override.rb +257 -0
  13. data/lib/google/cloud/dataproc/v1/cluster_controller/rest/client.rb +1117 -0
  14. data/lib/google/cloud/dataproc/v1/cluster_controller/rest/operations.rb +820 -0
  15. data/lib/google/cloud/dataproc/v1/cluster_controller/rest/service_stub.rb +539 -0
  16. data/lib/google/cloud/dataproc/v1/cluster_controller/rest.rb +55 -0
  17. data/lib/google/cloud/dataproc/v1/cluster_controller.rb +6 -0
  18. data/lib/google/cloud/dataproc/v1/job_controller/rest/client.rb +929 -0
  19. data/lib/google/cloud/dataproc/v1/job_controller/rest/operations.rb +820 -0
  20. data/lib/google/cloud/dataproc/v1/job_controller/rest/service_stub.rb +476 -0
  21. data/lib/google/cloud/dataproc/v1/job_controller/rest.rb +53 -0
  22. data/lib/google/cloud/dataproc/v1/job_controller.rb +6 -0
  23. data/lib/google/cloud/dataproc/v1/node_group_controller/rest/client.rb +581 -0
  24. data/lib/google/cloud/dataproc/v1/node_group_controller/rest/operations.rb +820 -0
  25. data/lib/google/cloud/dataproc/v1/node_group_controller/rest/service_stub.rb +227 -0
  26. data/lib/google/cloud/dataproc/v1/node_group_controller/rest.rb +55 -0
  27. data/lib/google/cloud/dataproc/v1/node_group_controller.rb +6 -0
  28. data/lib/google/cloud/dataproc/v1/rest.rb +43 -0
  29. data/lib/google/cloud/dataproc/v1/version.rb +1 -1
  30. data/lib/google/cloud/dataproc/v1/workflow_template_service/rest/client.rb +983 -0
  31. data/lib/google/cloud/dataproc/v1/workflow_template_service/rest/operations.rb +820 -0
  32. data/lib/google/cloud/dataproc/v1/workflow_template_service/rest/service_stub.rb +518 -0
  33. data/lib/google/cloud/dataproc/v1/workflow_template_service/rest.rb +55 -0
  34. data/lib/google/cloud/dataproc/v1/workflow_template_service.rb +6 -0
  35. data/lib/google/cloud/dataproc/v1.rb +5 -0
  36. metadata +30 -5
@@ -0,0 +1,929 @@
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/dataproc/v1/jobs_pb"
21
+ require "google/cloud/dataproc/v1/job_controller/rest/service_stub"
22
+ require "google/iam/v1/rest"
23
+
24
+ module Google
25
+ module Cloud
26
+ module Dataproc
27
+ module V1
28
+ module JobController
29
+ module Rest
30
+ ##
31
+ # REST client for the JobController service.
32
+ #
33
+ # The JobController provides methods to manage jobs.
34
+ #
35
+ class Client
36
+ # @private
37
+ attr_reader :job_controller_stub
38
+
39
+ ##
40
+ # Configure the JobController Client class.
41
+ #
42
+ # See {::Google::Cloud::Dataproc::V1::JobController::Rest::Client::Configuration}
43
+ # for a description of the configuration fields.
44
+ #
45
+ # @example
46
+ #
47
+ # # Modify the configuration for all JobController clients
48
+ # ::Google::Cloud::Dataproc::V1::JobController::Rest::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", "Dataproc", "V1"]
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.rpcs.submit_job.timeout = 900.0
69
+ default_config.rpcs.submit_job.retry_policy = {
70
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14]
71
+ }
72
+
73
+ default_config.rpcs.submit_job_as_operation.timeout = 900.0
74
+ default_config.rpcs.submit_job_as_operation.retry_policy = {
75
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14]
76
+ }
77
+
78
+ default_config.rpcs.get_job.timeout = 900.0
79
+ default_config.rpcs.get_job.retry_policy = {
80
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 13, 14]
81
+ }
82
+
83
+ default_config.rpcs.list_jobs.timeout = 900.0
84
+ default_config.rpcs.list_jobs.retry_policy = {
85
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 13, 14]
86
+ }
87
+
88
+ default_config.rpcs.update_job.timeout = 900.0
89
+ default_config.rpcs.update_job.retry_policy = {
90
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14]
91
+ }
92
+
93
+ default_config.rpcs.cancel_job.timeout = 900.0
94
+ default_config.rpcs.cancel_job.retry_policy = {
95
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 13, 14]
96
+ }
97
+
98
+ default_config.rpcs.delete_job.timeout = 900.0
99
+ default_config.rpcs.delete_job.retry_policy = {
100
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14]
101
+ }
102
+
103
+ default_config
104
+ end
105
+ yield @configure if block_given?
106
+ @configure
107
+ end
108
+
109
+ ##
110
+ # Configure the JobController Client instance.
111
+ #
112
+ # The configuration is set to the derived mode, meaning that values can be changed,
113
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
114
+ # should be made on {Client.configure}.
115
+ #
116
+ # See {::Google::Cloud::Dataproc::V1::JobController::Rest::Client::Configuration}
117
+ # for a description of the configuration fields.
118
+ #
119
+ # @yield [config] Configure the Client client.
120
+ # @yieldparam config [Client::Configuration]
121
+ #
122
+ # @return [Client::Configuration]
123
+ #
124
+ def configure
125
+ yield @config if block_given?
126
+ @config
127
+ end
128
+
129
+ ##
130
+ # Create a new JobController REST client object.
131
+ #
132
+ # @example
133
+ #
134
+ # # Create a client using the default configuration
135
+ # client = ::Google::Cloud::Dataproc::V1::JobController::Rest::Client.new
136
+ #
137
+ # # Create a client using a custom configuration
138
+ # client = ::Google::Cloud::Dataproc::V1::JobController::Rest::Client.new do |config|
139
+ # config.timeout = 10.0
140
+ # end
141
+ #
142
+ # @yield [config] Configure the JobController client.
143
+ # @yieldparam config [Client::Configuration]
144
+ #
145
+ def initialize
146
+ # Create the configuration object
147
+ @config = Configuration.new Client.configure
148
+
149
+ # Yield the configuration if needed
150
+ yield @config if block_given?
151
+
152
+ # Create credentials
153
+ credentials = @config.credentials
154
+ # Use self-signed JWT if the endpoint is unchanged from default,
155
+ # but only if the default endpoint does not have a region prefix.
156
+ enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
157
+ !@config.endpoint.split(".").first.include?("-")
158
+ credentials ||= Credentials.default scope: @config.scope,
159
+ enable_self_signed_jwt: enable_self_signed_jwt
160
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
161
+ credentials = Credentials.new credentials, scope: @config.scope
162
+ end
163
+
164
+ @quota_project_id = @config.quota_project
165
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
166
+
167
+ @operations_client = ::Google::Cloud::Dataproc::V1::JobController::Rest::Operations.new do |config|
168
+ config.credentials = credentials
169
+ config.quota_project = @quota_project_id
170
+ config.endpoint = @config.endpoint
171
+ end
172
+
173
+ @iam_policy_client = Google::Iam::V1::IAMPolicy::Rest::Client.new do |config|
174
+ config.credentials = credentials
175
+ config.quota_project = @quota_project_id
176
+ config.endpoint = @config.endpoint
177
+ config.bindings_override = @config.bindings_override
178
+ end
179
+
180
+ @job_controller_stub = ::Google::Cloud::Dataproc::V1::JobController::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials
181
+ end
182
+
183
+ ##
184
+ # Get the associated client for long-running operations.
185
+ #
186
+ # @return [::Google::Cloud::Dataproc::V1::JobController::Rest::Operations]
187
+ #
188
+ attr_reader :operations_client
189
+
190
+ ##
191
+ # Get the associated client for mix-in of the IAMPolicy.
192
+ #
193
+ # @return [Google::Iam::V1::IAMPolicy::Rest::Client]
194
+ #
195
+ attr_reader :iam_policy_client
196
+
197
+ # Service calls
198
+
199
+ ##
200
+ # Submits a job to a cluster.
201
+ #
202
+ # @overload submit_job(request, options = nil)
203
+ # Pass arguments to `submit_job` via a request object, either of type
204
+ # {::Google::Cloud::Dataproc::V1::SubmitJobRequest} or an equivalent Hash.
205
+ #
206
+ # @param request [::Google::Cloud::Dataproc::V1::SubmitJobRequest, ::Hash]
207
+ # A request object representing the call parameters. Required. To specify no
208
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
209
+ # @param options [::Gapic::CallOptions, ::Hash]
210
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
211
+ #
212
+ # @overload submit_job(project_id: nil, region: nil, job: nil, request_id: nil)
213
+ # Pass arguments to `submit_job` via keyword arguments. Note that at
214
+ # least one keyword argument is required. To specify no parameters, or to keep all
215
+ # the default parameter values, pass an empty Hash as a request object (see above).
216
+ #
217
+ # @param project_id [::String]
218
+ # Required. The ID of the Google Cloud Platform project that the job
219
+ # belongs to.
220
+ # @param region [::String]
221
+ # Required. The Dataproc region in which to handle the request.
222
+ # @param job [::Google::Cloud::Dataproc::V1::Job, ::Hash]
223
+ # Required. The job resource.
224
+ # @param request_id [::String]
225
+ # Optional. A unique id used to identify the request. If the server
226
+ # receives two
227
+ # [SubmitJobRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.SubmitJobRequest)s
228
+ # with the same id, then the second request will be ignored and the
229
+ # first {::Google::Cloud::Dataproc::V1::Job Job} created and stored in the backend
230
+ # is returned.
231
+ #
232
+ # It is recommended to always set this value to a
233
+ # [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier).
234
+ #
235
+ # The id must contain only letters (a-z, A-Z), numbers (0-9),
236
+ # underscores (_), and hyphens (-). The maximum length is 40 characters.
237
+ # @yield [result, operation] Access the result along with the TransportOperation object
238
+ # @yieldparam result [::Google::Cloud::Dataproc::V1::Job]
239
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
240
+ #
241
+ # @return [::Google::Cloud::Dataproc::V1::Job]
242
+ #
243
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
244
+ def submit_job request, options = nil
245
+ raise ::ArgumentError, "request must be provided" if request.nil?
246
+
247
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dataproc::V1::SubmitJobRequest
248
+
249
+ # Converts hash and nil to an options object
250
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
251
+
252
+ # Customize the options with defaults
253
+ call_metadata = @config.rpcs.submit_job.metadata.to_h
254
+
255
+ # Set x-goog-api-client and x-goog-user-project headers
256
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
257
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
258
+ gapic_version: ::Google::Cloud::Dataproc::V1::VERSION,
259
+ transports_version_send: [:rest]
260
+
261
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
262
+
263
+ options.apply_defaults timeout: @config.rpcs.submit_job.timeout,
264
+ metadata: call_metadata,
265
+ retry_policy: @config.rpcs.submit_job.retry_policy
266
+
267
+ options.apply_defaults timeout: @config.timeout,
268
+ metadata: @config.metadata,
269
+ retry_policy: @config.retry_policy
270
+
271
+ @job_controller_stub.submit_job request, options do |result, operation|
272
+ yield result, operation if block_given?
273
+ return result
274
+ end
275
+ rescue ::Gapic::Rest::Error => e
276
+ raise ::Google::Cloud::Error.from_error(e)
277
+ end
278
+
279
+ ##
280
+ # Submits job to a cluster.
281
+ #
282
+ # @overload submit_job_as_operation(request, options = nil)
283
+ # Pass arguments to `submit_job_as_operation` via a request object, either of type
284
+ # {::Google::Cloud::Dataproc::V1::SubmitJobRequest} or an equivalent Hash.
285
+ #
286
+ # @param request [::Google::Cloud::Dataproc::V1::SubmitJobRequest, ::Hash]
287
+ # A request object representing the call parameters. Required. To specify no
288
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
289
+ # @param options [::Gapic::CallOptions, ::Hash]
290
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
291
+ #
292
+ # @overload submit_job_as_operation(project_id: nil, region: nil, job: nil, request_id: nil)
293
+ # Pass arguments to `submit_job_as_operation` via keyword arguments. Note that at
294
+ # least one keyword argument is required. To specify no parameters, or to keep all
295
+ # the default parameter values, pass an empty Hash as a request object (see above).
296
+ #
297
+ # @param project_id [::String]
298
+ # Required. The ID of the Google Cloud Platform project that the job
299
+ # belongs to.
300
+ # @param region [::String]
301
+ # Required. The Dataproc region in which to handle the request.
302
+ # @param job [::Google::Cloud::Dataproc::V1::Job, ::Hash]
303
+ # Required. The job resource.
304
+ # @param request_id [::String]
305
+ # Optional. A unique id used to identify the request. If the server
306
+ # receives two
307
+ # [SubmitJobRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.SubmitJobRequest)s
308
+ # with the same id, then the second request will be ignored and the
309
+ # first {::Google::Cloud::Dataproc::V1::Job Job} created and stored in the backend
310
+ # is returned.
311
+ #
312
+ # It is recommended to always set this value to a
313
+ # [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier).
314
+ #
315
+ # The id must contain only letters (a-z, A-Z), numbers (0-9),
316
+ # underscores (_), and hyphens (-). The maximum length is 40 characters.
317
+ # @yield [result, operation] Access the result along with the TransportOperation object
318
+ # @yieldparam result [::Gapic::Operation]
319
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
320
+ #
321
+ # @return [::Gapic::Operation]
322
+ #
323
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
324
+ def submit_job_as_operation request, options = nil
325
+ raise ::ArgumentError, "request must be provided" if request.nil?
326
+
327
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dataproc::V1::SubmitJobRequest
328
+
329
+ # Converts hash and nil to an options object
330
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
331
+
332
+ # Customize the options with defaults
333
+ call_metadata = @config.rpcs.submit_job_as_operation.metadata.to_h
334
+
335
+ # Set x-goog-api-client and x-goog-user-project headers
336
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
337
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
338
+ gapic_version: ::Google::Cloud::Dataproc::V1::VERSION,
339
+ transports_version_send: [:rest]
340
+
341
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
342
+
343
+ options.apply_defaults timeout: @config.rpcs.submit_job_as_operation.timeout,
344
+ metadata: call_metadata,
345
+ retry_policy: @config.rpcs.submit_job_as_operation.retry_policy
346
+
347
+ options.apply_defaults timeout: @config.timeout,
348
+ metadata: @config.metadata,
349
+ retry_policy: @config.retry_policy
350
+
351
+ @job_controller_stub.submit_job_as_operation request, options do |result, operation|
352
+ result = ::Gapic::Operation.new result, @operations_client, options: options
353
+ yield result, operation if block_given?
354
+ return result
355
+ end
356
+ rescue ::Gapic::Rest::Error => e
357
+ raise ::Google::Cloud::Error.from_error(e)
358
+ end
359
+
360
+ ##
361
+ # Gets the resource representation for a job in a project.
362
+ #
363
+ # @overload get_job(request, options = nil)
364
+ # Pass arguments to `get_job` via a request object, either of type
365
+ # {::Google::Cloud::Dataproc::V1::GetJobRequest} or an equivalent Hash.
366
+ #
367
+ # @param request [::Google::Cloud::Dataproc::V1::GetJobRequest, ::Hash]
368
+ # A request object representing the call parameters. Required. To specify no
369
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
370
+ # @param options [::Gapic::CallOptions, ::Hash]
371
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
372
+ #
373
+ # @overload get_job(project_id: nil, region: nil, job_id: nil)
374
+ # Pass arguments to `get_job` via keyword arguments. Note that at
375
+ # least one keyword argument is required. To specify no parameters, or to keep all
376
+ # the default parameter values, pass an empty Hash as a request object (see above).
377
+ #
378
+ # @param project_id [::String]
379
+ # Required. The ID of the Google Cloud Platform project that the job
380
+ # belongs to.
381
+ # @param region [::String]
382
+ # Required. The Dataproc region in which to handle the request.
383
+ # @param job_id [::String]
384
+ # Required. The job ID.
385
+ # @yield [result, operation] Access the result along with the TransportOperation object
386
+ # @yieldparam result [::Google::Cloud::Dataproc::V1::Job]
387
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
388
+ #
389
+ # @return [::Google::Cloud::Dataproc::V1::Job]
390
+ #
391
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
392
+ def get_job request, options = nil
393
+ raise ::ArgumentError, "request must be provided" if request.nil?
394
+
395
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dataproc::V1::GetJobRequest
396
+
397
+ # Converts hash and nil to an options object
398
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
399
+
400
+ # Customize the options with defaults
401
+ call_metadata = @config.rpcs.get_job.metadata.to_h
402
+
403
+ # Set x-goog-api-client and x-goog-user-project headers
404
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
405
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
406
+ gapic_version: ::Google::Cloud::Dataproc::V1::VERSION,
407
+ transports_version_send: [:rest]
408
+
409
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
410
+
411
+ options.apply_defaults timeout: @config.rpcs.get_job.timeout,
412
+ metadata: call_metadata,
413
+ retry_policy: @config.rpcs.get_job.retry_policy
414
+
415
+ options.apply_defaults timeout: @config.timeout,
416
+ metadata: @config.metadata,
417
+ retry_policy: @config.retry_policy
418
+
419
+ @job_controller_stub.get_job request, options do |result, operation|
420
+ yield result, operation if block_given?
421
+ return result
422
+ end
423
+ rescue ::Gapic::Rest::Error => e
424
+ raise ::Google::Cloud::Error.from_error(e)
425
+ end
426
+
427
+ ##
428
+ # Lists regions/\\{region}/jobs in a project.
429
+ #
430
+ # @overload list_jobs(request, options = nil)
431
+ # Pass arguments to `list_jobs` via a request object, either of type
432
+ # {::Google::Cloud::Dataproc::V1::ListJobsRequest} or an equivalent Hash.
433
+ #
434
+ # @param request [::Google::Cloud::Dataproc::V1::ListJobsRequest, ::Hash]
435
+ # A request object representing the call parameters. Required. To specify no
436
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
437
+ # @param options [::Gapic::CallOptions, ::Hash]
438
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
439
+ #
440
+ # @overload list_jobs(project_id: nil, region: nil, page_size: nil, page_token: nil, cluster_name: nil, job_state_matcher: nil, filter: nil)
441
+ # Pass arguments to `list_jobs` via keyword arguments. Note that at
442
+ # least one keyword argument is required. To specify no parameters, or to keep all
443
+ # the default parameter values, pass an empty Hash as a request object (see above).
444
+ #
445
+ # @param project_id [::String]
446
+ # Required. The ID of the Google Cloud Platform project that the job
447
+ # belongs to.
448
+ # @param region [::String]
449
+ # Required. The Dataproc region in which to handle the request.
450
+ # @param page_size [::Integer]
451
+ # Optional. The number of results to return in each response.
452
+ # @param page_token [::String]
453
+ # Optional. The page token, returned by a previous call, to request the
454
+ # next page of results.
455
+ # @param cluster_name [::String]
456
+ # Optional. If set, the returned jobs list includes only jobs that were
457
+ # submitted to the named cluster.
458
+ # @param job_state_matcher [::Google::Cloud::Dataproc::V1::ListJobsRequest::JobStateMatcher]
459
+ # Optional. Specifies enumerated categories of jobs to list.
460
+ # (default = match ALL jobs).
461
+ #
462
+ # If `filter` is provided, `jobStateMatcher` will be ignored.
463
+ # @param filter [::String]
464
+ # Optional. A filter constraining the jobs to list. Filters are
465
+ # case-sensitive and have the following syntax:
466
+ #
467
+ # [field = value] AND [field [= value]] ...
468
+ #
469
+ # where **field** is `status.state` or `labels.[KEY]`, and `[KEY]` is a label
470
+ # key. **value** can be `*` to match all values.
471
+ # `status.state` can be either `ACTIVE` or `NON_ACTIVE`.
472
+ # Only the logical `AND` operator is supported; space-separated items are
473
+ # treated as having an implicit `AND` operator.
474
+ #
475
+ # Example filter:
476
+ #
477
+ # status.state = ACTIVE AND labels.env = staging AND labels.starred = *
478
+ # @yield [result, operation] Access the result along with the TransportOperation object
479
+ # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Dataproc::V1::Job>]
480
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
481
+ #
482
+ # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Dataproc::V1::Job>]
483
+ #
484
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
485
+ def list_jobs request, options = nil
486
+ raise ::ArgumentError, "request must be provided" if request.nil?
487
+
488
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dataproc::V1::ListJobsRequest
489
+
490
+ # Converts hash and nil to an options object
491
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
492
+
493
+ # Customize the options with defaults
494
+ call_metadata = @config.rpcs.list_jobs.metadata.to_h
495
+
496
+ # Set x-goog-api-client and x-goog-user-project headers
497
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
498
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
499
+ gapic_version: ::Google::Cloud::Dataproc::V1::VERSION,
500
+ transports_version_send: [:rest]
501
+
502
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
503
+
504
+ options.apply_defaults timeout: @config.rpcs.list_jobs.timeout,
505
+ metadata: call_metadata,
506
+ retry_policy: @config.rpcs.list_jobs.retry_policy
507
+
508
+ options.apply_defaults timeout: @config.timeout,
509
+ metadata: @config.metadata,
510
+ retry_policy: @config.retry_policy
511
+
512
+ @job_controller_stub.list_jobs request, options do |result, operation|
513
+ result = ::Gapic::Rest::PagedEnumerable.new @job_controller_stub, :list_jobs, "jobs", request, result, options
514
+ yield result, operation if block_given?
515
+ return result
516
+ end
517
+ rescue ::Gapic::Rest::Error => e
518
+ raise ::Google::Cloud::Error.from_error(e)
519
+ end
520
+
521
+ ##
522
+ # Updates a job in a project.
523
+ #
524
+ # @overload update_job(request, options = nil)
525
+ # Pass arguments to `update_job` via a request object, either of type
526
+ # {::Google::Cloud::Dataproc::V1::UpdateJobRequest} or an equivalent Hash.
527
+ #
528
+ # @param request [::Google::Cloud::Dataproc::V1::UpdateJobRequest, ::Hash]
529
+ # A request object representing the call parameters. Required. To specify no
530
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
531
+ # @param options [::Gapic::CallOptions, ::Hash]
532
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
533
+ #
534
+ # @overload update_job(project_id: nil, region: nil, job_id: nil, job: nil, update_mask: nil)
535
+ # Pass arguments to `update_job` via keyword arguments. Note that at
536
+ # least one keyword argument is required. To specify no parameters, or to keep all
537
+ # the default parameter values, pass an empty Hash as a request object (see above).
538
+ #
539
+ # @param project_id [::String]
540
+ # Required. The ID of the Google Cloud Platform project that the job
541
+ # belongs to.
542
+ # @param region [::String]
543
+ # Required. The Dataproc region in which to handle the request.
544
+ # @param job_id [::String]
545
+ # Required. The job ID.
546
+ # @param job [::Google::Cloud::Dataproc::V1::Job, ::Hash]
547
+ # Required. The changes to the job.
548
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
549
+ # Required. Specifies the path, relative to <code>Job</code>, of
550
+ # the field to update. For example, to update the labels of a Job the
551
+ # <code>update_mask</code> parameter would be specified as
552
+ # <code>labels</code>, and the `PATCH` request body would specify the new
553
+ # value. <strong>Note:</strong> Currently, <code>labels</code> is the only
554
+ # field that can be updated.
555
+ # @yield [result, operation] Access the result along with the TransportOperation object
556
+ # @yieldparam result [::Google::Cloud::Dataproc::V1::Job]
557
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
558
+ #
559
+ # @return [::Google::Cloud::Dataproc::V1::Job]
560
+ #
561
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
562
+ def update_job request, options = nil
563
+ raise ::ArgumentError, "request must be provided" if request.nil?
564
+
565
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dataproc::V1::UpdateJobRequest
566
+
567
+ # Converts hash and nil to an options object
568
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
569
+
570
+ # Customize the options with defaults
571
+ call_metadata = @config.rpcs.update_job.metadata.to_h
572
+
573
+ # Set x-goog-api-client and x-goog-user-project headers
574
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
575
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
576
+ gapic_version: ::Google::Cloud::Dataproc::V1::VERSION,
577
+ transports_version_send: [:rest]
578
+
579
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
580
+
581
+ options.apply_defaults timeout: @config.rpcs.update_job.timeout,
582
+ metadata: call_metadata,
583
+ retry_policy: @config.rpcs.update_job.retry_policy
584
+
585
+ options.apply_defaults timeout: @config.timeout,
586
+ metadata: @config.metadata,
587
+ retry_policy: @config.retry_policy
588
+
589
+ @job_controller_stub.update_job request, options do |result, operation|
590
+ yield result, operation if block_given?
591
+ return result
592
+ end
593
+ rescue ::Gapic::Rest::Error => e
594
+ raise ::Google::Cloud::Error.from_error(e)
595
+ end
596
+
597
+ ##
598
+ # Starts a job cancellation request. To access the job resource
599
+ # after cancellation, call
600
+ # [regions/\\{region}/jobs.list](https://cloud.google.com/dataproc/docs/reference/rest/v1/projects.regions.jobs/list)
601
+ # or
602
+ # [regions/\\{region}/jobs.get](https://cloud.google.com/dataproc/docs/reference/rest/v1/projects.regions.jobs/get).
603
+ #
604
+ # @overload cancel_job(request, options = nil)
605
+ # Pass arguments to `cancel_job` via a request object, either of type
606
+ # {::Google::Cloud::Dataproc::V1::CancelJobRequest} or an equivalent Hash.
607
+ #
608
+ # @param request [::Google::Cloud::Dataproc::V1::CancelJobRequest, ::Hash]
609
+ # A request object representing the call parameters. Required. To specify no
610
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
611
+ # @param options [::Gapic::CallOptions, ::Hash]
612
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
613
+ #
614
+ # @overload cancel_job(project_id: nil, region: nil, job_id: nil)
615
+ # Pass arguments to `cancel_job` via keyword arguments. Note that at
616
+ # least one keyword argument is required. To specify no parameters, or to keep all
617
+ # the default parameter values, pass an empty Hash as a request object (see above).
618
+ #
619
+ # @param project_id [::String]
620
+ # Required. The ID of the Google Cloud Platform project that the job
621
+ # belongs to.
622
+ # @param region [::String]
623
+ # Required. The Dataproc region in which to handle the request.
624
+ # @param job_id [::String]
625
+ # Required. The job ID.
626
+ # @yield [result, operation] Access the result along with the TransportOperation object
627
+ # @yieldparam result [::Google::Cloud::Dataproc::V1::Job]
628
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
629
+ #
630
+ # @return [::Google::Cloud::Dataproc::V1::Job]
631
+ #
632
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
633
+ def cancel_job request, options = nil
634
+ raise ::ArgumentError, "request must be provided" if request.nil?
635
+
636
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dataproc::V1::CancelJobRequest
637
+
638
+ # Converts hash and nil to an options object
639
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
640
+
641
+ # Customize the options with defaults
642
+ call_metadata = @config.rpcs.cancel_job.metadata.to_h
643
+
644
+ # Set x-goog-api-client and x-goog-user-project headers
645
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
646
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
647
+ gapic_version: ::Google::Cloud::Dataproc::V1::VERSION,
648
+ transports_version_send: [:rest]
649
+
650
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
651
+
652
+ options.apply_defaults timeout: @config.rpcs.cancel_job.timeout,
653
+ metadata: call_metadata,
654
+ retry_policy: @config.rpcs.cancel_job.retry_policy
655
+
656
+ options.apply_defaults timeout: @config.timeout,
657
+ metadata: @config.metadata,
658
+ retry_policy: @config.retry_policy
659
+
660
+ @job_controller_stub.cancel_job request, options do |result, operation|
661
+ yield result, operation if block_given?
662
+ return result
663
+ end
664
+ rescue ::Gapic::Rest::Error => e
665
+ raise ::Google::Cloud::Error.from_error(e)
666
+ end
667
+
668
+ ##
669
+ # Deletes the job from the project. If the job is active, the delete fails,
670
+ # and the response returns `FAILED_PRECONDITION`.
671
+ #
672
+ # @overload delete_job(request, options = nil)
673
+ # Pass arguments to `delete_job` via a request object, either of type
674
+ # {::Google::Cloud::Dataproc::V1::DeleteJobRequest} or an equivalent Hash.
675
+ #
676
+ # @param request [::Google::Cloud::Dataproc::V1::DeleteJobRequest, ::Hash]
677
+ # A request object representing the call parameters. Required. To specify no
678
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
679
+ # @param options [::Gapic::CallOptions, ::Hash]
680
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
681
+ #
682
+ # @overload delete_job(project_id: nil, region: nil, job_id: nil)
683
+ # Pass arguments to `delete_job` via keyword arguments. Note that at
684
+ # least one keyword argument is required. To specify no parameters, or to keep all
685
+ # the default parameter values, pass an empty Hash as a request object (see above).
686
+ #
687
+ # @param project_id [::String]
688
+ # Required. The ID of the Google Cloud Platform project that the job
689
+ # belongs to.
690
+ # @param region [::String]
691
+ # Required. The Dataproc region in which to handle the request.
692
+ # @param job_id [::String]
693
+ # Required. The job ID.
694
+ # @yield [result, operation] Access the result along with the TransportOperation object
695
+ # @yieldparam result [::Google::Protobuf::Empty]
696
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
697
+ #
698
+ # @return [::Google::Protobuf::Empty]
699
+ #
700
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
701
+ def delete_job request, options = nil
702
+ raise ::ArgumentError, "request must be provided" if request.nil?
703
+
704
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dataproc::V1::DeleteJobRequest
705
+
706
+ # Converts hash and nil to an options object
707
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
708
+
709
+ # Customize the options with defaults
710
+ call_metadata = @config.rpcs.delete_job.metadata.to_h
711
+
712
+ # Set x-goog-api-client and x-goog-user-project headers
713
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
714
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
715
+ gapic_version: ::Google::Cloud::Dataproc::V1::VERSION,
716
+ transports_version_send: [:rest]
717
+
718
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
719
+
720
+ options.apply_defaults timeout: @config.rpcs.delete_job.timeout,
721
+ metadata: call_metadata,
722
+ retry_policy: @config.rpcs.delete_job.retry_policy
723
+
724
+ options.apply_defaults timeout: @config.timeout,
725
+ metadata: @config.metadata,
726
+ retry_policy: @config.retry_policy
727
+
728
+ @job_controller_stub.delete_job request, options do |result, operation|
729
+ yield result, operation if block_given?
730
+ return result
731
+ end
732
+ rescue ::Gapic::Rest::Error => e
733
+ raise ::Google::Cloud::Error.from_error(e)
734
+ end
735
+
736
+ ##
737
+ # Configuration class for the JobController REST API.
738
+ #
739
+ # This class represents the configuration for JobController REST,
740
+ # providing control over timeouts, retry behavior, logging, transport
741
+ # parameters, and other low-level controls. Certain parameters can also be
742
+ # applied individually to specific RPCs. See
743
+ # {::Google::Cloud::Dataproc::V1::JobController::Rest::Client::Configuration::Rpcs}
744
+ # for a list of RPCs that can be configured independently.
745
+ #
746
+ # Configuration can be applied globally to all clients, or to a single client
747
+ # on construction.
748
+ #
749
+ # @example
750
+ #
751
+ # # Modify the global config, setting the timeout for
752
+ # # submit_job to 20 seconds,
753
+ # # and all remaining timeouts to 10 seconds.
754
+ # ::Google::Cloud::Dataproc::V1::JobController::Rest::Client.configure do |config|
755
+ # config.timeout = 10.0
756
+ # config.rpcs.submit_job.timeout = 20.0
757
+ # end
758
+ #
759
+ # # Apply the above configuration only to a new client.
760
+ # client = ::Google::Cloud::Dataproc::V1::JobController::Rest::Client.new do |config|
761
+ # config.timeout = 10.0
762
+ # config.rpcs.submit_job.timeout = 20.0
763
+ # end
764
+ #
765
+ # @!attribute [rw] endpoint
766
+ # The hostname or hostname:port of the service endpoint.
767
+ # Defaults to `"dataproc.googleapis.com"`.
768
+ # @return [::String]
769
+ # @!attribute [rw] credentials
770
+ # Credentials to send with calls. You may provide any of the following types:
771
+ # * (`String`) The path to a service account key file in JSON format
772
+ # * (`Hash`) A service account key as a Hash
773
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
774
+ # (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
775
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
776
+ # (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
777
+ # * (`nil`) indicating no credentials
778
+ # @return [::Object]
779
+ # @!attribute [rw] scope
780
+ # The OAuth scopes
781
+ # @return [::Array<::String>]
782
+ # @!attribute [rw] lib_name
783
+ # The library name as recorded in instrumentation and logging
784
+ # @return [::String]
785
+ # @!attribute [rw] lib_version
786
+ # The library version as recorded in instrumentation and logging
787
+ # @return [::String]
788
+ # @!attribute [rw] timeout
789
+ # The call timeout in seconds.
790
+ # @return [::Numeric]
791
+ # @!attribute [rw] metadata
792
+ # Additional headers to be sent with the call.
793
+ # @return [::Hash{::Symbol=>::String}]
794
+ # @!attribute [rw] retry_policy
795
+ # The retry policy. The value is a hash with the following keys:
796
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
797
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
798
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
799
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
800
+ # trigger a retry.
801
+ # @return [::Hash]
802
+ # @!attribute [rw] quota_project
803
+ # A separate project against which to charge quota.
804
+ # @return [::String]
805
+ #
806
+ class Configuration
807
+ extend ::Gapic::Config
808
+
809
+ config_attr :endpoint, "dataproc.googleapis.com", ::String
810
+ config_attr :credentials, nil do |value|
811
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
812
+ allowed.any? { |klass| klass === value }
813
+ end
814
+ config_attr :scope, nil, ::String, ::Array, nil
815
+ config_attr :lib_name, nil, ::String, nil
816
+ config_attr :lib_version, nil, ::String, nil
817
+ config_attr :timeout, nil, ::Numeric, nil
818
+ config_attr :metadata, nil, ::Hash, nil
819
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
820
+ config_attr :quota_project, nil, ::String, nil
821
+
822
+ # @private
823
+ # Overrides for http bindings for the RPCs of this service
824
+ # are only used when this service is used as mixin, and only
825
+ # by the host service.
826
+ # @return [::Hash{::Symbol=>::Array<::Gapic::Rest::GrpcTranscoder::HttpBinding>}]
827
+ config_attr :bindings_override, {}, ::Hash, nil
828
+
829
+ # @private
830
+ def initialize parent_config = nil
831
+ @parent_config = parent_config unless parent_config.nil?
832
+
833
+ yield self if block_given?
834
+ end
835
+
836
+ ##
837
+ # Configurations for individual RPCs
838
+ # @return [Rpcs]
839
+ #
840
+ def rpcs
841
+ @rpcs ||= begin
842
+ parent_rpcs = nil
843
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
844
+ Rpcs.new parent_rpcs
845
+ end
846
+ end
847
+
848
+ ##
849
+ # Configuration RPC class for the JobController API.
850
+ #
851
+ # Includes fields providing the configuration for each RPC in this service.
852
+ # Each configuration object is of type `Gapic::Config::Method` and includes
853
+ # the following configuration fields:
854
+ #
855
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
856
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
857
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
858
+ # include the following keys:
859
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
860
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
861
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
862
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
863
+ # trigger a retry.
864
+ #
865
+ class Rpcs
866
+ ##
867
+ # RPC-specific configuration for `submit_job`
868
+ # @return [::Gapic::Config::Method]
869
+ #
870
+ attr_reader :submit_job
871
+ ##
872
+ # RPC-specific configuration for `submit_job_as_operation`
873
+ # @return [::Gapic::Config::Method]
874
+ #
875
+ attr_reader :submit_job_as_operation
876
+ ##
877
+ # RPC-specific configuration for `get_job`
878
+ # @return [::Gapic::Config::Method]
879
+ #
880
+ attr_reader :get_job
881
+ ##
882
+ # RPC-specific configuration for `list_jobs`
883
+ # @return [::Gapic::Config::Method]
884
+ #
885
+ attr_reader :list_jobs
886
+ ##
887
+ # RPC-specific configuration for `update_job`
888
+ # @return [::Gapic::Config::Method]
889
+ #
890
+ attr_reader :update_job
891
+ ##
892
+ # RPC-specific configuration for `cancel_job`
893
+ # @return [::Gapic::Config::Method]
894
+ #
895
+ attr_reader :cancel_job
896
+ ##
897
+ # RPC-specific configuration for `delete_job`
898
+ # @return [::Gapic::Config::Method]
899
+ #
900
+ attr_reader :delete_job
901
+
902
+ # @private
903
+ def initialize parent_rpcs = nil
904
+ submit_job_config = parent_rpcs.submit_job if parent_rpcs.respond_to? :submit_job
905
+ @submit_job = ::Gapic::Config::Method.new submit_job_config
906
+ submit_job_as_operation_config = parent_rpcs.submit_job_as_operation if parent_rpcs.respond_to? :submit_job_as_operation
907
+ @submit_job_as_operation = ::Gapic::Config::Method.new submit_job_as_operation_config
908
+ get_job_config = parent_rpcs.get_job if parent_rpcs.respond_to? :get_job
909
+ @get_job = ::Gapic::Config::Method.new get_job_config
910
+ list_jobs_config = parent_rpcs.list_jobs if parent_rpcs.respond_to? :list_jobs
911
+ @list_jobs = ::Gapic::Config::Method.new list_jobs_config
912
+ update_job_config = parent_rpcs.update_job if parent_rpcs.respond_to? :update_job
913
+ @update_job = ::Gapic::Config::Method.new update_job_config
914
+ cancel_job_config = parent_rpcs.cancel_job if parent_rpcs.respond_to? :cancel_job
915
+ @cancel_job = ::Gapic::Config::Method.new cancel_job_config
916
+ delete_job_config = parent_rpcs.delete_job if parent_rpcs.respond_to? :delete_job
917
+ @delete_job = ::Gapic::Config::Method.new delete_job_config
918
+
919
+ yield self if block_given?
920
+ end
921
+ end
922
+ end
923
+ end
924
+ end
925
+ end
926
+ end
927
+ end
928
+ end
929
+ end