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
@@ -39,13 +39,12 @@ module Google
39
39
  # See {::Google::Cloud::Dataproc::V1::JobController::Client::Configuration}
40
40
  # for a description of the configuration fields.
41
41
  #
42
- # ## Example
42
+ # @example
43
43
  #
44
- # To modify the configuration for all JobController clients:
45
- #
46
- # ::Google::Cloud::Dataproc::V1::JobController::Client.configure do |config|
47
- # config.timeout = 10.0
48
- # end
44
+ # # Modify the configuration for all JobController clients
45
+ # ::Google::Cloud::Dataproc::V1::JobController::Client.configure do |config|
46
+ # config.timeout = 10.0
47
+ # end
49
48
  #
50
49
  # @yield [config] Configure the Client client.
51
50
  # @yieldparam config [Client::Configuration]
@@ -127,19 +126,15 @@ module Google
127
126
  ##
128
127
  # Create a new JobController client object.
129
128
  #
130
- # ## Examples
131
- #
132
- # To create a new JobController client with the default
133
- # configuration:
134
- #
135
- # client = ::Google::Cloud::Dataproc::V1::JobController::Client.new
129
+ # @example
136
130
  #
137
- # To create a new JobController client with a custom
138
- # configuration:
131
+ # # Create a client using the default configuration
132
+ # client = ::Google::Cloud::Dataproc::V1::JobController::Client.new
139
133
  #
140
- # client = ::Google::Cloud::Dataproc::V1::JobController::Client.new do |config|
141
- # config.timeout = 10.0
142
- # end
134
+ # # Create a client using a custom configuration
135
+ # client = ::Google::Cloud::Dataproc::V1::JobController::Client.new do |config|
136
+ # config.timeout = 10.0
137
+ # end
143
138
  #
144
139
  # @yield [config] Configure the JobController client.
145
140
  # @yieldparam config [Client::Configuration]
@@ -159,10 +154,9 @@ module Google
159
154
 
160
155
  # Create credentials
161
156
  credentials = @config.credentials
162
- # Use self-signed JWT if the scope and endpoint are unchanged from default,
157
+ # Use self-signed JWT if the endpoint is unchanged from default,
163
158
  # but only if the default endpoint does not have a region prefix.
164
- enable_self_signed_jwt = @config.scope == Client.configure.scope &&
165
- @config.endpoint == Client.configure.endpoint &&
159
+ enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
166
160
  !@config.endpoint.split(".").first.include?("-")
167
161
  credentials ||= Credentials.default scope: @config.scope,
168
162
  enable_self_signed_jwt: enable_self_signed_jwt
@@ -174,6 +168,7 @@ module Google
174
168
 
175
169
  @operations_client = Operations.new do |config|
176
170
  config.credentials = credentials
171
+ config.quota_project = @quota_project_id
177
172
  config.endpoint = @config.endpoint
178
173
  end
179
174
 
@@ -242,6 +237,21 @@ module Google
242
237
  #
243
238
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
244
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::JobController::Client.new
245
+ #
246
+ # # Create a request. To set request fields, pass in keyword arguments.
247
+ # request = Google::Cloud::Dataproc::V1::SubmitJobRequest.new
248
+ #
249
+ # # Call the submit_job method.
250
+ # result = client.submit_job request
251
+ #
252
+ # # The returned object is of type Google::Cloud::Dataproc::V1::Job.
253
+ # p result
254
+ #
245
255
  def submit_job request, options = nil
246
256
  raise ::ArgumentError, "request must be provided" if request.nil?
247
257
 
@@ -259,17 +269,23 @@ module Google
259
269
  gapic_version: ::Google::Cloud::Dataproc::V1::VERSION
260
270
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
261
271
 
262
- header_params = {
263
- "project_id" => request.project_id,
264
- "region" => request.region
265
- }
272
+ header_params = {}
273
+ if request.project_id
274
+ header_params["project_id"] = request.project_id
275
+ end
276
+ if request.region
277
+ header_params["region"] = request.region
278
+ end
279
+
266
280
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
267
281
  metadata[:"x-goog-request-params"] ||= request_params_header
268
282
 
269
283
  options.apply_defaults timeout: @config.rpcs.submit_job.timeout,
270
284
  metadata: metadata,
271
285
  retry_policy: @config.rpcs.submit_job.retry_policy
272
- options.apply_defaults metadata: @config.metadata,
286
+
287
+ options.apply_defaults timeout: @config.timeout,
288
+ metadata: @config.metadata,
273
289
  retry_policy: @config.retry_policy
274
290
 
275
291
  @job_controller_stub.call_rpc :submit_job, request, options: options do |response, operation|
@@ -327,6 +343,28 @@ module Google
327
343
  #
328
344
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
329
345
  #
346
+ # @example Basic example
347
+ # require "google/cloud/dataproc/v1"
348
+ #
349
+ # # Create a client object. The client can be reused for multiple calls.
350
+ # client = Google::Cloud::Dataproc::V1::JobController::Client.new
351
+ #
352
+ # # Create a request. To set request fields, pass in keyword arguments.
353
+ # request = Google::Cloud::Dataproc::V1::SubmitJobRequest.new
354
+ #
355
+ # # Call the submit_job_as_operation method.
356
+ # result = client.submit_job_as_operation request
357
+ #
358
+ # # The returned object is of type Gapic::Operation. You can use this
359
+ # # object to check the status of an operation, cancel it, or wait
360
+ # # for results. Here is how to block until completion:
361
+ # result.wait_until_done! timeout: 60
362
+ # if result.response?
363
+ # p result.response
364
+ # else
365
+ # puts "Error!"
366
+ # end
367
+ #
330
368
  def submit_job_as_operation request, options = nil
331
369
  raise ::ArgumentError, "request must be provided" if request.nil?
332
370
 
@@ -344,17 +382,23 @@ module Google
344
382
  gapic_version: ::Google::Cloud::Dataproc::V1::VERSION
345
383
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
346
384
 
347
- header_params = {
348
- "project_id" => request.project_id,
349
- "region" => request.region
350
- }
385
+ header_params = {}
386
+ if request.project_id
387
+ header_params["project_id"] = request.project_id
388
+ end
389
+ if request.region
390
+ header_params["region"] = request.region
391
+ end
392
+
351
393
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
352
394
  metadata[:"x-goog-request-params"] ||= request_params_header
353
395
 
354
396
  options.apply_defaults timeout: @config.rpcs.submit_job_as_operation.timeout,
355
397
  metadata: metadata,
356
398
  retry_policy: @config.rpcs.submit_job_as_operation.retry_policy
357
- options.apply_defaults metadata: @config.metadata,
399
+
400
+ options.apply_defaults timeout: @config.timeout,
401
+ metadata: @config.metadata,
358
402
  retry_policy: @config.retry_policy
359
403
 
360
404
  @job_controller_stub.call_rpc :submit_job_as_operation, request, options: options do |response, operation|
@@ -400,6 +444,21 @@ module Google
400
444
  #
401
445
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
402
446
  #
447
+ # @example Basic example
448
+ # require "google/cloud/dataproc/v1"
449
+ #
450
+ # # Create a client object. The client can be reused for multiple calls.
451
+ # client = Google::Cloud::Dataproc::V1::JobController::Client.new
452
+ #
453
+ # # Create a request. To set request fields, pass in keyword arguments.
454
+ # request = Google::Cloud::Dataproc::V1::GetJobRequest.new
455
+ #
456
+ # # Call the get_job method.
457
+ # result = client.get_job request
458
+ #
459
+ # # The returned object is of type Google::Cloud::Dataproc::V1::Job.
460
+ # p result
461
+ #
403
462
  def get_job request, options = nil
404
463
  raise ::ArgumentError, "request must be provided" if request.nil?
405
464
 
@@ -417,18 +476,26 @@ module Google
417
476
  gapic_version: ::Google::Cloud::Dataproc::V1::VERSION
418
477
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
419
478
 
420
- header_params = {
421
- "project_id" => request.project_id,
422
- "region" => request.region,
423
- "job_id" => request.job_id
424
- }
479
+ header_params = {}
480
+ if request.project_id
481
+ header_params["project_id"] = request.project_id
482
+ end
483
+ if request.region
484
+ header_params["region"] = request.region
485
+ end
486
+ if request.job_id
487
+ header_params["job_id"] = request.job_id
488
+ end
489
+
425
490
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
426
491
  metadata[:"x-goog-request-params"] ||= request_params_header
427
492
 
428
493
  options.apply_defaults timeout: @config.rpcs.get_job.timeout,
429
494
  metadata: metadata,
430
495
  retry_policy: @config.rpcs.get_job.retry_policy
431
- options.apply_defaults metadata: @config.metadata,
496
+
497
+ options.apply_defaults timeout: @config.timeout,
498
+ metadata: @config.metadata,
432
499
  retry_policy: @config.retry_policy
433
500
 
434
501
  @job_controller_stub.call_rpc :get_job, request, options: options do |response, operation|
@@ -499,6 +566,27 @@ module Google
499
566
  #
500
567
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
501
568
  #
569
+ # @example Basic example
570
+ # require "google/cloud/dataproc/v1"
571
+ #
572
+ # # Create a client object. The client can be reused for multiple calls.
573
+ # client = Google::Cloud::Dataproc::V1::JobController::Client.new
574
+ #
575
+ # # Create a request. To set request fields, pass in keyword arguments.
576
+ # request = Google::Cloud::Dataproc::V1::ListJobsRequest.new
577
+ #
578
+ # # Call the list_jobs method.
579
+ # result = client.list_jobs request
580
+ #
581
+ # # The returned object is of type Gapic::PagedEnumerable. You can
582
+ # # iterate over all elements by calling #each, and the enumerable
583
+ # # will lazily make API calls to fetch subsequent pages. Other
584
+ # # methods are also available for managing paging directly.
585
+ # result.each do |response|
586
+ # # Each element is of type ::Google::Cloud::Dataproc::V1::Job.
587
+ # p response
588
+ # end
589
+ #
502
590
  def list_jobs request, options = nil
503
591
  raise ::ArgumentError, "request must be provided" if request.nil?
504
592
 
@@ -516,17 +604,23 @@ module Google
516
604
  gapic_version: ::Google::Cloud::Dataproc::V1::VERSION
517
605
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
518
606
 
519
- header_params = {
520
- "project_id" => request.project_id,
521
- "region" => request.region
522
- }
607
+ header_params = {}
608
+ if request.project_id
609
+ header_params["project_id"] = request.project_id
610
+ end
611
+ if request.region
612
+ header_params["region"] = request.region
613
+ end
614
+
523
615
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
524
616
  metadata[:"x-goog-request-params"] ||= request_params_header
525
617
 
526
618
  options.apply_defaults timeout: @config.rpcs.list_jobs.timeout,
527
619
  metadata: metadata,
528
620
  retry_policy: @config.rpcs.list_jobs.retry_policy
529
- options.apply_defaults metadata: @config.metadata,
621
+
622
+ options.apply_defaults timeout: @config.timeout,
623
+ metadata: @config.metadata,
530
624
  retry_policy: @config.retry_policy
531
625
 
532
626
  @job_controller_stub.call_rpc :list_jobs, request, options: options do |response, operation|
@@ -581,6 +675,21 @@ module Google
581
675
  #
582
676
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
583
677
  #
678
+ # @example Basic example
679
+ # require "google/cloud/dataproc/v1"
680
+ #
681
+ # # Create a client object. The client can be reused for multiple calls.
682
+ # client = Google::Cloud::Dataproc::V1::JobController::Client.new
683
+ #
684
+ # # Create a request. To set request fields, pass in keyword arguments.
685
+ # request = Google::Cloud::Dataproc::V1::UpdateJobRequest.new
686
+ #
687
+ # # Call the update_job method.
688
+ # result = client.update_job request
689
+ #
690
+ # # The returned object is of type Google::Cloud::Dataproc::V1::Job.
691
+ # p result
692
+ #
584
693
  def update_job request, options = nil
585
694
  raise ::ArgumentError, "request must be provided" if request.nil?
586
695
 
@@ -598,18 +707,26 @@ module Google
598
707
  gapic_version: ::Google::Cloud::Dataproc::V1::VERSION
599
708
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
600
709
 
601
- header_params = {
602
- "project_id" => request.project_id,
603
- "region" => request.region,
604
- "job_id" => request.job_id
605
- }
710
+ header_params = {}
711
+ if request.project_id
712
+ header_params["project_id"] = request.project_id
713
+ end
714
+ if request.region
715
+ header_params["region"] = request.region
716
+ end
717
+ if request.job_id
718
+ header_params["job_id"] = request.job_id
719
+ end
720
+
606
721
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
607
722
  metadata[:"x-goog-request-params"] ||= request_params_header
608
723
 
609
724
  options.apply_defaults timeout: @config.rpcs.update_job.timeout,
610
725
  metadata: metadata,
611
726
  retry_policy: @config.rpcs.update_job.retry_policy
612
- options.apply_defaults metadata: @config.metadata,
727
+
728
+ options.apply_defaults timeout: @config.timeout,
729
+ metadata: @config.metadata,
613
730
  retry_policy: @config.retry_policy
614
731
 
615
732
  @job_controller_stub.call_rpc :update_job, request, options: options do |response, operation|
@@ -658,6 +775,21 @@ module Google
658
775
  #
659
776
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
660
777
  #
778
+ # @example Basic example
779
+ # require "google/cloud/dataproc/v1"
780
+ #
781
+ # # Create a client object. The client can be reused for multiple calls.
782
+ # client = Google::Cloud::Dataproc::V1::JobController::Client.new
783
+ #
784
+ # # Create a request. To set request fields, pass in keyword arguments.
785
+ # request = Google::Cloud::Dataproc::V1::CancelJobRequest.new
786
+ #
787
+ # # Call the cancel_job method.
788
+ # result = client.cancel_job request
789
+ #
790
+ # # The returned object is of type Google::Cloud::Dataproc::V1::Job.
791
+ # p result
792
+ #
661
793
  def cancel_job request, options = nil
662
794
  raise ::ArgumentError, "request must be provided" if request.nil?
663
795
 
@@ -675,18 +807,26 @@ module Google
675
807
  gapic_version: ::Google::Cloud::Dataproc::V1::VERSION
676
808
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
677
809
 
678
- header_params = {
679
- "project_id" => request.project_id,
680
- "region" => request.region,
681
- "job_id" => request.job_id
682
- }
810
+ header_params = {}
811
+ if request.project_id
812
+ header_params["project_id"] = request.project_id
813
+ end
814
+ if request.region
815
+ header_params["region"] = request.region
816
+ end
817
+ if request.job_id
818
+ header_params["job_id"] = request.job_id
819
+ end
820
+
683
821
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
684
822
  metadata[:"x-goog-request-params"] ||= request_params_header
685
823
 
686
824
  options.apply_defaults timeout: @config.rpcs.cancel_job.timeout,
687
825
  metadata: metadata,
688
826
  retry_policy: @config.rpcs.cancel_job.retry_policy
689
- options.apply_defaults metadata: @config.metadata,
827
+
828
+ options.apply_defaults timeout: @config.timeout,
829
+ metadata: @config.metadata,
690
830
  retry_policy: @config.retry_policy
691
831
 
692
832
  @job_controller_stub.call_rpc :cancel_job, request, options: options do |response, operation|
@@ -732,6 +872,21 @@ module Google
732
872
  #
733
873
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
734
874
  #
875
+ # @example Basic example
876
+ # require "google/cloud/dataproc/v1"
877
+ #
878
+ # # Create a client object. The client can be reused for multiple calls.
879
+ # client = Google::Cloud::Dataproc::V1::JobController::Client.new
880
+ #
881
+ # # Create a request. To set request fields, pass in keyword arguments.
882
+ # request = Google::Cloud::Dataproc::V1::DeleteJobRequest.new
883
+ #
884
+ # # Call the delete_job method.
885
+ # result = client.delete_job request
886
+ #
887
+ # # The returned object is of type Google::Protobuf::Empty.
888
+ # p result
889
+ #
735
890
  def delete_job request, options = nil
736
891
  raise ::ArgumentError, "request must be provided" if request.nil?
737
892
 
@@ -749,18 +904,26 @@ module Google
749
904
  gapic_version: ::Google::Cloud::Dataproc::V1::VERSION
750
905
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
751
906
 
752
- header_params = {
753
- "project_id" => request.project_id,
754
- "region" => request.region,
755
- "job_id" => request.job_id
756
- }
907
+ header_params = {}
908
+ if request.project_id
909
+ header_params["project_id"] = request.project_id
910
+ end
911
+ if request.region
912
+ header_params["region"] = request.region
913
+ end
914
+ if request.job_id
915
+ header_params["job_id"] = request.job_id
916
+ end
917
+
757
918
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
758
919
  metadata[:"x-goog-request-params"] ||= request_params_header
759
920
 
760
921
  options.apply_defaults timeout: @config.rpcs.delete_job.timeout,
761
922
  metadata: metadata,
762
923
  retry_policy: @config.rpcs.delete_job.retry_policy
763
- options.apply_defaults metadata: @config.metadata,
924
+
925
+ options.apply_defaults timeout: @config.timeout,
926
+ metadata: @config.metadata,
764
927
  retry_policy: @config.retry_policy
765
928
 
766
929
  @job_controller_stub.call_rpc :delete_job, request, options: options do |response, operation|
@@ -784,22 +947,21 @@ module Google
784
947
  # Configuration can be applied globally to all clients, or to a single client
785
948
  # on construction.
786
949
  #
787
- # # Examples
788
- #
789
- # To modify the global config, setting the timeout for submit_job
790
- # to 20 seconds, and all remaining timeouts to 10 seconds:
791
- #
792
- # ::Google::Cloud::Dataproc::V1::JobController::Client.configure do |config|
793
- # config.timeout = 10.0
794
- # config.rpcs.submit_job.timeout = 20.0
795
- # end
796
- #
797
- # To apply the above configuration only to a new client:
798
- #
799
- # client = ::Google::Cloud::Dataproc::V1::JobController::Client.new do |config|
800
- # config.timeout = 10.0
801
- # config.rpcs.submit_job.timeout = 20.0
802
- # end
950
+ # @example
951
+ #
952
+ # # Modify the global config, setting the timeout for
953
+ # # submit_job to 20 seconds,
954
+ # # and all remaining timeouts to 10 seconds.
955
+ # ::Google::Cloud::Dataproc::V1::JobController::Client.configure do |config|
956
+ # config.timeout = 10.0
957
+ # config.rpcs.submit_job.timeout = 20.0
958
+ # end
959
+ #
960
+ # # Apply the above configuration only to a new client.
961
+ # client = ::Google::Cloud::Dataproc::V1::JobController::Client.new do |config|
962
+ # config.timeout = 10.0
963
+ # config.rpcs.submit_job.timeout = 20.0
964
+ # end
803
965
  #
804
966
  # @!attribute [rw] endpoint
805
967
  # The hostname or hostname:port of the service endpoint.