google-cloud-dataproc-v1 0.6.2 → 0.8.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/.yardopts +1 -1
  3. data/AUTHENTICATION.md +7 -25
  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 +150 -56
  7. data/lib/google/cloud/dataproc/v1/batch_controller/client.rb +719 -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 +767 -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 +319 -93
  15. data/lib/google/cloud/dataproc/v1/cluster_controller/operations.rb +145 -33
  16. data/lib/google/cloud/dataproc/v1/clusters_pb.rb +10 -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 +237 -75
  19. data/lib/google/cloud/dataproc/v1/job_controller/operations.rb +145 -33
  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 +43 -2
  24. data/lib/google/cloud/dataproc/v1/version.rb +1 -1
  25. data/lib/google/cloud/dataproc/v1/workflow_template_service/client.rb +213 -67
  26. data/lib/google/cloud/dataproc/v1/workflow_template_service/operations.rb +145 -33
  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/resource.rb +10 -71
  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 +55 -24
  34. data/proto_docs/google/cloud/dataproc/v1/jobs.rb +20 -9
  35. data/proto_docs/google/cloud/dataproc/v1/operations.rb +48 -0
  36. data/proto_docs/google/cloud/dataproc/v1/shared.rb +127 -1
  37. data/proto_docs/google/cloud/dataproc/v1/workflow_templates.rb +12 -15
  38. metadata +13 -5
@@ -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]
@@ -125,19 +124,15 @@ module Google
125
124
  ##
126
125
  # Create a new ClusterController client object.
127
126
  #
128
- # ## Examples
129
- #
130
- # To create a new ClusterController client with the default
131
- # configuration:
132
- #
133
- # client = ::Google::Cloud::Dataproc::V1::ClusterController::Client.new
127
+ # @example
134
128
  #
135
- # To create a new ClusterController client with a custom
136
- # configuration:
129
+ # # Create a client using the default configuration
130
+ # client = ::Google::Cloud::Dataproc::V1::ClusterController::Client.new
137
131
  #
138
- # client = ::Google::Cloud::Dataproc::V1::ClusterController::Client.new do |config|
139
- # config.timeout = 10.0
140
- # 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
141
136
  #
142
137
  # @yield [config] Configure the ClusterController client.
143
138
  # @yieldparam config [Client::Configuration]
@@ -157,10 +152,9 @@ module Google
157
152
 
158
153
  # Create credentials
159
154
  credentials = @config.credentials
160
- # 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,
161
156
  # but only if the default endpoint does not have a region prefix.
162
- enable_self_signed_jwt = @config.scope == Client.configure.scope &&
163
- @config.endpoint == Client.configure.endpoint &&
157
+ enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
164
158
  !@config.endpoint.split(".").first.include?("-")
165
159
  credentials ||= Credentials.default scope: @config.scope,
166
160
  enable_self_signed_jwt: enable_self_signed_jwt
@@ -172,6 +166,7 @@ module Google
172
166
 
173
167
  @operations_client = Operations.new do |config|
174
168
  config.credentials = credentials
169
+ config.quota_project = @quota_project_id
175
170
  config.endpoint = @config.endpoint
176
171
  end
177
172
 
@@ -208,7 +203,7 @@ module Google
208
203
  # @param options [::Gapic::CallOptions, ::Hash]
209
204
  # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
210
205
  #
211
- # @overload create_cluster(project_id: nil, region: nil, cluster: nil, request_id: nil)
206
+ # @overload create_cluster(project_id: nil, region: nil, cluster: nil, request_id: nil, action_on_failed_primary_workers: nil)
212
207
  # Pass arguments to `create_cluster` via keyword arguments. Note that at
213
208
  # least one keyword argument is required. To specify no parameters, or to keep all
214
209
  # the default parameter values, pass an empty Hash as a request object (see above).
@@ -221,7 +216,7 @@ module Google
221
216
  # @param cluster [::Google::Cloud::Dataproc::V1::Cluster, ::Hash]
222
217
  # Required. The cluster to create.
223
218
  # @param request_id [::String]
224
- # Optional. A unique id used to identify the request. If the server receives two
219
+ # Optional. A unique ID used to identify the request. If the server receives two
225
220
  # [CreateClusterRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.CreateClusterRequest)s
226
221
  # with the same id, then the second request will be ignored and the
227
222
  # first {::Google::Longrunning::Operation google.longrunning.Operation} created and stored in the backend
@@ -230,8 +225,10 @@ module Google
230
225
  # It is recommended to always set this value to a
231
226
  # [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier).
232
227
  #
233
- # The id must contain only letters (a-z, A-Z), numbers (0-9),
228
+ # The ID must contain only letters (a-z, A-Z), numbers (0-9),
234
229
  # underscores (_), and hyphens (-). The maximum length is 40 characters.
230
+ # @param action_on_failed_primary_workers [::Google::Cloud::Dataproc::V1::FailureAction]
231
+ # Optional. Failure action when primary worker creation fails.
235
232
  #
236
233
  # @yield [response, operation] Access the result along with the RPC operation
237
234
  # @yieldparam response [::Gapic::Operation]
@@ -241,6 +238,28 @@ module Google
241
238
  #
242
239
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
243
240
  #
241
+ # @example Basic example
242
+ # require "google/cloud/dataproc/v1"
243
+ #
244
+ # # Create a client object. The client can be reused for multiple calls.
245
+ # client = Google::Cloud::Dataproc::V1::ClusterController::Client.new
246
+ #
247
+ # # Create a request. To set request fields, pass in keyword arguments.
248
+ # request = Google::Cloud::Dataproc::V1::CreateClusterRequest.new
249
+ #
250
+ # # Call the create_cluster method.
251
+ # result = client.create_cluster request
252
+ #
253
+ # # The returned object is of type Gapic::Operation. You can use this
254
+ # # object to check the status of an operation, cancel it, or wait
255
+ # # for results. Here is how to block until completion:
256
+ # result.wait_until_done! timeout: 60
257
+ # if result.response?
258
+ # p result.response
259
+ # else
260
+ # puts "Error!"
261
+ # end
262
+ #
244
263
  def create_cluster request, options = nil
245
264
  raise ::ArgumentError, "request must be provided" if request.nil?
246
265
 
@@ -258,17 +277,23 @@ module Google
258
277
  gapic_version: ::Google::Cloud::Dataproc::V1::VERSION
259
278
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
260
279
 
261
- header_params = {
262
- "project_id" => request.project_id,
263
- "region" => request.region
264
- }
280
+ header_params = {}
281
+ if request.project_id
282
+ header_params["project_id"] = request.project_id
283
+ end
284
+ if request.region
285
+ header_params["region"] = request.region
286
+ end
287
+
265
288
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
266
289
  metadata[:"x-goog-request-params"] ||= request_params_header
267
290
 
268
291
  options.apply_defaults timeout: @config.rpcs.create_cluster.timeout,
269
292
  metadata: metadata,
270
293
  retry_policy: @config.rpcs.create_cluster.retry_policy
271
- options.apply_defaults metadata: @config.metadata,
294
+
295
+ options.apply_defaults timeout: @config.timeout,
296
+ metadata: @config.metadata,
272
297
  retry_policy: @config.retry_policy
273
298
 
274
299
  @cluster_controller_stub.call_rpc :create_cluster, request, options: options do |response, operation|
@@ -284,6 +309,8 @@ module Google
284
309
  # Updates a cluster in a project. The returned
285
310
  # {::Google::Longrunning::Operation#metadata Operation.metadata} will be
286
311
  # [ClusterOperationMetadata](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#clusteroperationmetadata).
312
+ # The cluster must be in a {::Google::Cloud::Dataproc::V1::ClusterStatus::State `RUNNING`} state or an error
313
+ # is returned.
287
314
  #
288
315
  # @overload update_cluster(request, options = nil)
289
316
  # Pass arguments to `update_cluster` via a request object, either of type
@@ -372,7 +399,7 @@ module Google
372
399
  # </tbody>
373
400
  # </table>
374
401
  # @param request_id [::String]
375
- # Optional. A unique id used to identify the request. If the server
402
+ # Optional. A unique ID used to identify the request. If the server
376
403
  # receives two
377
404
  # [UpdateClusterRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.UpdateClusterRequest)s
378
405
  # with the same id, then the second request will be ignored and the
@@ -382,7 +409,7 @@ module Google
382
409
  # It is recommended to always set this value to a
383
410
  # [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier).
384
411
  #
385
- # The id must contain only letters (a-z, A-Z), numbers (0-9),
412
+ # The ID must contain only letters (a-z, A-Z), numbers (0-9),
386
413
  # underscores (_), and hyphens (-). The maximum length is 40 characters.
387
414
  #
388
415
  # @yield [response, operation] Access the result along with the RPC operation
@@ -393,6 +420,28 @@ module Google
393
420
  #
394
421
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
395
422
  #
423
+ # @example Basic example
424
+ # require "google/cloud/dataproc/v1"
425
+ #
426
+ # # Create a client object. The client can be reused for multiple calls.
427
+ # client = Google::Cloud::Dataproc::V1::ClusterController::Client.new
428
+ #
429
+ # # Create a request. To set request fields, pass in keyword arguments.
430
+ # request = Google::Cloud::Dataproc::V1::UpdateClusterRequest.new
431
+ #
432
+ # # Call the update_cluster method.
433
+ # result = client.update_cluster request
434
+ #
435
+ # # The returned object is of type Gapic::Operation. You can use this
436
+ # # object to check the status of an operation, cancel it, or wait
437
+ # # for results. Here is how to block until completion:
438
+ # result.wait_until_done! timeout: 60
439
+ # if result.response?
440
+ # p result.response
441
+ # else
442
+ # puts "Error!"
443
+ # end
444
+ #
396
445
  def update_cluster request, options = nil
397
446
  raise ::ArgumentError, "request must be provided" if request.nil?
398
447
 
@@ -410,18 +459,26 @@ module Google
410
459
  gapic_version: ::Google::Cloud::Dataproc::V1::VERSION
411
460
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
412
461
 
413
- header_params = {
414
- "project_id" => request.project_id,
415
- "region" => request.region,
416
- "cluster_name" => request.cluster_name
417
- }
462
+ header_params = {}
463
+ if request.project_id
464
+ header_params["project_id"] = request.project_id
465
+ end
466
+ if request.region
467
+ header_params["region"] = request.region
468
+ end
469
+ if request.cluster_name
470
+ header_params["cluster_name"] = request.cluster_name
471
+ end
472
+
418
473
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
419
474
  metadata[:"x-goog-request-params"] ||= request_params_header
420
475
 
421
476
  options.apply_defaults timeout: @config.rpcs.update_cluster.timeout,
422
477
  metadata: metadata,
423
478
  retry_policy: @config.rpcs.update_cluster.retry_policy
424
- options.apply_defaults metadata: @config.metadata,
479
+
480
+ options.apply_defaults timeout: @config.timeout,
481
+ metadata: @config.metadata,
425
482
  retry_policy: @config.retry_policy
426
483
 
427
484
  @cluster_controller_stub.call_rpc :update_cluster, request, options: options do |response, operation|
@@ -462,7 +519,7 @@ module Google
462
519
  # Optional. Specifying the `cluster_uuid` means the RPC will fail
463
520
  # (with error NOT_FOUND) if a cluster with the specified UUID does not exist.
464
521
  # @param request_id [::String]
465
- # Optional. A unique id used to identify the request. If the server
522
+ # Optional. A unique ID used to identify the request. If the server
466
523
  # receives two
467
524
  # [StopClusterRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.StopClusterRequest)s
468
525
  # with the same id, then the second request will be ignored and the
@@ -472,7 +529,7 @@ module Google
472
529
  # Recommendation: Set this value to a
473
530
  # [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier).
474
531
  #
475
- # The id must contain only letters (a-z, A-Z), numbers (0-9),
532
+ # The ID must contain only letters (a-z, A-Z), numbers (0-9),
476
533
  # underscores (_), and hyphens (-). The maximum length is 40 characters.
477
534
  #
478
535
  # @yield [response, operation] Access the result along with the RPC operation
@@ -483,6 +540,28 @@ module Google
483
540
  #
484
541
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
485
542
  #
543
+ # @example Basic example
544
+ # require "google/cloud/dataproc/v1"
545
+ #
546
+ # # Create a client object. The client can be reused for multiple calls.
547
+ # client = Google::Cloud::Dataproc::V1::ClusterController::Client.new
548
+ #
549
+ # # Create a request. To set request fields, pass in keyword arguments.
550
+ # request = Google::Cloud::Dataproc::V1::StopClusterRequest.new
551
+ #
552
+ # # Call the stop_cluster method.
553
+ # result = client.stop_cluster request
554
+ #
555
+ # # The returned object is of type Gapic::Operation. You can use this
556
+ # # object to check the status of an operation, cancel it, or wait
557
+ # # for results. Here is how to block until completion:
558
+ # result.wait_until_done! timeout: 60
559
+ # if result.response?
560
+ # p result.response
561
+ # else
562
+ # puts "Error!"
563
+ # end
564
+ #
486
565
  def stop_cluster request, options = nil
487
566
  raise ::ArgumentError, "request must be provided" if request.nil?
488
567
 
@@ -500,18 +579,26 @@ module Google
500
579
  gapic_version: ::Google::Cloud::Dataproc::V1::VERSION
501
580
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
502
581
 
503
- header_params = {
504
- "project_id" => request.project_id,
505
- "region" => request.region,
506
- "cluster_name" => request.cluster_name
507
- }
582
+ header_params = {}
583
+ if request.project_id
584
+ header_params["project_id"] = request.project_id
585
+ end
586
+ if request.region
587
+ header_params["region"] = request.region
588
+ end
589
+ if request.cluster_name
590
+ header_params["cluster_name"] = request.cluster_name
591
+ end
592
+
508
593
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
509
594
  metadata[:"x-goog-request-params"] ||= request_params_header
510
595
 
511
596
  options.apply_defaults timeout: @config.rpcs.stop_cluster.timeout,
512
597
  metadata: metadata,
513
598
  retry_policy: @config.rpcs.stop_cluster.retry_policy
514
- options.apply_defaults metadata: @config.metadata,
599
+
600
+ options.apply_defaults timeout: @config.timeout,
601
+ metadata: @config.metadata,
515
602
  retry_policy: @config.retry_policy
516
603
 
517
604
  @cluster_controller_stub.call_rpc :stop_cluster, request, options: options do |response, operation|
@@ -552,7 +639,7 @@ module Google
552
639
  # Optional. Specifying the `cluster_uuid` means the RPC will fail
553
640
  # (with error NOT_FOUND) if a cluster with the specified UUID does not exist.
554
641
  # @param request_id [::String]
555
- # Optional. A unique id used to identify the request. If the server
642
+ # Optional. A unique ID used to identify the request. If the server
556
643
  # receives two
557
644
  # [StartClusterRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.StartClusterRequest)s
558
645
  # with the same id, then the second request will be ignored and the
@@ -562,7 +649,7 @@ module Google
562
649
  # Recommendation: Set this value to a
563
650
  # [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier).
564
651
  #
565
- # The id must contain only letters (a-z, A-Z), numbers (0-9),
652
+ # The ID must contain only letters (a-z, A-Z), numbers (0-9),
566
653
  # underscores (_), and hyphens (-). The maximum length is 40 characters.
567
654
  #
568
655
  # @yield [response, operation] Access the result along with the RPC operation
@@ -573,6 +660,28 @@ module Google
573
660
  #
574
661
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
575
662
  #
663
+ # @example Basic example
664
+ # require "google/cloud/dataproc/v1"
665
+ #
666
+ # # Create a client object. The client can be reused for multiple calls.
667
+ # client = Google::Cloud::Dataproc::V1::ClusterController::Client.new
668
+ #
669
+ # # Create a request. To set request fields, pass in keyword arguments.
670
+ # request = Google::Cloud::Dataproc::V1::StartClusterRequest.new
671
+ #
672
+ # # Call the start_cluster method.
673
+ # result = client.start_cluster request
674
+ #
675
+ # # The returned object is of type Gapic::Operation. You can use this
676
+ # # object to check the status of an operation, cancel it, or wait
677
+ # # for results. Here is how to block until completion:
678
+ # result.wait_until_done! timeout: 60
679
+ # if result.response?
680
+ # p result.response
681
+ # else
682
+ # puts "Error!"
683
+ # end
684
+ #
576
685
  def start_cluster request, options = nil
577
686
  raise ::ArgumentError, "request must be provided" if request.nil?
578
687
 
@@ -590,18 +699,26 @@ module Google
590
699
  gapic_version: ::Google::Cloud::Dataproc::V1::VERSION
591
700
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
592
701
 
593
- header_params = {
594
- "project_id" => request.project_id,
595
- "region" => request.region,
596
- "cluster_name" => request.cluster_name
597
- }
702
+ header_params = {}
703
+ if request.project_id
704
+ header_params["project_id"] = request.project_id
705
+ end
706
+ if request.region
707
+ header_params["region"] = request.region
708
+ end
709
+ if request.cluster_name
710
+ header_params["cluster_name"] = request.cluster_name
711
+ end
712
+
598
713
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
599
714
  metadata[:"x-goog-request-params"] ||= request_params_header
600
715
 
601
716
  options.apply_defaults timeout: @config.rpcs.start_cluster.timeout,
602
717
  metadata: metadata,
603
718
  retry_policy: @config.rpcs.start_cluster.retry_policy
604
- options.apply_defaults metadata: @config.metadata,
719
+
720
+ options.apply_defaults timeout: @config.timeout,
721
+ metadata: @config.metadata,
605
722
  retry_policy: @config.retry_policy
606
723
 
607
724
  @cluster_controller_stub.call_rpc :start_cluster, request, options: options do |response, operation|
@@ -644,7 +761,7 @@ module Google
644
761
  # Optional. Specifying the `cluster_uuid` means the RPC should fail
645
762
  # (with error NOT_FOUND) if cluster with specified UUID does not exist.
646
763
  # @param request_id [::String]
647
- # Optional. A unique id used to identify the request. If the server
764
+ # Optional. A unique ID used to identify the request. If the server
648
765
  # receives two
649
766
  # [DeleteClusterRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.DeleteClusterRequest)s
650
767
  # with the same id, then the second request will be ignored and the
@@ -654,7 +771,7 @@ module Google
654
771
  # It is recommended to always set this value to a
655
772
  # [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier).
656
773
  #
657
- # The id must contain only letters (a-z, A-Z), numbers (0-9),
774
+ # The ID must contain only letters (a-z, A-Z), numbers (0-9),
658
775
  # underscores (_), and hyphens (-). The maximum length is 40 characters.
659
776
  #
660
777
  # @yield [response, operation] Access the result along with the RPC operation
@@ -665,6 +782,28 @@ module Google
665
782
  #
666
783
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
667
784
  #
785
+ # @example Basic example
786
+ # require "google/cloud/dataproc/v1"
787
+ #
788
+ # # Create a client object. The client can be reused for multiple calls.
789
+ # client = Google::Cloud::Dataproc::V1::ClusterController::Client.new
790
+ #
791
+ # # Create a request. To set request fields, pass in keyword arguments.
792
+ # request = Google::Cloud::Dataproc::V1::DeleteClusterRequest.new
793
+ #
794
+ # # Call the delete_cluster method.
795
+ # result = client.delete_cluster request
796
+ #
797
+ # # The returned object is of type Gapic::Operation. You can use this
798
+ # # object to check the status of an operation, cancel it, or wait
799
+ # # for results. Here is how to block until completion:
800
+ # result.wait_until_done! timeout: 60
801
+ # if result.response?
802
+ # p result.response
803
+ # else
804
+ # puts "Error!"
805
+ # end
806
+ #
668
807
  def delete_cluster request, options = nil
669
808
  raise ::ArgumentError, "request must be provided" if request.nil?
670
809
 
@@ -682,18 +821,26 @@ module Google
682
821
  gapic_version: ::Google::Cloud::Dataproc::V1::VERSION
683
822
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
684
823
 
685
- header_params = {
686
- "project_id" => request.project_id,
687
- "region" => request.region,
688
- "cluster_name" => request.cluster_name
689
- }
824
+ header_params = {}
825
+ if request.project_id
826
+ header_params["project_id"] = request.project_id
827
+ end
828
+ if request.region
829
+ header_params["region"] = request.region
830
+ end
831
+ if request.cluster_name
832
+ header_params["cluster_name"] = request.cluster_name
833
+ end
834
+
690
835
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
691
836
  metadata[:"x-goog-request-params"] ||= request_params_header
692
837
 
693
838
  options.apply_defaults timeout: @config.rpcs.delete_cluster.timeout,
694
839
  metadata: metadata,
695
840
  retry_policy: @config.rpcs.delete_cluster.retry_policy
696
- options.apply_defaults metadata: @config.metadata,
841
+
842
+ options.apply_defaults timeout: @config.timeout,
843
+ metadata: @config.metadata,
697
844
  retry_policy: @config.retry_policy
698
845
 
699
846
  @cluster_controller_stub.call_rpc :delete_cluster, request, options: options do |response, operation|
@@ -739,6 +886,21 @@ module Google
739
886
  #
740
887
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
741
888
  #
889
+ # @example Basic example
890
+ # require "google/cloud/dataproc/v1"
891
+ #
892
+ # # Create a client object. The client can be reused for multiple calls.
893
+ # client = Google::Cloud::Dataproc::V1::ClusterController::Client.new
894
+ #
895
+ # # Create a request. To set request fields, pass in keyword arguments.
896
+ # request = Google::Cloud::Dataproc::V1::GetClusterRequest.new
897
+ #
898
+ # # Call the get_cluster method.
899
+ # result = client.get_cluster request
900
+ #
901
+ # # The returned object is of type Google::Cloud::Dataproc::V1::Cluster.
902
+ # p result
903
+ #
742
904
  def get_cluster request, options = nil
743
905
  raise ::ArgumentError, "request must be provided" if request.nil?
744
906
 
@@ -756,18 +918,26 @@ module Google
756
918
  gapic_version: ::Google::Cloud::Dataproc::V1::VERSION
757
919
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
758
920
 
759
- header_params = {
760
- "project_id" => request.project_id,
761
- "region" => request.region,
762
- "cluster_name" => request.cluster_name
763
- }
921
+ header_params = {}
922
+ if request.project_id
923
+ header_params["project_id"] = request.project_id
924
+ end
925
+ if request.region
926
+ header_params["region"] = request.region
927
+ end
928
+ if request.cluster_name
929
+ header_params["cluster_name"] = request.cluster_name
930
+ end
931
+
764
932
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
765
933
  metadata[:"x-goog-request-params"] ||= request_params_header
766
934
 
767
935
  options.apply_defaults timeout: @config.rpcs.get_cluster.timeout,
768
936
  metadata: metadata,
769
937
  retry_policy: @config.rpcs.get_cluster.retry_policy
770
- options.apply_defaults metadata: @config.metadata,
938
+
939
+ options.apply_defaults timeout: @config.timeout,
940
+ metadata: @config.metadata,
771
941
  retry_policy: @config.retry_policy
772
942
 
773
943
  @cluster_controller_stub.call_rpc :get_cluster, request, options: options do |response, operation|
@@ -834,6 +1004,27 @@ module Google
834
1004
  #
835
1005
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
836
1006
  #
1007
+ # @example Basic example
1008
+ # require "google/cloud/dataproc/v1"
1009
+ #
1010
+ # # Create a client object. The client can be reused for multiple calls.
1011
+ # client = Google::Cloud::Dataproc::V1::ClusterController::Client.new
1012
+ #
1013
+ # # Create a request. To set request fields, pass in keyword arguments.
1014
+ # request = Google::Cloud::Dataproc::V1::ListClustersRequest.new
1015
+ #
1016
+ # # Call the list_clusters method.
1017
+ # result = client.list_clusters request
1018
+ #
1019
+ # # The returned object is of type Gapic::PagedEnumerable. You can
1020
+ # # iterate over all elements by calling #each, and the enumerable
1021
+ # # will lazily make API calls to fetch subsequent pages. Other
1022
+ # # methods are also available for managing paging directly.
1023
+ # result.each do |response|
1024
+ # # Each element is of type ::Google::Cloud::Dataproc::V1::Cluster.
1025
+ # p response
1026
+ # end
1027
+ #
837
1028
  def list_clusters request, options = nil
838
1029
  raise ::ArgumentError, "request must be provided" if request.nil?
839
1030
 
@@ -851,17 +1042,23 @@ module Google
851
1042
  gapic_version: ::Google::Cloud::Dataproc::V1::VERSION
852
1043
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
853
1044
 
854
- header_params = {
855
- "project_id" => request.project_id,
856
- "region" => request.region
857
- }
1045
+ header_params = {}
1046
+ if request.project_id
1047
+ header_params["project_id"] = request.project_id
1048
+ end
1049
+ if request.region
1050
+ header_params["region"] = request.region
1051
+ end
1052
+
858
1053
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
859
1054
  metadata[:"x-goog-request-params"] ||= request_params_header
860
1055
 
861
1056
  options.apply_defaults timeout: @config.rpcs.list_clusters.timeout,
862
1057
  metadata: metadata,
863
1058
  retry_policy: @config.rpcs.list_clusters.retry_policy
864
- options.apply_defaults metadata: @config.metadata,
1059
+
1060
+ options.apply_defaults timeout: @config.timeout,
1061
+ metadata: @config.metadata,
865
1062
  retry_policy: @config.retry_policy
866
1063
 
867
1064
  @cluster_controller_stub.call_rpc :list_clusters, request, options: options do |response, operation|
@@ -913,6 +1110,28 @@ module Google
913
1110
  #
914
1111
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
915
1112
  #
1113
+ # @example Basic example
1114
+ # require "google/cloud/dataproc/v1"
1115
+ #
1116
+ # # Create a client object. The client can be reused for multiple calls.
1117
+ # client = Google::Cloud::Dataproc::V1::ClusterController::Client.new
1118
+ #
1119
+ # # Create a request. To set request fields, pass in keyword arguments.
1120
+ # request = Google::Cloud::Dataproc::V1::DiagnoseClusterRequest.new
1121
+ #
1122
+ # # Call the diagnose_cluster method.
1123
+ # result = client.diagnose_cluster request
1124
+ #
1125
+ # # The returned object is of type Gapic::Operation. You can use this
1126
+ # # object to check the status of an operation, cancel it, or wait
1127
+ # # for results. Here is how to block until completion:
1128
+ # result.wait_until_done! timeout: 60
1129
+ # if result.response?
1130
+ # p result.response
1131
+ # else
1132
+ # puts "Error!"
1133
+ # end
1134
+ #
916
1135
  def diagnose_cluster request, options = nil
917
1136
  raise ::ArgumentError, "request must be provided" if request.nil?
918
1137
 
@@ -930,18 +1149,26 @@ module Google
930
1149
  gapic_version: ::Google::Cloud::Dataproc::V1::VERSION
931
1150
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
932
1151
 
933
- header_params = {
934
- "project_id" => request.project_id,
935
- "region" => request.region,
936
- "cluster_name" => request.cluster_name
937
- }
1152
+ header_params = {}
1153
+ if request.project_id
1154
+ header_params["project_id"] = request.project_id
1155
+ end
1156
+ if request.region
1157
+ header_params["region"] = request.region
1158
+ end
1159
+ if request.cluster_name
1160
+ header_params["cluster_name"] = request.cluster_name
1161
+ end
1162
+
938
1163
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
939
1164
  metadata[:"x-goog-request-params"] ||= request_params_header
940
1165
 
941
1166
  options.apply_defaults timeout: @config.rpcs.diagnose_cluster.timeout,
942
1167
  metadata: metadata,
943
1168
  retry_policy: @config.rpcs.diagnose_cluster.retry_policy
944
- options.apply_defaults metadata: @config.metadata,
1169
+
1170
+ options.apply_defaults timeout: @config.timeout,
1171
+ metadata: @config.metadata,
945
1172
  retry_policy: @config.retry_policy
946
1173
 
947
1174
  @cluster_controller_stub.call_rpc :diagnose_cluster, request, options: options do |response, operation|
@@ -966,22 +1193,21 @@ module Google
966
1193
  # Configuration can be applied globally to all clients, or to a single client
967
1194
  # on construction.
968
1195
  #
969
- # # Examples
970
- #
971
- # To modify the global config, setting the timeout for create_cluster
972
- # to 20 seconds, and all remaining timeouts to 10 seconds:
973
- #
974
- # ::Google::Cloud::Dataproc::V1::ClusterController::Client.configure do |config|
975
- # config.timeout = 10.0
976
- # config.rpcs.create_cluster.timeout = 20.0
977
- # end
978
- #
979
- # To apply the above configuration only to a new client:
980
- #
981
- # client = ::Google::Cloud::Dataproc::V1::ClusterController::Client.new do |config|
982
- # config.timeout = 10.0
983
- # config.rpcs.create_cluster.timeout = 20.0
984
- # end
1196
+ # @example
1197
+ #
1198
+ # # Modify the global config, setting the timeout for
1199
+ # # create_cluster to 20 seconds,
1200
+ # # and all remaining timeouts to 10 seconds.
1201
+ # ::Google::Cloud::Dataproc::V1::ClusterController::Client.configure do |config|
1202
+ # config.timeout = 10.0
1203
+ # config.rpcs.create_cluster.timeout = 20.0
1204
+ # end
1205
+ #
1206
+ # # Apply the above configuration only to a new client.
1207
+ # client = ::Google::Cloud::Dataproc::V1::ClusterController::Client.new do |config|
1208
+ # config.timeout = 10.0
1209
+ # config.rpcs.create_cluster.timeout = 20.0
1210
+ # end
985
1211
  #
986
1212
  # @!attribute [rw] endpoint
987
1213
  # The hostname or hostname:port of the service endpoint.