google-cloud-dataproc-v1 0.6.3 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (41) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +1 -1
  3. data/AUTHENTICATION.md +7 -25
  4. data/README.md +1 -1
  5. data/lib/google/cloud/dataproc/v1/autoscaling_policies_pb.rb +3 -2
  6. data/lib/google/cloud/dataproc/v1/autoscaling_policies_services_pb.rb +1 -1
  7. data/lib/google/cloud/dataproc/v1/autoscaling_policy_service/client.rb +106 -15
  8. data/lib/google/cloud/dataproc/v1/batch_controller/client.rb +719 -0
  9. data/lib/google/cloud/dataproc/v1/batch_controller/credentials.rb +51 -0
  10. data/lib/google/cloud/dataproc/v1/batch_controller/operations.rb +767 -0
  11. data/lib/google/cloud/dataproc/v1/batch_controller/paths.rb +69 -0
  12. data/lib/google/cloud/dataproc/v1/batch_controller.rb +50 -0
  13. data/lib/google/cloud/dataproc/v1/batches_pb.rb +123 -0
  14. data/lib/google/cloud/dataproc/v1/batches_services_pb.rb +52 -0
  15. data/lib/google/cloud/dataproc/v1/cluster_controller/client.rb +266 -49
  16. data/lib/google/cloud/dataproc/v1/cluster_controller/operations.rb +115 -12
  17. data/lib/google/cloud/dataproc/v1/cluster_controller/paths.rb +0 -19
  18. data/lib/google/cloud/dataproc/v1/clusters_pb.rb +23 -10
  19. data/lib/google/cloud/dataproc/v1/clusters_services_pb.rb +3 -1
  20. data/lib/google/cloud/dataproc/v1/job_controller/client.rb +187 -32
  21. data/lib/google/cloud/dataproc/v1/job_controller/operations.rb +115 -12
  22. data/lib/google/cloud/dataproc/v1/jobs_pb.rb +2 -2
  23. data/lib/google/cloud/dataproc/v1/jobs_services_pb.rb +1 -1
  24. data/lib/google/cloud/dataproc/v1/operations_pb.rb +18 -3
  25. data/lib/google/cloud/dataproc/v1/shared_pb.rb +99 -2
  26. data/lib/google/cloud/dataproc/v1/version.rb +1 -1
  27. data/lib/google/cloud/dataproc/v1/workflow_template_service/client.rb +163 -24
  28. data/lib/google/cloud/dataproc/v1/workflow_template_service/operations.rb +115 -12
  29. data/lib/google/cloud/dataproc/v1/workflow_template_service/paths.rb +0 -19
  30. data/lib/google/cloud/dataproc/v1/workflow_templates_pb.rb +2 -2
  31. data/lib/google/cloud/dataproc/v1/workflow_templates_services_pb.rb +2 -3
  32. data/lib/google/cloud/dataproc/v1.rb +1 -0
  33. data/proto_docs/google/api/resource.rb +10 -71
  34. data/proto_docs/google/cloud/dataproc/v1/autoscaling_policies.rb +18 -0
  35. data/proto_docs/google/cloud/dataproc/v1/batches.rb +339 -0
  36. data/proto_docs/google/cloud/dataproc/v1/clusters.rb +117 -47
  37. data/proto_docs/google/cloud/dataproc/v1/jobs.rb +20 -9
  38. data/proto_docs/google/cloud/dataproc/v1/operations.rb +48 -0
  39. data/proto_docs/google/cloud/dataproc/v1/shared.rb +336 -1
  40. data/proto_docs/google/cloud/dataproc/v1/workflow_templates.rb +12 -15
  41. metadata +11 -3
@@ -0,0 +1,719 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2021 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/batches_pb"
21
+
22
+ module Google
23
+ module Cloud
24
+ module Dataproc
25
+ module V1
26
+ module BatchController
27
+ ##
28
+ # Client for the BatchController service.
29
+ #
30
+ # The BatchController provides methods to manage batch workloads.
31
+ #
32
+ class Client
33
+ include Paths
34
+
35
+ # @private
36
+ attr_reader :batch_controller_stub
37
+
38
+ ##
39
+ # Configure the BatchController Client class.
40
+ #
41
+ # See {::Google::Cloud::Dataproc::V1::BatchController::Client::Configuration}
42
+ # for a description of the configuration fields.
43
+ #
44
+ # @example
45
+ #
46
+ # # Modify the configuration for all BatchController clients
47
+ # ::Google::Cloud::Dataproc::V1::BatchController::Client.configure do |config|
48
+ # config.timeout = 10.0
49
+ # end
50
+ #
51
+ # @yield [config] Configure the Client client.
52
+ # @yieldparam config [Client::Configuration]
53
+ #
54
+ # @return [Client::Configuration]
55
+ #
56
+ def self.configure
57
+ @configure ||= begin
58
+ namespace = ["Google", "Cloud", "Dataproc", "V1"]
59
+ parent_config = while namespace.any?
60
+ parent_name = namespace.join "::"
61
+ parent_const = const_get parent_name
62
+ break parent_const.configure if parent_const.respond_to? :configure
63
+ namespace.pop
64
+ end
65
+ default_config = Client::Configuration.new parent_config
66
+
67
+ default_config
68
+ end
69
+ yield @configure if block_given?
70
+ @configure
71
+ end
72
+
73
+ ##
74
+ # Configure the BatchController Client instance.
75
+ #
76
+ # The configuration is set to the derived mode, meaning that values can be changed,
77
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
78
+ # should be made on {Client.configure}.
79
+ #
80
+ # See {::Google::Cloud::Dataproc::V1::BatchController::Client::Configuration}
81
+ # for a description of the configuration fields.
82
+ #
83
+ # @yield [config] Configure the Client client.
84
+ # @yieldparam config [Client::Configuration]
85
+ #
86
+ # @return [Client::Configuration]
87
+ #
88
+ def configure
89
+ yield @config if block_given?
90
+ @config
91
+ end
92
+
93
+ ##
94
+ # Create a new BatchController client object.
95
+ #
96
+ # @example
97
+ #
98
+ # # Create a client using the default configuration
99
+ # client = ::Google::Cloud::Dataproc::V1::BatchController::Client.new
100
+ #
101
+ # # Create a client using a custom configuration
102
+ # client = ::Google::Cloud::Dataproc::V1::BatchController::Client.new do |config|
103
+ # config.timeout = 10.0
104
+ # end
105
+ #
106
+ # @yield [config] Configure the BatchController client.
107
+ # @yieldparam config [Client::Configuration]
108
+ #
109
+ def initialize
110
+ # These require statements are intentionally placed here to initialize
111
+ # the gRPC module only when it's required.
112
+ # See https://github.com/googleapis/toolkit/issues/446
113
+ require "gapic/grpc"
114
+ require "google/cloud/dataproc/v1/batches_services_pb"
115
+
116
+ # Create the configuration object
117
+ @config = Configuration.new Client.configure
118
+
119
+ # Yield the configuration if needed
120
+ yield @config if block_given?
121
+
122
+ # Create credentials
123
+ credentials = @config.credentials
124
+ # Use self-signed JWT if the endpoint is unchanged from default,
125
+ # but only if the default endpoint does not have a region prefix.
126
+ enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
127
+ !@config.endpoint.split(".").first.include?("-")
128
+ credentials ||= Credentials.default scope: @config.scope,
129
+ enable_self_signed_jwt: enable_self_signed_jwt
130
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
131
+ credentials = Credentials.new credentials, scope: @config.scope
132
+ end
133
+ @quota_project_id = @config.quota_project
134
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
135
+
136
+ @operations_client = Operations.new do |config|
137
+ config.credentials = credentials
138
+ config.quota_project = @quota_project_id
139
+ config.endpoint = @config.endpoint
140
+ end
141
+
142
+ @batch_controller_stub = ::Gapic::ServiceStub.new(
143
+ ::Google::Cloud::Dataproc::V1::BatchController::Stub,
144
+ credentials: credentials,
145
+ endpoint: @config.endpoint,
146
+ channel_args: @config.channel_args,
147
+ interceptors: @config.interceptors
148
+ )
149
+ end
150
+
151
+ ##
152
+ # Get the associated client for long-running operations.
153
+ #
154
+ # @return [::Google::Cloud::Dataproc::V1::BatchController::Operations]
155
+ #
156
+ attr_reader :operations_client
157
+
158
+ # Service calls
159
+
160
+ ##
161
+ # Creates a batch workload that executes asynchronously.
162
+ #
163
+ # @overload create_batch(request, options = nil)
164
+ # Pass arguments to `create_batch` via a request object, either of type
165
+ # {::Google::Cloud::Dataproc::V1::CreateBatchRequest} or an equivalent Hash.
166
+ #
167
+ # @param request [::Google::Cloud::Dataproc::V1::CreateBatchRequest, ::Hash]
168
+ # A request object representing the call parameters. Required. To specify no
169
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
170
+ # @param options [::Gapic::CallOptions, ::Hash]
171
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
172
+ #
173
+ # @overload create_batch(parent: nil, batch: nil, batch_id: nil, request_id: nil)
174
+ # Pass arguments to `create_batch` via keyword arguments. Note that at
175
+ # least one keyword argument is required. To specify no parameters, or to keep all
176
+ # the default parameter values, pass an empty Hash as a request object (see above).
177
+ #
178
+ # @param parent [::String]
179
+ # Required. The parent resource where this batch will be created.
180
+ # @param batch [::Google::Cloud::Dataproc::V1::Batch, ::Hash]
181
+ # Required. The batch to create.
182
+ # @param batch_id [::String]
183
+ # Optional. The ID to use for the batch, which will become the final component of
184
+ # the batch's resource name.
185
+ #
186
+ # This value must be 4-63 characters. Valid characters are `/[a-z][0-9]-/`.
187
+ # @param request_id [::String]
188
+ # Optional. A unique ID used to identify the request. If the service
189
+ # receives two
190
+ # [CreateBatchRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.CreateBatchRequest)s
191
+ # with the same request_id, the second request is ignored and the
192
+ # Operation that corresponds to the first Batch created and stored
193
+ # in the backend is returned.
194
+ #
195
+ # Recommendation: Set this value to a
196
+ # [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier).
197
+ #
198
+ # The value must contain only letters (a-z, A-Z), numbers (0-9),
199
+ # underscores (_), and hyphens (-). The maximum length is 40 characters.
200
+ #
201
+ # @yield [response, operation] Access the result along with the RPC operation
202
+ # @yieldparam response [::Gapic::Operation]
203
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
204
+ #
205
+ # @return [::Gapic::Operation]
206
+ #
207
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
208
+ #
209
+ # @example Basic example
210
+ # require "google/cloud/dataproc/v1"
211
+ #
212
+ # # Create a client object. The client can be reused for multiple calls.
213
+ # client = Google::Cloud::Dataproc::V1::BatchController::Client.new
214
+ #
215
+ # # Create a request. To set request fields, pass in keyword arguments.
216
+ # request = Google::Cloud::Dataproc::V1::CreateBatchRequest.new
217
+ #
218
+ # # Call the create_batch method.
219
+ # result = client.create_batch request
220
+ #
221
+ # # The returned object is of type Gapic::Operation. You can use this
222
+ # # object to check the status of an operation, cancel it, or wait
223
+ # # for results. Here is how to block until completion:
224
+ # result.wait_until_done! timeout: 60
225
+ # if result.response?
226
+ # p result.response
227
+ # else
228
+ # puts "Error!"
229
+ # end
230
+ #
231
+ def create_batch request, options = nil
232
+ raise ::ArgumentError, "request must be provided" if request.nil?
233
+
234
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dataproc::V1::CreateBatchRequest
235
+
236
+ # Converts hash and nil to an options object
237
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
238
+
239
+ # Customize the options with defaults
240
+ metadata = @config.rpcs.create_batch.metadata.to_h
241
+
242
+ # Set x-goog-api-client and x-goog-user-project headers
243
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
244
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
245
+ gapic_version: ::Google::Cloud::Dataproc::V1::VERSION
246
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
247
+
248
+ header_params = {}
249
+ if request.parent
250
+ header_params["parent"] = request.parent
251
+ end
252
+
253
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
254
+ metadata[:"x-goog-request-params"] ||= request_params_header
255
+
256
+ options.apply_defaults timeout: @config.rpcs.create_batch.timeout,
257
+ metadata: metadata,
258
+ retry_policy: @config.rpcs.create_batch.retry_policy
259
+
260
+ options.apply_defaults timeout: @config.timeout,
261
+ metadata: @config.metadata,
262
+ retry_policy: @config.retry_policy
263
+
264
+ @batch_controller_stub.call_rpc :create_batch, request, options: options do |response, operation|
265
+ response = ::Gapic::Operation.new response, @operations_client, options: options
266
+ yield response, operation if block_given?
267
+ return response
268
+ end
269
+ rescue ::GRPC::BadStatus => e
270
+ raise ::Google::Cloud::Error.from_error(e)
271
+ end
272
+
273
+ ##
274
+ # Gets the batch workload resource representation.
275
+ #
276
+ # @overload get_batch(request, options = nil)
277
+ # Pass arguments to `get_batch` via a request object, either of type
278
+ # {::Google::Cloud::Dataproc::V1::GetBatchRequest} or an equivalent Hash.
279
+ #
280
+ # @param request [::Google::Cloud::Dataproc::V1::GetBatchRequest, ::Hash]
281
+ # A request object representing the call parameters. Required. To specify no
282
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
283
+ # @param options [::Gapic::CallOptions, ::Hash]
284
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
285
+ #
286
+ # @overload get_batch(name: nil)
287
+ # Pass arguments to `get_batch` via keyword arguments. Note that at
288
+ # least one keyword argument is required. To specify no parameters, or to keep all
289
+ # the default parameter values, pass an empty Hash as a request object (see above).
290
+ #
291
+ # @param name [::String]
292
+ # Required. The name of the batch to retrieve.
293
+ #
294
+ # @yield [response, operation] Access the result along with the RPC operation
295
+ # @yieldparam response [::Google::Cloud::Dataproc::V1::Batch]
296
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
297
+ #
298
+ # @return [::Google::Cloud::Dataproc::V1::Batch]
299
+ #
300
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
301
+ #
302
+ # @example Basic example
303
+ # require "google/cloud/dataproc/v1"
304
+ #
305
+ # # Create a client object. The client can be reused for multiple calls.
306
+ # client = Google::Cloud::Dataproc::V1::BatchController::Client.new
307
+ #
308
+ # # Create a request. To set request fields, pass in keyword arguments.
309
+ # request = Google::Cloud::Dataproc::V1::GetBatchRequest.new
310
+ #
311
+ # # Call the get_batch method.
312
+ # result = client.get_batch request
313
+ #
314
+ # # The returned object is of type Google::Cloud::Dataproc::V1::Batch.
315
+ # p result
316
+ #
317
+ def get_batch request, options = nil
318
+ raise ::ArgumentError, "request must be provided" if request.nil?
319
+
320
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dataproc::V1::GetBatchRequest
321
+
322
+ # Converts hash and nil to an options object
323
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
324
+
325
+ # Customize the options with defaults
326
+ metadata = @config.rpcs.get_batch.metadata.to_h
327
+
328
+ # Set x-goog-api-client and x-goog-user-project headers
329
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
330
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
331
+ gapic_version: ::Google::Cloud::Dataproc::V1::VERSION
332
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
333
+
334
+ header_params = {}
335
+ if request.name
336
+ header_params["name"] = request.name
337
+ end
338
+
339
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
340
+ metadata[:"x-goog-request-params"] ||= request_params_header
341
+
342
+ options.apply_defaults timeout: @config.rpcs.get_batch.timeout,
343
+ metadata: metadata,
344
+ retry_policy: @config.rpcs.get_batch.retry_policy
345
+
346
+ options.apply_defaults timeout: @config.timeout,
347
+ metadata: @config.metadata,
348
+ retry_policy: @config.retry_policy
349
+
350
+ @batch_controller_stub.call_rpc :get_batch, request, options: options do |response, operation|
351
+ yield response, operation if block_given?
352
+ return response
353
+ end
354
+ rescue ::GRPC::BadStatus => e
355
+ raise ::Google::Cloud::Error.from_error(e)
356
+ end
357
+
358
+ ##
359
+ # Lists batch workloads.
360
+ #
361
+ # @overload list_batches(request, options = nil)
362
+ # Pass arguments to `list_batches` via a request object, either of type
363
+ # {::Google::Cloud::Dataproc::V1::ListBatchesRequest} or an equivalent Hash.
364
+ #
365
+ # @param request [::Google::Cloud::Dataproc::V1::ListBatchesRequest, ::Hash]
366
+ # A request object representing the call parameters. Required. To specify no
367
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
368
+ # @param options [::Gapic::CallOptions, ::Hash]
369
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
370
+ #
371
+ # @overload list_batches(parent: nil, page_size: nil, page_token: nil)
372
+ # Pass arguments to `list_batches` via keyword arguments. Note that at
373
+ # least one keyword argument is required. To specify no parameters, or to keep all
374
+ # the default parameter values, pass an empty Hash as a request object (see above).
375
+ #
376
+ # @param parent [::String]
377
+ # Required. The parent, which owns this collection of batches.
378
+ # @param page_size [::Integer]
379
+ # Optional. The maximum number of batches to return in each response.
380
+ # The service may return fewer than this value.
381
+ # The default page size is 20; the maximum page size is 1000.
382
+ # @param page_token [::String]
383
+ # Optional. A page token received from a previous `ListBatches` call.
384
+ # Provide this token to retrieve the subsequent page.
385
+ #
386
+ # @yield [response, operation] Access the result along with the RPC operation
387
+ # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Dataproc::V1::Batch>]
388
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
389
+ #
390
+ # @return [::Gapic::PagedEnumerable<::Google::Cloud::Dataproc::V1::Batch>]
391
+ #
392
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
393
+ #
394
+ # @example Basic example
395
+ # require "google/cloud/dataproc/v1"
396
+ #
397
+ # # Create a client object. The client can be reused for multiple calls.
398
+ # client = Google::Cloud::Dataproc::V1::BatchController::Client.new
399
+ #
400
+ # # Create a request. To set request fields, pass in keyword arguments.
401
+ # request = Google::Cloud::Dataproc::V1::ListBatchesRequest.new
402
+ #
403
+ # # Call the list_batches method.
404
+ # result = client.list_batches request
405
+ #
406
+ # # The returned object is of type Gapic::PagedEnumerable. You can
407
+ # # iterate over all elements by calling #each, and the enumerable
408
+ # # will lazily make API calls to fetch subsequent pages. Other
409
+ # # methods are also available for managing paging directly.
410
+ # result.each do |response|
411
+ # # Each element is of type ::Google::Cloud::Dataproc::V1::Batch.
412
+ # p response
413
+ # end
414
+ #
415
+ def list_batches request, options = nil
416
+ raise ::ArgumentError, "request must be provided" if request.nil?
417
+
418
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dataproc::V1::ListBatchesRequest
419
+
420
+ # Converts hash and nil to an options object
421
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
422
+
423
+ # Customize the options with defaults
424
+ metadata = @config.rpcs.list_batches.metadata.to_h
425
+
426
+ # Set x-goog-api-client and x-goog-user-project headers
427
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
428
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
429
+ gapic_version: ::Google::Cloud::Dataproc::V1::VERSION
430
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
431
+
432
+ header_params = {}
433
+ if request.parent
434
+ header_params["parent"] = request.parent
435
+ end
436
+
437
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
438
+ metadata[:"x-goog-request-params"] ||= request_params_header
439
+
440
+ options.apply_defaults timeout: @config.rpcs.list_batches.timeout,
441
+ metadata: metadata,
442
+ retry_policy: @config.rpcs.list_batches.retry_policy
443
+
444
+ options.apply_defaults timeout: @config.timeout,
445
+ metadata: @config.metadata,
446
+ retry_policy: @config.retry_policy
447
+
448
+ @batch_controller_stub.call_rpc :list_batches, request, options: options do |response, operation|
449
+ response = ::Gapic::PagedEnumerable.new @batch_controller_stub, :list_batches, request, response, operation, options
450
+ yield response, operation if block_given?
451
+ return response
452
+ end
453
+ rescue ::GRPC::BadStatus => e
454
+ raise ::Google::Cloud::Error.from_error(e)
455
+ end
456
+
457
+ ##
458
+ # Deletes the batch workload resource. If the batch is not in terminal state,
459
+ # the delete fails and the response returns `FAILED_PRECONDITION`.
460
+ #
461
+ # @overload delete_batch(request, options = nil)
462
+ # Pass arguments to `delete_batch` via a request object, either of type
463
+ # {::Google::Cloud::Dataproc::V1::DeleteBatchRequest} or an equivalent Hash.
464
+ #
465
+ # @param request [::Google::Cloud::Dataproc::V1::DeleteBatchRequest, ::Hash]
466
+ # A request object representing the call parameters. Required. To specify no
467
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
468
+ # @param options [::Gapic::CallOptions, ::Hash]
469
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
470
+ #
471
+ # @overload delete_batch(name: nil)
472
+ # Pass arguments to `delete_batch` via keyword arguments. Note that at
473
+ # least one keyword argument is required. To specify no parameters, or to keep all
474
+ # the default parameter values, pass an empty Hash as a request object (see above).
475
+ #
476
+ # @param name [::String]
477
+ # Required. The name of the batch resource to delete.
478
+ #
479
+ # @yield [response, operation] Access the result along with the RPC operation
480
+ # @yieldparam response [::Google::Protobuf::Empty]
481
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
482
+ #
483
+ # @return [::Google::Protobuf::Empty]
484
+ #
485
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
486
+ #
487
+ # @example Basic example
488
+ # require "google/cloud/dataproc/v1"
489
+ #
490
+ # # Create a client object. The client can be reused for multiple calls.
491
+ # client = Google::Cloud::Dataproc::V1::BatchController::Client.new
492
+ #
493
+ # # Create a request. To set request fields, pass in keyword arguments.
494
+ # request = Google::Cloud::Dataproc::V1::DeleteBatchRequest.new
495
+ #
496
+ # # Call the delete_batch method.
497
+ # result = client.delete_batch request
498
+ #
499
+ # # The returned object is of type Google::Protobuf::Empty.
500
+ # p result
501
+ #
502
+ def delete_batch request, options = nil
503
+ raise ::ArgumentError, "request must be provided" if request.nil?
504
+
505
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dataproc::V1::DeleteBatchRequest
506
+
507
+ # Converts hash and nil to an options object
508
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
509
+
510
+ # Customize the options with defaults
511
+ metadata = @config.rpcs.delete_batch.metadata.to_h
512
+
513
+ # Set x-goog-api-client and x-goog-user-project headers
514
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
515
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
516
+ gapic_version: ::Google::Cloud::Dataproc::V1::VERSION
517
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
518
+
519
+ header_params = {}
520
+ if request.name
521
+ header_params["name"] = request.name
522
+ end
523
+
524
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
525
+ metadata[:"x-goog-request-params"] ||= request_params_header
526
+
527
+ options.apply_defaults timeout: @config.rpcs.delete_batch.timeout,
528
+ metadata: metadata,
529
+ retry_policy: @config.rpcs.delete_batch.retry_policy
530
+
531
+ options.apply_defaults timeout: @config.timeout,
532
+ metadata: @config.metadata,
533
+ retry_policy: @config.retry_policy
534
+
535
+ @batch_controller_stub.call_rpc :delete_batch, request, options: options do |response, operation|
536
+ yield response, operation if block_given?
537
+ return response
538
+ end
539
+ rescue ::GRPC::BadStatus => e
540
+ raise ::Google::Cloud::Error.from_error(e)
541
+ end
542
+
543
+ ##
544
+ # Configuration class for the BatchController API.
545
+ #
546
+ # This class represents the configuration for BatchController,
547
+ # providing control over timeouts, retry behavior, logging, transport
548
+ # parameters, and other low-level controls. Certain parameters can also be
549
+ # applied individually to specific RPCs. See
550
+ # {::Google::Cloud::Dataproc::V1::BatchController::Client::Configuration::Rpcs}
551
+ # for a list of RPCs that can be configured independently.
552
+ #
553
+ # Configuration can be applied globally to all clients, or to a single client
554
+ # on construction.
555
+ #
556
+ # @example
557
+ #
558
+ # # Modify the global config, setting the timeout for
559
+ # # create_batch to 20 seconds,
560
+ # # and all remaining timeouts to 10 seconds.
561
+ # ::Google::Cloud::Dataproc::V1::BatchController::Client.configure do |config|
562
+ # config.timeout = 10.0
563
+ # config.rpcs.create_batch.timeout = 20.0
564
+ # end
565
+ #
566
+ # # Apply the above configuration only to a new client.
567
+ # client = ::Google::Cloud::Dataproc::V1::BatchController::Client.new do |config|
568
+ # config.timeout = 10.0
569
+ # config.rpcs.create_batch.timeout = 20.0
570
+ # end
571
+ #
572
+ # @!attribute [rw] endpoint
573
+ # The hostname or hostname:port of the service endpoint.
574
+ # Defaults to `"dataproc.googleapis.com"`.
575
+ # @return [::String]
576
+ # @!attribute [rw] credentials
577
+ # Credentials to send with calls. You may provide any of the following types:
578
+ # * (`String`) The path to a service account key file in JSON format
579
+ # * (`Hash`) A service account key as a Hash
580
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
581
+ # (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
582
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
583
+ # (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
584
+ # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
585
+ # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
586
+ # * (`nil`) indicating no credentials
587
+ # @return [::Object]
588
+ # @!attribute [rw] scope
589
+ # The OAuth scopes
590
+ # @return [::Array<::String>]
591
+ # @!attribute [rw] lib_name
592
+ # The library name as recorded in instrumentation and logging
593
+ # @return [::String]
594
+ # @!attribute [rw] lib_version
595
+ # The library version as recorded in instrumentation and logging
596
+ # @return [::String]
597
+ # @!attribute [rw] channel_args
598
+ # Extra parameters passed to the gRPC channel. Note: this is ignored if a
599
+ # `GRPC::Core::Channel` object is provided as the credential.
600
+ # @return [::Hash]
601
+ # @!attribute [rw] interceptors
602
+ # An array of interceptors that are run before calls are executed.
603
+ # @return [::Array<::GRPC::ClientInterceptor>]
604
+ # @!attribute [rw] timeout
605
+ # The call timeout in seconds.
606
+ # @return [::Numeric]
607
+ # @!attribute [rw] metadata
608
+ # Additional gRPC headers to be sent with the call.
609
+ # @return [::Hash{::Symbol=>::String}]
610
+ # @!attribute [rw] retry_policy
611
+ # The retry policy. The value is a hash with the following keys:
612
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
613
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
614
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
615
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
616
+ # trigger a retry.
617
+ # @return [::Hash]
618
+ # @!attribute [rw] quota_project
619
+ # A separate project against which to charge quota.
620
+ # @return [::String]
621
+ #
622
+ class Configuration
623
+ extend ::Gapic::Config
624
+
625
+ config_attr :endpoint, "dataproc.googleapis.com", ::String
626
+ config_attr :credentials, nil do |value|
627
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
628
+ allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
629
+ allowed.any? { |klass| klass === value }
630
+ end
631
+ config_attr :scope, nil, ::String, ::Array, nil
632
+ config_attr :lib_name, nil, ::String, nil
633
+ config_attr :lib_version, nil, ::String, nil
634
+ config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
635
+ config_attr :interceptors, nil, ::Array, nil
636
+ config_attr :timeout, nil, ::Numeric, nil
637
+ config_attr :metadata, nil, ::Hash, nil
638
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
639
+ config_attr :quota_project, nil, ::String, nil
640
+
641
+ # @private
642
+ def initialize parent_config = nil
643
+ @parent_config = parent_config unless parent_config.nil?
644
+
645
+ yield self if block_given?
646
+ end
647
+
648
+ ##
649
+ # Configurations for individual RPCs
650
+ # @return [Rpcs]
651
+ #
652
+ def rpcs
653
+ @rpcs ||= begin
654
+ parent_rpcs = nil
655
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
656
+ Rpcs.new parent_rpcs
657
+ end
658
+ end
659
+
660
+ ##
661
+ # Configuration RPC class for the BatchController API.
662
+ #
663
+ # Includes fields providing the configuration for each RPC in this service.
664
+ # Each configuration object is of type `Gapic::Config::Method` and includes
665
+ # the following configuration fields:
666
+ #
667
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
668
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
669
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
670
+ # include the following keys:
671
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
672
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
673
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
674
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
675
+ # trigger a retry.
676
+ #
677
+ class Rpcs
678
+ ##
679
+ # RPC-specific configuration for `create_batch`
680
+ # @return [::Gapic::Config::Method]
681
+ #
682
+ attr_reader :create_batch
683
+ ##
684
+ # RPC-specific configuration for `get_batch`
685
+ # @return [::Gapic::Config::Method]
686
+ #
687
+ attr_reader :get_batch
688
+ ##
689
+ # RPC-specific configuration for `list_batches`
690
+ # @return [::Gapic::Config::Method]
691
+ #
692
+ attr_reader :list_batches
693
+ ##
694
+ # RPC-specific configuration for `delete_batch`
695
+ # @return [::Gapic::Config::Method]
696
+ #
697
+ attr_reader :delete_batch
698
+
699
+ # @private
700
+ def initialize parent_rpcs = nil
701
+ create_batch_config = parent_rpcs.create_batch if parent_rpcs.respond_to? :create_batch
702
+ @create_batch = ::Gapic::Config::Method.new create_batch_config
703
+ get_batch_config = parent_rpcs.get_batch if parent_rpcs.respond_to? :get_batch
704
+ @get_batch = ::Gapic::Config::Method.new get_batch_config
705
+ list_batches_config = parent_rpcs.list_batches if parent_rpcs.respond_to? :list_batches
706
+ @list_batches = ::Gapic::Config::Method.new list_batches_config
707
+ delete_batch_config = parent_rpcs.delete_batch if parent_rpcs.respond_to? :delete_batch
708
+ @delete_batch = ::Gapic::Config::Method.new delete_batch_config
709
+
710
+ yield self if block_given?
711
+ end
712
+ end
713
+ end
714
+ end
715
+ end
716
+ end
717
+ end
718
+ end
719
+ end