google-cloud-dataproc-v1 0.16.0 → 0.17.0

Sign up to get free protection for your applications and to get access to all the features.
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,1117 @@
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/clusters_pb"
21
+ require "google/cloud/dataproc/v1/cluster_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 ClusterController
29
+ module Rest
30
+ ##
31
+ # REST client for the ClusterController service.
32
+ #
33
+ # The ClusterControllerService provides methods to manage clusters
34
+ # of Compute Engine instances.
35
+ #
36
+ class Client
37
+ include Paths
38
+
39
+ # @private
40
+ attr_reader :cluster_controller_stub
41
+
42
+ ##
43
+ # Configure the ClusterController Client class.
44
+ #
45
+ # See {::Google::Cloud::Dataproc::V1::ClusterController::Rest::Client::Configuration}
46
+ # for a description of the configuration fields.
47
+ #
48
+ # @example
49
+ #
50
+ # # Modify the configuration for all ClusterController clients
51
+ # ::Google::Cloud::Dataproc::V1::ClusterController::Rest::Client.configure do |config|
52
+ # config.timeout = 10.0
53
+ # end
54
+ #
55
+ # @yield [config] Configure the Client client.
56
+ # @yieldparam config [Client::Configuration]
57
+ #
58
+ # @return [Client::Configuration]
59
+ #
60
+ def self.configure
61
+ @configure ||= begin
62
+ namespace = ["Google", "Cloud", "Dataproc", "V1"]
63
+ parent_config = while namespace.any?
64
+ parent_name = namespace.join "::"
65
+ parent_const = const_get parent_name
66
+ break parent_const.configure if parent_const.respond_to? :configure
67
+ namespace.pop
68
+ end
69
+ default_config = Client::Configuration.new parent_config
70
+
71
+ default_config.rpcs.create_cluster.timeout = 300.0
72
+ default_config.rpcs.create_cluster.retry_policy = {
73
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14]
74
+ }
75
+
76
+ default_config.rpcs.update_cluster.timeout = 300.0
77
+ default_config.rpcs.update_cluster.retry_policy = {
78
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14]
79
+ }
80
+
81
+ default_config.rpcs.delete_cluster.timeout = 300.0
82
+ default_config.rpcs.delete_cluster.retry_policy = {
83
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14]
84
+ }
85
+
86
+ default_config.rpcs.get_cluster.timeout = 300.0
87
+ default_config.rpcs.get_cluster.retry_policy = {
88
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [13, 4, 14]
89
+ }
90
+
91
+ default_config.rpcs.list_clusters.timeout = 300.0
92
+ default_config.rpcs.list_clusters.retry_policy = {
93
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [13, 4, 14]
94
+ }
95
+
96
+ default_config.rpcs.diagnose_cluster.timeout = 300.0
97
+ default_config.rpcs.diagnose_cluster.retry_policy = {
98
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14]
99
+ }
100
+
101
+ default_config
102
+ end
103
+ yield @configure if block_given?
104
+ @configure
105
+ end
106
+
107
+ ##
108
+ # Configure the ClusterController Client instance.
109
+ #
110
+ # The configuration is set to the derived mode, meaning that values can be changed,
111
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
112
+ # should be made on {Client.configure}.
113
+ #
114
+ # See {::Google::Cloud::Dataproc::V1::ClusterController::Rest::Client::Configuration}
115
+ # for a description of the configuration fields.
116
+ #
117
+ # @yield [config] Configure the Client client.
118
+ # @yieldparam config [Client::Configuration]
119
+ #
120
+ # @return [Client::Configuration]
121
+ #
122
+ def configure
123
+ yield @config if block_given?
124
+ @config
125
+ end
126
+
127
+ ##
128
+ # Create a new ClusterController REST client object.
129
+ #
130
+ # @example
131
+ #
132
+ # # Create a client using the default configuration
133
+ # client = ::Google::Cloud::Dataproc::V1::ClusterController::Rest::Client.new
134
+ #
135
+ # # Create a client using a custom configuration
136
+ # client = ::Google::Cloud::Dataproc::V1::ClusterController::Rest::Client.new do |config|
137
+ # config.timeout = 10.0
138
+ # end
139
+ #
140
+ # @yield [config] Configure the ClusterController client.
141
+ # @yieldparam config [Client::Configuration]
142
+ #
143
+ def initialize
144
+ # Create the configuration object
145
+ @config = Configuration.new Client.configure
146
+
147
+ # Yield the configuration if needed
148
+ yield @config if block_given?
149
+
150
+ # Create credentials
151
+ credentials = @config.credentials
152
+ # Use self-signed JWT if the endpoint is unchanged from default,
153
+ # but only if the default endpoint does not have a region prefix.
154
+ enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
155
+ !@config.endpoint.split(".").first.include?("-")
156
+ credentials ||= Credentials.default scope: @config.scope,
157
+ enable_self_signed_jwt: enable_self_signed_jwt
158
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
159
+ credentials = Credentials.new credentials, scope: @config.scope
160
+ end
161
+
162
+ @quota_project_id = @config.quota_project
163
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
164
+
165
+ @operations_client = ::Google::Cloud::Dataproc::V1::ClusterController::Rest::Operations.new do |config|
166
+ config.credentials = credentials
167
+ config.quota_project = @quota_project_id
168
+ config.endpoint = @config.endpoint
169
+ end
170
+
171
+ @iam_policy_client = Google::Iam::V1::IAMPolicy::Rest::Client.new do |config|
172
+ config.credentials = credentials
173
+ config.quota_project = @quota_project_id
174
+ config.endpoint = @config.endpoint
175
+ config.bindings_override = @config.bindings_override
176
+ end
177
+
178
+ @cluster_controller_stub = ::Google::Cloud::Dataproc::V1::ClusterController::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials
179
+ end
180
+
181
+ ##
182
+ # Get the associated client for long-running operations.
183
+ #
184
+ # @return [::Google::Cloud::Dataproc::V1::ClusterController::Rest::Operations]
185
+ #
186
+ attr_reader :operations_client
187
+
188
+ ##
189
+ # Get the associated client for mix-in of the IAMPolicy.
190
+ #
191
+ # @return [Google::Iam::V1::IAMPolicy::Rest::Client]
192
+ #
193
+ attr_reader :iam_policy_client
194
+
195
+ # Service calls
196
+
197
+ ##
198
+ # Creates a cluster in a project. The returned
199
+ # {::Google::Longrunning::Operation#metadata Operation.metadata} will be
200
+ # [ClusterOperationMetadata](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#clusteroperationmetadata).
201
+ #
202
+ # @overload create_cluster(request, options = nil)
203
+ # Pass arguments to `create_cluster` via a request object, either of type
204
+ # {::Google::Cloud::Dataproc::V1::CreateClusterRequest} or an equivalent Hash.
205
+ #
206
+ # @param request [::Google::Cloud::Dataproc::V1::CreateClusterRequest, ::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 create_cluster(project_id: nil, region: nil, cluster: nil, request_id: nil, action_on_failed_primary_workers: nil)
213
+ # Pass arguments to `create_cluster` 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 cluster
219
+ # belongs to.
220
+ # @param region [::String]
221
+ # Required. The Dataproc region in which to handle the request.
222
+ # @param cluster [::Google::Cloud::Dataproc::V1::Cluster, ::Hash]
223
+ # Required. The cluster to create.
224
+ # @param request_id [::String]
225
+ # Optional. A unique ID used to identify the request. If the server receives
226
+ # two
227
+ # [CreateClusterRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.CreateClusterRequest)s
228
+ # with the same id, then the second request will be ignored and the
229
+ # first {::Google::Longrunning::Operation google.longrunning.Operation} created
230
+ # and stored in the backend 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
+ # @param action_on_failed_primary_workers [::Google::Cloud::Dataproc::V1::FailureAction]
238
+ # Optional. Failure action when primary worker creation fails.
239
+ # @yield [result, operation] Access the result along with the TransportOperation object
240
+ # @yieldparam result [::Gapic::Operation]
241
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
242
+ #
243
+ # @return [::Gapic::Operation]
244
+ #
245
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
246
+ def create_cluster request, options = nil
247
+ raise ::ArgumentError, "request must be provided" if request.nil?
248
+
249
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dataproc::V1::CreateClusterRequest
250
+
251
+ # Converts hash and nil to an options object
252
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
253
+
254
+ # Customize the options with defaults
255
+ call_metadata = @config.rpcs.create_cluster.metadata.to_h
256
+
257
+ # Set x-goog-api-client and x-goog-user-project headers
258
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
259
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
260
+ gapic_version: ::Google::Cloud::Dataproc::V1::VERSION,
261
+ transports_version_send: [:rest]
262
+
263
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
264
+
265
+ options.apply_defaults timeout: @config.rpcs.create_cluster.timeout,
266
+ metadata: call_metadata,
267
+ retry_policy: @config.rpcs.create_cluster.retry_policy
268
+
269
+ options.apply_defaults timeout: @config.timeout,
270
+ metadata: @config.metadata,
271
+ retry_policy: @config.retry_policy
272
+
273
+ @cluster_controller_stub.create_cluster request, options do |result, operation|
274
+ result = ::Gapic::Operation.new result, @operations_client, options: options
275
+ yield result, operation if block_given?
276
+ return result
277
+ end
278
+ rescue ::Gapic::Rest::Error => e
279
+ raise ::Google::Cloud::Error.from_error(e)
280
+ end
281
+
282
+ ##
283
+ # Updates a cluster in a project. The returned
284
+ # {::Google::Longrunning::Operation#metadata Operation.metadata} will be
285
+ # [ClusterOperationMetadata](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#clusteroperationmetadata).
286
+ # The cluster must be in a
287
+ # {::Google::Cloud::Dataproc::V1::ClusterStatus::State `RUNNING`} state or an error
288
+ # is returned.
289
+ #
290
+ # @overload update_cluster(request, options = nil)
291
+ # Pass arguments to `update_cluster` via a request object, either of type
292
+ # {::Google::Cloud::Dataproc::V1::UpdateClusterRequest} or an equivalent Hash.
293
+ #
294
+ # @param request [::Google::Cloud::Dataproc::V1::UpdateClusterRequest, ::Hash]
295
+ # A request object representing the call parameters. Required. To specify no
296
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
297
+ # @param options [::Gapic::CallOptions, ::Hash]
298
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
299
+ #
300
+ # @overload update_cluster(project_id: nil, region: nil, cluster_name: nil, cluster: nil, graceful_decommission_timeout: nil, update_mask: nil, request_id: nil)
301
+ # Pass arguments to `update_cluster` via keyword arguments. Note that at
302
+ # least one keyword argument is required. To specify no parameters, or to keep all
303
+ # the default parameter values, pass an empty Hash as a request object (see above).
304
+ #
305
+ # @param project_id [::String]
306
+ # Required. The ID of the Google Cloud Platform project the
307
+ # cluster belongs to.
308
+ # @param region [::String]
309
+ # Required. The Dataproc region in which to handle the request.
310
+ # @param cluster_name [::String]
311
+ # Required. The cluster name.
312
+ # @param cluster [::Google::Cloud::Dataproc::V1::Cluster, ::Hash]
313
+ # Required. The changes to the cluster.
314
+ # @param graceful_decommission_timeout [::Google::Protobuf::Duration, ::Hash]
315
+ # Optional. Timeout for graceful YARN decommissioning. Graceful
316
+ # decommissioning allows removing nodes from the cluster without
317
+ # interrupting jobs in progress. Timeout specifies how long to wait for jobs
318
+ # in progress to finish before forcefully removing nodes (and potentially
319
+ # interrupting jobs). Default timeout is 0 (for forceful decommission), and
320
+ # the maximum allowed timeout is 1 day. (see JSON representation of
321
+ # [Duration](https://developers.google.com/protocol-buffers/docs/proto3#json)).
322
+ #
323
+ # Only supported on Dataproc image versions 1.2 and higher.
324
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
325
+ # Required. Specifies the path, relative to `Cluster`, of
326
+ # the field to update. For example, to change the number of workers
327
+ # in a cluster to 5, the `update_mask` parameter would be
328
+ # specified as `config.worker_config.num_instances`,
329
+ # and the `PATCH` request body would specify the new value, as follows:
330
+ #
331
+ # {
332
+ # "config":{
333
+ # "workerConfig":{
334
+ # "numInstances":"5"
335
+ # }
336
+ # }
337
+ # }
338
+ # Similarly, to change the number of preemptible workers in a cluster to 5,
339
+ # the `update_mask` parameter would be
340
+ # `config.secondary_worker_config.num_instances`, and the `PATCH` request
341
+ # body would be set as follows:
342
+ #
343
+ # {
344
+ # "config":{
345
+ # "secondaryWorkerConfig":{
346
+ # "numInstances":"5"
347
+ # }
348
+ # }
349
+ # }
350
+ # <strong>Note:</strong> Currently, only the following fields can be updated:
351
+ #
352
+ # <table>
353
+ # <tbody>
354
+ # <tr>
355
+ # <td><strong>Mask</strong></td>
356
+ # <td><strong>Purpose</strong></td>
357
+ # </tr>
358
+ # <tr>
359
+ # <td><strong><em>labels</em></strong></td>
360
+ # <td>Update labels</td>
361
+ # </tr>
362
+ # <tr>
363
+ # <td><strong><em>config.worker_config.num_instances</em></strong></td>
364
+ # <td>Resize primary worker group</td>
365
+ # </tr>
366
+ # <tr>
367
+ # <td><strong><em>config.secondary_worker_config.num_instances</em></strong></td>
368
+ # <td>Resize secondary worker group</td>
369
+ # </tr>
370
+ # <tr>
371
+ # <td>config.autoscaling_config.policy_uri</td><td>Use, stop using, or
372
+ # change autoscaling policies</td>
373
+ # </tr>
374
+ # </tbody>
375
+ # </table>
376
+ # @param request_id [::String]
377
+ # Optional. A unique ID used to identify the request. If the server
378
+ # receives two
379
+ # [UpdateClusterRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.UpdateClusterRequest)s
380
+ # with the same id, then the second request will be ignored and the
381
+ # first {::Google::Longrunning::Operation google.longrunning.Operation} created
382
+ # and stored in the backend is returned.
383
+ #
384
+ # It is recommended to always set this value to a
385
+ # [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier).
386
+ #
387
+ # The ID must contain only letters (a-z, A-Z), numbers (0-9),
388
+ # underscores (_), and hyphens (-). The maximum length is 40 characters.
389
+ # @yield [result, operation] Access the result along with the TransportOperation object
390
+ # @yieldparam result [::Gapic::Operation]
391
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
392
+ #
393
+ # @return [::Gapic::Operation]
394
+ #
395
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
396
+ def update_cluster request, options = nil
397
+ raise ::ArgumentError, "request must be provided" if request.nil?
398
+
399
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dataproc::V1::UpdateClusterRequest
400
+
401
+ # Converts hash and nil to an options object
402
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
403
+
404
+ # Customize the options with defaults
405
+ call_metadata = @config.rpcs.update_cluster.metadata.to_h
406
+
407
+ # Set x-goog-api-client and x-goog-user-project headers
408
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
409
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
410
+ gapic_version: ::Google::Cloud::Dataproc::V1::VERSION,
411
+ transports_version_send: [:rest]
412
+
413
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
414
+
415
+ options.apply_defaults timeout: @config.rpcs.update_cluster.timeout,
416
+ metadata: call_metadata,
417
+ retry_policy: @config.rpcs.update_cluster.retry_policy
418
+
419
+ options.apply_defaults timeout: @config.timeout,
420
+ metadata: @config.metadata,
421
+ retry_policy: @config.retry_policy
422
+
423
+ @cluster_controller_stub.update_cluster request, options do |result, operation|
424
+ result = ::Gapic::Operation.new result, @operations_client, options: options
425
+ yield result, operation if block_given?
426
+ return result
427
+ end
428
+ rescue ::Gapic::Rest::Error => e
429
+ raise ::Google::Cloud::Error.from_error(e)
430
+ end
431
+
432
+ ##
433
+ # Stops a cluster in a project.
434
+ #
435
+ # @overload stop_cluster(request, options = nil)
436
+ # Pass arguments to `stop_cluster` via a request object, either of type
437
+ # {::Google::Cloud::Dataproc::V1::StopClusterRequest} or an equivalent Hash.
438
+ #
439
+ # @param request [::Google::Cloud::Dataproc::V1::StopClusterRequest, ::Hash]
440
+ # A request object representing the call parameters. Required. To specify no
441
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
442
+ # @param options [::Gapic::CallOptions, ::Hash]
443
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
444
+ #
445
+ # @overload stop_cluster(project_id: nil, region: nil, cluster_name: nil, cluster_uuid: nil, request_id: nil)
446
+ # Pass arguments to `stop_cluster` via keyword arguments. Note that at
447
+ # least one keyword argument is required. To specify no parameters, or to keep all
448
+ # the default parameter values, pass an empty Hash as a request object (see above).
449
+ #
450
+ # @param project_id [::String]
451
+ # Required. The ID of the Google Cloud Platform project the
452
+ # cluster belongs to.
453
+ # @param region [::String]
454
+ # Required. The Dataproc region in which to handle the request.
455
+ # @param cluster_name [::String]
456
+ # Required. The cluster name.
457
+ # @param cluster_uuid [::String]
458
+ # Optional. Specifying the `cluster_uuid` means the RPC will fail
459
+ # (with error NOT_FOUND) if a cluster with the specified UUID does not exist.
460
+ # @param request_id [::String]
461
+ # Optional. A unique ID used to identify the request. If the server
462
+ # receives two
463
+ # [StopClusterRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.StopClusterRequest)s
464
+ # with the same id, then the second request will be ignored and the
465
+ # first {::Google::Longrunning::Operation google.longrunning.Operation} created
466
+ # and stored in the backend is returned.
467
+ #
468
+ # Recommendation: Set this value to a
469
+ # [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier).
470
+ #
471
+ # The ID must contain only letters (a-z, A-Z), numbers (0-9),
472
+ # underscores (_), and hyphens (-). The maximum length is 40 characters.
473
+ # @yield [result, operation] Access the result along with the TransportOperation object
474
+ # @yieldparam result [::Gapic::Operation]
475
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
476
+ #
477
+ # @return [::Gapic::Operation]
478
+ #
479
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
480
+ def stop_cluster request, options = nil
481
+ raise ::ArgumentError, "request must be provided" if request.nil?
482
+
483
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dataproc::V1::StopClusterRequest
484
+
485
+ # Converts hash and nil to an options object
486
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
487
+
488
+ # Customize the options with defaults
489
+ call_metadata = @config.rpcs.stop_cluster.metadata.to_h
490
+
491
+ # Set x-goog-api-client and x-goog-user-project headers
492
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
493
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
494
+ gapic_version: ::Google::Cloud::Dataproc::V1::VERSION,
495
+ transports_version_send: [:rest]
496
+
497
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
498
+
499
+ options.apply_defaults timeout: @config.rpcs.stop_cluster.timeout,
500
+ metadata: call_metadata,
501
+ retry_policy: @config.rpcs.stop_cluster.retry_policy
502
+
503
+ options.apply_defaults timeout: @config.timeout,
504
+ metadata: @config.metadata,
505
+ retry_policy: @config.retry_policy
506
+
507
+ @cluster_controller_stub.stop_cluster request, options do |result, operation|
508
+ result = ::Gapic::Operation.new result, @operations_client, options: options
509
+ yield result, operation if block_given?
510
+ return result
511
+ end
512
+ rescue ::Gapic::Rest::Error => e
513
+ raise ::Google::Cloud::Error.from_error(e)
514
+ end
515
+
516
+ ##
517
+ # Starts a cluster in a project.
518
+ #
519
+ # @overload start_cluster(request, options = nil)
520
+ # Pass arguments to `start_cluster` via a request object, either of type
521
+ # {::Google::Cloud::Dataproc::V1::StartClusterRequest} or an equivalent Hash.
522
+ #
523
+ # @param request [::Google::Cloud::Dataproc::V1::StartClusterRequest, ::Hash]
524
+ # A request object representing the call parameters. Required. To specify no
525
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
526
+ # @param options [::Gapic::CallOptions, ::Hash]
527
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
528
+ #
529
+ # @overload start_cluster(project_id: nil, region: nil, cluster_name: nil, cluster_uuid: nil, request_id: nil)
530
+ # Pass arguments to `start_cluster` via keyword arguments. Note that at
531
+ # least one keyword argument is required. To specify no parameters, or to keep all
532
+ # the default parameter values, pass an empty Hash as a request object (see above).
533
+ #
534
+ # @param project_id [::String]
535
+ # Required. The ID of the Google Cloud Platform project the
536
+ # cluster belongs to.
537
+ # @param region [::String]
538
+ # Required. The Dataproc region in which to handle the request.
539
+ # @param cluster_name [::String]
540
+ # Required. The cluster name.
541
+ # @param cluster_uuid [::String]
542
+ # Optional. Specifying the `cluster_uuid` means the RPC will fail
543
+ # (with error NOT_FOUND) if a cluster with the specified UUID does not exist.
544
+ # @param request_id [::String]
545
+ # Optional. A unique ID used to identify the request. If the server
546
+ # receives two
547
+ # [StartClusterRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.StartClusterRequest)s
548
+ # with the same id, then the second request will be ignored and the
549
+ # first {::Google::Longrunning::Operation google.longrunning.Operation} created
550
+ # and stored in the backend is returned.
551
+ #
552
+ # Recommendation: Set this value to a
553
+ # [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier).
554
+ #
555
+ # The ID must contain only letters (a-z, A-Z), numbers (0-9),
556
+ # underscores (_), and hyphens (-). The maximum length is 40 characters.
557
+ # @yield [result, operation] Access the result along with the TransportOperation object
558
+ # @yieldparam result [::Gapic::Operation]
559
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
560
+ #
561
+ # @return [::Gapic::Operation]
562
+ #
563
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
564
+ def start_cluster request, options = nil
565
+ raise ::ArgumentError, "request must be provided" if request.nil?
566
+
567
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dataproc::V1::StartClusterRequest
568
+
569
+ # Converts hash and nil to an options object
570
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
571
+
572
+ # Customize the options with defaults
573
+ call_metadata = @config.rpcs.start_cluster.metadata.to_h
574
+
575
+ # Set x-goog-api-client and x-goog-user-project headers
576
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
577
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
578
+ gapic_version: ::Google::Cloud::Dataproc::V1::VERSION,
579
+ transports_version_send: [:rest]
580
+
581
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
582
+
583
+ options.apply_defaults timeout: @config.rpcs.start_cluster.timeout,
584
+ metadata: call_metadata,
585
+ retry_policy: @config.rpcs.start_cluster.retry_policy
586
+
587
+ options.apply_defaults timeout: @config.timeout,
588
+ metadata: @config.metadata,
589
+ retry_policy: @config.retry_policy
590
+
591
+ @cluster_controller_stub.start_cluster request, options do |result, operation|
592
+ result = ::Gapic::Operation.new result, @operations_client, options: options
593
+ yield result, operation if block_given?
594
+ return result
595
+ end
596
+ rescue ::Gapic::Rest::Error => e
597
+ raise ::Google::Cloud::Error.from_error(e)
598
+ end
599
+
600
+ ##
601
+ # Deletes a cluster in a project. The returned
602
+ # {::Google::Longrunning::Operation#metadata Operation.metadata} will be
603
+ # [ClusterOperationMetadata](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#clusteroperationmetadata).
604
+ #
605
+ # @overload delete_cluster(request, options = nil)
606
+ # Pass arguments to `delete_cluster` via a request object, either of type
607
+ # {::Google::Cloud::Dataproc::V1::DeleteClusterRequest} or an equivalent Hash.
608
+ #
609
+ # @param request [::Google::Cloud::Dataproc::V1::DeleteClusterRequest, ::Hash]
610
+ # A request object representing the call parameters. Required. To specify no
611
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
612
+ # @param options [::Gapic::CallOptions, ::Hash]
613
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
614
+ #
615
+ # @overload delete_cluster(project_id: nil, region: nil, cluster_name: nil, cluster_uuid: nil, request_id: nil)
616
+ # Pass arguments to `delete_cluster` via keyword arguments. Note that at
617
+ # least one keyword argument is required. To specify no parameters, or to keep all
618
+ # the default parameter values, pass an empty Hash as a request object (see above).
619
+ #
620
+ # @param project_id [::String]
621
+ # Required. The ID of the Google Cloud Platform project that the cluster
622
+ # belongs to.
623
+ # @param region [::String]
624
+ # Required. The Dataproc region in which to handle the request.
625
+ # @param cluster_name [::String]
626
+ # Required. The cluster name.
627
+ # @param cluster_uuid [::String]
628
+ # Optional. Specifying the `cluster_uuid` means the RPC should fail
629
+ # (with error NOT_FOUND) if cluster with specified UUID does not exist.
630
+ # @param request_id [::String]
631
+ # Optional. A unique ID used to identify the request. If the server
632
+ # receives two
633
+ # [DeleteClusterRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.DeleteClusterRequest)s
634
+ # with the same id, then the second request will be ignored and the
635
+ # first {::Google::Longrunning::Operation google.longrunning.Operation} created
636
+ # and stored in the backend is returned.
637
+ #
638
+ # It is recommended to always set this value to a
639
+ # [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier).
640
+ #
641
+ # The ID must contain only letters (a-z, A-Z), numbers (0-9),
642
+ # underscores (_), and hyphens (-). The maximum length is 40 characters.
643
+ # @yield [result, operation] Access the result along with the TransportOperation object
644
+ # @yieldparam result [::Gapic::Operation]
645
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
646
+ #
647
+ # @return [::Gapic::Operation]
648
+ #
649
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
650
+ def delete_cluster request, options = nil
651
+ raise ::ArgumentError, "request must be provided" if request.nil?
652
+
653
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dataproc::V1::DeleteClusterRequest
654
+
655
+ # Converts hash and nil to an options object
656
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
657
+
658
+ # Customize the options with defaults
659
+ call_metadata = @config.rpcs.delete_cluster.metadata.to_h
660
+
661
+ # Set x-goog-api-client and x-goog-user-project headers
662
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
663
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
664
+ gapic_version: ::Google::Cloud::Dataproc::V1::VERSION,
665
+ transports_version_send: [:rest]
666
+
667
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
668
+
669
+ options.apply_defaults timeout: @config.rpcs.delete_cluster.timeout,
670
+ metadata: call_metadata,
671
+ retry_policy: @config.rpcs.delete_cluster.retry_policy
672
+
673
+ options.apply_defaults timeout: @config.timeout,
674
+ metadata: @config.metadata,
675
+ retry_policy: @config.retry_policy
676
+
677
+ @cluster_controller_stub.delete_cluster request, options do |result, operation|
678
+ result = ::Gapic::Operation.new result, @operations_client, options: options
679
+ yield result, operation if block_given?
680
+ return result
681
+ end
682
+ rescue ::Gapic::Rest::Error => e
683
+ raise ::Google::Cloud::Error.from_error(e)
684
+ end
685
+
686
+ ##
687
+ # Gets the resource representation for a cluster in a project.
688
+ #
689
+ # @overload get_cluster(request, options = nil)
690
+ # Pass arguments to `get_cluster` via a request object, either of type
691
+ # {::Google::Cloud::Dataproc::V1::GetClusterRequest} or an equivalent Hash.
692
+ #
693
+ # @param request [::Google::Cloud::Dataproc::V1::GetClusterRequest, ::Hash]
694
+ # A request object representing the call parameters. Required. To specify no
695
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
696
+ # @param options [::Gapic::CallOptions, ::Hash]
697
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
698
+ #
699
+ # @overload get_cluster(project_id: nil, region: nil, cluster_name: nil)
700
+ # Pass arguments to `get_cluster` via keyword arguments. Note that at
701
+ # least one keyword argument is required. To specify no parameters, or to keep all
702
+ # the default parameter values, pass an empty Hash as a request object (see above).
703
+ #
704
+ # @param project_id [::String]
705
+ # Required. The ID of the Google Cloud Platform project that the cluster
706
+ # belongs to.
707
+ # @param region [::String]
708
+ # Required. The Dataproc region in which to handle the request.
709
+ # @param cluster_name [::String]
710
+ # Required. The cluster name.
711
+ # @yield [result, operation] Access the result along with the TransportOperation object
712
+ # @yieldparam result [::Google::Cloud::Dataproc::V1::Cluster]
713
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
714
+ #
715
+ # @return [::Google::Cloud::Dataproc::V1::Cluster]
716
+ #
717
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
718
+ def get_cluster request, options = nil
719
+ raise ::ArgumentError, "request must be provided" if request.nil?
720
+
721
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dataproc::V1::GetClusterRequest
722
+
723
+ # Converts hash and nil to an options object
724
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
725
+
726
+ # Customize the options with defaults
727
+ call_metadata = @config.rpcs.get_cluster.metadata.to_h
728
+
729
+ # Set x-goog-api-client and x-goog-user-project headers
730
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
731
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
732
+ gapic_version: ::Google::Cloud::Dataproc::V1::VERSION,
733
+ transports_version_send: [:rest]
734
+
735
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
736
+
737
+ options.apply_defaults timeout: @config.rpcs.get_cluster.timeout,
738
+ metadata: call_metadata,
739
+ retry_policy: @config.rpcs.get_cluster.retry_policy
740
+
741
+ options.apply_defaults timeout: @config.timeout,
742
+ metadata: @config.metadata,
743
+ retry_policy: @config.retry_policy
744
+
745
+ @cluster_controller_stub.get_cluster request, options do |result, operation|
746
+ yield result, operation if block_given?
747
+ return result
748
+ end
749
+ rescue ::Gapic::Rest::Error => e
750
+ raise ::Google::Cloud::Error.from_error(e)
751
+ end
752
+
753
+ ##
754
+ # Lists all regions/\\{region}/clusters in a project alphabetically.
755
+ #
756
+ # @overload list_clusters(request, options = nil)
757
+ # Pass arguments to `list_clusters` via a request object, either of type
758
+ # {::Google::Cloud::Dataproc::V1::ListClustersRequest} or an equivalent Hash.
759
+ #
760
+ # @param request [::Google::Cloud::Dataproc::V1::ListClustersRequest, ::Hash]
761
+ # A request object representing the call parameters. Required. To specify no
762
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
763
+ # @param options [::Gapic::CallOptions, ::Hash]
764
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
765
+ #
766
+ # @overload list_clusters(project_id: nil, region: nil, filter: nil, page_size: nil, page_token: nil)
767
+ # Pass arguments to `list_clusters` via keyword arguments. Note that at
768
+ # least one keyword argument is required. To specify no parameters, or to keep all
769
+ # the default parameter values, pass an empty Hash as a request object (see above).
770
+ #
771
+ # @param project_id [::String]
772
+ # Required. The ID of the Google Cloud Platform project that the cluster
773
+ # belongs to.
774
+ # @param region [::String]
775
+ # Required. The Dataproc region in which to handle the request.
776
+ # @param filter [::String]
777
+ # Optional. A filter constraining the clusters to list. Filters are
778
+ # case-sensitive and have the following syntax:
779
+ #
780
+ # field = value [AND [field = value]] ...
781
+ #
782
+ # where **field** is one of `status.state`, `clusterName`, or `labels.[KEY]`,
783
+ # and `[KEY]` is a label key. **value** can be `*` to match all values.
784
+ # `status.state` can be one of the following: `ACTIVE`, `INACTIVE`,
785
+ # `CREATING`, `RUNNING`, `ERROR`, `DELETING`, or `UPDATING`. `ACTIVE`
786
+ # contains the `CREATING`, `UPDATING`, and `RUNNING` states. `INACTIVE`
787
+ # contains the `DELETING` and `ERROR` states.
788
+ # `clusterName` is the name of the cluster provided at creation time.
789
+ # Only the logical `AND` operator is supported; space-separated items are
790
+ # treated as having an implicit `AND` operator.
791
+ #
792
+ # Example filter:
793
+ #
794
+ # status.state = ACTIVE AND clusterName = mycluster
795
+ # AND labels.env = staging AND labels.starred = *
796
+ # @param page_size [::Integer]
797
+ # Optional. The standard List page size.
798
+ # @param page_token [::String]
799
+ # Optional. The standard List page token.
800
+ # @yield [result, operation] Access the result along with the TransportOperation object
801
+ # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Dataproc::V1::Cluster>]
802
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
803
+ #
804
+ # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Dataproc::V1::Cluster>]
805
+ #
806
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
807
+ def list_clusters request, options = nil
808
+ raise ::ArgumentError, "request must be provided" if request.nil?
809
+
810
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dataproc::V1::ListClustersRequest
811
+
812
+ # Converts hash and nil to an options object
813
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
814
+
815
+ # Customize the options with defaults
816
+ call_metadata = @config.rpcs.list_clusters.metadata.to_h
817
+
818
+ # Set x-goog-api-client and x-goog-user-project headers
819
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
820
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
821
+ gapic_version: ::Google::Cloud::Dataproc::V1::VERSION,
822
+ transports_version_send: [:rest]
823
+
824
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
825
+
826
+ options.apply_defaults timeout: @config.rpcs.list_clusters.timeout,
827
+ metadata: call_metadata,
828
+ retry_policy: @config.rpcs.list_clusters.retry_policy
829
+
830
+ options.apply_defaults timeout: @config.timeout,
831
+ metadata: @config.metadata,
832
+ retry_policy: @config.retry_policy
833
+
834
+ @cluster_controller_stub.list_clusters request, options do |result, operation|
835
+ result = ::Gapic::Rest::PagedEnumerable.new @cluster_controller_stub, :list_clusters, "clusters", request, result, options
836
+ yield result, operation if block_given?
837
+ return result
838
+ end
839
+ rescue ::Gapic::Rest::Error => e
840
+ raise ::Google::Cloud::Error.from_error(e)
841
+ end
842
+
843
+ ##
844
+ # Gets cluster diagnostic information. The returned
845
+ # {::Google::Longrunning::Operation#metadata Operation.metadata} will be
846
+ # [ClusterOperationMetadata](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#clusteroperationmetadata).
847
+ # After the operation completes,
848
+ # {::Google::Longrunning::Operation#response Operation.response}
849
+ # contains
850
+ # [DiagnoseClusterResults](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#diagnoseclusterresults).
851
+ #
852
+ # @overload diagnose_cluster(request, options = nil)
853
+ # Pass arguments to `diagnose_cluster` via a request object, either of type
854
+ # {::Google::Cloud::Dataproc::V1::DiagnoseClusterRequest} or an equivalent Hash.
855
+ #
856
+ # @param request [::Google::Cloud::Dataproc::V1::DiagnoseClusterRequest, ::Hash]
857
+ # A request object representing the call parameters. Required. To specify no
858
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
859
+ # @param options [::Gapic::CallOptions, ::Hash]
860
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
861
+ #
862
+ # @overload diagnose_cluster(project_id: nil, region: nil, cluster_name: nil)
863
+ # Pass arguments to `diagnose_cluster` via keyword arguments. Note that at
864
+ # least one keyword argument is required. To specify no parameters, or to keep all
865
+ # the default parameter values, pass an empty Hash as a request object (see above).
866
+ #
867
+ # @param project_id [::String]
868
+ # Required. The ID of the Google Cloud Platform project that the cluster
869
+ # belongs to.
870
+ # @param region [::String]
871
+ # Required. The Dataproc region in which to handle the request.
872
+ # @param cluster_name [::String]
873
+ # Required. The cluster name.
874
+ # @yield [result, operation] Access the result along with the TransportOperation object
875
+ # @yieldparam result [::Gapic::Operation]
876
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
877
+ #
878
+ # @return [::Gapic::Operation]
879
+ #
880
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
881
+ def diagnose_cluster request, options = nil
882
+ raise ::ArgumentError, "request must be provided" if request.nil?
883
+
884
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dataproc::V1::DiagnoseClusterRequest
885
+
886
+ # Converts hash and nil to an options object
887
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
888
+
889
+ # Customize the options with defaults
890
+ call_metadata = @config.rpcs.diagnose_cluster.metadata.to_h
891
+
892
+ # Set x-goog-api-client and x-goog-user-project headers
893
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
894
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
895
+ gapic_version: ::Google::Cloud::Dataproc::V1::VERSION,
896
+ transports_version_send: [:rest]
897
+
898
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
899
+
900
+ options.apply_defaults timeout: @config.rpcs.diagnose_cluster.timeout,
901
+ metadata: call_metadata,
902
+ retry_policy: @config.rpcs.diagnose_cluster.retry_policy
903
+
904
+ options.apply_defaults timeout: @config.timeout,
905
+ metadata: @config.metadata,
906
+ retry_policy: @config.retry_policy
907
+
908
+ @cluster_controller_stub.diagnose_cluster request, options do |result, operation|
909
+ result = ::Gapic::Operation.new result, @operations_client, options: options
910
+ yield result, operation if block_given?
911
+ return result
912
+ end
913
+ rescue ::Gapic::Rest::Error => e
914
+ raise ::Google::Cloud::Error.from_error(e)
915
+ end
916
+
917
+ ##
918
+ # Configuration class for the ClusterController REST API.
919
+ #
920
+ # This class represents the configuration for ClusterController REST,
921
+ # providing control over timeouts, retry behavior, logging, transport
922
+ # parameters, and other low-level controls. Certain parameters can also be
923
+ # applied individually to specific RPCs. See
924
+ # {::Google::Cloud::Dataproc::V1::ClusterController::Rest::Client::Configuration::Rpcs}
925
+ # for a list of RPCs that can be configured independently.
926
+ #
927
+ # Configuration can be applied globally to all clients, or to a single client
928
+ # on construction.
929
+ #
930
+ # @example
931
+ #
932
+ # # Modify the global config, setting the timeout for
933
+ # # create_cluster to 20 seconds,
934
+ # # and all remaining timeouts to 10 seconds.
935
+ # ::Google::Cloud::Dataproc::V1::ClusterController::Rest::Client.configure do |config|
936
+ # config.timeout = 10.0
937
+ # config.rpcs.create_cluster.timeout = 20.0
938
+ # end
939
+ #
940
+ # # Apply the above configuration only to a new client.
941
+ # client = ::Google::Cloud::Dataproc::V1::ClusterController::Rest::Client.new do |config|
942
+ # config.timeout = 10.0
943
+ # config.rpcs.create_cluster.timeout = 20.0
944
+ # end
945
+ #
946
+ # @!attribute [rw] endpoint
947
+ # The hostname or hostname:port of the service endpoint.
948
+ # Defaults to `"dataproc.googleapis.com"`.
949
+ # @return [::String]
950
+ # @!attribute [rw] credentials
951
+ # Credentials to send with calls. You may provide any of the following types:
952
+ # * (`String`) The path to a service account key file in JSON format
953
+ # * (`Hash`) A service account key as a Hash
954
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
955
+ # (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
956
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
957
+ # (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
958
+ # * (`nil`) indicating no credentials
959
+ # @return [::Object]
960
+ # @!attribute [rw] scope
961
+ # The OAuth scopes
962
+ # @return [::Array<::String>]
963
+ # @!attribute [rw] lib_name
964
+ # The library name as recorded in instrumentation and logging
965
+ # @return [::String]
966
+ # @!attribute [rw] lib_version
967
+ # The library version as recorded in instrumentation and logging
968
+ # @return [::String]
969
+ # @!attribute [rw] timeout
970
+ # The call timeout in seconds.
971
+ # @return [::Numeric]
972
+ # @!attribute [rw] metadata
973
+ # Additional headers to be sent with the call.
974
+ # @return [::Hash{::Symbol=>::String}]
975
+ # @!attribute [rw] retry_policy
976
+ # The retry policy. The value is a hash with the following keys:
977
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
978
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
979
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
980
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
981
+ # trigger a retry.
982
+ # @return [::Hash]
983
+ # @!attribute [rw] quota_project
984
+ # A separate project against which to charge quota.
985
+ # @return [::String]
986
+ #
987
+ class Configuration
988
+ extend ::Gapic::Config
989
+
990
+ config_attr :endpoint, "dataproc.googleapis.com", ::String
991
+ config_attr :credentials, nil do |value|
992
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
993
+ allowed.any? { |klass| klass === value }
994
+ end
995
+ config_attr :scope, nil, ::String, ::Array, nil
996
+ config_attr :lib_name, nil, ::String, nil
997
+ config_attr :lib_version, nil, ::String, nil
998
+ config_attr :timeout, nil, ::Numeric, nil
999
+ config_attr :metadata, nil, ::Hash, nil
1000
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
1001
+ config_attr :quota_project, nil, ::String, nil
1002
+
1003
+ # @private
1004
+ # Overrides for http bindings for the RPCs of this service
1005
+ # are only used when this service is used as mixin, and only
1006
+ # by the host service.
1007
+ # @return [::Hash{::Symbol=>::Array<::Gapic::Rest::GrpcTranscoder::HttpBinding>}]
1008
+ config_attr :bindings_override, {}, ::Hash, nil
1009
+
1010
+ # @private
1011
+ def initialize parent_config = nil
1012
+ @parent_config = parent_config unless parent_config.nil?
1013
+
1014
+ yield self if block_given?
1015
+ end
1016
+
1017
+ ##
1018
+ # Configurations for individual RPCs
1019
+ # @return [Rpcs]
1020
+ #
1021
+ def rpcs
1022
+ @rpcs ||= begin
1023
+ parent_rpcs = nil
1024
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
1025
+ Rpcs.new parent_rpcs
1026
+ end
1027
+ end
1028
+
1029
+ ##
1030
+ # Configuration RPC class for the ClusterController API.
1031
+ #
1032
+ # Includes fields providing the configuration for each RPC in this service.
1033
+ # Each configuration object is of type `Gapic::Config::Method` and includes
1034
+ # the following configuration fields:
1035
+ #
1036
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
1037
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
1038
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
1039
+ # include the following keys:
1040
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
1041
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
1042
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
1043
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
1044
+ # trigger a retry.
1045
+ #
1046
+ class Rpcs
1047
+ ##
1048
+ # RPC-specific configuration for `create_cluster`
1049
+ # @return [::Gapic::Config::Method]
1050
+ #
1051
+ attr_reader :create_cluster
1052
+ ##
1053
+ # RPC-specific configuration for `update_cluster`
1054
+ # @return [::Gapic::Config::Method]
1055
+ #
1056
+ attr_reader :update_cluster
1057
+ ##
1058
+ # RPC-specific configuration for `stop_cluster`
1059
+ # @return [::Gapic::Config::Method]
1060
+ #
1061
+ attr_reader :stop_cluster
1062
+ ##
1063
+ # RPC-specific configuration for `start_cluster`
1064
+ # @return [::Gapic::Config::Method]
1065
+ #
1066
+ attr_reader :start_cluster
1067
+ ##
1068
+ # RPC-specific configuration for `delete_cluster`
1069
+ # @return [::Gapic::Config::Method]
1070
+ #
1071
+ attr_reader :delete_cluster
1072
+ ##
1073
+ # RPC-specific configuration for `get_cluster`
1074
+ # @return [::Gapic::Config::Method]
1075
+ #
1076
+ attr_reader :get_cluster
1077
+ ##
1078
+ # RPC-specific configuration for `list_clusters`
1079
+ # @return [::Gapic::Config::Method]
1080
+ #
1081
+ attr_reader :list_clusters
1082
+ ##
1083
+ # RPC-specific configuration for `diagnose_cluster`
1084
+ # @return [::Gapic::Config::Method]
1085
+ #
1086
+ attr_reader :diagnose_cluster
1087
+
1088
+ # @private
1089
+ def initialize parent_rpcs = nil
1090
+ create_cluster_config = parent_rpcs.create_cluster if parent_rpcs.respond_to? :create_cluster
1091
+ @create_cluster = ::Gapic::Config::Method.new create_cluster_config
1092
+ update_cluster_config = parent_rpcs.update_cluster if parent_rpcs.respond_to? :update_cluster
1093
+ @update_cluster = ::Gapic::Config::Method.new update_cluster_config
1094
+ stop_cluster_config = parent_rpcs.stop_cluster if parent_rpcs.respond_to? :stop_cluster
1095
+ @stop_cluster = ::Gapic::Config::Method.new stop_cluster_config
1096
+ start_cluster_config = parent_rpcs.start_cluster if parent_rpcs.respond_to? :start_cluster
1097
+ @start_cluster = ::Gapic::Config::Method.new start_cluster_config
1098
+ delete_cluster_config = parent_rpcs.delete_cluster if parent_rpcs.respond_to? :delete_cluster
1099
+ @delete_cluster = ::Gapic::Config::Method.new delete_cluster_config
1100
+ get_cluster_config = parent_rpcs.get_cluster if parent_rpcs.respond_to? :get_cluster
1101
+ @get_cluster = ::Gapic::Config::Method.new get_cluster_config
1102
+ list_clusters_config = parent_rpcs.list_clusters if parent_rpcs.respond_to? :list_clusters
1103
+ @list_clusters = ::Gapic::Config::Method.new list_clusters_config
1104
+ diagnose_cluster_config = parent_rpcs.diagnose_cluster if parent_rpcs.respond_to? :diagnose_cluster
1105
+ @diagnose_cluster = ::Gapic::Config::Method.new diagnose_cluster_config
1106
+
1107
+ yield self if block_given?
1108
+ end
1109
+ end
1110
+ end
1111
+ end
1112
+ end
1113
+ end
1114
+ end
1115
+ end
1116
+ end
1117
+ end