google-cloud-dataproc-v1 0.3.2 → 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/v1/autoscaling_policy_service/client.rb +19 -22
- data/lib/google/cloud/dataproc/v1/autoscaling_policy_service/paths.rb +1 -1
- data/lib/google/cloud/dataproc/v1/cluster_controller.rb +1 -0
- data/lib/google/cloud/dataproc/v1/cluster_controller/client.rb +238 -52
- data/lib/google/cloud/dataproc/v1/cluster_controller/operations.rb +95 -10
- data/lib/google/cloud/dataproc/v1/cluster_controller/paths.rb +71 -0
- data/lib/google/cloud/dataproc/v1/clusters_pb.rb +60 -0
- data/lib/google/cloud/dataproc/v1/clusters_services_pb.rb +4 -0
- data/lib/google/cloud/dataproc/v1/job_controller/client.rb +42 -55
- data/lib/google/cloud/dataproc/v1/job_controller/operations.rb +95 -10
- data/lib/google/cloud/dataproc/v1/jobs_pb.rb +2 -0
- data/lib/google/cloud/dataproc/v1/shared_pb.rb +7 -0
- data/lib/google/cloud/dataproc/v1/version.rb +1 -1
- data/lib/google/cloud/dataproc/v1/workflow_template_service/client.rb +28 -42
- data/lib/google/cloud/dataproc/v1/workflow_template_service/operations.rb +95 -10
- data/lib/google/cloud/dataproc/v1/workflow_template_service/paths.rb +39 -1
- data/lib/google/cloud/dataproc/v1/workflow_templates_pb.rb +5 -0
- data/lib/google/cloud/dataproc/v1/workflow_templates_services_pb.rb +2 -1
- data/proto_docs/google/api/field_behavior.rb +12 -0
- data/proto_docs/google/cloud/dataproc/v1/clusters.rb +240 -16
- data/proto_docs/google/cloud/dataproc/v1/jobs.rb +29 -10
- data/proto_docs/google/cloud/dataproc/v1/shared.rb +24 -1
- data/proto_docs/google/cloud/dataproc/v1/workflow_templates.rb +34 -7
- 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 +21 -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
|
@@ -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
|
|
@@ -23,6 +23,7 @@ require "gapic/config/method"
|
|
23
23
|
require "google/cloud/dataproc/v1/version"
|
24
24
|
|
25
25
|
require "google/cloud/dataproc/v1/cluster_controller/credentials"
|
26
|
+
require "google/cloud/dataproc/v1/cluster_controller/paths"
|
26
27
|
require "google/cloud/dataproc/v1/cluster_controller/operations"
|
27
28
|
require "google/cloud/dataproc/v1/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,57 +61,39 @@ 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
|
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
|
66
68
|
|
67
69
|
default_config.rpcs.create_cluster.timeout = 300.0
|
68
70
|
default_config.rpcs.create_cluster.retry_policy = {
|
69
|
-
initial_delay: 0.1,
|
70
|
-
max_delay: 60.0,
|
71
|
-
multiplier: 1.3,
|
72
|
-
retry_codes: [14]
|
71
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14]
|
73
72
|
}
|
74
73
|
|
75
74
|
default_config.rpcs.update_cluster.timeout = 300.0
|
76
75
|
default_config.rpcs.update_cluster.retry_policy = {
|
77
|
-
initial_delay: 0.1,
|
78
|
-
max_delay: 60.0,
|
79
|
-
multiplier: 1.3,
|
80
|
-
retry_codes: [14]
|
76
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14]
|
81
77
|
}
|
82
78
|
|
83
79
|
default_config.rpcs.delete_cluster.timeout = 300.0
|
84
80
|
default_config.rpcs.delete_cluster.retry_policy = {
|
85
|
-
initial_delay: 0.1,
|
86
|
-
max_delay: 60.0,
|
87
|
-
multiplier: 1.3,
|
88
|
-
retry_codes: [14]
|
81
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14]
|
89
82
|
}
|
90
83
|
|
91
84
|
default_config.rpcs.get_cluster.timeout = 300.0
|
92
85
|
default_config.rpcs.get_cluster.retry_policy = {
|
93
|
-
initial_delay: 0.1,
|
94
|
-
max_delay: 60.0,
|
95
|
-
multiplier: 1.3,
|
96
|
-
retry_codes: [13, 4, 14]
|
86
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [13, 4, 14]
|
97
87
|
}
|
98
88
|
|
99
89
|
default_config.rpcs.list_clusters.timeout = 300.0
|
100
90
|
default_config.rpcs.list_clusters.retry_policy = {
|
101
|
-
initial_delay: 0.1,
|
102
|
-
max_delay: 60.0,
|
103
|
-
multiplier: 1.3,
|
104
|
-
retry_codes: [13, 4, 14]
|
91
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [13, 4, 14]
|
105
92
|
}
|
106
93
|
|
107
94
|
default_config.rpcs.diagnose_cluster.timeout = 300.0
|
108
95
|
default_config.rpcs.diagnose_cluster.retry_policy = {
|
109
|
-
initial_delay: 0.1,
|
110
|
-
max_delay: 60.0,
|
111
|
-
multiplier: 1.3,
|
112
|
-
retry_codes: [14]
|
96
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14]
|
113
97
|
}
|
114
98
|
|
115
99
|
default_config
|
@@ -173,8 +157,14 @@ module Google
|
|
173
157
|
|
174
158
|
# Create credentials
|
175
159
|
credentials = @config.credentials
|
176
|
-
|
177
|
-
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)
|
178
168
|
credentials = Credentials.new credentials, scope: @config.scope
|
179
169
|
end
|
180
170
|
@quota_project_id = @config.quota_project
|
@@ -231,9 +221,9 @@ module Google
|
|
231
221
|
# @param cluster [::Google::Cloud::Dataproc::V1::Cluster, ::Hash]
|
232
222
|
# Required. The cluster to create.
|
233
223
|
# @param request_id [::String]
|
234
|
-
# Optional. A unique id used to identify the request. If the server
|
235
|
-
#
|
236
|
-
# id, then the second request will be ignored and the
|
224
|
+
# Optional. A unique id used to identify the request. If the server receives two
|
225
|
+
# [CreateClusterRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.CreateClusterRequest)s
|
226
|
+
# with the same id, then the second request will be ignored and the
|
237
227
|
# first {::Google::Longrunning::Operation google.longrunning.Operation} created and stored in the backend
|
238
228
|
# is returned.
|
239
229
|
#
|
@@ -270,7 +260,7 @@ module Google
|
|
270
260
|
|
271
261
|
header_params = {
|
272
262
|
"project_id" => request.project_id,
|
273
|
-
"region"
|
263
|
+
"region" => request.region
|
274
264
|
}
|
275
265
|
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
276
266
|
metadata[:"x-goog-request-params"] ||= request_params_header
|
@@ -383,8 +373,9 @@ module Google
|
|
383
373
|
# </table>
|
384
374
|
# @param request_id [::String]
|
385
375
|
# Optional. A unique id used to identify the request. If the server
|
386
|
-
# receives two
|
387
|
-
#
|
376
|
+
# receives two
|
377
|
+
# [UpdateClusterRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.UpdateClusterRequest)s
|
378
|
+
# with the same id, then the second request will be ignored and the
|
388
379
|
# first {::Google::Longrunning::Operation google.longrunning.Operation} created and stored in the
|
389
380
|
# backend is returned.
|
390
381
|
#
|
@@ -420,8 +411,8 @@ module Google
|
|
420
411
|
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
421
412
|
|
422
413
|
header_params = {
|
423
|
-
"project_id"
|
424
|
-
"region"
|
414
|
+
"project_id" => request.project_id,
|
415
|
+
"region" => request.region,
|
425
416
|
"cluster_name" => request.cluster_name
|
426
417
|
}
|
427
418
|
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
@@ -442,6 +433,186 @@ module Google
|
|
442
433
|
raise ::Google::Cloud::Error.from_error(e)
|
443
434
|
end
|
444
435
|
|
436
|
+
##
|
437
|
+
# Stops a cluster in a project.
|
438
|
+
#
|
439
|
+
# @overload stop_cluster(request, options = nil)
|
440
|
+
# Pass arguments to `stop_cluster` via a request object, either of type
|
441
|
+
# {::Google::Cloud::Dataproc::V1::StopClusterRequest} or an equivalent Hash.
|
442
|
+
#
|
443
|
+
# @param request [::Google::Cloud::Dataproc::V1::StopClusterRequest, ::Hash]
|
444
|
+
# A request object representing the call parameters. Required. To specify no
|
445
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
446
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
447
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
448
|
+
#
|
449
|
+
# @overload stop_cluster(project_id: nil, region: nil, cluster_name: nil, cluster_uuid: nil, request_id: nil)
|
450
|
+
# Pass arguments to `stop_cluster` via keyword arguments. Note that at
|
451
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
452
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
453
|
+
#
|
454
|
+
# @param project_id [::String]
|
455
|
+
# Required. The ID of the Google Cloud Platform project the
|
456
|
+
# cluster belongs to.
|
457
|
+
# @param region [::String]
|
458
|
+
# Required. The Dataproc region in which to handle the request.
|
459
|
+
# @param cluster_name [::String]
|
460
|
+
# Required. The cluster name.
|
461
|
+
# @param cluster_uuid [::String]
|
462
|
+
# Optional. Specifying the `cluster_uuid` means the RPC will fail
|
463
|
+
# (with error NOT_FOUND) if a cluster with the specified UUID does not exist.
|
464
|
+
# @param request_id [::String]
|
465
|
+
# Optional. A unique id used to identify the request. If the server
|
466
|
+
# receives two
|
467
|
+
# [StopClusterRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.StopClusterRequest)s
|
468
|
+
# with the same id, then the second request will be ignored and the
|
469
|
+
# first {::Google::Longrunning::Operation google.longrunning.Operation} created and stored in the
|
470
|
+
# backend is returned.
|
471
|
+
#
|
472
|
+
# Recommendation: Set this value to a
|
473
|
+
# [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier).
|
474
|
+
#
|
475
|
+
# The id must contain only letters (a-z, A-Z), numbers (0-9),
|
476
|
+
# underscores (_), and hyphens (-). The maximum length is 40 characters.
|
477
|
+
#
|
478
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
479
|
+
# @yieldparam response [::Gapic::Operation]
|
480
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
481
|
+
#
|
482
|
+
# @return [::Gapic::Operation]
|
483
|
+
#
|
484
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
485
|
+
#
|
486
|
+
def stop_cluster request, options = nil
|
487
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
488
|
+
|
489
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dataproc::V1::StopClusterRequest
|
490
|
+
|
491
|
+
# Converts hash and nil to an options object
|
492
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
493
|
+
|
494
|
+
# Customize the options with defaults
|
495
|
+
metadata = @config.rpcs.stop_cluster.metadata.to_h
|
496
|
+
|
497
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
498
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
499
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
500
|
+
gapic_version: ::Google::Cloud::Dataproc::V1::VERSION
|
501
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
502
|
+
|
503
|
+
header_params = {
|
504
|
+
"project_id" => request.project_id,
|
505
|
+
"region" => request.region,
|
506
|
+
"cluster_name" => request.cluster_name
|
507
|
+
}
|
508
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
509
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
510
|
+
|
511
|
+
options.apply_defaults timeout: @config.rpcs.stop_cluster.timeout,
|
512
|
+
metadata: metadata,
|
513
|
+
retry_policy: @config.rpcs.stop_cluster.retry_policy
|
514
|
+
options.apply_defaults metadata: @config.metadata,
|
515
|
+
retry_policy: @config.retry_policy
|
516
|
+
|
517
|
+
@cluster_controller_stub.call_rpc :stop_cluster, request, options: options do |response, operation|
|
518
|
+
response = ::Gapic::Operation.new response, @operations_client, options: options
|
519
|
+
yield response, operation if block_given?
|
520
|
+
return response
|
521
|
+
end
|
522
|
+
rescue ::GRPC::BadStatus => e
|
523
|
+
raise ::Google::Cloud::Error.from_error(e)
|
524
|
+
end
|
525
|
+
|
526
|
+
##
|
527
|
+
# Starts a cluster in a project.
|
528
|
+
#
|
529
|
+
# @overload start_cluster(request, options = nil)
|
530
|
+
# Pass arguments to `start_cluster` via a request object, either of type
|
531
|
+
# {::Google::Cloud::Dataproc::V1::StartClusterRequest} or an equivalent Hash.
|
532
|
+
#
|
533
|
+
# @param request [::Google::Cloud::Dataproc::V1::StartClusterRequest, ::Hash]
|
534
|
+
# A request object representing the call parameters. Required. To specify no
|
535
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
536
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
537
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
538
|
+
#
|
539
|
+
# @overload start_cluster(project_id: nil, region: nil, cluster_name: nil, cluster_uuid: nil, request_id: nil)
|
540
|
+
# Pass arguments to `start_cluster` via keyword arguments. Note that at
|
541
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
542
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
543
|
+
#
|
544
|
+
# @param project_id [::String]
|
545
|
+
# Required. The ID of the Google Cloud Platform project the
|
546
|
+
# cluster belongs to.
|
547
|
+
# @param region [::String]
|
548
|
+
# Required. The Dataproc region in which to handle the request.
|
549
|
+
# @param cluster_name [::String]
|
550
|
+
# Required. The cluster name.
|
551
|
+
# @param cluster_uuid [::String]
|
552
|
+
# Optional. Specifying the `cluster_uuid` means the RPC will fail
|
553
|
+
# (with error NOT_FOUND) if a cluster with the specified UUID does not exist.
|
554
|
+
# @param request_id [::String]
|
555
|
+
# Optional. A unique id used to identify the request. If the server
|
556
|
+
# receives two
|
557
|
+
# [StartClusterRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.StartClusterRequest)s
|
558
|
+
# with the same id, then the second request will be ignored and the
|
559
|
+
# first {::Google::Longrunning::Operation google.longrunning.Operation} created and stored in the
|
560
|
+
# backend is returned.
|
561
|
+
#
|
562
|
+
# Recommendation: Set this value to a
|
563
|
+
# [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier).
|
564
|
+
#
|
565
|
+
# The id must contain only letters (a-z, A-Z), numbers (0-9),
|
566
|
+
# underscores (_), and hyphens (-). The maximum length is 40 characters.
|
567
|
+
#
|
568
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
569
|
+
# @yieldparam response [::Gapic::Operation]
|
570
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
571
|
+
#
|
572
|
+
# @return [::Gapic::Operation]
|
573
|
+
#
|
574
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
575
|
+
#
|
576
|
+
def start_cluster request, options = nil
|
577
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
578
|
+
|
579
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dataproc::V1::StartClusterRequest
|
580
|
+
|
581
|
+
# Converts hash and nil to an options object
|
582
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
583
|
+
|
584
|
+
# Customize the options with defaults
|
585
|
+
metadata = @config.rpcs.start_cluster.metadata.to_h
|
586
|
+
|
587
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
588
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
589
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
590
|
+
gapic_version: ::Google::Cloud::Dataproc::V1::VERSION
|
591
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
592
|
+
|
593
|
+
header_params = {
|
594
|
+
"project_id" => request.project_id,
|
595
|
+
"region" => request.region,
|
596
|
+
"cluster_name" => request.cluster_name
|
597
|
+
}
|
598
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
599
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
600
|
+
|
601
|
+
options.apply_defaults timeout: @config.rpcs.start_cluster.timeout,
|
602
|
+
metadata: metadata,
|
603
|
+
retry_policy: @config.rpcs.start_cluster.retry_policy
|
604
|
+
options.apply_defaults metadata: @config.metadata,
|
605
|
+
retry_policy: @config.retry_policy
|
606
|
+
|
607
|
+
@cluster_controller_stub.call_rpc :start_cluster, request, options: options do |response, operation|
|
608
|
+
response = ::Gapic::Operation.new response, @operations_client, options: options
|
609
|
+
yield response, operation if block_given?
|
610
|
+
return response
|
611
|
+
end
|
612
|
+
rescue ::GRPC::BadStatus => e
|
613
|
+
raise ::Google::Cloud::Error.from_error(e)
|
614
|
+
end
|
615
|
+
|
445
616
|
##
|
446
617
|
# Deletes a cluster in a project. The returned
|
447
618
|
# {::Google::Longrunning::Operation#metadata Operation.metadata} will be
|
@@ -474,8 +645,9 @@ module Google
|
|
474
645
|
# (with error NOT_FOUND) if cluster with specified UUID does not exist.
|
475
646
|
# @param request_id [::String]
|
476
647
|
# Optional. A unique id used to identify the request. If the server
|
477
|
-
# receives two
|
478
|
-
#
|
648
|
+
# receives two
|
649
|
+
# [DeleteClusterRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.DeleteClusterRequest)s
|
650
|
+
# with the same id, then the second request will be ignored and the
|
479
651
|
# first {::Google::Longrunning::Operation google.longrunning.Operation} created and stored in the
|
480
652
|
# backend is returned.
|
481
653
|
#
|
@@ -511,8 +683,8 @@ module Google
|
|
511
683
|
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
512
684
|
|
513
685
|
header_params = {
|
514
|
-
"project_id"
|
515
|
-
"region"
|
686
|
+
"project_id" => request.project_id,
|
687
|
+
"region" => request.region,
|
516
688
|
"cluster_name" => request.cluster_name
|
517
689
|
}
|
518
690
|
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
@@ -585,8 +757,8 @@ module Google
|
|
585
757
|
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
586
758
|
|
587
759
|
header_params = {
|
588
|
-
"project_id"
|
589
|
-
"region"
|
760
|
+
"project_id" => request.project_id,
|
761
|
+
"region" => request.region,
|
590
762
|
"cluster_name" => request.cluster_name
|
591
763
|
}
|
592
764
|
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
@@ -681,7 +853,7 @@ module Google
|
|
681
853
|
|
682
854
|
header_params = {
|
683
855
|
"project_id" => request.project_id,
|
684
|
-
"region"
|
856
|
+
"region" => request.region
|
685
857
|
}
|
686
858
|
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
687
859
|
metadata[:"x-goog-request-params"] ||= request_params_header
|
@@ -759,8 +931,8 @@ module Google
|
|
759
931
|
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
760
932
|
|
761
933
|
header_params = {
|
762
|
-
"project_id"
|
763
|
-
"region"
|
934
|
+
"project_id" => request.project_id,
|
935
|
+
"region" => request.region,
|
764
936
|
"cluster_name" => request.cluster_name
|
765
937
|
}
|
766
938
|
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
@@ -873,7 +1045,7 @@ module Google
|
|
873
1045
|
config_attr :scope, nil, ::String, ::Array, nil
|
874
1046
|
config_attr :lib_name, nil, ::String, nil
|
875
1047
|
config_attr :lib_version, nil, ::String, nil
|
876
|
-
config_attr(:channel_args, { "grpc.service_config_disable_resolution"=>1 }, ::Hash, nil)
|
1048
|
+
config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
|
877
1049
|
config_attr :interceptors, nil, ::Array, nil
|
878
1050
|
config_attr :timeout, nil, ::Numeric, nil
|
879
1051
|
config_attr :metadata, nil, ::Hash, nil
|
@@ -894,7 +1066,7 @@ module Google
|
|
894
1066
|
def rpcs
|
895
1067
|
@rpcs ||= begin
|
896
1068
|
parent_rpcs = nil
|
897
|
-
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config
|
1069
|
+
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
|
898
1070
|
Rpcs.new parent_rpcs
|
899
1071
|
end
|
900
1072
|
end
|
@@ -928,6 +1100,16 @@ module Google
|
|
928
1100
|
#
|
929
1101
|
attr_reader :update_cluster
|
930
1102
|
##
|
1103
|
+
# RPC-specific configuration for `stop_cluster`
|
1104
|
+
# @return [::Gapic::Config::Method]
|
1105
|
+
#
|
1106
|
+
attr_reader :stop_cluster
|
1107
|
+
##
|
1108
|
+
# RPC-specific configuration for `start_cluster`
|
1109
|
+
# @return [::Gapic::Config::Method]
|
1110
|
+
#
|
1111
|
+
attr_reader :start_cluster
|
1112
|
+
##
|
931
1113
|
# RPC-specific configuration for `delete_cluster`
|
932
1114
|
# @return [::Gapic::Config::Method]
|
933
1115
|
#
|
@@ -950,17 +1132,21 @@ module Google
|
|
950
1132
|
|
951
1133
|
# @private
|
952
1134
|
def initialize parent_rpcs = nil
|
953
|
-
create_cluster_config = parent_rpcs
|
1135
|
+
create_cluster_config = parent_rpcs.create_cluster if parent_rpcs.respond_to? :create_cluster
|
954
1136
|
@create_cluster = ::Gapic::Config::Method.new create_cluster_config
|
955
|
-
update_cluster_config = parent_rpcs
|
1137
|
+
update_cluster_config = parent_rpcs.update_cluster if parent_rpcs.respond_to? :update_cluster
|
956
1138
|
@update_cluster = ::Gapic::Config::Method.new update_cluster_config
|
957
|
-
|
1139
|
+
stop_cluster_config = parent_rpcs.stop_cluster if parent_rpcs.respond_to? :stop_cluster
|
1140
|
+
@stop_cluster = ::Gapic::Config::Method.new stop_cluster_config
|
1141
|
+
start_cluster_config = parent_rpcs.start_cluster if parent_rpcs.respond_to? :start_cluster
|
1142
|
+
@start_cluster = ::Gapic::Config::Method.new start_cluster_config
|
1143
|
+
delete_cluster_config = parent_rpcs.delete_cluster if parent_rpcs.respond_to? :delete_cluster
|
958
1144
|
@delete_cluster = ::Gapic::Config::Method.new delete_cluster_config
|
959
|
-
get_cluster_config = parent_rpcs
|
1145
|
+
get_cluster_config = parent_rpcs.get_cluster if parent_rpcs.respond_to? :get_cluster
|
960
1146
|
@get_cluster = ::Gapic::Config::Method.new get_cluster_config
|
961
|
-
list_clusters_config = parent_rpcs
|
1147
|
+
list_clusters_config = parent_rpcs.list_clusters if parent_rpcs.respond_to? :list_clusters
|
962
1148
|
@list_clusters = ::Gapic::Config::Method.new list_clusters_config
|
963
|
-
diagnose_cluster_config = parent_rpcs
|
1149
|
+
diagnose_cluster_config = parent_rpcs.diagnose_cluster if parent_rpcs.respond_to? :diagnose_cluster
|
964
1150
|
@diagnose_cluster = ::Gapic::Config::Method.new diagnose_cluster_config
|
965
1151
|
|
966
1152
|
yield self if block_given?
|