google-cloud-dataproc-v1 0.1.0
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 +7 -0
- data/.yardopts +12 -0
- data/AUTHENTICATION.md +169 -0
- data/LICENSE.md +203 -0
- data/README.md +71 -0
- data/lib/google/cloud/common_resources_pb.rb +15 -0
- data/lib/google/cloud/dataproc/v1/autoscaling_policies_pb.rb +81 -0
- data/lib/google/cloud/dataproc/v1/autoscaling_policies_services_pb.rb +58 -0
- data/lib/google/cloud/dataproc/v1/autoscaling_policy_service/client.rb +734 -0
- data/lib/google/cloud/dataproc/v1/autoscaling_policy_service/credentials.rb +51 -0
- data/lib/google/cloud/dataproc/v1/autoscaling_policy_service/paths.rb +110 -0
- data/lib/google/cloud/dataproc/v1/autoscaling_policy_service.rb +50 -0
- data/lib/google/cloud/dataproc/v1/cluster_controller/client.rb +970 -0
- data/lib/google/cloud/dataproc/v1/cluster_controller/credentials.rb +51 -0
- data/lib/google/cloud/dataproc/v1/cluster_controller/operations.rb +564 -0
- data/lib/google/cloud/dataproc/v1/cluster_controller.rb +50 -0
- data/lib/google/cloud/dataproc/v1/clusters_pb.rb +235 -0
- data/lib/google/cloud/dataproc/v1/clusters_services_pb.rb +68 -0
- data/lib/google/cloud/dataproc/v1/job_controller/client.rb +980 -0
- data/lib/google/cloud/dataproc/v1/job_controller/credentials.rb +51 -0
- data/lib/google/cloud/dataproc/v1/job_controller/operations.rb +564 -0
- data/lib/google/cloud/dataproc/v1/job_controller.rb +49 -0
- data/lib/google/cloud/dataproc/v1/jobs_pb.rb +282 -0
- data/lib/google/cloud/dataproc/v1/jobs_services_pb.rb +62 -0
- data/lib/google/cloud/dataproc/v1/operations_pb.rb +46 -0
- data/lib/google/cloud/dataproc/v1/shared_pb.rb +29 -0
- data/lib/google/cloud/dataproc/v1/version.rb +28 -0
- data/lib/google/cloud/dataproc/v1/workflow_template_service/client.rb +1024 -0
- data/lib/google/cloud/dataproc/v1/workflow_template_service/credentials.rb +51 -0
- data/lib/google/cloud/dataproc/v1/workflow_template_service/operations.rb +564 -0
- data/lib/google/cloud/dataproc/v1/workflow_template_service/paths.rb +110 -0
- data/lib/google/cloud/dataproc/v1/workflow_template_service.rb +51 -0
- data/lib/google/cloud/dataproc/v1/workflow_templates_pb.rb +187 -0
- data/lib/google/cloud/dataproc/v1/workflow_templates_services_pb.rb +104 -0
- data/lib/google/cloud/dataproc/v1.rb +38 -0
- data/lib/google-cloud-dataproc-v1.rb +21 -0
- data/proto_docs/README.md +4 -0
- data/proto_docs/google/api/field_behavior.rb +59 -0
- data/proto_docs/google/api/resource.rb +247 -0
- data/proto_docs/google/cloud/dataproc/v1/autoscaling_policies.rb +272 -0
- data/proto_docs/google/cloud/dataproc/v1/clusters.rb +961 -0
- data/proto_docs/google/cloud/dataproc/v1/jobs.rb +976 -0
- data/proto_docs/google/cloud/dataproc/v1/operations.rb +98 -0
- data/proto_docs/google/cloud/dataproc/v1/shared.rb +50 -0
- data/proto_docs/google/cloud/dataproc/v1/workflow_templates.rb +693 -0
- data/proto_docs/google/longrunning/operations.rb +150 -0
- data/proto_docs/google/protobuf/any.rb +138 -0
- data/proto_docs/google/protobuf/duration.rb +98 -0
- data/proto_docs/google/protobuf/empty.rb +36 -0
- data/proto_docs/google/protobuf/field_mask.rb +229 -0
- data/proto_docs/google/protobuf/timestamp.rb +120 -0
- data/proto_docs/google/rpc/status.rb +46 -0
- metadata +205 -0
@@ -0,0 +1,970 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2020 Google LLC
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
|
17
|
+
# Auto-generated by gapic-generator-ruby. DO NOT EDIT!
|
18
|
+
|
19
|
+
require "google/cloud/errors"
|
20
|
+
require "google/cloud/dataproc/v1/clusters_pb"
|
21
|
+
|
22
|
+
module Google
|
23
|
+
module Cloud
|
24
|
+
module Dataproc
|
25
|
+
module V1
|
26
|
+
module ClusterController
|
27
|
+
##
|
28
|
+
# Client for the ClusterController service.
|
29
|
+
#
|
30
|
+
# The ClusterControllerService provides methods to manage clusters
|
31
|
+
# of Compute Engine instances.
|
32
|
+
#
|
33
|
+
class Client
|
34
|
+
# @private
|
35
|
+
attr_reader :cluster_controller_stub
|
36
|
+
|
37
|
+
##
|
38
|
+
# Configure the ClusterController Client class.
|
39
|
+
#
|
40
|
+
# See {Google::Cloud::Dataproc::V1::ClusterController::Client::Configuration}
|
41
|
+
# for a description of the configuration fields.
|
42
|
+
#
|
43
|
+
# ## Example
|
44
|
+
#
|
45
|
+
# To modify the configuration for all ClusterController clients:
|
46
|
+
#
|
47
|
+
# Google::Cloud::Dataproc::V1::ClusterController::Client.configure do |config|
|
48
|
+
# config.timeout = 10_000
|
49
|
+
# end
|
50
|
+
#
|
51
|
+
# @yield [config] Configure the Client client.
|
52
|
+
# @yieldparam config [Client::Configuration]
|
53
|
+
#
|
54
|
+
# @return [Client::Configuration]
|
55
|
+
#
|
56
|
+
def self.configure
|
57
|
+
@configure ||= begin
|
58
|
+
namespace = ["Google", "Cloud", "Dataproc", "V1"]
|
59
|
+
parent_config = while namespace.any?
|
60
|
+
parent_name = namespace.join "::"
|
61
|
+
parent_const = const_get parent_name
|
62
|
+
break parent_const.configure if parent_const&.respond_to? :configure
|
63
|
+
namespace.pop
|
64
|
+
end
|
65
|
+
default_config = Client::Configuration.new parent_config
|
66
|
+
|
67
|
+
default_config.rpcs.create_cluster.timeout = 300.0
|
68
|
+
default_config.rpcs.create_cluster.retry_policy = {
|
69
|
+
initial_delay: 0.1,
|
70
|
+
max_delay: 60.0,
|
71
|
+
multiplier: 1.3,
|
72
|
+
retry_codes: ["UNAVAILABLE"]
|
73
|
+
}
|
74
|
+
|
75
|
+
default_config.rpcs.update_cluster.timeout = 300.0
|
76
|
+
default_config.rpcs.update_cluster.retry_policy = {
|
77
|
+
initial_delay: 0.1,
|
78
|
+
max_delay: 60.0,
|
79
|
+
multiplier: 1.3,
|
80
|
+
retry_codes: ["UNAVAILABLE"]
|
81
|
+
}
|
82
|
+
|
83
|
+
default_config.rpcs.delete_cluster.timeout = 300.0
|
84
|
+
default_config.rpcs.delete_cluster.retry_policy = {
|
85
|
+
initial_delay: 0.1,
|
86
|
+
max_delay: 60.0,
|
87
|
+
multiplier: 1.3,
|
88
|
+
retry_codes: ["UNAVAILABLE"]
|
89
|
+
}
|
90
|
+
|
91
|
+
default_config.rpcs.get_cluster.timeout = 300.0
|
92
|
+
default_config.rpcs.get_cluster.retry_policy = {
|
93
|
+
initial_delay: 0.1,
|
94
|
+
max_delay: 60.0,
|
95
|
+
multiplier: 1.3,
|
96
|
+
retry_codes: ["INTERNAL", "DEADLINE_EXCEEDED", "UNAVAILABLE"]
|
97
|
+
}
|
98
|
+
|
99
|
+
default_config.rpcs.list_clusters.timeout = 300.0
|
100
|
+
default_config.rpcs.list_clusters.retry_policy = {
|
101
|
+
initial_delay: 0.1,
|
102
|
+
max_delay: 60.0,
|
103
|
+
multiplier: 1.3,
|
104
|
+
retry_codes: ["INTERNAL", "DEADLINE_EXCEEDED", "UNAVAILABLE"]
|
105
|
+
}
|
106
|
+
|
107
|
+
default_config.rpcs.diagnose_cluster.timeout = 300.0
|
108
|
+
default_config.rpcs.diagnose_cluster.retry_policy = {
|
109
|
+
initial_delay: 0.1,
|
110
|
+
max_delay: 60.0,
|
111
|
+
multiplier: 1.3,
|
112
|
+
retry_codes: ["UNAVAILABLE"]
|
113
|
+
}
|
114
|
+
|
115
|
+
default_config
|
116
|
+
end
|
117
|
+
yield @configure if block_given?
|
118
|
+
@configure
|
119
|
+
end
|
120
|
+
|
121
|
+
##
|
122
|
+
# Configure the ClusterController Client instance.
|
123
|
+
#
|
124
|
+
# The configuration is set to the derived mode, meaning that values can be changed,
|
125
|
+
# but structural changes (adding new fields, etc.) are not allowed. Structural changes
|
126
|
+
# should be made on {Client.configure}.
|
127
|
+
#
|
128
|
+
# See {Google::Cloud::Dataproc::V1::ClusterController::Client::Configuration}
|
129
|
+
# for a description of the configuration fields.
|
130
|
+
#
|
131
|
+
# @yield [config] Configure the Client client.
|
132
|
+
# @yieldparam config [Client::Configuration]
|
133
|
+
#
|
134
|
+
# @return [Client::Configuration]
|
135
|
+
#
|
136
|
+
def configure
|
137
|
+
yield @config if block_given?
|
138
|
+
@config
|
139
|
+
end
|
140
|
+
|
141
|
+
##
|
142
|
+
# Create a new ClusterController client object.
|
143
|
+
#
|
144
|
+
# ## Examples
|
145
|
+
#
|
146
|
+
# To create a new ClusterController client with the default
|
147
|
+
# configuration:
|
148
|
+
#
|
149
|
+
# client = Google::Cloud::Dataproc::V1::ClusterController::Client.new
|
150
|
+
#
|
151
|
+
# To create a new ClusterController client with a custom
|
152
|
+
# configuration:
|
153
|
+
#
|
154
|
+
# client = Google::Cloud::Dataproc::V1::ClusterController::Client.new do |config|
|
155
|
+
# config.timeout = 10_000
|
156
|
+
# end
|
157
|
+
#
|
158
|
+
# @yield [config] Configure the ClusterController client.
|
159
|
+
# @yieldparam config [Client::Configuration]
|
160
|
+
#
|
161
|
+
def initialize
|
162
|
+
# These require statements are intentionally placed here to initialize
|
163
|
+
# the gRPC module only when it's required.
|
164
|
+
# See https://github.com/googleapis/toolkit/issues/446
|
165
|
+
require "gapic/grpc"
|
166
|
+
require "google/cloud/dataproc/v1/clusters_services_pb"
|
167
|
+
|
168
|
+
# Create the configuration object
|
169
|
+
@config = Configuration.new Client.configure
|
170
|
+
|
171
|
+
# Yield the configuration if needed
|
172
|
+
yield @config if block_given?
|
173
|
+
|
174
|
+
# Create credentials
|
175
|
+
credentials = @config.credentials
|
176
|
+
credentials ||= Credentials.default scope: @config.scope
|
177
|
+
if credentials.is_a?(String) || credentials.is_a?(Hash)
|
178
|
+
credentials = Credentials.new credentials, scope: @config.scope
|
179
|
+
end
|
180
|
+
@quota_project_id = credentials.respond_to?(:quota_project_id) ? credentials.quota_project_id : nil
|
181
|
+
|
182
|
+
@operations_client = Operations.new do |config|
|
183
|
+
config.credentials = credentials
|
184
|
+
config.endpoint = @config.endpoint
|
185
|
+
end
|
186
|
+
|
187
|
+
@cluster_controller_stub = Gapic::ServiceStub.new(
|
188
|
+
Google::Cloud::Dataproc::V1::ClusterController::Stub,
|
189
|
+
credentials: credentials,
|
190
|
+
endpoint: @config.endpoint,
|
191
|
+
channel_args: @config.channel_args,
|
192
|
+
interceptors: @config.interceptors
|
193
|
+
)
|
194
|
+
end
|
195
|
+
|
196
|
+
##
|
197
|
+
# Get the associated client for long-running operations.
|
198
|
+
#
|
199
|
+
# @return [Google::Cloud::Dataproc::V1::ClusterController::Operations]
|
200
|
+
#
|
201
|
+
attr_reader :operations_client
|
202
|
+
|
203
|
+
# Service calls
|
204
|
+
|
205
|
+
##
|
206
|
+
# Creates a cluster in a project. The returned
|
207
|
+
# {Google::Longrunning::Operation#metadata Operation.metadata} will be
|
208
|
+
# [ClusterOperationMetadata](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#clusteroperationmetadata).
|
209
|
+
#
|
210
|
+
# @overload create_cluster(request, options = nil)
|
211
|
+
# Pass arguments to `create_cluster` via a request object, either of type
|
212
|
+
# {Google::Cloud::Dataproc::V1::CreateClusterRequest} or an equivalent Hash.
|
213
|
+
#
|
214
|
+
# @param request [Google::Cloud::Dataproc::V1::CreateClusterRequest, Hash]
|
215
|
+
# A request object representing the call parameters. Required. To specify no
|
216
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
217
|
+
# @param options [Gapic::CallOptions, Hash]
|
218
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
219
|
+
#
|
220
|
+
# @overload create_cluster(project_id: nil, region: nil, cluster: nil, request_id: nil)
|
221
|
+
# Pass arguments to `create_cluster` via keyword arguments. Note that at
|
222
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
223
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
224
|
+
#
|
225
|
+
# @param project_id [String]
|
226
|
+
# Required. The ID of the Google Cloud Platform project that the cluster
|
227
|
+
# belongs to.
|
228
|
+
# @param region [String]
|
229
|
+
# Required. The Dataproc region in which to handle the request.
|
230
|
+
# @param cluster [Google::Cloud::Dataproc::V1::Cluster, Hash]
|
231
|
+
# Required. The cluster to create.
|
232
|
+
# @param request_id [String]
|
233
|
+
# Optional. A unique id used to identify the request. If the server
|
234
|
+
# receives two {Google::Cloud::Dataproc::V1::CreateClusterRequest CreateClusterRequest} requests with the same
|
235
|
+
# id, then the second request will be ignored and the
|
236
|
+
# first {Google::Longrunning::Operation google.longrunning.Operation} created and stored in the backend
|
237
|
+
# is returned.
|
238
|
+
#
|
239
|
+
# It is recommended to always set this value to a
|
240
|
+
# [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier).
|
241
|
+
#
|
242
|
+
# The id must contain only letters (a-z, A-Z), numbers (0-9),
|
243
|
+
# underscores (_), and hyphens (-). The maximum length is 40 characters.
|
244
|
+
#
|
245
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
246
|
+
# @yieldparam response [Gapic::Operation]
|
247
|
+
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
248
|
+
#
|
249
|
+
# @return [Gapic::Operation]
|
250
|
+
#
|
251
|
+
# @raise [Google::Cloud::Error] if the RPC is aborted.
|
252
|
+
#
|
253
|
+
def create_cluster request, options = nil
|
254
|
+
raise ArgumentError, "request must be provided" if request.nil?
|
255
|
+
|
256
|
+
request = Gapic::Protobuf.coerce request, to: Google::Cloud::Dataproc::V1::CreateClusterRequest
|
257
|
+
|
258
|
+
# Converts hash and nil to an options object
|
259
|
+
options = Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
260
|
+
|
261
|
+
# Customize the options with defaults
|
262
|
+
metadata = @config.rpcs.create_cluster.metadata.to_h
|
263
|
+
|
264
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
265
|
+
metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
|
266
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
267
|
+
gapic_version: ::Google::Cloud::Dataproc::V1::VERSION
|
268
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
269
|
+
|
270
|
+
header_params = {
|
271
|
+
"project_id" => request.project_id,
|
272
|
+
"region" => request.region
|
273
|
+
}
|
274
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
275
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
276
|
+
|
277
|
+
options.apply_defaults timeout: @config.rpcs.create_cluster.timeout,
|
278
|
+
metadata: metadata,
|
279
|
+
retry_policy: @config.rpcs.create_cluster.retry_policy
|
280
|
+
options.apply_defaults metadata: @config.metadata,
|
281
|
+
retry_policy: @config.retry_policy
|
282
|
+
|
283
|
+
@cluster_controller_stub.call_rpc :create_cluster, request, options: options do |response, operation|
|
284
|
+
response = Gapic::Operation.new response, @operations_client, options: options
|
285
|
+
yield response, operation if block_given?
|
286
|
+
return response
|
287
|
+
end
|
288
|
+
rescue GRPC::BadStatus => e
|
289
|
+
raise Google::Cloud::Error.from_error(e)
|
290
|
+
end
|
291
|
+
|
292
|
+
##
|
293
|
+
# Updates a cluster in a project. The returned
|
294
|
+
# {Google::Longrunning::Operation#metadata Operation.metadata} will be
|
295
|
+
# [ClusterOperationMetadata](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#clusteroperationmetadata).
|
296
|
+
#
|
297
|
+
# @overload update_cluster(request, options = nil)
|
298
|
+
# Pass arguments to `update_cluster` via a request object, either of type
|
299
|
+
# {Google::Cloud::Dataproc::V1::UpdateClusterRequest} or an equivalent Hash.
|
300
|
+
#
|
301
|
+
# @param request [Google::Cloud::Dataproc::V1::UpdateClusterRequest, Hash]
|
302
|
+
# A request object representing the call parameters. Required. To specify no
|
303
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
304
|
+
# @param options [Gapic::CallOptions, Hash]
|
305
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
306
|
+
#
|
307
|
+
# @overload update_cluster(project_id: nil, region: nil, cluster_name: nil, cluster: nil, graceful_decommission_timeout: nil, update_mask: nil, request_id: nil)
|
308
|
+
# Pass arguments to `update_cluster` via keyword arguments. Note that at
|
309
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
310
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
311
|
+
#
|
312
|
+
# @param project_id [String]
|
313
|
+
# Required. The ID of the Google Cloud Platform project the
|
314
|
+
# cluster belongs to.
|
315
|
+
# @param region [String]
|
316
|
+
# Required. The Dataproc region in which to handle the request.
|
317
|
+
# @param cluster_name [String]
|
318
|
+
# Required. The cluster name.
|
319
|
+
# @param cluster [Google::Cloud::Dataproc::V1::Cluster, Hash]
|
320
|
+
# Required. The changes to the cluster.
|
321
|
+
# @param graceful_decommission_timeout [Google::Protobuf::Duration, Hash]
|
322
|
+
# Optional. Timeout for graceful YARN decomissioning. Graceful
|
323
|
+
# decommissioning allows removing nodes from the cluster without
|
324
|
+
# interrupting jobs in progress. Timeout specifies how long to wait for jobs
|
325
|
+
# in progress to finish before forcefully removing nodes (and potentially
|
326
|
+
# interrupting jobs). Default timeout is 0 (for forceful decommission), and
|
327
|
+
# the maximum allowed timeout is 1 day. (see JSON representation of
|
328
|
+
# [Duration](https://developers.google.com/protocol-buffers/docs/proto3#json)).
|
329
|
+
#
|
330
|
+
# Only supported on Dataproc image versions 1.2 and higher.
|
331
|
+
# @param update_mask [Google::Protobuf::FieldMask, Hash]
|
332
|
+
# Required. Specifies the path, relative to `Cluster`, of
|
333
|
+
# the field to update. For example, to change the number of workers
|
334
|
+
# in a cluster to 5, the `update_mask` parameter would be
|
335
|
+
# specified as `config.worker_config.num_instances`,
|
336
|
+
# and the `PATCH` request body would specify the new value, as follows:
|
337
|
+
#
|
338
|
+
# {
|
339
|
+
# "config":{
|
340
|
+
# "workerConfig":{
|
341
|
+
# "numInstances":"5"
|
342
|
+
# }
|
343
|
+
# }
|
344
|
+
# }
|
345
|
+
# Similarly, to change the number of preemptible workers in a cluster to 5,
|
346
|
+
# the `update_mask` parameter would be
|
347
|
+
# `config.secondary_worker_config.num_instances`, and the `PATCH` request
|
348
|
+
# body would be set as follows:
|
349
|
+
#
|
350
|
+
# {
|
351
|
+
# "config":{
|
352
|
+
# "secondaryWorkerConfig":{
|
353
|
+
# "numInstances":"5"
|
354
|
+
# }
|
355
|
+
# }
|
356
|
+
# }
|
357
|
+
# <strong>Note:</strong> Currently, only the following fields can be updated:
|
358
|
+
#
|
359
|
+
# <table>
|
360
|
+
# <tbody>
|
361
|
+
# <tr>
|
362
|
+
# <td><strong>Mask</strong></td>
|
363
|
+
# <td><strong>Purpose</strong></td>
|
364
|
+
# </tr>
|
365
|
+
# <tr>
|
366
|
+
# <td><strong><em>labels</em></strong></td>
|
367
|
+
# <td>Update labels</td>
|
368
|
+
# </tr>
|
369
|
+
# <tr>
|
370
|
+
# <td><strong><em>config.worker_config.num_instances</em></strong></td>
|
371
|
+
# <td>Resize primary worker group</td>
|
372
|
+
# </tr>
|
373
|
+
# <tr>
|
374
|
+
# <td><strong><em>config.secondary_worker_config.num_instances</em></strong></td>
|
375
|
+
# <td>Resize secondary worker group</td>
|
376
|
+
# </tr>
|
377
|
+
# <tr>
|
378
|
+
# <td>config.autoscaling_config.policy_uri</td><td>Use, stop using, or
|
379
|
+
# change autoscaling policies</td>
|
380
|
+
# </tr>
|
381
|
+
# </tbody>
|
382
|
+
# </table>
|
383
|
+
# @param request_id [String]
|
384
|
+
# Optional. A unique id used to identify the request. If the server
|
385
|
+
# receives two {Google::Cloud::Dataproc::V1::UpdateClusterRequest UpdateClusterRequest} requests with the same
|
386
|
+
# id, then the second request will be ignored and the
|
387
|
+
# first {Google::Longrunning::Operation google.longrunning.Operation} created and stored in the
|
388
|
+
# backend is returned.
|
389
|
+
#
|
390
|
+
# It is recommended to always set this value to a
|
391
|
+
# [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier).
|
392
|
+
#
|
393
|
+
# The id must contain only letters (a-z, A-Z), numbers (0-9),
|
394
|
+
# underscores (_), and hyphens (-). The maximum length is 40 characters.
|
395
|
+
#
|
396
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
397
|
+
# @yieldparam response [Gapic::Operation]
|
398
|
+
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
399
|
+
#
|
400
|
+
# @return [Gapic::Operation]
|
401
|
+
#
|
402
|
+
# @raise [Google::Cloud::Error] if the RPC is aborted.
|
403
|
+
#
|
404
|
+
def update_cluster request, options = nil
|
405
|
+
raise ArgumentError, "request must be provided" if request.nil?
|
406
|
+
|
407
|
+
request = Gapic::Protobuf.coerce request, to: Google::Cloud::Dataproc::V1::UpdateClusterRequest
|
408
|
+
|
409
|
+
# Converts hash and nil to an options object
|
410
|
+
options = Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
411
|
+
|
412
|
+
# Customize the options with defaults
|
413
|
+
metadata = @config.rpcs.update_cluster.metadata.to_h
|
414
|
+
|
415
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
416
|
+
metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
|
417
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
418
|
+
gapic_version: ::Google::Cloud::Dataproc::V1::VERSION
|
419
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
420
|
+
|
421
|
+
header_params = {
|
422
|
+
"project_id" => request.project_id,
|
423
|
+
"region" => request.region,
|
424
|
+
"cluster_name" => request.cluster_name
|
425
|
+
}
|
426
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
427
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
428
|
+
|
429
|
+
options.apply_defaults timeout: @config.rpcs.update_cluster.timeout,
|
430
|
+
metadata: metadata,
|
431
|
+
retry_policy: @config.rpcs.update_cluster.retry_policy
|
432
|
+
options.apply_defaults metadata: @config.metadata,
|
433
|
+
retry_policy: @config.retry_policy
|
434
|
+
|
435
|
+
@cluster_controller_stub.call_rpc :update_cluster, request, options: options do |response, operation|
|
436
|
+
response = Gapic::Operation.new response, @operations_client, options: options
|
437
|
+
yield response, operation if block_given?
|
438
|
+
return response
|
439
|
+
end
|
440
|
+
rescue GRPC::BadStatus => e
|
441
|
+
raise Google::Cloud::Error.from_error(e)
|
442
|
+
end
|
443
|
+
|
444
|
+
##
|
445
|
+
# Deletes a cluster in a project. The returned
|
446
|
+
# {Google::Longrunning::Operation#metadata Operation.metadata} will be
|
447
|
+
# [ClusterOperationMetadata](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#clusteroperationmetadata).
|
448
|
+
#
|
449
|
+
# @overload delete_cluster(request, options = nil)
|
450
|
+
# Pass arguments to `delete_cluster` via a request object, either of type
|
451
|
+
# {Google::Cloud::Dataproc::V1::DeleteClusterRequest} or an equivalent Hash.
|
452
|
+
#
|
453
|
+
# @param request [Google::Cloud::Dataproc::V1::DeleteClusterRequest, Hash]
|
454
|
+
# A request object representing the call parameters. Required. To specify no
|
455
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
456
|
+
# @param options [Gapic::CallOptions, Hash]
|
457
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
458
|
+
#
|
459
|
+
# @overload delete_cluster(project_id: nil, region: nil, cluster_name: nil, cluster_uuid: nil, request_id: nil)
|
460
|
+
# Pass arguments to `delete_cluster` via keyword arguments. Note that at
|
461
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
462
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
463
|
+
#
|
464
|
+
# @param project_id [String]
|
465
|
+
# Required. The ID of the Google Cloud Platform project that the cluster
|
466
|
+
# belongs to.
|
467
|
+
# @param region [String]
|
468
|
+
# Required. The Dataproc region in which to handle the request.
|
469
|
+
# @param cluster_name [String]
|
470
|
+
# Required. The cluster name.
|
471
|
+
# @param cluster_uuid [String]
|
472
|
+
# Optional. Specifying the `cluster_uuid` means the RPC should fail
|
473
|
+
# (with error NOT_FOUND) if cluster with specified UUID does not exist.
|
474
|
+
# @param request_id [String]
|
475
|
+
# Optional. A unique id used to identify the request. If the server
|
476
|
+
# receives two {Google::Cloud::Dataproc::V1::DeleteClusterRequest DeleteClusterRequest} requests with the same
|
477
|
+
# id, then the second request will be ignored and the
|
478
|
+
# first {Google::Longrunning::Operation google.longrunning.Operation} created and stored in the
|
479
|
+
# backend is returned.
|
480
|
+
#
|
481
|
+
# It is recommended to always set this value to a
|
482
|
+
# [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier).
|
483
|
+
#
|
484
|
+
# The id must contain only letters (a-z, A-Z), numbers (0-9),
|
485
|
+
# underscores (_), and hyphens (-). The maximum length is 40 characters.
|
486
|
+
#
|
487
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
488
|
+
# @yieldparam response [Gapic::Operation]
|
489
|
+
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
490
|
+
#
|
491
|
+
# @return [Gapic::Operation]
|
492
|
+
#
|
493
|
+
# @raise [Google::Cloud::Error] if the RPC is aborted.
|
494
|
+
#
|
495
|
+
def delete_cluster request, options = nil
|
496
|
+
raise ArgumentError, "request must be provided" if request.nil?
|
497
|
+
|
498
|
+
request = Gapic::Protobuf.coerce request, to: Google::Cloud::Dataproc::V1::DeleteClusterRequest
|
499
|
+
|
500
|
+
# Converts hash and nil to an options object
|
501
|
+
options = Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
502
|
+
|
503
|
+
# Customize the options with defaults
|
504
|
+
metadata = @config.rpcs.delete_cluster.metadata.to_h
|
505
|
+
|
506
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
507
|
+
metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
|
508
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
509
|
+
gapic_version: ::Google::Cloud::Dataproc::V1::VERSION
|
510
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
511
|
+
|
512
|
+
header_params = {
|
513
|
+
"project_id" => request.project_id,
|
514
|
+
"region" => request.region,
|
515
|
+
"cluster_name" => request.cluster_name
|
516
|
+
}
|
517
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
518
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
519
|
+
|
520
|
+
options.apply_defaults timeout: @config.rpcs.delete_cluster.timeout,
|
521
|
+
metadata: metadata,
|
522
|
+
retry_policy: @config.rpcs.delete_cluster.retry_policy
|
523
|
+
options.apply_defaults metadata: @config.metadata,
|
524
|
+
retry_policy: @config.retry_policy
|
525
|
+
|
526
|
+
@cluster_controller_stub.call_rpc :delete_cluster, request, options: options do |response, operation|
|
527
|
+
response = Gapic::Operation.new response, @operations_client, options: options
|
528
|
+
yield response, operation if block_given?
|
529
|
+
return response
|
530
|
+
end
|
531
|
+
rescue GRPC::BadStatus => e
|
532
|
+
raise Google::Cloud::Error.from_error(e)
|
533
|
+
end
|
534
|
+
|
535
|
+
##
|
536
|
+
# Gets the resource representation for a cluster in a project.
|
537
|
+
#
|
538
|
+
# @overload get_cluster(request, options = nil)
|
539
|
+
# Pass arguments to `get_cluster` via a request object, either of type
|
540
|
+
# {Google::Cloud::Dataproc::V1::GetClusterRequest} or an equivalent Hash.
|
541
|
+
#
|
542
|
+
# @param request [Google::Cloud::Dataproc::V1::GetClusterRequest, Hash]
|
543
|
+
# A request object representing the call parameters. Required. To specify no
|
544
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
545
|
+
# @param options [Gapic::CallOptions, Hash]
|
546
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
547
|
+
#
|
548
|
+
# @overload get_cluster(project_id: nil, region: nil, cluster_name: nil)
|
549
|
+
# Pass arguments to `get_cluster` via keyword arguments. Note that at
|
550
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
551
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
552
|
+
#
|
553
|
+
# @param project_id [String]
|
554
|
+
# Required. The ID of the Google Cloud Platform project that the cluster
|
555
|
+
# belongs to.
|
556
|
+
# @param region [String]
|
557
|
+
# Required. The Dataproc region in which to handle the request.
|
558
|
+
# @param cluster_name [String]
|
559
|
+
# Required. The cluster name.
|
560
|
+
#
|
561
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
562
|
+
# @yieldparam response [Google::Cloud::Dataproc::V1::Cluster]
|
563
|
+
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
564
|
+
#
|
565
|
+
# @return [Google::Cloud::Dataproc::V1::Cluster]
|
566
|
+
#
|
567
|
+
# @raise [Google::Cloud::Error] if the RPC is aborted.
|
568
|
+
#
|
569
|
+
def get_cluster request, options = nil
|
570
|
+
raise ArgumentError, "request must be provided" if request.nil?
|
571
|
+
|
572
|
+
request = Gapic::Protobuf.coerce request, to: Google::Cloud::Dataproc::V1::GetClusterRequest
|
573
|
+
|
574
|
+
# Converts hash and nil to an options object
|
575
|
+
options = Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
576
|
+
|
577
|
+
# Customize the options with defaults
|
578
|
+
metadata = @config.rpcs.get_cluster.metadata.to_h
|
579
|
+
|
580
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
581
|
+
metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
|
582
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
583
|
+
gapic_version: ::Google::Cloud::Dataproc::V1::VERSION
|
584
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
585
|
+
|
586
|
+
header_params = {
|
587
|
+
"project_id" => request.project_id,
|
588
|
+
"region" => request.region,
|
589
|
+
"cluster_name" => request.cluster_name
|
590
|
+
}
|
591
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
592
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
593
|
+
|
594
|
+
options.apply_defaults timeout: @config.rpcs.get_cluster.timeout,
|
595
|
+
metadata: metadata,
|
596
|
+
retry_policy: @config.rpcs.get_cluster.retry_policy
|
597
|
+
options.apply_defaults metadata: @config.metadata,
|
598
|
+
retry_policy: @config.retry_policy
|
599
|
+
|
600
|
+
@cluster_controller_stub.call_rpc :get_cluster, request, options: options do |response, operation|
|
601
|
+
yield response, operation if block_given?
|
602
|
+
return response
|
603
|
+
end
|
604
|
+
rescue GRPC::BadStatus => e
|
605
|
+
raise Google::Cloud::Error.from_error(e)
|
606
|
+
end
|
607
|
+
|
608
|
+
##
|
609
|
+
# Lists all regions/\\{region}/clusters in a project alphabetically.
|
610
|
+
#
|
611
|
+
# @overload list_clusters(request, options = nil)
|
612
|
+
# Pass arguments to `list_clusters` via a request object, either of type
|
613
|
+
# {Google::Cloud::Dataproc::V1::ListClustersRequest} or an equivalent Hash.
|
614
|
+
#
|
615
|
+
# @param request [Google::Cloud::Dataproc::V1::ListClustersRequest, Hash]
|
616
|
+
# A request object representing the call parameters. Required. To specify no
|
617
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
618
|
+
# @param options [Gapic::CallOptions, Hash]
|
619
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
620
|
+
#
|
621
|
+
# @overload list_clusters(project_id: nil, region: nil, filter: nil, page_size: nil, page_token: nil)
|
622
|
+
# Pass arguments to `list_clusters` via keyword arguments. Note that at
|
623
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
624
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
625
|
+
#
|
626
|
+
# @param project_id [String]
|
627
|
+
# Required. The ID of the Google Cloud Platform project that the cluster
|
628
|
+
# belongs to.
|
629
|
+
# @param region [String]
|
630
|
+
# Required. The Dataproc region in which to handle the request.
|
631
|
+
# @param filter [String]
|
632
|
+
# Optional. A filter constraining the clusters to list. Filters are
|
633
|
+
# case-sensitive and have the following syntax:
|
634
|
+
#
|
635
|
+
# field = value [AND [field = value]] ...
|
636
|
+
#
|
637
|
+
# where **field** is one of `status.state`, `clusterName`, or `labels.[KEY]`,
|
638
|
+
# and `[KEY]` is a label key. **value** can be `*` to match all values.
|
639
|
+
# `status.state` can be one of the following: `ACTIVE`, `INACTIVE`,
|
640
|
+
# `CREATING`, `RUNNING`, `ERROR`, `DELETING`, or `UPDATING`. `ACTIVE`
|
641
|
+
# contains the `CREATING`, `UPDATING`, and `RUNNING` states. `INACTIVE`
|
642
|
+
# contains the `DELETING` and `ERROR` states.
|
643
|
+
# `clusterName` is the name of the cluster provided at creation time.
|
644
|
+
# Only the logical `AND` operator is supported; space-separated items are
|
645
|
+
# treated as having an implicit `AND` operator.
|
646
|
+
#
|
647
|
+
# Example filter:
|
648
|
+
#
|
649
|
+
# status.state = ACTIVE AND clusterName = mycluster
|
650
|
+
# AND labels.env = staging AND labels.starred = *
|
651
|
+
# @param page_size [Integer]
|
652
|
+
# Optional. The standard List page size.
|
653
|
+
# @param page_token [String]
|
654
|
+
# Optional. The standard List page token.
|
655
|
+
#
|
656
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
657
|
+
# @yieldparam response [Gapic::PagedEnumerable<Google::Cloud::Dataproc::V1::Cluster>]
|
658
|
+
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
659
|
+
#
|
660
|
+
# @return [Gapic::PagedEnumerable<Google::Cloud::Dataproc::V1::Cluster>]
|
661
|
+
#
|
662
|
+
# @raise [Google::Cloud::Error] if the RPC is aborted.
|
663
|
+
#
|
664
|
+
def list_clusters request, options = nil
|
665
|
+
raise ArgumentError, "request must be provided" if request.nil?
|
666
|
+
|
667
|
+
request = Gapic::Protobuf.coerce request, to: Google::Cloud::Dataproc::V1::ListClustersRequest
|
668
|
+
|
669
|
+
# Converts hash and nil to an options object
|
670
|
+
options = Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
671
|
+
|
672
|
+
# Customize the options with defaults
|
673
|
+
metadata = @config.rpcs.list_clusters.metadata.to_h
|
674
|
+
|
675
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
676
|
+
metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
|
677
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
678
|
+
gapic_version: ::Google::Cloud::Dataproc::V1::VERSION
|
679
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
680
|
+
|
681
|
+
header_params = {
|
682
|
+
"project_id" => request.project_id,
|
683
|
+
"region" => request.region
|
684
|
+
}
|
685
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
686
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
687
|
+
|
688
|
+
options.apply_defaults timeout: @config.rpcs.list_clusters.timeout,
|
689
|
+
metadata: metadata,
|
690
|
+
retry_policy: @config.rpcs.list_clusters.retry_policy
|
691
|
+
options.apply_defaults metadata: @config.metadata,
|
692
|
+
retry_policy: @config.retry_policy
|
693
|
+
|
694
|
+
@cluster_controller_stub.call_rpc :list_clusters, request, options: options do |response, operation|
|
695
|
+
response = Gapic::PagedEnumerable.new @cluster_controller_stub, :list_clusters, request, response, operation, options
|
696
|
+
yield response, operation if block_given?
|
697
|
+
return response
|
698
|
+
end
|
699
|
+
rescue GRPC::BadStatus => e
|
700
|
+
raise Google::Cloud::Error.from_error(e)
|
701
|
+
end
|
702
|
+
|
703
|
+
##
|
704
|
+
# Gets cluster diagnostic information. The returned
|
705
|
+
# {Google::Longrunning::Operation#metadata Operation.metadata} will be
|
706
|
+
# [ClusterOperationMetadata](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#clusteroperationmetadata).
|
707
|
+
# After the operation completes,
|
708
|
+
# {Google::Longrunning::Operation#response Operation.response}
|
709
|
+
# contains
|
710
|
+
# [DiagnoseClusterResults](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#diagnoseclusterresults).
|
711
|
+
#
|
712
|
+
# @overload diagnose_cluster(request, options = nil)
|
713
|
+
# Pass arguments to `diagnose_cluster` via a request object, either of type
|
714
|
+
# {Google::Cloud::Dataproc::V1::DiagnoseClusterRequest} or an equivalent Hash.
|
715
|
+
#
|
716
|
+
# @param request [Google::Cloud::Dataproc::V1::DiagnoseClusterRequest, Hash]
|
717
|
+
# A request object representing the call parameters. Required. To specify no
|
718
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
719
|
+
# @param options [Gapic::CallOptions, Hash]
|
720
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
721
|
+
#
|
722
|
+
# @overload diagnose_cluster(project_id: nil, region: nil, cluster_name: nil)
|
723
|
+
# Pass arguments to `diagnose_cluster` via keyword arguments. Note that at
|
724
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
725
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
726
|
+
#
|
727
|
+
# @param project_id [String]
|
728
|
+
# Required. The ID of the Google Cloud Platform project that the cluster
|
729
|
+
# belongs to.
|
730
|
+
# @param region [String]
|
731
|
+
# Required. The Dataproc region in which to handle the request.
|
732
|
+
# @param cluster_name [String]
|
733
|
+
# Required. The cluster name.
|
734
|
+
#
|
735
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
736
|
+
# @yieldparam response [Gapic::Operation]
|
737
|
+
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
738
|
+
#
|
739
|
+
# @return [Gapic::Operation]
|
740
|
+
#
|
741
|
+
# @raise [Google::Cloud::Error] if the RPC is aborted.
|
742
|
+
#
|
743
|
+
def diagnose_cluster request, options = nil
|
744
|
+
raise ArgumentError, "request must be provided" if request.nil?
|
745
|
+
|
746
|
+
request = Gapic::Protobuf.coerce request, to: Google::Cloud::Dataproc::V1::DiagnoseClusterRequest
|
747
|
+
|
748
|
+
# Converts hash and nil to an options object
|
749
|
+
options = Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
750
|
+
|
751
|
+
# Customize the options with defaults
|
752
|
+
metadata = @config.rpcs.diagnose_cluster.metadata.to_h
|
753
|
+
|
754
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
755
|
+
metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
|
756
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
757
|
+
gapic_version: ::Google::Cloud::Dataproc::V1::VERSION
|
758
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
759
|
+
|
760
|
+
header_params = {
|
761
|
+
"project_id" => request.project_id,
|
762
|
+
"region" => request.region,
|
763
|
+
"cluster_name" => request.cluster_name
|
764
|
+
}
|
765
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
766
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
767
|
+
|
768
|
+
options.apply_defaults timeout: @config.rpcs.diagnose_cluster.timeout,
|
769
|
+
metadata: metadata,
|
770
|
+
retry_policy: @config.rpcs.diagnose_cluster.retry_policy
|
771
|
+
options.apply_defaults metadata: @config.metadata,
|
772
|
+
retry_policy: @config.retry_policy
|
773
|
+
|
774
|
+
@cluster_controller_stub.call_rpc :diagnose_cluster, request, options: options do |response, operation|
|
775
|
+
response = Gapic::Operation.new response, @operations_client, options: options
|
776
|
+
yield response, operation if block_given?
|
777
|
+
return response
|
778
|
+
end
|
779
|
+
rescue GRPC::BadStatus => e
|
780
|
+
raise Google::Cloud::Error.from_error(e)
|
781
|
+
end
|
782
|
+
|
783
|
+
##
|
784
|
+
# Configuration class for the ClusterController API.
|
785
|
+
#
|
786
|
+
# This class represents the configuration for ClusterController,
|
787
|
+
# providing control over timeouts, retry behavior, logging, transport
|
788
|
+
# parameters, and other low-level controls. Certain parameters can also be
|
789
|
+
# applied individually to specific RPCs. See
|
790
|
+
# {Google::Cloud::Dataproc::V1::ClusterController::Client::Configuration::Rpcs}
|
791
|
+
# for a list of RPCs that can be configured independently.
|
792
|
+
#
|
793
|
+
# Configuration can be applied globally to all clients, or to a single client
|
794
|
+
# on construction.
|
795
|
+
#
|
796
|
+
# # Examples
|
797
|
+
#
|
798
|
+
# To modify the global config, setting the timeout for create_cluster
|
799
|
+
# to 20 seconds, and all remaining timeouts to 10 seconds:
|
800
|
+
#
|
801
|
+
# Google::Cloud::Dataproc::V1::ClusterController::Client.configure do |config|
|
802
|
+
# config.timeout = 10_000
|
803
|
+
# config.rpcs.create_cluster.timeout = 20_000
|
804
|
+
# end
|
805
|
+
#
|
806
|
+
# To apply the above configuration only to a new client:
|
807
|
+
#
|
808
|
+
# client = Google::Cloud::Dataproc::V1::ClusterController::Client.new do |config|
|
809
|
+
# config.timeout = 10_000
|
810
|
+
# config.rpcs.create_cluster.timeout = 20_000
|
811
|
+
# end
|
812
|
+
#
|
813
|
+
# @!attribute [rw] endpoint
|
814
|
+
# The hostname or hostname:port of the service endpoint.
|
815
|
+
# Defaults to `"dataproc.googleapis.com"`.
|
816
|
+
# @return [String]
|
817
|
+
# @!attribute [rw] credentials
|
818
|
+
# Credentials to send with calls. You may provide any of the following types:
|
819
|
+
# * (`String`) The path to a service account key file in JSON format
|
820
|
+
# * (`Hash`) A service account key as a Hash
|
821
|
+
# * (`Google::Auth::Credentials`) A googleauth credentials object
|
822
|
+
# (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
|
823
|
+
# * (`Signet::OAuth2::Client`) A signet oauth2 client object
|
824
|
+
# (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
|
825
|
+
# * (`GRPC::Core::Channel`) a gRPC channel with included credentials
|
826
|
+
# * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
|
827
|
+
# * (`nil`) indicating no credentials
|
828
|
+
# @return [Object]
|
829
|
+
# @!attribute [rw] scope
|
830
|
+
# The OAuth scopes
|
831
|
+
# @return [Array<String>]
|
832
|
+
# @!attribute [rw] lib_name
|
833
|
+
# The library name as recorded in instrumentation and logging
|
834
|
+
# @return [String]
|
835
|
+
# @!attribute [rw] lib_version
|
836
|
+
# The library version as recorded in instrumentation and logging
|
837
|
+
# @return [String]
|
838
|
+
# @!attribute [rw] channel_args
|
839
|
+
# Extra parameters passed to the gRPC channel. Note: this is ignored if a
|
840
|
+
# `GRPC::Core::Channel` object is provided as the credential.
|
841
|
+
# @return [Hash]
|
842
|
+
# @!attribute [rw] interceptors
|
843
|
+
# An array of interceptors that are run before calls are executed.
|
844
|
+
# @return [Array<GRPC::ClientInterceptor>]
|
845
|
+
# @!attribute [rw] timeout
|
846
|
+
# The call timeout in milliseconds.
|
847
|
+
# @return [Numeric]
|
848
|
+
# @!attribute [rw] metadata
|
849
|
+
# Additional gRPC headers to be sent with the call.
|
850
|
+
# @return [Hash{Symbol=>String}]
|
851
|
+
# @!attribute [rw] retry_policy
|
852
|
+
# The retry policy. The value is a hash with the following keys:
|
853
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
854
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
855
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
856
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
857
|
+
# trigger a retry.
|
858
|
+
# @return [Hash]
|
859
|
+
#
|
860
|
+
class Configuration
|
861
|
+
extend Gapic::Config
|
862
|
+
|
863
|
+
config_attr :endpoint, "dataproc.googleapis.com", String
|
864
|
+
config_attr :credentials, nil do |value|
|
865
|
+
allowed = [::String, ::Hash, ::Proc, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
|
866
|
+
allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
|
867
|
+
allowed.any? { |klass| klass === value }
|
868
|
+
end
|
869
|
+
config_attr :scope, nil, String, Array, nil
|
870
|
+
config_attr :lib_name, nil, String, nil
|
871
|
+
config_attr :lib_version, nil, String, nil
|
872
|
+
config_attr(:channel_args, { "grpc.service_config_disable_resolution"=>1 }, Hash, nil)
|
873
|
+
config_attr :interceptors, nil, Array, nil
|
874
|
+
config_attr :timeout, nil, Numeric, nil
|
875
|
+
config_attr :metadata, nil, Hash, nil
|
876
|
+
config_attr :retry_policy, nil, Hash, Proc, nil
|
877
|
+
|
878
|
+
# @private
|
879
|
+
def initialize parent_config = nil
|
880
|
+
@parent_config = parent_config unless parent_config.nil?
|
881
|
+
|
882
|
+
yield self if block_given?
|
883
|
+
end
|
884
|
+
|
885
|
+
##
|
886
|
+
# Configurations for individual RPCs
|
887
|
+
# @return [Rpcs]
|
888
|
+
#
|
889
|
+
def rpcs
|
890
|
+
@rpcs ||= begin
|
891
|
+
parent_rpcs = nil
|
892
|
+
parent_rpcs = @parent_config.rpcs if @parent_config&.respond_to? :rpcs
|
893
|
+
Rpcs.new parent_rpcs
|
894
|
+
end
|
895
|
+
end
|
896
|
+
|
897
|
+
##
|
898
|
+
# Configuration RPC class for the ClusterController API.
|
899
|
+
#
|
900
|
+
# Includes fields providing the configuration for each RPC in this service.
|
901
|
+
# Each configuration object is of type `Gapic::Config::Method` and includes
|
902
|
+
# the following configuration fields:
|
903
|
+
#
|
904
|
+
# * `timeout` (*type:* `Numeric`) - The call timeout in milliseconds
|
905
|
+
# * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
|
906
|
+
# * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
|
907
|
+
# include the following keys:
|
908
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
909
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
910
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
911
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
912
|
+
# trigger a retry.
|
913
|
+
#
|
914
|
+
class Rpcs
|
915
|
+
##
|
916
|
+
# RPC-specific configuration for `create_cluster`
|
917
|
+
# @return [Gapic::Config::Method]
|
918
|
+
#
|
919
|
+
attr_reader :create_cluster
|
920
|
+
##
|
921
|
+
# RPC-specific configuration for `update_cluster`
|
922
|
+
# @return [Gapic::Config::Method]
|
923
|
+
#
|
924
|
+
attr_reader :update_cluster
|
925
|
+
##
|
926
|
+
# RPC-specific configuration for `delete_cluster`
|
927
|
+
# @return [Gapic::Config::Method]
|
928
|
+
#
|
929
|
+
attr_reader :delete_cluster
|
930
|
+
##
|
931
|
+
# RPC-specific configuration for `get_cluster`
|
932
|
+
# @return [Gapic::Config::Method]
|
933
|
+
#
|
934
|
+
attr_reader :get_cluster
|
935
|
+
##
|
936
|
+
# RPC-specific configuration for `list_clusters`
|
937
|
+
# @return [Gapic::Config::Method]
|
938
|
+
#
|
939
|
+
attr_reader :list_clusters
|
940
|
+
##
|
941
|
+
# RPC-specific configuration for `diagnose_cluster`
|
942
|
+
# @return [Gapic::Config::Method]
|
943
|
+
#
|
944
|
+
attr_reader :diagnose_cluster
|
945
|
+
|
946
|
+
# @private
|
947
|
+
def initialize parent_rpcs = nil
|
948
|
+
create_cluster_config = parent_rpcs&.create_cluster if parent_rpcs&.respond_to? :create_cluster
|
949
|
+
@create_cluster = Gapic::Config::Method.new create_cluster_config
|
950
|
+
update_cluster_config = parent_rpcs&.update_cluster if parent_rpcs&.respond_to? :update_cluster
|
951
|
+
@update_cluster = Gapic::Config::Method.new update_cluster_config
|
952
|
+
delete_cluster_config = parent_rpcs&.delete_cluster if parent_rpcs&.respond_to? :delete_cluster
|
953
|
+
@delete_cluster = Gapic::Config::Method.new delete_cluster_config
|
954
|
+
get_cluster_config = parent_rpcs&.get_cluster if parent_rpcs&.respond_to? :get_cluster
|
955
|
+
@get_cluster = Gapic::Config::Method.new get_cluster_config
|
956
|
+
list_clusters_config = parent_rpcs&.list_clusters if parent_rpcs&.respond_to? :list_clusters
|
957
|
+
@list_clusters = Gapic::Config::Method.new list_clusters_config
|
958
|
+
diagnose_cluster_config = parent_rpcs&.diagnose_cluster if parent_rpcs&.respond_to? :diagnose_cluster
|
959
|
+
@diagnose_cluster = Gapic::Config::Method.new diagnose_cluster_config
|
960
|
+
|
961
|
+
yield self if block_given?
|
962
|
+
end
|
963
|
+
end
|
964
|
+
end
|
965
|
+
end
|
966
|
+
end
|
967
|
+
end
|
968
|
+
end
|
969
|
+
end
|
970
|
+
end
|