google-cloud-dataproc-v1 0.13.0 → 0.14.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 +4 -4
- data/README.md +1 -1
- data/lib/google/cloud/dataproc/v1/cluster_controller/client.rb +14 -12
- data/lib/google/cloud/dataproc/v1/cluster_controller/paths.rb +21 -0
- data/lib/google/cloud/dataproc/v1/clusters_pb.rb +18 -0
- data/lib/google/cloud/dataproc/v1/clusters_services_pb.rb +2 -1
- data/lib/google/cloud/dataproc/v1/jobs_pb.rb +6 -0
- data/lib/google/cloud/dataproc/v1/node_group_controller/client.rb +662 -0
- data/lib/google/cloud/dataproc/v1/node_group_controller/credentials.rb +51 -0
- data/lib/google/cloud/dataproc/v1/node_group_controller/operations.rb +770 -0
- data/lib/google/cloud/dataproc/v1/node_group_controller/paths.rb +73 -0
- data/lib/google/cloud/dataproc/v1/node_group_controller.rb +51 -0
- data/lib/google/cloud/dataproc/v1/node_groups_pb.rb +44 -0
- data/lib/google/cloud/dataproc/v1/node_groups_services_pb.rb +55 -0
- data/lib/google/cloud/dataproc/v1/operations_pb.rb +19 -0
- data/lib/google/cloud/dataproc/v1/version.rb +1 -1
- data/lib/google/cloud/dataproc/v1/workflow_template_service/paths.rb +21 -0
- data/lib/google/cloud/dataproc/v1.rb +1 -0
- data/proto_docs/google/api/client.rb +318 -0
- data/proto_docs/google/api/launch_stage.rb +71 -0
- data/proto_docs/google/cloud/dataproc/v1/clusters.rb +121 -46
- data/proto_docs/google/cloud/dataproc/v1/jobs.rb +33 -18
- data/proto_docs/google/cloud/dataproc/v1/node_groups.rb +115 -0
- data/proto_docs/google/cloud/dataproc/v1/operations.rb +57 -0
- data/proto_docs/google/rpc/status.rb +4 -2
- metadata +12 -2
@@ -0,0 +1,662 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2022 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/node_groups_pb"
|
21
|
+
|
22
|
+
module Google
|
23
|
+
module Cloud
|
24
|
+
module Dataproc
|
25
|
+
module V1
|
26
|
+
module NodeGroupController
|
27
|
+
##
|
28
|
+
# Client for the NodeGroupController service.
|
29
|
+
#
|
30
|
+
# The `NodeGroupControllerService` provides methods to manage node groups
|
31
|
+
# of Compute Engine managed instances.
|
32
|
+
#
|
33
|
+
class Client
|
34
|
+
include Paths
|
35
|
+
|
36
|
+
# @private
|
37
|
+
attr_reader :node_group_controller_stub
|
38
|
+
|
39
|
+
##
|
40
|
+
# Configure the NodeGroupController Client class.
|
41
|
+
#
|
42
|
+
# See {::Google::Cloud::Dataproc::V1::NodeGroupController::Client::Configuration}
|
43
|
+
# for a description of the configuration fields.
|
44
|
+
#
|
45
|
+
# @example
|
46
|
+
#
|
47
|
+
# # Modify the configuration for all NodeGroupController clients
|
48
|
+
# ::Google::Cloud::Dataproc::V1::NodeGroupController::Client.configure do |config|
|
49
|
+
# config.timeout = 10.0
|
50
|
+
# end
|
51
|
+
#
|
52
|
+
# @yield [config] Configure the Client client.
|
53
|
+
# @yieldparam config [Client::Configuration]
|
54
|
+
#
|
55
|
+
# @return [Client::Configuration]
|
56
|
+
#
|
57
|
+
def self.configure
|
58
|
+
@configure ||= begin
|
59
|
+
namespace = ["Google", "Cloud", "Dataproc", "V1"]
|
60
|
+
parent_config = while namespace.any?
|
61
|
+
parent_name = namespace.join "::"
|
62
|
+
parent_const = const_get parent_name
|
63
|
+
break parent_const.configure if parent_const.respond_to? :configure
|
64
|
+
namespace.pop
|
65
|
+
end
|
66
|
+
default_config = Client::Configuration.new parent_config
|
67
|
+
|
68
|
+
default_config
|
69
|
+
end
|
70
|
+
yield @configure if block_given?
|
71
|
+
@configure
|
72
|
+
end
|
73
|
+
|
74
|
+
##
|
75
|
+
# Configure the NodeGroupController Client instance.
|
76
|
+
#
|
77
|
+
# The configuration is set to the derived mode, meaning that values can be changed,
|
78
|
+
# but structural changes (adding new fields, etc.) are not allowed. Structural changes
|
79
|
+
# should be made on {Client.configure}.
|
80
|
+
#
|
81
|
+
# See {::Google::Cloud::Dataproc::V1::NodeGroupController::Client::Configuration}
|
82
|
+
# for a description of the configuration fields.
|
83
|
+
#
|
84
|
+
# @yield [config] Configure the Client client.
|
85
|
+
# @yieldparam config [Client::Configuration]
|
86
|
+
#
|
87
|
+
# @return [Client::Configuration]
|
88
|
+
#
|
89
|
+
def configure
|
90
|
+
yield @config if block_given?
|
91
|
+
@config
|
92
|
+
end
|
93
|
+
|
94
|
+
##
|
95
|
+
# Create a new NodeGroupController client object.
|
96
|
+
#
|
97
|
+
# @example
|
98
|
+
#
|
99
|
+
# # Create a client using the default configuration
|
100
|
+
# client = ::Google::Cloud::Dataproc::V1::NodeGroupController::Client.new
|
101
|
+
#
|
102
|
+
# # Create a client using a custom configuration
|
103
|
+
# client = ::Google::Cloud::Dataproc::V1::NodeGroupController::Client.new do |config|
|
104
|
+
# config.timeout = 10.0
|
105
|
+
# end
|
106
|
+
#
|
107
|
+
# @yield [config] Configure the NodeGroupController client.
|
108
|
+
# @yieldparam config [Client::Configuration]
|
109
|
+
#
|
110
|
+
def initialize
|
111
|
+
# These require statements are intentionally placed here to initialize
|
112
|
+
# the gRPC module only when it's required.
|
113
|
+
# See https://github.com/googleapis/toolkit/issues/446
|
114
|
+
require "gapic/grpc"
|
115
|
+
require "google/cloud/dataproc/v1/node_groups_services_pb"
|
116
|
+
|
117
|
+
# Create the configuration object
|
118
|
+
@config = Configuration.new Client.configure
|
119
|
+
|
120
|
+
# Yield the configuration if needed
|
121
|
+
yield @config if block_given?
|
122
|
+
|
123
|
+
# Create credentials
|
124
|
+
credentials = @config.credentials
|
125
|
+
# Use self-signed JWT if the endpoint is unchanged from default,
|
126
|
+
# but only if the default endpoint does not have a region prefix.
|
127
|
+
enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
|
128
|
+
!@config.endpoint.split(".").first.include?("-")
|
129
|
+
credentials ||= Credentials.default scope: @config.scope,
|
130
|
+
enable_self_signed_jwt: enable_self_signed_jwt
|
131
|
+
if credentials.is_a?(::String) || credentials.is_a?(::Hash)
|
132
|
+
credentials = Credentials.new credentials, scope: @config.scope
|
133
|
+
end
|
134
|
+
@quota_project_id = @config.quota_project
|
135
|
+
@quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
|
136
|
+
|
137
|
+
@operations_client = Operations.new do |config|
|
138
|
+
config.credentials = credentials
|
139
|
+
config.quota_project = @quota_project_id
|
140
|
+
config.endpoint = @config.endpoint
|
141
|
+
end
|
142
|
+
|
143
|
+
@node_group_controller_stub = ::Gapic::ServiceStub.new(
|
144
|
+
::Google::Cloud::Dataproc::V1::NodeGroupController::Stub,
|
145
|
+
credentials: credentials,
|
146
|
+
endpoint: @config.endpoint,
|
147
|
+
channel_args: @config.channel_args,
|
148
|
+
interceptors: @config.interceptors
|
149
|
+
)
|
150
|
+
end
|
151
|
+
|
152
|
+
##
|
153
|
+
# Get the associated client for long-running operations.
|
154
|
+
#
|
155
|
+
# @return [::Google::Cloud::Dataproc::V1::NodeGroupController::Operations]
|
156
|
+
#
|
157
|
+
attr_reader :operations_client
|
158
|
+
|
159
|
+
# Service calls
|
160
|
+
|
161
|
+
##
|
162
|
+
# Creates a node group in a cluster. The returned
|
163
|
+
# {::Google::Longrunning::Operation#metadata Operation.metadata} is
|
164
|
+
# [NodeGroupOperationMetadata](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#nodegroupoperationmetadata).
|
165
|
+
#
|
166
|
+
# @overload create_node_group(request, options = nil)
|
167
|
+
# Pass arguments to `create_node_group` via a request object, either of type
|
168
|
+
# {::Google::Cloud::Dataproc::V1::CreateNodeGroupRequest} or an equivalent Hash.
|
169
|
+
#
|
170
|
+
# @param request [::Google::Cloud::Dataproc::V1::CreateNodeGroupRequest, ::Hash]
|
171
|
+
# A request object representing the call parameters. Required. To specify no
|
172
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
173
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
174
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
175
|
+
#
|
176
|
+
# @overload create_node_group(parent: nil, node_group: nil, node_group_id: nil, request_id: nil)
|
177
|
+
# Pass arguments to `create_node_group` via keyword arguments. Note that at
|
178
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
179
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
180
|
+
#
|
181
|
+
# @param parent [::String]
|
182
|
+
# Required. The parent resource where this node group will be created.
|
183
|
+
# Format: `projects/{project}/regions/{region}/clusters/{cluster}`
|
184
|
+
# @param node_group [::Google::Cloud::Dataproc::V1::NodeGroup, ::Hash]
|
185
|
+
# Required. The node group to create.
|
186
|
+
# @param node_group_id [::String]
|
187
|
+
# Optional. An optional node group ID. Generated if not specified.
|
188
|
+
#
|
189
|
+
# The ID must contain only letters (a-z, A-Z), numbers (0-9),
|
190
|
+
# underscores (_), and hyphens (-). Cannot begin or end with underscore
|
191
|
+
# or hyphen. Must consist of from 3 to 33 characters.
|
192
|
+
# @param request_id [::String]
|
193
|
+
# Optional. A unique ID used to identify the request. If the server receives
|
194
|
+
# two
|
195
|
+
# [CreateNodeGroupRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.CreateNodeGroupRequests)
|
196
|
+
# with the same ID, the second request is ignored and the
|
197
|
+
# first {::Google::Longrunning::Operation google.longrunning.Operation} created
|
198
|
+
# and stored in the backend is returned.
|
199
|
+
#
|
200
|
+
# Recommendation: Set this value to a
|
201
|
+
# [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier).
|
202
|
+
#
|
203
|
+
# The ID must contain only letters (a-z, A-Z), numbers (0-9),
|
204
|
+
# underscores (_), and hyphens (-). The maximum length is 40 characters.
|
205
|
+
#
|
206
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
207
|
+
# @yieldparam response [::Gapic::Operation]
|
208
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
209
|
+
#
|
210
|
+
# @return [::Gapic::Operation]
|
211
|
+
#
|
212
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
213
|
+
#
|
214
|
+
# @example Basic example
|
215
|
+
# require "google/cloud/dataproc/v1"
|
216
|
+
#
|
217
|
+
# # Create a client object. The client can be reused for multiple calls.
|
218
|
+
# client = Google::Cloud::Dataproc::V1::NodeGroupController::Client.new
|
219
|
+
#
|
220
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
221
|
+
# request = Google::Cloud::Dataproc::V1::CreateNodeGroupRequest.new
|
222
|
+
#
|
223
|
+
# # Call the create_node_group method.
|
224
|
+
# result = client.create_node_group request
|
225
|
+
#
|
226
|
+
# # The returned object is of type Gapic::Operation. You can use this
|
227
|
+
# # object to check the status of an operation, cancel it, or wait
|
228
|
+
# # for results. Here is how to block until completion:
|
229
|
+
# result.wait_until_done! timeout: 60
|
230
|
+
# if result.response?
|
231
|
+
# p result.response
|
232
|
+
# else
|
233
|
+
# puts "Error!"
|
234
|
+
# end
|
235
|
+
#
|
236
|
+
def create_node_group request, options = nil
|
237
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
238
|
+
|
239
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dataproc::V1::CreateNodeGroupRequest
|
240
|
+
|
241
|
+
# Converts hash and nil to an options object
|
242
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
243
|
+
|
244
|
+
# Customize the options with defaults
|
245
|
+
metadata = @config.rpcs.create_node_group.metadata.to_h
|
246
|
+
|
247
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
248
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
249
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
250
|
+
gapic_version: ::Google::Cloud::Dataproc::V1::VERSION
|
251
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
252
|
+
|
253
|
+
header_params = {}
|
254
|
+
if request.parent
|
255
|
+
header_params["parent"] = request.parent
|
256
|
+
end
|
257
|
+
|
258
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
259
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
260
|
+
|
261
|
+
options.apply_defaults timeout: @config.rpcs.create_node_group.timeout,
|
262
|
+
metadata: metadata,
|
263
|
+
retry_policy: @config.rpcs.create_node_group.retry_policy
|
264
|
+
|
265
|
+
options.apply_defaults timeout: @config.timeout,
|
266
|
+
metadata: @config.metadata,
|
267
|
+
retry_policy: @config.retry_policy
|
268
|
+
|
269
|
+
@node_group_controller_stub.call_rpc :create_node_group, request, options: options do |response, operation|
|
270
|
+
response = ::Gapic::Operation.new response, @operations_client, options: options
|
271
|
+
yield response, operation if block_given?
|
272
|
+
return response
|
273
|
+
end
|
274
|
+
rescue ::GRPC::BadStatus => e
|
275
|
+
raise ::Google::Cloud::Error.from_error(e)
|
276
|
+
end
|
277
|
+
|
278
|
+
##
|
279
|
+
# Resizes a node group in a cluster. The returned
|
280
|
+
# {::Google::Longrunning::Operation#metadata Operation.metadata} is
|
281
|
+
# [NodeGroupOperationMetadata](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#nodegroupoperationmetadata).
|
282
|
+
#
|
283
|
+
# @overload resize_node_group(request, options = nil)
|
284
|
+
# Pass arguments to `resize_node_group` via a request object, either of type
|
285
|
+
# {::Google::Cloud::Dataproc::V1::ResizeNodeGroupRequest} or an equivalent Hash.
|
286
|
+
#
|
287
|
+
# @param request [::Google::Cloud::Dataproc::V1::ResizeNodeGroupRequest, ::Hash]
|
288
|
+
# A request object representing the call parameters. Required. To specify no
|
289
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
290
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
291
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
292
|
+
#
|
293
|
+
# @overload resize_node_group(name: nil, size: nil, request_id: nil, graceful_decommission_timeout: nil)
|
294
|
+
# Pass arguments to `resize_node_group` via keyword arguments. Note that at
|
295
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
296
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
297
|
+
#
|
298
|
+
# @param name [::String]
|
299
|
+
# Required. The name of the node group to resize.
|
300
|
+
# Format:
|
301
|
+
# `projects/{project}/regions/{region}/clusters/{cluster}/nodeGroups/{nodeGroup}`
|
302
|
+
# @param size [::Integer]
|
303
|
+
# Required. The number of running instances for the node group to maintain.
|
304
|
+
# The group adds or removes instances to maintain the number of instances
|
305
|
+
# specified by this parameter.
|
306
|
+
# @param request_id [::String]
|
307
|
+
# Optional. A unique ID used to identify the request. If the server receives
|
308
|
+
# two
|
309
|
+
# [ResizeNodeGroupRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.ResizeNodeGroupRequests)
|
310
|
+
# with the same ID, the second request is ignored and the
|
311
|
+
# first {::Google::Longrunning::Operation google.longrunning.Operation} created
|
312
|
+
# and stored in the backend is returned.
|
313
|
+
#
|
314
|
+
# Recommendation: Set this value to a
|
315
|
+
# [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier).
|
316
|
+
#
|
317
|
+
# The ID must contain only letters (a-z, A-Z), numbers (0-9),
|
318
|
+
# underscores (_), and hyphens (-). The maximum length is 40 characters.
|
319
|
+
# @param graceful_decommission_timeout [::Google::Protobuf::Duration, ::Hash]
|
320
|
+
# Optional. Timeout for graceful YARN decommissioning. [Graceful
|
321
|
+
# decommissioning]
|
322
|
+
# (https://cloud.google.com/dataproc/docs/concepts/configuring-clusters/scaling-clusters#graceful_decommissioning)
|
323
|
+
# allows the removal of nodes from the Compute Engine node group
|
324
|
+
# without interrupting jobs in progress. This timeout specifies how long to
|
325
|
+
# wait for jobs in progress to finish before forcefully removing nodes (and
|
326
|
+
# potentially interrupting jobs). Default timeout is 0 (for forceful
|
327
|
+
# decommission), and the maximum allowed timeout is 1 day. (see JSON
|
328
|
+
# representation of
|
329
|
+
# [Duration](https://developers.google.com/protocol-buffers/docs/proto3#json)).
|
330
|
+
#
|
331
|
+
# Only supported on Dataproc image versions 1.2 and higher.
|
332
|
+
#
|
333
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
334
|
+
# @yieldparam response [::Gapic::Operation]
|
335
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
336
|
+
#
|
337
|
+
# @return [::Gapic::Operation]
|
338
|
+
#
|
339
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
340
|
+
#
|
341
|
+
# @example Basic example
|
342
|
+
# require "google/cloud/dataproc/v1"
|
343
|
+
#
|
344
|
+
# # Create a client object. The client can be reused for multiple calls.
|
345
|
+
# client = Google::Cloud::Dataproc::V1::NodeGroupController::Client.new
|
346
|
+
#
|
347
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
348
|
+
# request = Google::Cloud::Dataproc::V1::ResizeNodeGroupRequest.new
|
349
|
+
#
|
350
|
+
# # Call the resize_node_group method.
|
351
|
+
# result = client.resize_node_group request
|
352
|
+
#
|
353
|
+
# # The returned object is of type Gapic::Operation. You can use this
|
354
|
+
# # object to check the status of an operation, cancel it, or wait
|
355
|
+
# # for results. Here is how to block until completion:
|
356
|
+
# result.wait_until_done! timeout: 60
|
357
|
+
# if result.response?
|
358
|
+
# p result.response
|
359
|
+
# else
|
360
|
+
# puts "Error!"
|
361
|
+
# end
|
362
|
+
#
|
363
|
+
def resize_node_group request, options = nil
|
364
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
365
|
+
|
366
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dataproc::V1::ResizeNodeGroupRequest
|
367
|
+
|
368
|
+
# Converts hash and nil to an options object
|
369
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
370
|
+
|
371
|
+
# Customize the options with defaults
|
372
|
+
metadata = @config.rpcs.resize_node_group.metadata.to_h
|
373
|
+
|
374
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
375
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
376
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
377
|
+
gapic_version: ::Google::Cloud::Dataproc::V1::VERSION
|
378
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
379
|
+
|
380
|
+
header_params = {}
|
381
|
+
if request.name
|
382
|
+
header_params["name"] = request.name
|
383
|
+
end
|
384
|
+
|
385
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
386
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
387
|
+
|
388
|
+
options.apply_defaults timeout: @config.rpcs.resize_node_group.timeout,
|
389
|
+
metadata: metadata,
|
390
|
+
retry_policy: @config.rpcs.resize_node_group.retry_policy
|
391
|
+
|
392
|
+
options.apply_defaults timeout: @config.timeout,
|
393
|
+
metadata: @config.metadata,
|
394
|
+
retry_policy: @config.retry_policy
|
395
|
+
|
396
|
+
@node_group_controller_stub.call_rpc :resize_node_group, request, options: options do |response, operation|
|
397
|
+
response = ::Gapic::Operation.new response, @operations_client, options: options
|
398
|
+
yield response, operation if block_given?
|
399
|
+
return response
|
400
|
+
end
|
401
|
+
rescue ::GRPC::BadStatus => e
|
402
|
+
raise ::Google::Cloud::Error.from_error(e)
|
403
|
+
end
|
404
|
+
|
405
|
+
##
|
406
|
+
# Gets the resource representation for a node group in a
|
407
|
+
# cluster.
|
408
|
+
#
|
409
|
+
# @overload get_node_group(request, options = nil)
|
410
|
+
# Pass arguments to `get_node_group` via a request object, either of type
|
411
|
+
# {::Google::Cloud::Dataproc::V1::GetNodeGroupRequest} or an equivalent Hash.
|
412
|
+
#
|
413
|
+
# @param request [::Google::Cloud::Dataproc::V1::GetNodeGroupRequest, ::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 get_node_group(name: nil)
|
420
|
+
# Pass arguments to `get_node_group` 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
|
+
# Required. The name of the node group to retrieve.
|
426
|
+
# Format:
|
427
|
+
# `projects/{project}/regions/{region}/clusters/{cluster}/nodeGroups/{nodeGroup}`
|
428
|
+
#
|
429
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
430
|
+
# @yieldparam response [::Google::Cloud::Dataproc::V1::NodeGroup]
|
431
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
432
|
+
#
|
433
|
+
# @return [::Google::Cloud::Dataproc::V1::NodeGroup]
|
434
|
+
#
|
435
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
436
|
+
#
|
437
|
+
# @example Basic example
|
438
|
+
# require "google/cloud/dataproc/v1"
|
439
|
+
#
|
440
|
+
# # Create a client object. The client can be reused for multiple calls.
|
441
|
+
# client = Google::Cloud::Dataproc::V1::NodeGroupController::Client.new
|
442
|
+
#
|
443
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
444
|
+
# request = Google::Cloud::Dataproc::V1::GetNodeGroupRequest.new
|
445
|
+
#
|
446
|
+
# # Call the get_node_group method.
|
447
|
+
# result = client.get_node_group request
|
448
|
+
#
|
449
|
+
# # The returned object is of type Google::Cloud::Dataproc::V1::NodeGroup.
|
450
|
+
# p result
|
451
|
+
#
|
452
|
+
def get_node_group request, options = nil
|
453
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
454
|
+
|
455
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dataproc::V1::GetNodeGroupRequest
|
456
|
+
|
457
|
+
# Converts hash and nil to an options object
|
458
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
459
|
+
|
460
|
+
# Customize the options with defaults
|
461
|
+
metadata = @config.rpcs.get_node_group.metadata.to_h
|
462
|
+
|
463
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
464
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
465
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
466
|
+
gapic_version: ::Google::Cloud::Dataproc::V1::VERSION
|
467
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
468
|
+
|
469
|
+
header_params = {}
|
470
|
+
if request.name
|
471
|
+
header_params["name"] = request.name
|
472
|
+
end
|
473
|
+
|
474
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
475
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
476
|
+
|
477
|
+
options.apply_defaults timeout: @config.rpcs.get_node_group.timeout,
|
478
|
+
metadata: metadata,
|
479
|
+
retry_policy: @config.rpcs.get_node_group.retry_policy
|
480
|
+
|
481
|
+
options.apply_defaults timeout: @config.timeout,
|
482
|
+
metadata: @config.metadata,
|
483
|
+
retry_policy: @config.retry_policy
|
484
|
+
|
485
|
+
@node_group_controller_stub.call_rpc :get_node_group, request, options: options do |response, operation|
|
486
|
+
yield response, operation if block_given?
|
487
|
+
return response
|
488
|
+
end
|
489
|
+
rescue ::GRPC::BadStatus => e
|
490
|
+
raise ::Google::Cloud::Error.from_error(e)
|
491
|
+
end
|
492
|
+
|
493
|
+
##
|
494
|
+
# Configuration class for the NodeGroupController API.
|
495
|
+
#
|
496
|
+
# This class represents the configuration for NodeGroupController,
|
497
|
+
# providing control over timeouts, retry behavior, logging, transport
|
498
|
+
# parameters, and other low-level controls. Certain parameters can also be
|
499
|
+
# applied individually to specific RPCs. See
|
500
|
+
# {::Google::Cloud::Dataproc::V1::NodeGroupController::Client::Configuration::Rpcs}
|
501
|
+
# for a list of RPCs that can be configured independently.
|
502
|
+
#
|
503
|
+
# Configuration can be applied globally to all clients, or to a single client
|
504
|
+
# on construction.
|
505
|
+
#
|
506
|
+
# @example
|
507
|
+
#
|
508
|
+
# # Modify the global config, setting the timeout for
|
509
|
+
# # create_node_group to 20 seconds,
|
510
|
+
# # and all remaining timeouts to 10 seconds.
|
511
|
+
# ::Google::Cloud::Dataproc::V1::NodeGroupController::Client.configure do |config|
|
512
|
+
# config.timeout = 10.0
|
513
|
+
# config.rpcs.create_node_group.timeout = 20.0
|
514
|
+
# end
|
515
|
+
#
|
516
|
+
# # Apply the above configuration only to a new client.
|
517
|
+
# client = ::Google::Cloud::Dataproc::V1::NodeGroupController::Client.new do |config|
|
518
|
+
# config.timeout = 10.0
|
519
|
+
# config.rpcs.create_node_group.timeout = 20.0
|
520
|
+
# end
|
521
|
+
#
|
522
|
+
# @!attribute [rw] endpoint
|
523
|
+
# The hostname or hostname:port of the service endpoint.
|
524
|
+
# Defaults to `"dataproc.googleapis.com"`.
|
525
|
+
# @return [::String]
|
526
|
+
# @!attribute [rw] credentials
|
527
|
+
# Credentials to send with calls. You may provide any of the following types:
|
528
|
+
# * (`String`) The path to a service account key file in JSON format
|
529
|
+
# * (`Hash`) A service account key as a Hash
|
530
|
+
# * (`Google::Auth::Credentials`) A googleauth credentials object
|
531
|
+
# (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
|
532
|
+
# * (`Signet::OAuth2::Client`) A signet oauth2 client object
|
533
|
+
# (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
|
534
|
+
# * (`GRPC::Core::Channel`) a gRPC channel with included credentials
|
535
|
+
# * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
|
536
|
+
# * (`nil`) indicating no credentials
|
537
|
+
# @return [::Object]
|
538
|
+
# @!attribute [rw] scope
|
539
|
+
# The OAuth scopes
|
540
|
+
# @return [::Array<::String>]
|
541
|
+
# @!attribute [rw] lib_name
|
542
|
+
# The library name as recorded in instrumentation and logging
|
543
|
+
# @return [::String]
|
544
|
+
# @!attribute [rw] lib_version
|
545
|
+
# The library version as recorded in instrumentation and logging
|
546
|
+
# @return [::String]
|
547
|
+
# @!attribute [rw] channel_args
|
548
|
+
# Extra parameters passed to the gRPC channel. Note: this is ignored if a
|
549
|
+
# `GRPC::Core::Channel` object is provided as the credential.
|
550
|
+
# @return [::Hash]
|
551
|
+
# @!attribute [rw] interceptors
|
552
|
+
# An array of interceptors that are run before calls are executed.
|
553
|
+
# @return [::Array<::GRPC::ClientInterceptor>]
|
554
|
+
# @!attribute [rw] timeout
|
555
|
+
# The call timeout in seconds.
|
556
|
+
# @return [::Numeric]
|
557
|
+
# @!attribute [rw] metadata
|
558
|
+
# Additional gRPC headers to be sent with the call.
|
559
|
+
# @return [::Hash{::Symbol=>::String}]
|
560
|
+
# @!attribute [rw] retry_policy
|
561
|
+
# The retry policy. The value is a hash with the following keys:
|
562
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
563
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
564
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
565
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
566
|
+
# trigger a retry.
|
567
|
+
# @return [::Hash]
|
568
|
+
# @!attribute [rw] quota_project
|
569
|
+
# A separate project against which to charge quota.
|
570
|
+
# @return [::String]
|
571
|
+
#
|
572
|
+
class Configuration
|
573
|
+
extend ::Gapic::Config
|
574
|
+
|
575
|
+
config_attr :endpoint, "dataproc.googleapis.com", ::String
|
576
|
+
config_attr :credentials, nil do |value|
|
577
|
+
allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
|
578
|
+
allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
|
579
|
+
allowed.any? { |klass| klass === value }
|
580
|
+
end
|
581
|
+
config_attr :scope, nil, ::String, ::Array, nil
|
582
|
+
config_attr :lib_name, nil, ::String, nil
|
583
|
+
config_attr :lib_version, nil, ::String, nil
|
584
|
+
config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
|
585
|
+
config_attr :interceptors, nil, ::Array, nil
|
586
|
+
config_attr :timeout, nil, ::Numeric, nil
|
587
|
+
config_attr :metadata, nil, ::Hash, nil
|
588
|
+
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
|
589
|
+
config_attr :quota_project, nil, ::String, nil
|
590
|
+
|
591
|
+
# @private
|
592
|
+
def initialize parent_config = nil
|
593
|
+
@parent_config = parent_config unless parent_config.nil?
|
594
|
+
|
595
|
+
yield self if block_given?
|
596
|
+
end
|
597
|
+
|
598
|
+
##
|
599
|
+
# Configurations for individual RPCs
|
600
|
+
# @return [Rpcs]
|
601
|
+
#
|
602
|
+
def rpcs
|
603
|
+
@rpcs ||= begin
|
604
|
+
parent_rpcs = nil
|
605
|
+
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
|
606
|
+
Rpcs.new parent_rpcs
|
607
|
+
end
|
608
|
+
end
|
609
|
+
|
610
|
+
##
|
611
|
+
# Configuration RPC class for the NodeGroupController API.
|
612
|
+
#
|
613
|
+
# Includes fields providing the configuration for each RPC in this service.
|
614
|
+
# Each configuration object is of type `Gapic::Config::Method` and includes
|
615
|
+
# the following configuration fields:
|
616
|
+
#
|
617
|
+
# * `timeout` (*type:* `Numeric`) - The call timeout in seconds
|
618
|
+
# * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
|
619
|
+
# * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
|
620
|
+
# include the following keys:
|
621
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
622
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
623
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
624
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
625
|
+
# trigger a retry.
|
626
|
+
#
|
627
|
+
class Rpcs
|
628
|
+
##
|
629
|
+
# RPC-specific configuration for `create_node_group`
|
630
|
+
# @return [::Gapic::Config::Method]
|
631
|
+
#
|
632
|
+
attr_reader :create_node_group
|
633
|
+
##
|
634
|
+
# RPC-specific configuration for `resize_node_group`
|
635
|
+
# @return [::Gapic::Config::Method]
|
636
|
+
#
|
637
|
+
attr_reader :resize_node_group
|
638
|
+
##
|
639
|
+
# RPC-specific configuration for `get_node_group`
|
640
|
+
# @return [::Gapic::Config::Method]
|
641
|
+
#
|
642
|
+
attr_reader :get_node_group
|
643
|
+
|
644
|
+
# @private
|
645
|
+
def initialize parent_rpcs = nil
|
646
|
+
create_node_group_config = parent_rpcs.create_node_group if parent_rpcs.respond_to? :create_node_group
|
647
|
+
@create_node_group = ::Gapic::Config::Method.new create_node_group_config
|
648
|
+
resize_node_group_config = parent_rpcs.resize_node_group if parent_rpcs.respond_to? :resize_node_group
|
649
|
+
@resize_node_group = ::Gapic::Config::Method.new resize_node_group_config
|
650
|
+
get_node_group_config = parent_rpcs.get_node_group if parent_rpcs.respond_to? :get_node_group
|
651
|
+
@get_node_group = ::Gapic::Config::Method.new get_node_group_config
|
652
|
+
|
653
|
+
yield self if block_given?
|
654
|
+
end
|
655
|
+
end
|
656
|
+
end
|
657
|
+
end
|
658
|
+
end
|
659
|
+
end
|
660
|
+
end
|
661
|
+
end
|
662
|
+
end
|