google-cloud-dataproc-v1 0.6.1 → 0.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. checksums.yaml +4 -4
  2. data/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_policy_service/client.rb +154 -69
  6. data/lib/google/cloud/dataproc/v1/batch_controller/client.rb +718 -0
  7. data/lib/google/cloud/dataproc/v1/batch_controller/credentials.rb +51 -0
  8. data/lib/google/cloud/dataproc/v1/batch_controller/operations.rb +767 -0
  9. data/lib/google/cloud/dataproc/v1/batch_controller/paths.rb +69 -0
  10. data/lib/google/cloud/dataproc/v1/batch_controller.rb +50 -0
  11. data/lib/google/cloud/dataproc/v1/batches_pb.rb +123 -0
  12. data/lib/google/cloud/dataproc/v1/batches_services_pb.rb +52 -0
  13. data/lib/google/cloud/dataproc/v1/cluster_controller/client.rb +325 -118
  14. data/lib/google/cloud/dataproc/v1/cluster_controller/operations.rb +149 -37
  15. data/lib/google/cloud/dataproc/v1/clusters_pb.rb +9 -2
  16. data/lib/google/cloud/dataproc/v1/clusters_services_pb.rb +2 -0
  17. data/lib/google/cloud/dataproc/v1/job_controller/client.rb +244 -104
  18. data/lib/google/cloud/dataproc/v1/job_controller/operations.rb +149 -37
  19. data/lib/google/cloud/dataproc/v1/jobs_pb.rb +2 -2
  20. data/lib/google/cloud/dataproc/v1/operations_pb.rb +18 -3
  21. data/lib/google/cloud/dataproc/v1/shared_pb.rb +40 -2
  22. data/lib/google/cloud/dataproc/v1/version.rb +1 -1
  23. data/lib/google/cloud/dataproc/v1/workflow_template_service/client.rb +219 -95
  24. data/lib/google/cloud/dataproc/v1/workflow_template_service/operations.rb +149 -37
  25. data/lib/google/cloud/dataproc/v1/workflow_templates_pb.rb +2 -2
  26. data/lib/google/cloud/dataproc/v1/workflow_templates_services_pb.rb +1 -2
  27. data/lib/google/cloud/dataproc/v1.rb +1 -0
  28. data/proto_docs/google/api/field_behavior.rb +7 -1
  29. data/proto_docs/google/cloud/dataproc/v1/autoscaling_policies.rb +18 -0
  30. data/proto_docs/google/cloud/dataproc/v1/batches.rb +339 -0
  31. data/proto_docs/google/cloud/dataproc/v1/clusters.rb +45 -22
  32. data/proto_docs/google/cloud/dataproc/v1/jobs.rb +8 -9
  33. data/proto_docs/google/cloud/dataproc/v1/operations.rb +48 -0
  34. data/proto_docs/google/cloud/dataproc/v1/shared.rb +117 -1
  35. data/proto_docs/google/cloud/dataproc/v1/workflow_templates.rb +11 -14
  36. metadata +12 -4
@@ -42,13 +42,12 @@ module Google
42
42
  # See {::Google::Cloud::Dataproc::V1::ClusterController::Client::Configuration}
43
43
  # for a description of the configuration fields.
44
44
  #
45
- # ## Example
45
+ # @example
46
46
  #
47
- # To modify the configuration for all ClusterController clients:
48
- #
49
- # ::Google::Cloud::Dataproc::V1::ClusterController::Client.configure do |config|
50
- # config.timeout = 10.0
51
- # end
47
+ # # Modify the configuration for all ClusterController clients
48
+ # ::Google::Cloud::Dataproc::V1::ClusterController::Client.configure do |config|
49
+ # config.timeout = 10.0
50
+ # end
52
51
  #
53
52
  # @yield [config] Configure the Client client.
54
53
  # @yieldparam config [Client::Configuration]
@@ -68,50 +67,32 @@ module Google
68
67
 
69
68
  default_config.rpcs.create_cluster.timeout = 300.0
70
69
  default_config.rpcs.create_cluster.retry_policy = {
71
- initial_delay: 0.1,
72
- max_delay: 60.0,
73
- multiplier: 1.3,
74
- retry_codes: [14]
70
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14]
75
71
  }
76
72
 
77
73
  default_config.rpcs.update_cluster.timeout = 300.0
78
74
  default_config.rpcs.update_cluster.retry_policy = {
79
- initial_delay: 0.1,
80
- max_delay: 60.0,
81
- multiplier: 1.3,
82
- retry_codes: [14]
75
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14]
83
76
  }
84
77
 
85
78
  default_config.rpcs.delete_cluster.timeout = 300.0
86
79
  default_config.rpcs.delete_cluster.retry_policy = {
87
- initial_delay: 0.1,
88
- max_delay: 60.0,
89
- multiplier: 1.3,
90
- retry_codes: [14]
80
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14]
91
81
  }
92
82
 
93
83
  default_config.rpcs.get_cluster.timeout = 300.0
94
84
  default_config.rpcs.get_cluster.retry_policy = {
95
- initial_delay: 0.1,
96
- max_delay: 60.0,
97
- multiplier: 1.3,
98
- retry_codes: [13, 4, 14]
85
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [13, 4, 14]
99
86
  }
100
87
 
101
88
  default_config.rpcs.list_clusters.timeout = 300.0
102
89
  default_config.rpcs.list_clusters.retry_policy = {
103
- initial_delay: 0.1,
104
- max_delay: 60.0,
105
- multiplier: 1.3,
106
- retry_codes: [13, 4, 14]
90
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [13, 4, 14]
107
91
  }
108
92
 
109
93
  default_config.rpcs.diagnose_cluster.timeout = 300.0
110
94
  default_config.rpcs.diagnose_cluster.retry_policy = {
111
- initial_delay: 0.1,
112
- max_delay: 60.0,
113
- multiplier: 1.3,
114
- retry_codes: [14]
95
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14]
115
96
  }
116
97
 
117
98
  default_config
@@ -143,19 +124,15 @@ module Google
143
124
  ##
144
125
  # Create a new ClusterController client object.
145
126
  #
146
- # ## Examples
147
- #
148
- # To create a new ClusterController client with the default
149
- # configuration:
150
- #
151
- # client = ::Google::Cloud::Dataproc::V1::ClusterController::Client.new
127
+ # @example
152
128
  #
153
- # To create a new ClusterController client with a custom
154
- # configuration:
129
+ # # Create a client using the default configuration
130
+ # client = ::Google::Cloud::Dataproc::V1::ClusterController::Client.new
155
131
  #
156
- # client = ::Google::Cloud::Dataproc::V1::ClusterController::Client.new do |config|
157
- # config.timeout = 10.0
158
- # end
132
+ # # Create a client using a custom configuration
133
+ # client = ::Google::Cloud::Dataproc::V1::ClusterController::Client.new do |config|
134
+ # config.timeout = 10.0
135
+ # end
159
136
  #
160
137
  # @yield [config] Configure the ClusterController client.
161
138
  # @yieldparam config [Client::Configuration]
@@ -175,14 +152,13 @@ module Google
175
152
 
176
153
  # Create credentials
177
154
  credentials = @config.credentials
178
- # Use self-signed JWT if the scope and endpoint are unchanged from default,
155
+ # Use self-signed JWT if the endpoint is unchanged from default,
179
156
  # but only if the default endpoint does not have a region prefix.
180
- enable_self_signed_jwt = @config.scope == Client.configure.scope &&
181
- @config.endpoint == Client.configure.endpoint &&
157
+ enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
182
158
  !@config.endpoint.split(".").first.include?("-")
183
159
  credentials ||= Credentials.default scope: @config.scope,
184
160
  enable_self_signed_jwt: enable_self_signed_jwt
185
- if credentials.is_a?(String) || credentials.is_a?(Hash)
161
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
186
162
  credentials = Credentials.new credentials, scope: @config.scope
187
163
  end
188
164
  @quota_project_id = @config.quota_project
@@ -226,7 +202,7 @@ module Google
226
202
  # @param options [::Gapic::CallOptions, ::Hash]
227
203
  # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
228
204
  #
229
- # @overload create_cluster(project_id: nil, region: nil, cluster: nil, request_id: nil)
205
+ # @overload create_cluster(project_id: nil, region: nil, cluster: nil, request_id: nil, action_on_failed_primary_workers: nil)
230
206
  # Pass arguments to `create_cluster` via keyword arguments. Note that at
231
207
  # least one keyword argument is required. To specify no parameters, or to keep all
232
208
  # the default parameter values, pass an empty Hash as a request object (see above).
@@ -239,7 +215,7 @@ module Google
239
215
  # @param cluster [::Google::Cloud::Dataproc::V1::Cluster, ::Hash]
240
216
  # Required. The cluster to create.
241
217
  # @param request_id [::String]
242
- # Optional. A unique id used to identify the request. If the server receives two
218
+ # Optional. A unique ID used to identify the request. If the server receives two
243
219
  # [CreateClusterRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.CreateClusterRequest)s
244
220
  # with the same id, then the second request will be ignored and the
245
221
  # first {::Google::Longrunning::Operation google.longrunning.Operation} created and stored in the backend
@@ -248,8 +224,10 @@ module Google
248
224
  # It is recommended to always set this value to a
249
225
  # [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier).
250
226
  #
251
- # The id must contain only letters (a-z, A-Z), numbers (0-9),
227
+ # The ID must contain only letters (a-z, A-Z), numbers (0-9),
252
228
  # underscores (_), and hyphens (-). The maximum length is 40 characters.
229
+ # @param action_on_failed_primary_workers [::Google::Cloud::Dataproc::V1::FailureAction]
230
+ # Optional. Failure action when primary worker creation fails.
253
231
  #
254
232
  # @yield [response, operation] Access the result along with the RPC operation
255
233
  # @yieldparam response [::Gapic::Operation]
@@ -259,6 +237,28 @@ module Google
259
237
  #
260
238
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
261
239
  #
240
+ # @example Basic example
241
+ # require "google/cloud/dataproc/v1"
242
+ #
243
+ # # Create a client object. The client can be reused for multiple calls.
244
+ # client = Google::Cloud::Dataproc::V1::ClusterController::Client.new
245
+ #
246
+ # # Create a request. To set request fields, pass in keyword arguments.
247
+ # request = Google::Cloud::Dataproc::V1::CreateClusterRequest.new
248
+ #
249
+ # # Call the create_cluster method.
250
+ # result = client.create_cluster request
251
+ #
252
+ # # The returned object is of type Gapic::Operation. You can use this
253
+ # # object to check the status of an operation, cancel it, or wait
254
+ # # for results. Here is how to block until completion:
255
+ # result.wait_until_done! timeout: 60
256
+ # if result.response?
257
+ # p result.response
258
+ # else
259
+ # puts "Error!"
260
+ # end
261
+ #
262
262
  def create_cluster request, options = nil
263
263
  raise ::ArgumentError, "request must be provided" if request.nil?
264
264
 
@@ -276,17 +276,23 @@ module Google
276
276
  gapic_version: ::Google::Cloud::Dataproc::V1::VERSION
277
277
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
278
278
 
279
- header_params = {
280
- "project_id" => request.project_id,
281
- "region" => request.region
282
- }
279
+ header_params = {}
280
+ if request.project_id
281
+ header_params["project_id"] = request.project_id
282
+ end
283
+ if request.region
284
+ header_params["region"] = request.region
285
+ end
286
+
283
287
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
284
288
  metadata[:"x-goog-request-params"] ||= request_params_header
285
289
 
286
290
  options.apply_defaults timeout: @config.rpcs.create_cluster.timeout,
287
291
  metadata: metadata,
288
292
  retry_policy: @config.rpcs.create_cluster.retry_policy
289
- options.apply_defaults metadata: @config.metadata,
293
+
294
+ options.apply_defaults timeout: @config.timeout,
295
+ metadata: @config.metadata,
290
296
  retry_policy: @config.retry_policy
291
297
 
292
298
  @cluster_controller_stub.call_rpc :create_cluster, request, options: options do |response, operation|
@@ -302,6 +308,8 @@ module Google
302
308
  # Updates a cluster in a project. The returned
303
309
  # {::Google::Longrunning::Operation#metadata Operation.metadata} will be
304
310
  # [ClusterOperationMetadata](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#clusteroperationmetadata).
311
+ # The cluster must be in a {::Google::Cloud::Dataproc::V1::ClusterStatus::State `RUNNING`} state or an error
312
+ # is returned.
305
313
  #
306
314
  # @overload update_cluster(request, options = nil)
307
315
  # Pass arguments to `update_cluster` via a request object, either of type
@@ -390,7 +398,7 @@ module Google
390
398
  # </tbody>
391
399
  # </table>
392
400
  # @param request_id [::String]
393
- # Optional. A unique id used to identify the request. If the server
401
+ # Optional. A unique ID used to identify the request. If the server
394
402
  # receives two
395
403
  # [UpdateClusterRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.UpdateClusterRequest)s
396
404
  # with the same id, then the second request will be ignored and the
@@ -400,7 +408,7 @@ module Google
400
408
  # It is recommended to always set this value to a
401
409
  # [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier).
402
410
  #
403
- # The id must contain only letters (a-z, A-Z), numbers (0-9),
411
+ # The ID must contain only letters (a-z, A-Z), numbers (0-9),
404
412
  # underscores (_), and hyphens (-). The maximum length is 40 characters.
405
413
  #
406
414
  # @yield [response, operation] Access the result along with the RPC operation
@@ -411,6 +419,28 @@ module Google
411
419
  #
412
420
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
413
421
  #
422
+ # @example Basic example
423
+ # require "google/cloud/dataproc/v1"
424
+ #
425
+ # # Create a client object. The client can be reused for multiple calls.
426
+ # client = Google::Cloud::Dataproc::V1::ClusterController::Client.new
427
+ #
428
+ # # Create a request. To set request fields, pass in keyword arguments.
429
+ # request = Google::Cloud::Dataproc::V1::UpdateClusterRequest.new
430
+ #
431
+ # # Call the update_cluster method.
432
+ # result = client.update_cluster request
433
+ #
434
+ # # The returned object is of type Gapic::Operation. You can use this
435
+ # # object to check the status of an operation, cancel it, or wait
436
+ # # for results. Here is how to block until completion:
437
+ # result.wait_until_done! timeout: 60
438
+ # if result.response?
439
+ # p result.response
440
+ # else
441
+ # puts "Error!"
442
+ # end
443
+ #
414
444
  def update_cluster request, options = nil
415
445
  raise ::ArgumentError, "request must be provided" if request.nil?
416
446
 
@@ -428,18 +458,26 @@ module Google
428
458
  gapic_version: ::Google::Cloud::Dataproc::V1::VERSION
429
459
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
430
460
 
431
- header_params = {
432
- "project_id" => request.project_id,
433
- "region" => request.region,
434
- "cluster_name" => request.cluster_name
435
- }
461
+ header_params = {}
462
+ if request.project_id
463
+ header_params["project_id"] = request.project_id
464
+ end
465
+ if request.region
466
+ header_params["region"] = request.region
467
+ end
468
+ if request.cluster_name
469
+ header_params["cluster_name"] = request.cluster_name
470
+ end
471
+
436
472
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
437
473
  metadata[:"x-goog-request-params"] ||= request_params_header
438
474
 
439
475
  options.apply_defaults timeout: @config.rpcs.update_cluster.timeout,
440
476
  metadata: metadata,
441
477
  retry_policy: @config.rpcs.update_cluster.retry_policy
442
- options.apply_defaults metadata: @config.metadata,
478
+
479
+ options.apply_defaults timeout: @config.timeout,
480
+ metadata: @config.metadata,
443
481
  retry_policy: @config.retry_policy
444
482
 
445
483
  @cluster_controller_stub.call_rpc :update_cluster, request, options: options do |response, operation|
@@ -480,7 +518,7 @@ module Google
480
518
  # Optional. Specifying the `cluster_uuid` means the RPC will fail
481
519
  # (with error NOT_FOUND) if a cluster with the specified UUID does not exist.
482
520
  # @param request_id [::String]
483
- # Optional. A unique id used to identify the request. If the server
521
+ # Optional. A unique ID used to identify the request. If the server
484
522
  # receives two
485
523
  # [StopClusterRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.StopClusterRequest)s
486
524
  # with the same id, then the second request will be ignored and the
@@ -490,7 +528,7 @@ module Google
490
528
  # Recommendation: Set this value to a
491
529
  # [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier).
492
530
  #
493
- # The id must contain only letters (a-z, A-Z), numbers (0-9),
531
+ # The ID must contain only letters (a-z, A-Z), numbers (0-9),
494
532
  # underscores (_), and hyphens (-). The maximum length is 40 characters.
495
533
  #
496
534
  # @yield [response, operation] Access the result along with the RPC operation
@@ -501,6 +539,28 @@ module Google
501
539
  #
502
540
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
503
541
  #
542
+ # @example Basic example
543
+ # require "google/cloud/dataproc/v1"
544
+ #
545
+ # # Create a client object. The client can be reused for multiple calls.
546
+ # client = Google::Cloud::Dataproc::V1::ClusterController::Client.new
547
+ #
548
+ # # Create a request. To set request fields, pass in keyword arguments.
549
+ # request = Google::Cloud::Dataproc::V1::StopClusterRequest.new
550
+ #
551
+ # # Call the stop_cluster method.
552
+ # result = client.stop_cluster request
553
+ #
554
+ # # The returned object is of type Gapic::Operation. You can use this
555
+ # # object to check the status of an operation, cancel it, or wait
556
+ # # for results. Here is how to block until completion:
557
+ # result.wait_until_done! timeout: 60
558
+ # if result.response?
559
+ # p result.response
560
+ # else
561
+ # puts "Error!"
562
+ # end
563
+ #
504
564
  def stop_cluster request, options = nil
505
565
  raise ::ArgumentError, "request must be provided" if request.nil?
506
566
 
@@ -518,18 +578,26 @@ module Google
518
578
  gapic_version: ::Google::Cloud::Dataproc::V1::VERSION
519
579
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
520
580
 
521
- header_params = {
522
- "project_id" => request.project_id,
523
- "region" => request.region,
524
- "cluster_name" => request.cluster_name
525
- }
581
+ header_params = {}
582
+ if request.project_id
583
+ header_params["project_id"] = request.project_id
584
+ end
585
+ if request.region
586
+ header_params["region"] = request.region
587
+ end
588
+ if request.cluster_name
589
+ header_params["cluster_name"] = request.cluster_name
590
+ end
591
+
526
592
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
527
593
  metadata[:"x-goog-request-params"] ||= request_params_header
528
594
 
529
595
  options.apply_defaults timeout: @config.rpcs.stop_cluster.timeout,
530
596
  metadata: metadata,
531
597
  retry_policy: @config.rpcs.stop_cluster.retry_policy
532
- options.apply_defaults metadata: @config.metadata,
598
+
599
+ options.apply_defaults timeout: @config.timeout,
600
+ metadata: @config.metadata,
533
601
  retry_policy: @config.retry_policy
534
602
 
535
603
  @cluster_controller_stub.call_rpc :stop_cluster, request, options: options do |response, operation|
@@ -570,7 +638,7 @@ module Google
570
638
  # Optional. Specifying the `cluster_uuid` means the RPC will fail
571
639
  # (with error NOT_FOUND) if a cluster with the specified UUID does not exist.
572
640
  # @param request_id [::String]
573
- # Optional. A unique id used to identify the request. If the server
641
+ # Optional. A unique ID used to identify the request. If the server
574
642
  # receives two
575
643
  # [StartClusterRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.StartClusterRequest)s
576
644
  # with the same id, then the second request will be ignored and the
@@ -580,7 +648,7 @@ module Google
580
648
  # Recommendation: Set this value to a
581
649
  # [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier).
582
650
  #
583
- # The id must contain only letters (a-z, A-Z), numbers (0-9),
651
+ # The ID must contain only letters (a-z, A-Z), numbers (0-9),
584
652
  # underscores (_), and hyphens (-). The maximum length is 40 characters.
585
653
  #
586
654
  # @yield [response, operation] Access the result along with the RPC operation
@@ -591,6 +659,28 @@ module Google
591
659
  #
592
660
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
593
661
  #
662
+ # @example Basic example
663
+ # require "google/cloud/dataproc/v1"
664
+ #
665
+ # # Create a client object. The client can be reused for multiple calls.
666
+ # client = Google::Cloud::Dataproc::V1::ClusterController::Client.new
667
+ #
668
+ # # Create a request. To set request fields, pass in keyword arguments.
669
+ # request = Google::Cloud::Dataproc::V1::StartClusterRequest.new
670
+ #
671
+ # # Call the start_cluster method.
672
+ # result = client.start_cluster request
673
+ #
674
+ # # The returned object is of type Gapic::Operation. You can use this
675
+ # # object to check the status of an operation, cancel it, or wait
676
+ # # for results. Here is how to block until completion:
677
+ # result.wait_until_done! timeout: 60
678
+ # if result.response?
679
+ # p result.response
680
+ # else
681
+ # puts "Error!"
682
+ # end
683
+ #
594
684
  def start_cluster request, options = nil
595
685
  raise ::ArgumentError, "request must be provided" if request.nil?
596
686
 
@@ -608,18 +698,26 @@ module Google
608
698
  gapic_version: ::Google::Cloud::Dataproc::V1::VERSION
609
699
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
610
700
 
611
- header_params = {
612
- "project_id" => request.project_id,
613
- "region" => request.region,
614
- "cluster_name" => request.cluster_name
615
- }
701
+ header_params = {}
702
+ if request.project_id
703
+ header_params["project_id"] = request.project_id
704
+ end
705
+ if request.region
706
+ header_params["region"] = request.region
707
+ end
708
+ if request.cluster_name
709
+ header_params["cluster_name"] = request.cluster_name
710
+ end
711
+
616
712
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
617
713
  metadata[:"x-goog-request-params"] ||= request_params_header
618
714
 
619
715
  options.apply_defaults timeout: @config.rpcs.start_cluster.timeout,
620
716
  metadata: metadata,
621
717
  retry_policy: @config.rpcs.start_cluster.retry_policy
622
- options.apply_defaults metadata: @config.metadata,
718
+
719
+ options.apply_defaults timeout: @config.timeout,
720
+ metadata: @config.metadata,
623
721
  retry_policy: @config.retry_policy
624
722
 
625
723
  @cluster_controller_stub.call_rpc :start_cluster, request, options: options do |response, operation|
@@ -662,7 +760,7 @@ module Google
662
760
  # Optional. Specifying the `cluster_uuid` means the RPC should fail
663
761
  # (with error NOT_FOUND) if cluster with specified UUID does not exist.
664
762
  # @param request_id [::String]
665
- # Optional. A unique id used to identify the request. If the server
763
+ # Optional. A unique ID used to identify the request. If the server
666
764
  # receives two
667
765
  # [DeleteClusterRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.DeleteClusterRequest)s
668
766
  # with the same id, then the second request will be ignored and the
@@ -672,7 +770,7 @@ module Google
672
770
  # It is recommended to always set this value to a
673
771
  # [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier).
674
772
  #
675
- # The id must contain only letters (a-z, A-Z), numbers (0-9),
773
+ # The ID must contain only letters (a-z, A-Z), numbers (0-9),
676
774
  # underscores (_), and hyphens (-). The maximum length is 40 characters.
677
775
  #
678
776
  # @yield [response, operation] Access the result along with the RPC operation
@@ -683,6 +781,28 @@ module Google
683
781
  #
684
782
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
685
783
  #
784
+ # @example Basic example
785
+ # require "google/cloud/dataproc/v1"
786
+ #
787
+ # # Create a client object. The client can be reused for multiple calls.
788
+ # client = Google::Cloud::Dataproc::V1::ClusterController::Client.new
789
+ #
790
+ # # Create a request. To set request fields, pass in keyword arguments.
791
+ # request = Google::Cloud::Dataproc::V1::DeleteClusterRequest.new
792
+ #
793
+ # # Call the delete_cluster method.
794
+ # result = client.delete_cluster request
795
+ #
796
+ # # The returned object is of type Gapic::Operation. You can use this
797
+ # # object to check the status of an operation, cancel it, or wait
798
+ # # for results. Here is how to block until completion:
799
+ # result.wait_until_done! timeout: 60
800
+ # if result.response?
801
+ # p result.response
802
+ # else
803
+ # puts "Error!"
804
+ # end
805
+ #
686
806
  def delete_cluster request, options = nil
687
807
  raise ::ArgumentError, "request must be provided" if request.nil?
688
808
 
@@ -700,18 +820,26 @@ module Google
700
820
  gapic_version: ::Google::Cloud::Dataproc::V1::VERSION
701
821
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
702
822
 
703
- header_params = {
704
- "project_id" => request.project_id,
705
- "region" => request.region,
706
- "cluster_name" => request.cluster_name
707
- }
823
+ header_params = {}
824
+ if request.project_id
825
+ header_params["project_id"] = request.project_id
826
+ end
827
+ if request.region
828
+ header_params["region"] = request.region
829
+ end
830
+ if request.cluster_name
831
+ header_params["cluster_name"] = request.cluster_name
832
+ end
833
+
708
834
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
709
835
  metadata[:"x-goog-request-params"] ||= request_params_header
710
836
 
711
837
  options.apply_defaults timeout: @config.rpcs.delete_cluster.timeout,
712
838
  metadata: metadata,
713
839
  retry_policy: @config.rpcs.delete_cluster.retry_policy
714
- options.apply_defaults metadata: @config.metadata,
840
+
841
+ options.apply_defaults timeout: @config.timeout,
842
+ metadata: @config.metadata,
715
843
  retry_policy: @config.retry_policy
716
844
 
717
845
  @cluster_controller_stub.call_rpc :delete_cluster, request, options: options do |response, operation|
@@ -757,6 +885,21 @@ module Google
757
885
  #
758
886
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
759
887
  #
888
+ # @example Basic example
889
+ # require "google/cloud/dataproc/v1"
890
+ #
891
+ # # Create a client object. The client can be reused for multiple calls.
892
+ # client = Google::Cloud::Dataproc::V1::ClusterController::Client.new
893
+ #
894
+ # # Create a request. To set request fields, pass in keyword arguments.
895
+ # request = Google::Cloud::Dataproc::V1::GetClusterRequest.new
896
+ #
897
+ # # Call the get_cluster method.
898
+ # result = client.get_cluster request
899
+ #
900
+ # # The returned object is of type Google::Cloud::Dataproc::V1::Cluster.
901
+ # p result
902
+ #
760
903
  def get_cluster request, options = nil
761
904
  raise ::ArgumentError, "request must be provided" if request.nil?
762
905
 
@@ -774,18 +917,26 @@ module Google
774
917
  gapic_version: ::Google::Cloud::Dataproc::V1::VERSION
775
918
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
776
919
 
777
- header_params = {
778
- "project_id" => request.project_id,
779
- "region" => request.region,
780
- "cluster_name" => request.cluster_name
781
- }
920
+ header_params = {}
921
+ if request.project_id
922
+ header_params["project_id"] = request.project_id
923
+ end
924
+ if request.region
925
+ header_params["region"] = request.region
926
+ end
927
+ if request.cluster_name
928
+ header_params["cluster_name"] = request.cluster_name
929
+ end
930
+
782
931
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
783
932
  metadata[:"x-goog-request-params"] ||= request_params_header
784
933
 
785
934
  options.apply_defaults timeout: @config.rpcs.get_cluster.timeout,
786
935
  metadata: metadata,
787
936
  retry_policy: @config.rpcs.get_cluster.retry_policy
788
- options.apply_defaults metadata: @config.metadata,
937
+
938
+ options.apply_defaults timeout: @config.timeout,
939
+ metadata: @config.metadata,
789
940
  retry_policy: @config.retry_policy
790
941
 
791
942
  @cluster_controller_stub.call_rpc :get_cluster, request, options: options do |response, operation|
@@ -852,6 +1003,27 @@ module Google
852
1003
  #
853
1004
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
854
1005
  #
1006
+ # @example Basic example
1007
+ # require "google/cloud/dataproc/v1"
1008
+ #
1009
+ # # Create a client object. The client can be reused for multiple calls.
1010
+ # client = Google::Cloud::Dataproc::V1::ClusterController::Client.new
1011
+ #
1012
+ # # Create a request. To set request fields, pass in keyword arguments.
1013
+ # request = Google::Cloud::Dataproc::V1::ListClustersRequest.new
1014
+ #
1015
+ # # Call the list_clusters method.
1016
+ # result = client.list_clusters request
1017
+ #
1018
+ # # The returned object is of type Gapic::PagedEnumerable. You can
1019
+ # # iterate over all elements by calling #each, and the enumerable
1020
+ # # will lazily make API calls to fetch subsequent pages. Other
1021
+ # # methods are also available for managing paging directly.
1022
+ # result.each do |response|
1023
+ # # Each element is of type ::Google::Cloud::Dataproc::V1::Cluster.
1024
+ # p response
1025
+ # end
1026
+ #
855
1027
  def list_clusters request, options = nil
856
1028
  raise ::ArgumentError, "request must be provided" if request.nil?
857
1029
 
@@ -869,17 +1041,23 @@ module Google
869
1041
  gapic_version: ::Google::Cloud::Dataproc::V1::VERSION
870
1042
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
871
1043
 
872
- header_params = {
873
- "project_id" => request.project_id,
874
- "region" => request.region
875
- }
1044
+ header_params = {}
1045
+ if request.project_id
1046
+ header_params["project_id"] = request.project_id
1047
+ end
1048
+ if request.region
1049
+ header_params["region"] = request.region
1050
+ end
1051
+
876
1052
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
877
1053
  metadata[:"x-goog-request-params"] ||= request_params_header
878
1054
 
879
1055
  options.apply_defaults timeout: @config.rpcs.list_clusters.timeout,
880
1056
  metadata: metadata,
881
1057
  retry_policy: @config.rpcs.list_clusters.retry_policy
882
- options.apply_defaults metadata: @config.metadata,
1058
+
1059
+ options.apply_defaults timeout: @config.timeout,
1060
+ metadata: @config.metadata,
883
1061
  retry_policy: @config.retry_policy
884
1062
 
885
1063
  @cluster_controller_stub.call_rpc :list_clusters, request, options: options do |response, operation|
@@ -931,6 +1109,28 @@ module Google
931
1109
  #
932
1110
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
933
1111
  #
1112
+ # @example Basic example
1113
+ # require "google/cloud/dataproc/v1"
1114
+ #
1115
+ # # Create a client object. The client can be reused for multiple calls.
1116
+ # client = Google::Cloud::Dataproc::V1::ClusterController::Client.new
1117
+ #
1118
+ # # Create a request. To set request fields, pass in keyword arguments.
1119
+ # request = Google::Cloud::Dataproc::V1::DiagnoseClusterRequest.new
1120
+ #
1121
+ # # Call the diagnose_cluster method.
1122
+ # result = client.diagnose_cluster request
1123
+ #
1124
+ # # The returned object is of type Gapic::Operation. You can use this
1125
+ # # object to check the status of an operation, cancel it, or wait
1126
+ # # for results. Here is how to block until completion:
1127
+ # result.wait_until_done! timeout: 60
1128
+ # if result.response?
1129
+ # p result.response
1130
+ # else
1131
+ # puts "Error!"
1132
+ # end
1133
+ #
934
1134
  def diagnose_cluster request, options = nil
935
1135
  raise ::ArgumentError, "request must be provided" if request.nil?
936
1136
 
@@ -948,18 +1148,26 @@ module Google
948
1148
  gapic_version: ::Google::Cloud::Dataproc::V1::VERSION
949
1149
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
950
1150
 
951
- header_params = {
952
- "project_id" => request.project_id,
953
- "region" => request.region,
954
- "cluster_name" => request.cluster_name
955
- }
1151
+ header_params = {}
1152
+ if request.project_id
1153
+ header_params["project_id"] = request.project_id
1154
+ end
1155
+ if request.region
1156
+ header_params["region"] = request.region
1157
+ end
1158
+ if request.cluster_name
1159
+ header_params["cluster_name"] = request.cluster_name
1160
+ end
1161
+
956
1162
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
957
1163
  metadata[:"x-goog-request-params"] ||= request_params_header
958
1164
 
959
1165
  options.apply_defaults timeout: @config.rpcs.diagnose_cluster.timeout,
960
1166
  metadata: metadata,
961
1167
  retry_policy: @config.rpcs.diagnose_cluster.retry_policy
962
- options.apply_defaults metadata: @config.metadata,
1168
+
1169
+ options.apply_defaults timeout: @config.timeout,
1170
+ metadata: @config.metadata,
963
1171
  retry_policy: @config.retry_policy
964
1172
 
965
1173
  @cluster_controller_stub.call_rpc :diagnose_cluster, request, options: options do |response, operation|
@@ -984,22 +1192,21 @@ module Google
984
1192
  # Configuration can be applied globally to all clients, or to a single client
985
1193
  # on construction.
986
1194
  #
987
- # # Examples
988
- #
989
- # To modify the global config, setting the timeout for create_cluster
990
- # to 20 seconds, and all remaining timeouts to 10 seconds:
991
- #
992
- # ::Google::Cloud::Dataproc::V1::ClusterController::Client.configure do |config|
993
- # config.timeout = 10.0
994
- # config.rpcs.create_cluster.timeout = 20.0
995
- # end
996
- #
997
- # To apply the above configuration only to a new client:
998
- #
999
- # client = ::Google::Cloud::Dataproc::V1::ClusterController::Client.new do |config|
1000
- # config.timeout = 10.0
1001
- # config.rpcs.create_cluster.timeout = 20.0
1002
- # end
1195
+ # @example
1196
+ #
1197
+ # # Modify the global config, setting the timeout for
1198
+ # # create_cluster to 20 seconds,
1199
+ # # and all remaining timeouts to 10 seconds.
1200
+ # ::Google::Cloud::Dataproc::V1::ClusterController::Client.configure do |config|
1201
+ # config.timeout = 10.0
1202
+ # config.rpcs.create_cluster.timeout = 20.0
1203
+ # end
1204
+ #
1205
+ # # Apply the above configuration only to a new client.
1206
+ # client = ::Google::Cloud::Dataproc::V1::ClusterController::Client.new do |config|
1207
+ # config.timeout = 10.0
1208
+ # config.rpcs.create_cluster.timeout = 20.0
1209
+ # end
1003
1210
  #
1004
1211
  # @!attribute [rw] endpoint
1005
1212
  # The hostname or hostname:port of the service endpoint.