google-cloud-dataproc-v1beta2 0.2.5 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (34) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE.md +188 -190
  3. data/README.md +66 -2
  4. data/lib/google/cloud/dataproc/v1beta2.rb +3 -0
  5. data/lib/google/cloud/dataproc/v1beta2/autoscaling_policies_services_pb.rb +5 -5
  6. data/lib/google/cloud/dataproc/v1beta2/autoscaling_policy_service/client.rb +25 -19
  7. data/lib/google/cloud/dataproc/v1beta2/autoscaling_policy_service/paths.rb +1 -1
  8. data/lib/google/cloud/dataproc/v1beta2/cluster_controller.rb +1 -0
  9. data/lib/google/cloud/dataproc/v1beta2/cluster_controller/client.rb +62 -51
  10. data/lib/google/cloud/dataproc/v1beta2/cluster_controller/operations.rb +95 -10
  11. data/lib/google/cloud/dataproc/v1beta2/cluster_controller/paths.rb +52 -0
  12. data/lib/google/cloud/dataproc/v1beta2/clusters_pb.rb +8 -0
  13. data/lib/google/cloud/dataproc/v1beta2/clusters_services_pb.rb +6 -6
  14. data/lib/google/cloud/dataproc/v1beta2/job_controller/client.rb +50 -44
  15. data/lib/google/cloud/dataproc/v1beta2/job_controller/operations.rb +95 -10
  16. data/lib/google/cloud/dataproc/v1beta2/jobs_services_pb.rb +7 -7
  17. data/lib/google/cloud/dataproc/v1beta2/shared_pb.rb +1 -2
  18. data/lib/google/cloud/dataproc/v1beta2/version.rb +1 -1
  19. data/lib/google/cloud/dataproc/v1beta2/workflow_template_service/client.rb +41 -34
  20. data/lib/google/cloud/dataproc/v1beta2/workflow_template_service/operations.rb +95 -10
  21. data/lib/google/cloud/dataproc/v1beta2/workflow_template_service/paths.rb +20 -1
  22. data/lib/google/cloud/dataproc/v1beta2/workflow_templates_pb.rb +5 -0
  23. data/lib/google/cloud/dataproc/v1beta2/workflow_templates_services_pb.rb +9 -8
  24. data/proto_docs/google/api/field_behavior.rb +6 -0
  25. data/proto_docs/google/api/resource.rb +50 -14
  26. data/proto_docs/google/cloud/dataproc/v1beta2/autoscaling_policies.rb +13 -7
  27. data/proto_docs/google/cloud/dataproc/v1beta2/clusters.rb +64 -21
  28. data/proto_docs/google/cloud/dataproc/v1beta2/jobs.rb +14 -13
  29. data/proto_docs/google/cloud/dataproc/v1beta2/shared.rb +3 -6
  30. data/proto_docs/google/cloud/dataproc/v1beta2/workflow_templates.rb +42 -8
  31. data/proto_docs/google/longrunning/operations.rb +17 -3
  32. data/proto_docs/google/protobuf/any.rb +5 -2
  33. data/proto_docs/google/protobuf/timestamp.rb +10 -1
  34. metadata +11 -7
@@ -36,3 +36,6 @@ module Google
36
36
  end
37
37
  end
38
38
  end
39
+
40
+ helper_path = ::File.join __dir__, "v1beta2", "_helpers.rb"
41
+ require "google/cloud/dataproc/v1beta2/_helpers" if ::File.file? helper_path
@@ -35,19 +35,19 @@ module Google
35
35
  self.service_name = 'google.cloud.dataproc.v1beta2.AutoscalingPolicyService'
36
36
 
37
37
  # Creates new autoscaling policy.
38
- rpc :CreateAutoscalingPolicy, Google::Cloud::Dataproc::V1beta2::CreateAutoscalingPolicyRequest, Google::Cloud::Dataproc::V1beta2::AutoscalingPolicy
38
+ rpc :CreateAutoscalingPolicy, ::Google::Cloud::Dataproc::V1beta2::CreateAutoscalingPolicyRequest, ::Google::Cloud::Dataproc::V1beta2::AutoscalingPolicy
39
39
  # Updates (replaces) autoscaling policy.
40
40
  #
41
41
  # Disabled check for update_mask, because all updates will be full
42
42
  # replacements.
43
- rpc :UpdateAutoscalingPolicy, Google::Cloud::Dataproc::V1beta2::UpdateAutoscalingPolicyRequest, Google::Cloud::Dataproc::V1beta2::AutoscalingPolicy
43
+ rpc :UpdateAutoscalingPolicy, ::Google::Cloud::Dataproc::V1beta2::UpdateAutoscalingPolicyRequest, ::Google::Cloud::Dataproc::V1beta2::AutoscalingPolicy
44
44
  # Retrieves autoscaling policy.
45
- rpc :GetAutoscalingPolicy, Google::Cloud::Dataproc::V1beta2::GetAutoscalingPolicyRequest, Google::Cloud::Dataproc::V1beta2::AutoscalingPolicy
45
+ rpc :GetAutoscalingPolicy, ::Google::Cloud::Dataproc::V1beta2::GetAutoscalingPolicyRequest, ::Google::Cloud::Dataproc::V1beta2::AutoscalingPolicy
46
46
  # Lists autoscaling policies in the project.
47
- rpc :ListAutoscalingPolicies, Google::Cloud::Dataproc::V1beta2::ListAutoscalingPoliciesRequest, Google::Cloud::Dataproc::V1beta2::ListAutoscalingPoliciesResponse
47
+ rpc :ListAutoscalingPolicies, ::Google::Cloud::Dataproc::V1beta2::ListAutoscalingPoliciesRequest, ::Google::Cloud::Dataproc::V1beta2::ListAutoscalingPoliciesResponse
48
48
  # Deletes an autoscaling policy. It is an error to delete an autoscaling
49
49
  # policy that is in use by one or more clusters.
50
- rpc :DeleteAutoscalingPolicy, Google::Cloud::Dataproc::V1beta2::DeleteAutoscalingPolicyRequest, Google::Protobuf::Empty
50
+ rpc :DeleteAutoscalingPolicy, ::Google::Cloud::Dataproc::V1beta2::DeleteAutoscalingPolicyRequest, ::Google::Protobuf::Empty
51
51
  end
52
52
 
53
53
  Stub = Service.rpc_stub_class
@@ -61,7 +61,7 @@ module Google
61
61
  parent_config = while namespace.any?
62
62
  parent_name = namespace.join "::"
63
63
  parent_const = const_get parent_name
64
- break parent_const.configure if parent_const&.respond_to? :configure
64
+ break parent_const.configure if parent_const.respond_to? :configure
65
65
  namespace.pop
66
66
  end
67
67
  default_config = Client::Configuration.new parent_config
@@ -71,25 +71,25 @@ module Google
71
71
  default_config.rpcs.update_autoscaling_policy.timeout = 600.0
72
72
  default_config.rpcs.update_autoscaling_policy.retry_policy = {
73
73
  initial_delay: 0.1,
74
- max_delay: 60.0,
75
- multiplier: 1.3,
76
- retry_codes: [4, 14]
74
+ max_delay: 60.0,
75
+ multiplier: 1.3,
76
+ retry_codes: [4, 14]
77
77
  }
78
78
 
79
79
  default_config.rpcs.get_autoscaling_policy.timeout = 600.0
80
80
  default_config.rpcs.get_autoscaling_policy.retry_policy = {
81
81
  initial_delay: 0.1,
82
- max_delay: 60.0,
83
- multiplier: 1.3,
84
- retry_codes: [4, 14]
82
+ max_delay: 60.0,
83
+ multiplier: 1.3,
84
+ retry_codes: [4, 14]
85
85
  }
86
86
 
87
87
  default_config.rpcs.list_autoscaling_policies.timeout = 600.0
88
88
  default_config.rpcs.list_autoscaling_policies.retry_policy = {
89
89
  initial_delay: 0.1,
90
- max_delay: 60.0,
91
- multiplier: 1.3,
92
- retry_codes: [4, 14]
90
+ max_delay: 60.0,
91
+ multiplier: 1.3,
92
+ retry_codes: [4, 14]
93
93
  }
94
94
 
95
95
  default_config.rpcs.delete_autoscaling_policy.timeout = 600.0
@@ -155,7 +155,13 @@ module Google
155
155
 
156
156
  # Create credentials
157
157
  credentials = @config.credentials
158
- credentials ||= Credentials.default scope: @config.scope
158
+ # Use self-signed JWT if the scope and endpoint are unchanged from default,
159
+ # but only if the default endpoint does not have a region prefix.
160
+ enable_self_signed_jwt = @config.scope == Client.configure.scope &&
161
+ @config.endpoint == Client.configure.endpoint &&
162
+ !@config.endpoint.split(".").first.include?("-")
163
+ credentials ||= Credentials.default scope: @config.scope,
164
+ enable_self_signed_jwt: enable_self_signed_jwt
159
165
  if credentials.is_a?(String) || credentials.is_a?(Hash)
160
166
  credentials = Credentials.new credentials, scope: @config.scope
161
167
  end
@@ -644,7 +650,7 @@ module Google
644
650
  config_attr :scope, nil, ::String, ::Array, nil
645
651
  config_attr :lib_name, nil, ::String, nil
646
652
  config_attr :lib_version, nil, ::String, nil
647
- config_attr(:channel_args, { "grpc.service_config_disable_resolution"=>1 }, ::Hash, nil)
653
+ config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
648
654
  config_attr :interceptors, nil, ::Array, nil
649
655
  config_attr :timeout, nil, ::Numeric, nil
650
656
  config_attr :metadata, nil, ::Hash, nil
@@ -665,7 +671,7 @@ module Google
665
671
  def rpcs
666
672
  @rpcs ||= begin
667
673
  parent_rpcs = nil
668
- parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config&.respond_to?(:rpcs)
674
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
669
675
  Rpcs.new parent_rpcs
670
676
  end
671
677
  end
@@ -677,7 +683,7 @@ module Google
677
683
  # Each configuration object is of type `Gapic::Config::Method` and includes
678
684
  # the following configuration fields:
679
685
  #
680
- # * `timeout` (*type:* `Numeric`) - The call timeout in milliseconds
686
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
681
687
  # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
682
688
  # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
683
689
  # include the following keys:
@@ -716,15 +722,15 @@ module Google
716
722
 
717
723
  # @private
718
724
  def initialize parent_rpcs = nil
719
- create_autoscaling_policy_config = parent_rpcs&.create_autoscaling_policy if parent_rpcs&.respond_to? :create_autoscaling_policy
725
+ create_autoscaling_policy_config = parent_rpcs.create_autoscaling_policy if parent_rpcs.respond_to? :create_autoscaling_policy
720
726
  @create_autoscaling_policy = ::Gapic::Config::Method.new create_autoscaling_policy_config
721
- update_autoscaling_policy_config = parent_rpcs&.update_autoscaling_policy if parent_rpcs&.respond_to? :update_autoscaling_policy
727
+ update_autoscaling_policy_config = parent_rpcs.update_autoscaling_policy if parent_rpcs.respond_to? :update_autoscaling_policy
722
728
  @update_autoscaling_policy = ::Gapic::Config::Method.new update_autoscaling_policy_config
723
- get_autoscaling_policy_config = parent_rpcs&.get_autoscaling_policy if parent_rpcs&.respond_to? :get_autoscaling_policy
729
+ get_autoscaling_policy_config = parent_rpcs.get_autoscaling_policy if parent_rpcs.respond_to? :get_autoscaling_policy
724
730
  @get_autoscaling_policy = ::Gapic::Config::Method.new get_autoscaling_policy_config
725
- list_autoscaling_policies_config = parent_rpcs&.list_autoscaling_policies if parent_rpcs&.respond_to? :list_autoscaling_policies
731
+ list_autoscaling_policies_config = parent_rpcs.list_autoscaling_policies if parent_rpcs.respond_to? :list_autoscaling_policies
726
732
  @list_autoscaling_policies = ::Gapic::Config::Method.new list_autoscaling_policies_config
727
- delete_autoscaling_policy_config = parent_rpcs&.delete_autoscaling_policy if parent_rpcs&.respond_to? :delete_autoscaling_policy
733
+ delete_autoscaling_policy_config = parent_rpcs.delete_autoscaling_policy if parent_rpcs.respond_to? :delete_autoscaling_policy
728
734
  @delete_autoscaling_policy = ::Gapic::Config::Method.new delete_autoscaling_policy_config
729
735
 
730
736
  yield self if block_given?
@@ -54,7 +54,7 @@ module Google
54
54
 
55
55
  "projects/#{project}/locations/#{location}/autoscalingPolicies/#{autoscaling_policy}"
56
56
  end),
57
- "autoscaling_policy:project:region" => (proc do |project:, region:, autoscaling_policy:|
57
+ "autoscaling_policy:project:region" => (proc do |project:, region:, autoscaling_policy:|
58
58
  raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
59
59
  raise ::ArgumentError, "region cannot contain /" if region.to_s.include? "/"
60
60
 
@@ -23,6 +23,7 @@ require "gapic/config/method"
23
23
  require "google/cloud/dataproc/v1beta2/version"
24
24
 
25
25
  require "google/cloud/dataproc/v1beta2/cluster_controller/credentials"
26
+ require "google/cloud/dataproc/v1beta2/cluster_controller/paths"
26
27
  require "google/cloud/dataproc/v1beta2/cluster_controller/operations"
27
28
  require "google/cloud/dataproc/v1beta2/cluster_controller/client"
28
29
 
@@ -31,6 +31,8 @@ module Google
31
31
  # of Compute Engine instances.
32
32
  #
33
33
  class Client
34
+ include Paths
35
+
34
36
  # @private
35
37
  attr_reader :cluster_controller_stub
36
38
 
@@ -59,7 +61,7 @@ module Google
59
61
  parent_config = while namespace.any?
60
62
  parent_name = namespace.join "::"
61
63
  parent_const = const_get parent_name
62
- break parent_const.configure if parent_const&.respond_to? :configure
64
+ break parent_const.configure if parent_const.respond_to? :configure
63
65
  namespace.pop
64
66
  end
65
67
  default_config = Client::Configuration.new parent_config
@@ -67,49 +69,49 @@ module Google
67
69
  default_config.rpcs.create_cluster.timeout = 300.0
68
70
  default_config.rpcs.create_cluster.retry_policy = {
69
71
  initial_delay: 0.1,
70
- max_delay: 60.0,
71
- multiplier: 1.3,
72
- retry_codes: [14]
72
+ max_delay: 60.0,
73
+ multiplier: 1.3,
74
+ retry_codes: [14]
73
75
  }
74
76
 
75
77
  default_config.rpcs.update_cluster.timeout = 300.0
76
78
  default_config.rpcs.update_cluster.retry_policy = {
77
79
  initial_delay: 0.1,
78
- max_delay: 60.0,
79
- multiplier: 1.3,
80
- retry_codes: [14]
80
+ max_delay: 60.0,
81
+ multiplier: 1.3,
82
+ retry_codes: [14]
81
83
  }
82
84
 
83
85
  default_config.rpcs.delete_cluster.timeout = 300.0
84
86
  default_config.rpcs.delete_cluster.retry_policy = {
85
87
  initial_delay: 0.1,
86
- max_delay: 60.0,
87
- multiplier: 1.3,
88
- retry_codes: [14]
88
+ max_delay: 60.0,
89
+ multiplier: 1.3,
90
+ retry_codes: [14]
89
91
  }
90
92
 
91
93
  default_config.rpcs.get_cluster.timeout = 300.0
92
94
  default_config.rpcs.get_cluster.retry_policy = {
93
95
  initial_delay: 0.1,
94
- max_delay: 60.0,
95
- multiplier: 1.3,
96
- retry_codes: [13, 4, 14]
96
+ max_delay: 60.0,
97
+ multiplier: 1.3,
98
+ retry_codes: [13, 4, 14]
97
99
  }
98
100
 
99
101
  default_config.rpcs.list_clusters.timeout = 300.0
100
102
  default_config.rpcs.list_clusters.retry_policy = {
101
103
  initial_delay: 0.1,
102
- max_delay: 60.0,
103
- multiplier: 1.3,
104
- retry_codes: [13, 4, 14]
104
+ max_delay: 60.0,
105
+ multiplier: 1.3,
106
+ retry_codes: [13, 4, 14]
105
107
  }
106
108
 
107
109
  default_config.rpcs.diagnose_cluster.timeout = 300.0
108
110
  default_config.rpcs.diagnose_cluster.retry_policy = {
109
111
  initial_delay: 0.1,
110
- max_delay: 60.0,
111
- multiplier: 1.3,
112
- retry_codes: [14]
112
+ max_delay: 60.0,
113
+ multiplier: 1.3,
114
+ retry_codes: [14]
113
115
  }
114
116
 
115
117
  default_config
@@ -173,7 +175,13 @@ module Google
173
175
 
174
176
  # Create credentials
175
177
  credentials = @config.credentials
176
- credentials ||= Credentials.default scope: @config.scope
178
+ # Use self-signed JWT if the scope and endpoint are unchanged from default,
179
+ # 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 &&
182
+ !@config.endpoint.split(".").first.include?("-")
183
+ credentials ||= Credentials.default scope: @config.scope,
184
+ enable_self_signed_jwt: enable_self_signed_jwt
177
185
  if credentials.is_a?(String) || credentials.is_a?(Hash)
178
186
  credentials = Credentials.new credentials, scope: @config.scope
179
187
  end
@@ -232,10 +240,11 @@ module Google
232
240
  # Required. The cluster to create.
233
241
  # @param request_id [::String]
234
242
  # Optional. A unique id used to identify the request. If the server
235
- # receives two {::Google::Cloud::Dataproc::V1beta2::CreateClusterRequest CreateClusterRequest} requests with the same
236
- # id, then the second request will be ignored and the
237
- # first {::Google::Longrunning::Operation google.longrunning.Operation} created and stored in the backend
238
- # is returned.
243
+ # receives two
244
+ # {::Google::Cloud::Dataproc::V1beta2::CreateClusterRequest CreateClusterRequest}
245
+ # requests with the same id, then the second request will be ignored and the
246
+ # first {::Google::Longrunning::Operation google.longrunning.Operation} created
247
+ # and stored in the backend is returned.
239
248
  #
240
249
  # It is recommended to always set this value to a
241
250
  # [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier).
@@ -270,7 +279,7 @@ module Google
270
279
 
271
280
  header_params = {
272
281
  "project_id" => request.project_id,
273
- "region" => request.region
282
+ "region" => request.region
274
283
  }
275
284
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
276
285
  metadata[:"x-goog-request-params"] ||= request_params_header
@@ -392,10 +401,11 @@ module Google
392
401
  # </table>
393
402
  # @param request_id [::String]
394
403
  # Optional. A unique id used to identify the request. If the server
395
- # receives two {::Google::Cloud::Dataproc::V1beta2::UpdateClusterRequest UpdateClusterRequest} requests with the same
396
- # id, then the second request will be ignored and the
397
- # first {::Google::Longrunning::Operation google.longrunning.Operation} created and stored in the
398
- # backend is returned.
404
+ # receives two
405
+ # {::Google::Cloud::Dataproc::V1beta2::UpdateClusterRequest UpdateClusterRequest}
406
+ # requests with the same id, then the second request will be ignored and the
407
+ # first {::Google::Longrunning::Operation google.longrunning.Operation} created
408
+ # and stored in the backend is returned.
399
409
  #
400
410
  # It is recommended to always set this value to a
401
411
  # [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier).
@@ -429,8 +439,8 @@ module Google
429
439
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
430
440
 
431
441
  header_params = {
432
- "project_id" => request.project_id,
433
- "region" => request.region,
442
+ "project_id" => request.project_id,
443
+ "region" => request.region,
434
444
  "cluster_name" => request.cluster_name
435
445
  }
436
446
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
@@ -483,10 +493,11 @@ module Google
483
493
  # (with error NOT_FOUND) if cluster with specified UUID does not exist.
484
494
  # @param request_id [::String]
485
495
  # Optional. A unique id used to identify the request. If the server
486
- # receives two {::Google::Cloud::Dataproc::V1beta2::DeleteClusterRequest DeleteClusterRequest} requests with the same
487
- # id, then the second request will be ignored and the
488
- # first {::Google::Longrunning::Operation google.longrunning.Operation} created and stored in the
489
- # backend is returned.
496
+ # receives two
497
+ # {::Google::Cloud::Dataproc::V1beta2::DeleteClusterRequest DeleteClusterRequest}
498
+ # requests with the same id, then the second request will be ignored and the
499
+ # first {::Google::Longrunning::Operation google.longrunning.Operation} created
500
+ # and stored in the backend is returned.
490
501
  #
491
502
  # It is recommended to always set this value to a
492
503
  # [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier).
@@ -520,8 +531,8 @@ module Google
520
531
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
521
532
 
522
533
  header_params = {
523
- "project_id" => request.project_id,
524
- "region" => request.region,
534
+ "project_id" => request.project_id,
535
+ "region" => request.region,
525
536
  "cluster_name" => request.cluster_name
526
537
  }
527
538
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
@@ -594,8 +605,8 @@ module Google
594
605
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
595
606
 
596
607
  header_params = {
597
- "project_id" => request.project_id,
598
- "region" => request.region,
608
+ "project_id" => request.project_id,
609
+ "region" => request.region,
599
610
  "cluster_name" => request.cluster_name
600
611
  }
601
612
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
@@ -690,7 +701,7 @@ module Google
690
701
 
691
702
  header_params = {
692
703
  "project_id" => request.project_id,
693
- "region" => request.region
704
+ "region" => request.region
694
705
  }
695
706
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
696
707
  metadata[:"x-goog-request-params"] ||= request_params_header
@@ -768,8 +779,8 @@ module Google
768
779
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
769
780
 
770
781
  header_params = {
771
- "project_id" => request.project_id,
772
- "region" => request.region,
782
+ "project_id" => request.project_id,
783
+ "region" => request.region,
773
784
  "cluster_name" => request.cluster_name
774
785
  }
775
786
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
@@ -882,7 +893,7 @@ module Google
882
893
  config_attr :scope, nil, ::String, ::Array, nil
883
894
  config_attr :lib_name, nil, ::String, nil
884
895
  config_attr :lib_version, nil, ::String, nil
885
- config_attr(:channel_args, { "grpc.service_config_disable_resolution"=>1 }, ::Hash, nil)
896
+ config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
886
897
  config_attr :interceptors, nil, ::Array, nil
887
898
  config_attr :timeout, nil, ::Numeric, nil
888
899
  config_attr :metadata, nil, ::Hash, nil
@@ -903,7 +914,7 @@ module Google
903
914
  def rpcs
904
915
  @rpcs ||= begin
905
916
  parent_rpcs = nil
906
- parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config&.respond_to?(:rpcs)
917
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
907
918
  Rpcs.new parent_rpcs
908
919
  end
909
920
  end
@@ -915,7 +926,7 @@ module Google
915
926
  # Each configuration object is of type `Gapic::Config::Method` and includes
916
927
  # the following configuration fields:
917
928
  #
918
- # * `timeout` (*type:* `Numeric`) - The call timeout in milliseconds
929
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
919
930
  # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
920
931
  # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
921
932
  # include the following keys:
@@ -959,17 +970,17 @@ module Google
959
970
 
960
971
  # @private
961
972
  def initialize parent_rpcs = nil
962
- create_cluster_config = parent_rpcs&.create_cluster if parent_rpcs&.respond_to? :create_cluster
973
+ create_cluster_config = parent_rpcs.create_cluster if parent_rpcs.respond_to? :create_cluster
963
974
  @create_cluster = ::Gapic::Config::Method.new create_cluster_config
964
- update_cluster_config = parent_rpcs&.update_cluster if parent_rpcs&.respond_to? :update_cluster
975
+ update_cluster_config = parent_rpcs.update_cluster if parent_rpcs.respond_to? :update_cluster
965
976
  @update_cluster = ::Gapic::Config::Method.new update_cluster_config
966
- delete_cluster_config = parent_rpcs&.delete_cluster if parent_rpcs&.respond_to? :delete_cluster
977
+ delete_cluster_config = parent_rpcs.delete_cluster if parent_rpcs.respond_to? :delete_cluster
967
978
  @delete_cluster = ::Gapic::Config::Method.new delete_cluster_config
968
- get_cluster_config = parent_rpcs&.get_cluster if parent_rpcs&.respond_to? :get_cluster
979
+ get_cluster_config = parent_rpcs.get_cluster if parent_rpcs.respond_to? :get_cluster
969
980
  @get_cluster = ::Gapic::Config::Method.new get_cluster_config
970
- list_clusters_config = parent_rpcs&.list_clusters if parent_rpcs&.respond_to? :list_clusters
981
+ list_clusters_config = parent_rpcs.list_clusters if parent_rpcs.respond_to? :list_clusters
971
982
  @list_clusters = ::Gapic::Config::Method.new list_clusters_config
972
- diagnose_cluster_config = parent_rpcs&.diagnose_cluster if parent_rpcs&.respond_to? :diagnose_cluster
983
+ diagnose_cluster_config = parent_rpcs.diagnose_cluster if parent_rpcs.respond_to? :diagnose_cluster
973
984
  @diagnose_cluster = ::Gapic::Config::Method.new diagnose_cluster_config
974
985
 
975
986
  yield self if block_given?
@@ -103,8 +103,13 @@ module Google
103
103
  # Lists operations that match the specified filter in the request. If the
104
104
  # server doesn't support this method, it returns `UNIMPLEMENTED`.
105
105
  #
106
- # NOTE: the `name` binding below allows API services to override the binding
107
- # to use different resource name schemes, such as `users/*/operations`.
106
+ # NOTE: the `name` binding allows API services to override the binding
107
+ # to use different resource name schemes, such as `users/*/operations`. To
108
+ # override the binding, API services can add a binding such as
109
+ # `"/v1/{name=users/*}/operations"` to their service configuration.
110
+ # For backwards compatibility, the default name includes the operations
111
+ # collection id, however overriding users must ensure the name binding
112
+ # is the parent resource, without the operations collection id.
108
113
  #
109
114
  # @overload list_operations(request, options = nil)
110
115
  # Pass arguments to `list_operations` via a request object, either of type
@@ -122,7 +127,7 @@ module Google
122
127
  # the default parameter values, pass an empty Hash as a request object (see above).
123
128
  #
124
129
  # @param name [::String]
125
- # The name of the operation collection.
130
+ # The name of the operation's parent resource.
126
131
  # @param filter [::String]
127
132
  # The standard list filter.
128
133
  # @param page_size [::Integer]
@@ -390,6 +395,79 @@ module Google
390
395
  raise ::Google::Cloud::Error.from_error(e)
391
396
  end
392
397
 
398
+ ##
399
+ # Waits for the specified long-running operation until it is done or reaches
400
+ # at most a specified timeout, returning the latest state. If the operation
401
+ # is already done, the latest state is immediately returned. If the timeout
402
+ # specified is greater than the default HTTP/RPC timeout, the HTTP/RPC
403
+ # timeout is used. If the server does not support this method, it returns
404
+ # `google.rpc.Code.UNIMPLEMENTED`.
405
+ # Note that this method is on a best-effort basis. It may return the latest
406
+ # state before the specified timeout (including immediately), meaning even an
407
+ # immediate response is no guarantee that the operation is done.
408
+ #
409
+ # @overload wait_operation(request, options = nil)
410
+ # Pass arguments to `wait_operation` via a request object, either of type
411
+ # {::Google::Longrunning::WaitOperationRequest} or an equivalent Hash.
412
+ #
413
+ # @param request [::Google::Longrunning::WaitOperationRequest, ::Hash]
414
+ # A request object representing the call parameters. Required. To specify no
415
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
416
+ # @param options [::Gapic::CallOptions, ::Hash]
417
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
418
+ #
419
+ # @overload wait_operation(name: nil, timeout: nil)
420
+ # Pass arguments to `wait_operation` via keyword arguments. Note that at
421
+ # least one keyword argument is required. To specify no parameters, or to keep all
422
+ # the default parameter values, pass an empty Hash as a request object (see above).
423
+ #
424
+ # @param name [::String]
425
+ # The name of the operation resource to wait on.
426
+ # @param timeout [::Google::Protobuf::Duration, ::Hash]
427
+ # The maximum duration to wait before timing out. If left blank, the wait
428
+ # will be at most the time permitted by the underlying HTTP/RPC protocol.
429
+ # If RPC context deadline is also specified, the shorter one will be used.
430
+ #
431
+ # @yield [response, operation] Access the result along with the RPC operation
432
+ # @yieldparam response [::Gapic::Operation]
433
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
434
+ #
435
+ # @return [::Gapic::Operation]
436
+ #
437
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
438
+ #
439
+ def wait_operation request, options = nil
440
+ raise ::ArgumentError, "request must be provided" if request.nil?
441
+
442
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::WaitOperationRequest
443
+
444
+ # Converts hash and nil to an options object
445
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
446
+
447
+ # Customize the options with defaults
448
+ metadata = @config.rpcs.wait_operation.metadata.to_h
449
+
450
+ # Set x-goog-api-client and x-goog-user-project headers
451
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
452
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
453
+ gapic_version: ::Google::Cloud::Dataproc::V1beta2::VERSION
454
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
455
+
456
+ options.apply_defaults timeout: @config.rpcs.wait_operation.timeout,
457
+ metadata: metadata,
458
+ retry_policy: @config.rpcs.wait_operation.retry_policy
459
+ options.apply_defaults metadata: @config.metadata,
460
+ retry_policy: @config.retry_policy
461
+
462
+ @operations_stub.call_rpc :wait_operation, request, options: options do |response, operation|
463
+ response = ::Gapic::Operation.new response, @operations_client, options: options
464
+ yield response, operation if block_given?
465
+ return response
466
+ end
467
+ rescue ::GRPC::BadStatus => e
468
+ raise ::Google::Cloud::Error.from_error(e)
469
+ end
470
+
393
471
  ##
394
472
  # Configuration class for the Operations API.
395
473
  #
@@ -482,7 +560,7 @@ module Google
482
560
  config_attr :scope, nil, ::String, ::Array, nil
483
561
  config_attr :lib_name, nil, ::String, nil
484
562
  config_attr :lib_version, nil, ::String, nil
485
- config_attr(:channel_args, { "grpc.service_config_disable_resolution"=>1 }, ::Hash, nil)
563
+ config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
486
564
  config_attr :interceptors, nil, ::Array, nil
487
565
  config_attr :timeout, nil, ::Numeric, nil
488
566
  config_attr :metadata, nil, ::Hash, nil
@@ -503,7 +581,7 @@ module Google
503
581
  def rpcs
504
582
  @rpcs ||= begin
505
583
  parent_rpcs = nil
506
- parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config&.respond_to?(:rpcs)
584
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
507
585
  Rpcs.new parent_rpcs
508
586
  end
509
587
  end
@@ -515,7 +593,7 @@ module Google
515
593
  # Each configuration object is of type `Gapic::Config::Method` and includes
516
594
  # the following configuration fields:
517
595
  #
518
- # * `timeout` (*type:* `Numeric`) - The call timeout in milliseconds
596
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
519
597
  # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
520
598
  # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
521
599
  # include the following keys:
@@ -546,17 +624,24 @@ module Google
546
624
  # @return [::Gapic::Config::Method]
547
625
  #
548
626
  attr_reader :cancel_operation
627
+ ##
628
+ # RPC-specific configuration for `wait_operation`
629
+ # @return [::Gapic::Config::Method]
630
+ #
631
+ attr_reader :wait_operation
549
632
 
550
633
  # @private
551
634
  def initialize parent_rpcs = nil
552
- list_operations_config = parent_rpcs&.list_operations if parent_rpcs&.respond_to? :list_operations
635
+ list_operations_config = parent_rpcs.list_operations if parent_rpcs.respond_to? :list_operations
553
636
  @list_operations = ::Gapic::Config::Method.new list_operations_config
554
- get_operation_config = parent_rpcs&.get_operation if parent_rpcs&.respond_to? :get_operation
637
+ get_operation_config = parent_rpcs.get_operation if parent_rpcs.respond_to? :get_operation
555
638
  @get_operation = ::Gapic::Config::Method.new get_operation_config
556
- delete_operation_config = parent_rpcs&.delete_operation if parent_rpcs&.respond_to? :delete_operation
639
+ delete_operation_config = parent_rpcs.delete_operation if parent_rpcs.respond_to? :delete_operation
557
640
  @delete_operation = ::Gapic::Config::Method.new delete_operation_config
558
- cancel_operation_config = parent_rpcs&.cancel_operation if parent_rpcs&.respond_to? :cancel_operation
641
+ cancel_operation_config = parent_rpcs.cancel_operation if parent_rpcs.respond_to? :cancel_operation
559
642
  @cancel_operation = ::Gapic::Config::Method.new cancel_operation_config
643
+ wait_operation_config = parent_rpcs.wait_operation if parent_rpcs.respond_to? :wait_operation
644
+ @wait_operation = ::Gapic::Config::Method.new wait_operation_config
560
645
 
561
646
  yield self if block_given?
562
647
  end