google-cloud-dataproc-v1 0.6.0 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. checksums.yaml +4 -4
  2. data/AUTHENTICATION.md +8 -8
  3. data/README.md +1 -1
  4. data/lib/google/cloud/dataproc/v1/autoscaling_policies_pb.rb +3 -2
  5. data/lib/google/cloud/dataproc/v1/autoscaling_policies_services_pb.rb +1 -1
  6. data/lib/google/cloud/dataproc/v1/autoscaling_policy_service/client.rb +48 -54
  7. data/lib/google/cloud/dataproc/v1/batch_controller/client.rb +637 -0
  8. data/lib/google/cloud/dataproc/v1/batch_controller/credentials.rb +51 -0
  9. data/lib/google/cloud/dataproc/v1/batch_controller/operations.rb +664 -0
  10. data/lib/google/cloud/dataproc/v1/batch_controller/paths.rb +69 -0
  11. data/lib/google/cloud/dataproc/v1/batch_controller.rb +50 -0
  12. data/lib/google/cloud/dataproc/v1/batches_pb.rb +123 -0
  13. data/lib/google/cloud/dataproc/v1/batches_services_pb.rb +52 -0
  14. data/lib/google/cloud/dataproc/v1/cluster_controller/client.rb +75 -80
  15. data/lib/google/cloud/dataproc/v1/cluster_controller/operations.rb +34 -25
  16. data/lib/google/cloud/dataproc/v1/clusters_pb.rb +9 -2
  17. data/lib/google/cloud/dataproc/v1/clusters_services_pb.rb +3 -1
  18. data/lib/google/cloud/dataproc/v1/job_controller/client.rb +58 -72
  19. data/lib/google/cloud/dataproc/v1/job_controller/operations.rb +34 -25
  20. data/lib/google/cloud/dataproc/v1/jobs_pb.rb +2 -2
  21. data/lib/google/cloud/dataproc/v1/jobs_services_pb.rb +1 -1
  22. data/lib/google/cloud/dataproc/v1/operations_pb.rb +18 -3
  23. data/lib/google/cloud/dataproc/v1/shared_pb.rb +40 -2
  24. data/lib/google/cloud/dataproc/v1/version.rb +1 -1
  25. data/lib/google/cloud/dataproc/v1/workflow_template_service/client.rb +59 -74
  26. data/lib/google/cloud/dataproc/v1/workflow_template_service/operations.rb +34 -25
  27. data/lib/google/cloud/dataproc/v1/workflow_templates_pb.rb +2 -2
  28. data/lib/google/cloud/dataproc/v1/workflow_templates_services_pb.rb +2 -3
  29. data/lib/google/cloud/dataproc/v1.rb +1 -0
  30. data/proto_docs/google/api/field_behavior.rb +7 -1
  31. data/proto_docs/google/cloud/dataproc/v1/autoscaling_policies.rb +18 -0
  32. data/proto_docs/google/cloud/dataproc/v1/batches.rb +339 -0
  33. data/proto_docs/google/cloud/dataproc/v1/clusters.rb +45 -22
  34. data/proto_docs/google/cloud/dataproc/v1/jobs.rb +8 -9
  35. data/proto_docs/google/cloud/dataproc/v1/operations.rb +48 -0
  36. data/proto_docs/google/cloud/dataproc/v1/shared.rb +117 -1
  37. data/proto_docs/google/cloud/dataproc/v1/workflow_templates.rb +11 -14
  38. metadata +21 -7
@@ -0,0 +1,637 @@
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.endpoint = @config.endpoint
139
+ end
140
+
141
+ @batch_controller_stub = ::Gapic::ServiceStub.new(
142
+ ::Google::Cloud::Dataproc::V1::BatchController::Stub,
143
+ credentials: credentials,
144
+ endpoint: @config.endpoint,
145
+ channel_args: @config.channel_args,
146
+ interceptors: @config.interceptors
147
+ )
148
+ end
149
+
150
+ ##
151
+ # Get the associated client for long-running operations.
152
+ #
153
+ # @return [::Google::Cloud::Dataproc::V1::BatchController::Operations]
154
+ #
155
+ attr_reader :operations_client
156
+
157
+ # Service calls
158
+
159
+ ##
160
+ # Creates a batch workload that executes asynchronously.
161
+ #
162
+ # @overload create_batch(request, options = nil)
163
+ # Pass arguments to `create_batch` via a request object, either of type
164
+ # {::Google::Cloud::Dataproc::V1::CreateBatchRequest} or an equivalent Hash.
165
+ #
166
+ # @param request [::Google::Cloud::Dataproc::V1::CreateBatchRequest, ::Hash]
167
+ # A request object representing the call parameters. Required. To specify no
168
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
169
+ # @param options [::Gapic::CallOptions, ::Hash]
170
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
171
+ #
172
+ # @overload create_batch(parent: nil, batch: nil, batch_id: nil, request_id: nil)
173
+ # Pass arguments to `create_batch` via keyword arguments. Note that at
174
+ # least one keyword argument is required. To specify no parameters, or to keep all
175
+ # the default parameter values, pass an empty Hash as a request object (see above).
176
+ #
177
+ # @param parent [::String]
178
+ # Required. The parent resource where this batch will be created.
179
+ # @param batch [::Google::Cloud::Dataproc::V1::Batch, ::Hash]
180
+ # Required. The batch to create.
181
+ # @param batch_id [::String]
182
+ # Optional. The ID to use for the batch, which will become the final component of
183
+ # the batch's resource name.
184
+ #
185
+ # This value must be 4-63 characters. Valid characters are `/[a-z][0-9]-/`.
186
+ # @param request_id [::String]
187
+ # Optional. A unique ID used to identify the request. If the service
188
+ # receives two
189
+ # [CreateBatchRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.CreateBatchRequest)s
190
+ # with the same request_id, the second request is ignored and the
191
+ # Operation that corresponds to the first Batch created and stored
192
+ # in the backend is returned.
193
+ #
194
+ # Recommendation: Set this value to a
195
+ # [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier).
196
+ #
197
+ # The value must contain only letters (a-z, A-Z), numbers (0-9),
198
+ # underscores (_), and hyphens (-). The maximum length is 40 characters.
199
+ #
200
+ # @yield [response, operation] Access the result along with the RPC operation
201
+ # @yieldparam response [::Gapic::Operation]
202
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
203
+ #
204
+ # @return [::Gapic::Operation]
205
+ #
206
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
207
+ #
208
+ def create_batch request, options = nil
209
+ raise ::ArgumentError, "request must be provided" if request.nil?
210
+
211
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dataproc::V1::CreateBatchRequest
212
+
213
+ # Converts hash and nil to an options object
214
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
215
+
216
+ # Customize the options with defaults
217
+ metadata = @config.rpcs.create_batch.metadata.to_h
218
+
219
+ # Set x-goog-api-client and x-goog-user-project headers
220
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
221
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
222
+ gapic_version: ::Google::Cloud::Dataproc::V1::VERSION
223
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
224
+
225
+ header_params = {
226
+ "parent" => request.parent
227
+ }
228
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
229
+ metadata[:"x-goog-request-params"] ||= request_params_header
230
+
231
+ options.apply_defaults timeout: @config.rpcs.create_batch.timeout,
232
+ metadata: metadata,
233
+ retry_policy: @config.rpcs.create_batch.retry_policy
234
+
235
+ options.apply_defaults timeout: @config.timeout,
236
+ metadata: @config.metadata,
237
+ retry_policy: @config.retry_policy
238
+
239
+ @batch_controller_stub.call_rpc :create_batch, request, options: options do |response, operation|
240
+ response = ::Gapic::Operation.new response, @operations_client, options: options
241
+ yield response, operation if block_given?
242
+ return response
243
+ end
244
+ rescue ::GRPC::BadStatus => e
245
+ raise ::Google::Cloud::Error.from_error(e)
246
+ end
247
+
248
+ ##
249
+ # Gets the batch workload resource representation.
250
+ #
251
+ # @overload get_batch(request, options = nil)
252
+ # Pass arguments to `get_batch` via a request object, either of type
253
+ # {::Google::Cloud::Dataproc::V1::GetBatchRequest} or an equivalent Hash.
254
+ #
255
+ # @param request [::Google::Cloud::Dataproc::V1::GetBatchRequest, ::Hash]
256
+ # A request object representing the call parameters. Required. To specify no
257
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
258
+ # @param options [::Gapic::CallOptions, ::Hash]
259
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
260
+ #
261
+ # @overload get_batch(name: nil)
262
+ # Pass arguments to `get_batch` via keyword arguments. Note that at
263
+ # least one keyword argument is required. To specify no parameters, or to keep all
264
+ # the default parameter values, pass an empty Hash as a request object (see above).
265
+ #
266
+ # @param name [::String]
267
+ # Required. The name of the batch to retrieve.
268
+ #
269
+ # @yield [response, operation] Access the result along with the RPC operation
270
+ # @yieldparam response [::Google::Cloud::Dataproc::V1::Batch]
271
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
272
+ #
273
+ # @return [::Google::Cloud::Dataproc::V1::Batch]
274
+ #
275
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
276
+ #
277
+ def get_batch request, options = nil
278
+ raise ::ArgumentError, "request must be provided" if request.nil?
279
+
280
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dataproc::V1::GetBatchRequest
281
+
282
+ # Converts hash and nil to an options object
283
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
284
+
285
+ # Customize the options with defaults
286
+ metadata = @config.rpcs.get_batch.metadata.to_h
287
+
288
+ # Set x-goog-api-client and x-goog-user-project headers
289
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
290
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
291
+ gapic_version: ::Google::Cloud::Dataproc::V1::VERSION
292
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
293
+
294
+ header_params = {
295
+ "name" => request.name
296
+ }
297
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
298
+ metadata[:"x-goog-request-params"] ||= request_params_header
299
+
300
+ options.apply_defaults timeout: @config.rpcs.get_batch.timeout,
301
+ metadata: metadata,
302
+ retry_policy: @config.rpcs.get_batch.retry_policy
303
+
304
+ options.apply_defaults timeout: @config.timeout,
305
+ metadata: @config.metadata,
306
+ retry_policy: @config.retry_policy
307
+
308
+ @batch_controller_stub.call_rpc :get_batch, request, options: options do |response, operation|
309
+ yield response, operation if block_given?
310
+ return response
311
+ end
312
+ rescue ::GRPC::BadStatus => e
313
+ raise ::Google::Cloud::Error.from_error(e)
314
+ end
315
+
316
+ ##
317
+ # Lists batch workloads.
318
+ #
319
+ # @overload list_batches(request, options = nil)
320
+ # Pass arguments to `list_batches` via a request object, either of type
321
+ # {::Google::Cloud::Dataproc::V1::ListBatchesRequest} or an equivalent Hash.
322
+ #
323
+ # @param request [::Google::Cloud::Dataproc::V1::ListBatchesRequest, ::Hash]
324
+ # A request object representing the call parameters. Required. To specify no
325
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
326
+ # @param options [::Gapic::CallOptions, ::Hash]
327
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
328
+ #
329
+ # @overload list_batches(parent: nil, page_size: nil, page_token: nil)
330
+ # Pass arguments to `list_batches` via keyword arguments. Note that at
331
+ # least one keyword argument is required. To specify no parameters, or to keep all
332
+ # the default parameter values, pass an empty Hash as a request object (see above).
333
+ #
334
+ # @param parent [::String]
335
+ # Required. The parent, which owns this collection of batches.
336
+ # @param page_size [::Integer]
337
+ # Optional. The maximum number of batches to return in each response.
338
+ # The service may return fewer than this value.
339
+ # The default page size is 20; the maximum page size is 1000.
340
+ # @param page_token [::String]
341
+ # Optional. A page token received from a previous `ListBatches` call.
342
+ # Provide this token to retrieve the subsequent page.
343
+ #
344
+ # @yield [response, operation] Access the result along with the RPC operation
345
+ # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Dataproc::V1::Batch>]
346
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
347
+ #
348
+ # @return [::Gapic::PagedEnumerable<::Google::Cloud::Dataproc::V1::Batch>]
349
+ #
350
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
351
+ #
352
+ def list_batches request, options = nil
353
+ raise ::ArgumentError, "request must be provided" if request.nil?
354
+
355
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dataproc::V1::ListBatchesRequest
356
+
357
+ # Converts hash and nil to an options object
358
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
359
+
360
+ # Customize the options with defaults
361
+ metadata = @config.rpcs.list_batches.metadata.to_h
362
+
363
+ # Set x-goog-api-client and x-goog-user-project headers
364
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
365
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
366
+ gapic_version: ::Google::Cloud::Dataproc::V1::VERSION
367
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
368
+
369
+ header_params = {
370
+ "parent" => request.parent
371
+ }
372
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
373
+ metadata[:"x-goog-request-params"] ||= request_params_header
374
+
375
+ options.apply_defaults timeout: @config.rpcs.list_batches.timeout,
376
+ metadata: metadata,
377
+ retry_policy: @config.rpcs.list_batches.retry_policy
378
+
379
+ options.apply_defaults timeout: @config.timeout,
380
+ metadata: @config.metadata,
381
+ retry_policy: @config.retry_policy
382
+
383
+ @batch_controller_stub.call_rpc :list_batches, request, options: options do |response, operation|
384
+ response = ::Gapic::PagedEnumerable.new @batch_controller_stub, :list_batches, request, response, operation, options
385
+ yield response, operation if block_given?
386
+ return response
387
+ end
388
+ rescue ::GRPC::BadStatus => e
389
+ raise ::Google::Cloud::Error.from_error(e)
390
+ end
391
+
392
+ ##
393
+ # Deletes the batch workload resource. If the batch is not in terminal state,
394
+ # the delete fails and the response returns `FAILED_PRECONDITION`.
395
+ #
396
+ # @overload delete_batch(request, options = nil)
397
+ # Pass arguments to `delete_batch` via a request object, either of type
398
+ # {::Google::Cloud::Dataproc::V1::DeleteBatchRequest} or an equivalent Hash.
399
+ #
400
+ # @param request [::Google::Cloud::Dataproc::V1::DeleteBatchRequest, ::Hash]
401
+ # A request object representing the call parameters. Required. To specify no
402
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
403
+ # @param options [::Gapic::CallOptions, ::Hash]
404
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
405
+ #
406
+ # @overload delete_batch(name: nil)
407
+ # Pass arguments to `delete_batch` via keyword arguments. Note that at
408
+ # least one keyword argument is required. To specify no parameters, or to keep all
409
+ # the default parameter values, pass an empty Hash as a request object (see above).
410
+ #
411
+ # @param name [::String]
412
+ # Required. The name of the batch resource to delete.
413
+ #
414
+ # @yield [response, operation] Access the result along with the RPC operation
415
+ # @yieldparam response [::Google::Protobuf::Empty]
416
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
417
+ #
418
+ # @return [::Google::Protobuf::Empty]
419
+ #
420
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
421
+ #
422
+ def delete_batch request, options = nil
423
+ raise ::ArgumentError, "request must be provided" if request.nil?
424
+
425
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dataproc::V1::DeleteBatchRequest
426
+
427
+ # Converts hash and nil to an options object
428
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
429
+
430
+ # Customize the options with defaults
431
+ metadata = @config.rpcs.delete_batch.metadata.to_h
432
+
433
+ # Set x-goog-api-client and x-goog-user-project headers
434
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
435
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
436
+ gapic_version: ::Google::Cloud::Dataproc::V1::VERSION
437
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
438
+
439
+ header_params = {
440
+ "name" => request.name
441
+ }
442
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
443
+ metadata[:"x-goog-request-params"] ||= request_params_header
444
+
445
+ options.apply_defaults timeout: @config.rpcs.delete_batch.timeout,
446
+ metadata: metadata,
447
+ retry_policy: @config.rpcs.delete_batch.retry_policy
448
+
449
+ options.apply_defaults timeout: @config.timeout,
450
+ metadata: @config.metadata,
451
+ retry_policy: @config.retry_policy
452
+
453
+ @batch_controller_stub.call_rpc :delete_batch, request, options: options do |response, operation|
454
+ yield response, operation if block_given?
455
+ return response
456
+ end
457
+ rescue ::GRPC::BadStatus => e
458
+ raise ::Google::Cloud::Error.from_error(e)
459
+ end
460
+
461
+ ##
462
+ # Configuration class for the BatchController API.
463
+ #
464
+ # This class represents the configuration for BatchController,
465
+ # providing control over timeouts, retry behavior, logging, transport
466
+ # parameters, and other low-level controls. Certain parameters can also be
467
+ # applied individually to specific RPCs. See
468
+ # {::Google::Cloud::Dataproc::V1::BatchController::Client::Configuration::Rpcs}
469
+ # for a list of RPCs that can be configured independently.
470
+ #
471
+ # Configuration can be applied globally to all clients, or to a single client
472
+ # on construction.
473
+ #
474
+ # @example
475
+ #
476
+ # # Modify the global config, setting the timeout for
477
+ # # create_batch to 20 seconds,
478
+ # # and all remaining timeouts to 10 seconds.
479
+ # ::Google::Cloud::Dataproc::V1::BatchController::Client.configure do |config|
480
+ # config.timeout = 10.0
481
+ # config.rpcs.create_batch.timeout = 20.0
482
+ # end
483
+ #
484
+ # # Apply the above configuration only to a new client.
485
+ # client = ::Google::Cloud::Dataproc::V1::BatchController::Client.new do |config|
486
+ # config.timeout = 10.0
487
+ # config.rpcs.create_batch.timeout = 20.0
488
+ # end
489
+ #
490
+ # @!attribute [rw] endpoint
491
+ # The hostname or hostname:port of the service endpoint.
492
+ # Defaults to `"dataproc.googleapis.com"`.
493
+ # @return [::String]
494
+ # @!attribute [rw] credentials
495
+ # Credentials to send with calls. You may provide any of the following types:
496
+ # * (`String`) The path to a service account key file in JSON format
497
+ # * (`Hash`) A service account key as a Hash
498
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
499
+ # (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
500
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
501
+ # (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
502
+ # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
503
+ # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
504
+ # * (`nil`) indicating no credentials
505
+ # @return [::Object]
506
+ # @!attribute [rw] scope
507
+ # The OAuth scopes
508
+ # @return [::Array<::String>]
509
+ # @!attribute [rw] lib_name
510
+ # The library name as recorded in instrumentation and logging
511
+ # @return [::String]
512
+ # @!attribute [rw] lib_version
513
+ # The library version as recorded in instrumentation and logging
514
+ # @return [::String]
515
+ # @!attribute [rw] channel_args
516
+ # Extra parameters passed to the gRPC channel. Note: this is ignored if a
517
+ # `GRPC::Core::Channel` object is provided as the credential.
518
+ # @return [::Hash]
519
+ # @!attribute [rw] interceptors
520
+ # An array of interceptors that are run before calls are executed.
521
+ # @return [::Array<::GRPC::ClientInterceptor>]
522
+ # @!attribute [rw] timeout
523
+ # The call timeout in seconds.
524
+ # @return [::Numeric]
525
+ # @!attribute [rw] metadata
526
+ # Additional gRPC headers to be sent with the call.
527
+ # @return [::Hash{::Symbol=>::String}]
528
+ # @!attribute [rw] retry_policy
529
+ # The retry policy. The value is a hash with the following keys:
530
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
531
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
532
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
533
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
534
+ # trigger a retry.
535
+ # @return [::Hash]
536
+ # @!attribute [rw] quota_project
537
+ # A separate project against which to charge quota.
538
+ # @return [::String]
539
+ #
540
+ class Configuration
541
+ extend ::Gapic::Config
542
+
543
+ config_attr :endpoint, "dataproc.googleapis.com", ::String
544
+ config_attr :credentials, nil do |value|
545
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
546
+ allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
547
+ allowed.any? { |klass| klass === value }
548
+ end
549
+ config_attr :scope, nil, ::String, ::Array, nil
550
+ config_attr :lib_name, nil, ::String, nil
551
+ config_attr :lib_version, nil, ::String, nil
552
+ config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
553
+ config_attr :interceptors, nil, ::Array, nil
554
+ config_attr :timeout, nil, ::Numeric, nil
555
+ config_attr :metadata, nil, ::Hash, nil
556
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
557
+ config_attr :quota_project, nil, ::String, nil
558
+
559
+ # @private
560
+ def initialize parent_config = nil
561
+ @parent_config = parent_config unless parent_config.nil?
562
+
563
+ yield self if block_given?
564
+ end
565
+
566
+ ##
567
+ # Configurations for individual RPCs
568
+ # @return [Rpcs]
569
+ #
570
+ def rpcs
571
+ @rpcs ||= begin
572
+ parent_rpcs = nil
573
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
574
+ Rpcs.new parent_rpcs
575
+ end
576
+ end
577
+
578
+ ##
579
+ # Configuration RPC class for the BatchController API.
580
+ #
581
+ # Includes fields providing the configuration for each RPC in this service.
582
+ # Each configuration object is of type `Gapic::Config::Method` and includes
583
+ # the following configuration fields:
584
+ #
585
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
586
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
587
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
588
+ # include the following keys:
589
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
590
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
591
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
592
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
593
+ # trigger a retry.
594
+ #
595
+ class Rpcs
596
+ ##
597
+ # RPC-specific configuration for `create_batch`
598
+ # @return [::Gapic::Config::Method]
599
+ #
600
+ attr_reader :create_batch
601
+ ##
602
+ # RPC-specific configuration for `get_batch`
603
+ # @return [::Gapic::Config::Method]
604
+ #
605
+ attr_reader :get_batch
606
+ ##
607
+ # RPC-specific configuration for `list_batches`
608
+ # @return [::Gapic::Config::Method]
609
+ #
610
+ attr_reader :list_batches
611
+ ##
612
+ # RPC-specific configuration for `delete_batch`
613
+ # @return [::Gapic::Config::Method]
614
+ #
615
+ attr_reader :delete_batch
616
+
617
+ # @private
618
+ def initialize parent_rpcs = nil
619
+ create_batch_config = parent_rpcs.create_batch if parent_rpcs.respond_to? :create_batch
620
+ @create_batch = ::Gapic::Config::Method.new create_batch_config
621
+ get_batch_config = parent_rpcs.get_batch if parent_rpcs.respond_to? :get_batch
622
+ @get_batch = ::Gapic::Config::Method.new get_batch_config
623
+ list_batches_config = parent_rpcs.list_batches if parent_rpcs.respond_to? :list_batches
624
+ @list_batches = ::Gapic::Config::Method.new list_batches_config
625
+ delete_batch_config = parent_rpcs.delete_batch if parent_rpcs.respond_to? :delete_batch
626
+ @delete_batch = ::Gapic::Config::Method.new delete_batch_config
627
+
628
+ yield self if block_given?
629
+ end
630
+ end
631
+ end
632
+ end
633
+ end
634
+ end
635
+ end
636
+ end
637
+ end
@@ -0,0 +1,51 @@
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 "googleauth"
20
+
21
+ module Google
22
+ module Cloud
23
+ module Dataproc
24
+ module V1
25
+ module BatchController
26
+ # Credentials for the BatchController API.
27
+ class Credentials < ::Google::Auth::Credentials
28
+ self.scope = [
29
+ "https://www.googleapis.com/auth/cloud-platform"
30
+ ]
31
+ self.env_vars = [
32
+ "DATAPROC_CREDENTIALS",
33
+ "DATAPROC_KEYFILE",
34
+ "GOOGLE_CLOUD_CREDENTIALS",
35
+ "GOOGLE_CLOUD_KEYFILE",
36
+ "GCLOUD_KEYFILE",
37
+ "DATAPROC_CREDENTIALS_JSON",
38
+ "DATAPROC_KEYFILE_JSON",
39
+ "GOOGLE_CLOUD_CREDENTIALS_JSON",
40
+ "GOOGLE_CLOUD_KEYFILE_JSON",
41
+ "GCLOUD_KEYFILE_JSON"
42
+ ]
43
+ self.paths = [
44
+ "~/.config/google_cloud/application_default_credentials.json"
45
+ ]
46
+ end
47
+ end
48
+ end
49
+ end
50
+ end
51
+ end