google-cloud-dataproc-v1beta2 0.4.0 → 0.6.2
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.
- checksums.yaml +4 -4
- data/AUTHENTICATION.md +8 -8
- data/LICENSE.md +188 -190
- data/README.md +67 -3
- data/lib/google/cloud/dataproc/v1beta2/autoscaling_policy_service/client.rb +20 -23
- data/lib/google/cloud/dataproc/v1beta2/autoscaling_policy_service/paths.rb +1 -1
- data/lib/google/cloud/dataproc/v1beta2/cluster_controller/client.rb +34 -46
- data/lib/google/cloud/dataproc/v1beta2/cluster_controller/operations.rb +96 -11
- data/lib/google/cloud/dataproc/v1beta2/job_controller/client.rb +37 -52
- data/lib/google/cloud/dataproc/v1beta2/job_controller/operations.rb +96 -11
- data/lib/google/cloud/dataproc/v1beta2/version.rb +1 -1
- data/lib/google/cloud/dataproc/v1beta2/workflow_template_service/client.rb +26 -41
- data/lib/google/cloud/dataproc/v1beta2/workflow_template_service/operations.rb +96 -11
- data/lib/google/cloud/dataproc/v1beta2/workflow_template_service/paths.rb +1 -1
- data/proto_docs/google/api/field_behavior.rb +12 -0
- data/proto_docs/google/longrunning/operations.rb +17 -3
- data/proto_docs/google/protobuf/any.rb +5 -2
- data/proto_docs/google/protobuf/timestamp.rb +10 -1
- metadata +20 -11
@@ -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
|
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
|
@@ -70,26 +70,17 @@ module Google
|
|
70
70
|
|
71
71
|
default_config.rpcs.update_autoscaling_policy.timeout = 600.0
|
72
72
|
default_config.rpcs.update_autoscaling_policy.retry_policy = {
|
73
|
-
initial_delay: 0.1,
|
74
|
-
max_delay: 60.0,
|
75
|
-
multiplier: 1.3,
|
76
|
-
retry_codes: [4, 14]
|
73
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
|
77
74
|
}
|
78
75
|
|
79
76
|
default_config.rpcs.get_autoscaling_policy.timeout = 600.0
|
80
77
|
default_config.rpcs.get_autoscaling_policy.retry_policy = {
|
81
|
-
initial_delay: 0.1,
|
82
|
-
max_delay: 60.0,
|
83
|
-
multiplier: 1.3,
|
84
|
-
retry_codes: [4, 14]
|
78
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
|
85
79
|
}
|
86
80
|
|
87
81
|
default_config.rpcs.list_autoscaling_policies.timeout = 600.0
|
88
82
|
default_config.rpcs.list_autoscaling_policies.retry_policy = {
|
89
|
-
initial_delay: 0.1,
|
90
|
-
max_delay: 60.0,
|
91
|
-
multiplier: 1.3,
|
92
|
-
retry_codes: [4, 14]
|
83
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
|
93
84
|
}
|
94
85
|
|
95
86
|
default_config.rpcs.delete_autoscaling_policy.timeout = 600.0
|
@@ -155,8 +146,14 @@ module Google
|
|
155
146
|
|
156
147
|
# Create credentials
|
157
148
|
credentials = @config.credentials
|
158
|
-
|
159
|
-
if
|
149
|
+
# Use self-signed JWT if the scope and endpoint are unchanged from default,
|
150
|
+
# but only if the default endpoint does not have a region prefix.
|
151
|
+
enable_self_signed_jwt = @config.scope == Client.configure.scope &&
|
152
|
+
@config.endpoint == Client.configure.endpoint &&
|
153
|
+
!@config.endpoint.split(".").first.include?("-")
|
154
|
+
credentials ||= Credentials.default scope: @config.scope,
|
155
|
+
enable_self_signed_jwt: enable_self_signed_jwt
|
156
|
+
if credentials.is_a?(::String) || credentials.is_a?(::Hash)
|
160
157
|
credentials = Credentials.new credentials, scope: @config.scope
|
161
158
|
end
|
162
159
|
@quota_project_id = @config.quota_project
|
@@ -644,7 +641,7 @@ module Google
|
|
644
641
|
config_attr :scope, nil, ::String, ::Array, nil
|
645
642
|
config_attr :lib_name, nil, ::String, nil
|
646
643
|
config_attr :lib_version, nil, ::String, nil
|
647
|
-
config_attr(:channel_args, { "grpc.service_config_disable_resolution"=>1 }, ::Hash, nil)
|
644
|
+
config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
|
648
645
|
config_attr :interceptors, nil, ::Array, nil
|
649
646
|
config_attr :timeout, nil, ::Numeric, nil
|
650
647
|
config_attr :metadata, nil, ::Hash, nil
|
@@ -665,7 +662,7 @@ module Google
|
|
665
662
|
def rpcs
|
666
663
|
@rpcs ||= begin
|
667
664
|
parent_rpcs = nil
|
668
|
-
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config
|
665
|
+
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
|
669
666
|
Rpcs.new parent_rpcs
|
670
667
|
end
|
671
668
|
end
|
@@ -677,7 +674,7 @@ module Google
|
|
677
674
|
# Each configuration object is of type `Gapic::Config::Method` and includes
|
678
675
|
# the following configuration fields:
|
679
676
|
#
|
680
|
-
# * `timeout` (*type:* `Numeric`) - The call timeout in
|
677
|
+
# * `timeout` (*type:* `Numeric`) - The call timeout in seconds
|
681
678
|
# * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
|
682
679
|
# * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
|
683
680
|
# include the following keys:
|
@@ -716,15 +713,15 @@ module Google
|
|
716
713
|
|
717
714
|
# @private
|
718
715
|
def initialize parent_rpcs = nil
|
719
|
-
create_autoscaling_policy_config = parent_rpcs
|
716
|
+
create_autoscaling_policy_config = parent_rpcs.create_autoscaling_policy if parent_rpcs.respond_to? :create_autoscaling_policy
|
720
717
|
@create_autoscaling_policy = ::Gapic::Config::Method.new create_autoscaling_policy_config
|
721
|
-
update_autoscaling_policy_config = parent_rpcs
|
718
|
+
update_autoscaling_policy_config = parent_rpcs.update_autoscaling_policy if parent_rpcs.respond_to? :update_autoscaling_policy
|
722
719
|
@update_autoscaling_policy = ::Gapic::Config::Method.new update_autoscaling_policy_config
|
723
|
-
get_autoscaling_policy_config = parent_rpcs
|
720
|
+
get_autoscaling_policy_config = parent_rpcs.get_autoscaling_policy if parent_rpcs.respond_to? :get_autoscaling_policy
|
724
721
|
@get_autoscaling_policy = ::Gapic::Config::Method.new get_autoscaling_policy_config
|
725
|
-
list_autoscaling_policies_config = parent_rpcs
|
722
|
+
list_autoscaling_policies_config = parent_rpcs.list_autoscaling_policies if parent_rpcs.respond_to? :list_autoscaling_policies
|
726
723
|
@list_autoscaling_policies = ::Gapic::Config::Method.new list_autoscaling_policies_config
|
727
|
-
delete_autoscaling_policy_config = parent_rpcs
|
724
|
+
delete_autoscaling_policy_config = parent_rpcs.delete_autoscaling_policy if parent_rpcs.respond_to? :delete_autoscaling_policy
|
728
725
|
@delete_autoscaling_policy = ::Gapic::Config::Method.new delete_autoscaling_policy_config
|
729
726
|
|
730
727
|
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"
|
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
|
|
@@ -61,57 +61,39 @@ 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
|
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
|
68
68
|
|
69
69
|
default_config.rpcs.create_cluster.timeout = 300.0
|
70
70
|
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]
|
71
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14]
|
75
72
|
}
|
76
73
|
|
77
74
|
default_config.rpcs.update_cluster.timeout = 300.0
|
78
75
|
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]
|
76
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14]
|
83
77
|
}
|
84
78
|
|
85
79
|
default_config.rpcs.delete_cluster.timeout = 300.0
|
86
80
|
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]
|
81
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14]
|
91
82
|
}
|
92
83
|
|
93
84
|
default_config.rpcs.get_cluster.timeout = 300.0
|
94
85
|
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]
|
86
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [13, 4, 14]
|
99
87
|
}
|
100
88
|
|
101
89
|
default_config.rpcs.list_clusters.timeout = 300.0
|
102
90
|
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]
|
91
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [13, 4, 14]
|
107
92
|
}
|
108
93
|
|
109
94
|
default_config.rpcs.diagnose_cluster.timeout = 300.0
|
110
95
|
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]
|
96
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14]
|
115
97
|
}
|
116
98
|
|
117
99
|
default_config
|
@@ -175,8 +157,14 @@ module Google
|
|
175
157
|
|
176
158
|
# Create credentials
|
177
159
|
credentials = @config.credentials
|
178
|
-
|
179
|
-
if
|
160
|
+
# Use self-signed JWT if the scope and endpoint are unchanged from default,
|
161
|
+
# 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 &&
|
164
|
+
!@config.endpoint.split(".").first.include?("-")
|
165
|
+
credentials ||= Credentials.default scope: @config.scope,
|
166
|
+
enable_self_signed_jwt: enable_self_signed_jwt
|
167
|
+
if credentials.is_a?(::String) || credentials.is_a?(::Hash)
|
180
168
|
credentials = Credentials.new credentials, scope: @config.scope
|
181
169
|
end
|
182
170
|
@quota_project_id = @config.quota_project
|
@@ -273,7 +261,7 @@ module Google
|
|
273
261
|
|
274
262
|
header_params = {
|
275
263
|
"project_id" => request.project_id,
|
276
|
-
"region"
|
264
|
+
"region" => request.region
|
277
265
|
}
|
278
266
|
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
279
267
|
metadata[:"x-goog-request-params"] ||= request_params_header
|
@@ -433,8 +421,8 @@ module Google
|
|
433
421
|
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
434
422
|
|
435
423
|
header_params = {
|
436
|
-
"project_id"
|
437
|
-
"region"
|
424
|
+
"project_id" => request.project_id,
|
425
|
+
"region" => request.region,
|
438
426
|
"cluster_name" => request.cluster_name
|
439
427
|
}
|
440
428
|
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
@@ -525,8 +513,8 @@ module Google
|
|
525
513
|
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
526
514
|
|
527
515
|
header_params = {
|
528
|
-
"project_id"
|
529
|
-
"region"
|
516
|
+
"project_id" => request.project_id,
|
517
|
+
"region" => request.region,
|
530
518
|
"cluster_name" => request.cluster_name
|
531
519
|
}
|
532
520
|
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
@@ -599,8 +587,8 @@ module Google
|
|
599
587
|
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
600
588
|
|
601
589
|
header_params = {
|
602
|
-
"project_id"
|
603
|
-
"region"
|
590
|
+
"project_id" => request.project_id,
|
591
|
+
"region" => request.region,
|
604
592
|
"cluster_name" => request.cluster_name
|
605
593
|
}
|
606
594
|
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
@@ -695,7 +683,7 @@ module Google
|
|
695
683
|
|
696
684
|
header_params = {
|
697
685
|
"project_id" => request.project_id,
|
698
|
-
"region"
|
686
|
+
"region" => request.region
|
699
687
|
}
|
700
688
|
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
701
689
|
metadata[:"x-goog-request-params"] ||= request_params_header
|
@@ -773,8 +761,8 @@ module Google
|
|
773
761
|
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
774
762
|
|
775
763
|
header_params = {
|
776
|
-
"project_id"
|
777
|
-
"region"
|
764
|
+
"project_id" => request.project_id,
|
765
|
+
"region" => request.region,
|
778
766
|
"cluster_name" => request.cluster_name
|
779
767
|
}
|
780
768
|
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
@@ -887,7 +875,7 @@ module Google
|
|
887
875
|
config_attr :scope, nil, ::String, ::Array, nil
|
888
876
|
config_attr :lib_name, nil, ::String, nil
|
889
877
|
config_attr :lib_version, nil, ::String, nil
|
890
|
-
config_attr(:channel_args, { "grpc.service_config_disable_resolution"=>1 }, ::Hash, nil)
|
878
|
+
config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
|
891
879
|
config_attr :interceptors, nil, ::Array, nil
|
892
880
|
config_attr :timeout, nil, ::Numeric, nil
|
893
881
|
config_attr :metadata, nil, ::Hash, nil
|
@@ -908,7 +896,7 @@ module Google
|
|
908
896
|
def rpcs
|
909
897
|
@rpcs ||= begin
|
910
898
|
parent_rpcs = nil
|
911
|
-
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config
|
899
|
+
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
|
912
900
|
Rpcs.new parent_rpcs
|
913
901
|
end
|
914
902
|
end
|
@@ -920,7 +908,7 @@ module Google
|
|
920
908
|
# Each configuration object is of type `Gapic::Config::Method` and includes
|
921
909
|
# the following configuration fields:
|
922
910
|
#
|
923
|
-
# * `timeout` (*type:* `Numeric`) - The call timeout in
|
911
|
+
# * `timeout` (*type:* `Numeric`) - The call timeout in seconds
|
924
912
|
# * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
|
925
913
|
# * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
|
926
914
|
# include the following keys:
|
@@ -964,17 +952,17 @@ module Google
|
|
964
952
|
|
965
953
|
# @private
|
966
954
|
def initialize parent_rpcs = nil
|
967
|
-
create_cluster_config = parent_rpcs
|
955
|
+
create_cluster_config = parent_rpcs.create_cluster if parent_rpcs.respond_to? :create_cluster
|
968
956
|
@create_cluster = ::Gapic::Config::Method.new create_cluster_config
|
969
|
-
update_cluster_config = parent_rpcs
|
957
|
+
update_cluster_config = parent_rpcs.update_cluster if parent_rpcs.respond_to? :update_cluster
|
970
958
|
@update_cluster = ::Gapic::Config::Method.new update_cluster_config
|
971
|
-
delete_cluster_config = parent_rpcs
|
959
|
+
delete_cluster_config = parent_rpcs.delete_cluster if parent_rpcs.respond_to? :delete_cluster
|
972
960
|
@delete_cluster = ::Gapic::Config::Method.new delete_cluster_config
|
973
|
-
get_cluster_config = parent_rpcs
|
961
|
+
get_cluster_config = parent_rpcs.get_cluster if parent_rpcs.respond_to? :get_cluster
|
974
962
|
@get_cluster = ::Gapic::Config::Method.new get_cluster_config
|
975
|
-
list_clusters_config = parent_rpcs
|
963
|
+
list_clusters_config = parent_rpcs.list_clusters if parent_rpcs.respond_to? :list_clusters
|
976
964
|
@list_clusters = ::Gapic::Config::Method.new list_clusters_config
|
977
|
-
diagnose_cluster_config = parent_rpcs
|
965
|
+
diagnose_cluster_config = parent_rpcs.diagnose_cluster if parent_rpcs.respond_to? :diagnose_cluster
|
978
966
|
@diagnose_cluster = ::Gapic::Config::Method.new diagnose_cluster_config
|
979
967
|
|
980
968
|
yield self if block_given?
|
@@ -82,7 +82,7 @@ module Google
|
|
82
82
|
# Create credentials
|
83
83
|
credentials = @config.credentials
|
84
84
|
credentials ||= Credentials.default scope: @config.scope
|
85
|
-
if credentials.is_a?(String) || credentials.is_a?(Hash)
|
85
|
+
if credentials.is_a?(::String) || credentials.is_a?(::Hash)
|
86
86
|
credentials = Credentials.new credentials, scope: @config.scope
|
87
87
|
end
|
88
88
|
@quota_project_id = @config.quota_project
|
@@ -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
|
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
|
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 until the specified long-running operation is done or reaches at most
|
400
|
+
# a specified timeout, returning the latest state. If the operation is
|
401
|
+
# 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
|
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
|
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
|
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
|
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
|
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
|
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
|