google-cloud-dataproc-v1 0.6.1 → 0.7.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/AUTHENTICATION.md +8 -8
- data/README.md +1 -1
- data/lib/google/cloud/dataproc/v1/autoscaling_policies_pb.rb +3 -2
- data/lib/google/cloud/dataproc/v1/autoscaling_policy_service/client.rb +154 -69
- data/lib/google/cloud/dataproc/v1/batch_controller/client.rb +718 -0
- data/lib/google/cloud/dataproc/v1/batch_controller/credentials.rb +51 -0
- data/lib/google/cloud/dataproc/v1/batch_controller/operations.rb +767 -0
- data/lib/google/cloud/dataproc/v1/batch_controller/paths.rb +69 -0
- data/lib/google/cloud/dataproc/v1/batch_controller.rb +50 -0
- data/lib/google/cloud/dataproc/v1/batches_pb.rb +123 -0
- data/lib/google/cloud/dataproc/v1/batches_services_pb.rb +52 -0
- data/lib/google/cloud/dataproc/v1/cluster_controller/client.rb +325 -118
- data/lib/google/cloud/dataproc/v1/cluster_controller/operations.rb +149 -37
- data/lib/google/cloud/dataproc/v1/clusters_pb.rb +9 -2
- data/lib/google/cloud/dataproc/v1/clusters_services_pb.rb +2 -0
- data/lib/google/cloud/dataproc/v1/job_controller/client.rb +244 -104
- data/lib/google/cloud/dataproc/v1/job_controller/operations.rb +149 -37
- data/lib/google/cloud/dataproc/v1/jobs_pb.rb +2 -2
- data/lib/google/cloud/dataproc/v1/operations_pb.rb +18 -3
- data/lib/google/cloud/dataproc/v1/shared_pb.rb +40 -2
- data/lib/google/cloud/dataproc/v1/version.rb +1 -1
- data/lib/google/cloud/dataproc/v1/workflow_template_service/client.rb +219 -95
- data/lib/google/cloud/dataproc/v1/workflow_template_service/operations.rb +149 -37
- data/lib/google/cloud/dataproc/v1/workflow_templates_pb.rb +2 -2
- data/lib/google/cloud/dataproc/v1/workflow_templates_services_pb.rb +1 -2
- data/lib/google/cloud/dataproc/v1.rb +1 -0
- data/proto_docs/google/api/field_behavior.rb +7 -1
- data/proto_docs/google/cloud/dataproc/v1/autoscaling_policies.rb +18 -0
- data/proto_docs/google/cloud/dataproc/v1/batches.rb +339 -0
- data/proto_docs/google/cloud/dataproc/v1/clusters.rb +45 -22
- data/proto_docs/google/cloud/dataproc/v1/jobs.rb +8 -9
- data/proto_docs/google/cloud/dataproc/v1/operations.rb +48 -0
- data/proto_docs/google/cloud/dataproc/v1/shared.rb +117 -1
- data/proto_docs/google/cloud/dataproc/v1/workflow_templates.rb +11 -14
- metadata +12 -4
@@ -0,0 +1,718 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2021 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/batches_pb"
|
21
|
+
|
22
|
+
module Google
|
23
|
+
module Cloud
|
24
|
+
module Dataproc
|
25
|
+
module V1
|
26
|
+
module BatchController
|
27
|
+
##
|
28
|
+
# Client for the BatchController service.
|
29
|
+
#
|
30
|
+
# The BatchController provides methods to manage batch workloads.
|
31
|
+
#
|
32
|
+
class Client
|
33
|
+
include Paths
|
34
|
+
|
35
|
+
# @private
|
36
|
+
attr_reader :batch_controller_stub
|
37
|
+
|
38
|
+
##
|
39
|
+
# Configure the BatchController Client class.
|
40
|
+
#
|
41
|
+
# See {::Google::Cloud::Dataproc::V1::BatchController::Client::Configuration}
|
42
|
+
# for a description of the configuration fields.
|
43
|
+
#
|
44
|
+
# @example
|
45
|
+
#
|
46
|
+
# # Modify the configuration for all BatchController clients
|
47
|
+
# ::Google::Cloud::Dataproc::V1::BatchController::Client.configure do |config|
|
48
|
+
# config.timeout = 10.0
|
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
|
68
|
+
end
|
69
|
+
yield @configure if block_given?
|
70
|
+
@configure
|
71
|
+
end
|
72
|
+
|
73
|
+
##
|
74
|
+
# Configure the BatchController Client instance.
|
75
|
+
#
|
76
|
+
# The configuration is set to the derived mode, meaning that values can be changed,
|
77
|
+
# but structural changes (adding new fields, etc.) are not allowed. Structural changes
|
78
|
+
# should be made on {Client.configure}.
|
79
|
+
#
|
80
|
+
# See {::Google::Cloud::Dataproc::V1::BatchController::Client::Configuration}
|
81
|
+
# for a description of the configuration fields.
|
82
|
+
#
|
83
|
+
# @yield [config] Configure the Client client.
|
84
|
+
# @yieldparam config [Client::Configuration]
|
85
|
+
#
|
86
|
+
# @return [Client::Configuration]
|
87
|
+
#
|
88
|
+
def configure
|
89
|
+
yield @config if block_given?
|
90
|
+
@config
|
91
|
+
end
|
92
|
+
|
93
|
+
##
|
94
|
+
# Create a new BatchController client object.
|
95
|
+
#
|
96
|
+
# @example
|
97
|
+
#
|
98
|
+
# # Create a client using the default configuration
|
99
|
+
# client = ::Google::Cloud::Dataproc::V1::BatchController::Client.new
|
100
|
+
#
|
101
|
+
# # Create a client using a custom configuration
|
102
|
+
# client = ::Google::Cloud::Dataproc::V1::BatchController::Client.new do |config|
|
103
|
+
# config.timeout = 10.0
|
104
|
+
# end
|
105
|
+
#
|
106
|
+
# @yield [config] Configure the BatchController client.
|
107
|
+
# @yieldparam config [Client::Configuration]
|
108
|
+
#
|
109
|
+
def initialize
|
110
|
+
# These require statements are intentionally placed here to initialize
|
111
|
+
# the gRPC module only when it's required.
|
112
|
+
# See https://github.com/googleapis/toolkit/issues/446
|
113
|
+
require "gapic/grpc"
|
114
|
+
require "google/cloud/dataproc/v1/batches_services_pb"
|
115
|
+
|
116
|
+
# Create the configuration object
|
117
|
+
@config = Configuration.new Client.configure
|
118
|
+
|
119
|
+
# Yield the configuration if needed
|
120
|
+
yield @config if block_given?
|
121
|
+
|
122
|
+
# Create credentials
|
123
|
+
credentials = @config.credentials
|
124
|
+
# Use self-signed JWT if the endpoint is unchanged from default,
|
125
|
+
# but only if the default endpoint does not have a region prefix.
|
126
|
+
enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
|
127
|
+
!@config.endpoint.split(".").first.include?("-")
|
128
|
+
credentials ||= Credentials.default scope: @config.scope,
|
129
|
+
enable_self_signed_jwt: enable_self_signed_jwt
|
130
|
+
if credentials.is_a?(::String) || credentials.is_a?(::Hash)
|
131
|
+
credentials = Credentials.new credentials, scope: @config.scope
|
132
|
+
end
|
133
|
+
@quota_project_id = @config.quota_project
|
134
|
+
@quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
|
135
|
+
|
136
|
+
@operations_client = Operations.new do |config|
|
137
|
+
config.credentials = credentials
|
138
|
+
config.endpoint = @config.endpoint
|
139
|
+
end
|
140
|
+
|
141
|
+
@batch_controller_stub = ::Gapic::ServiceStub.new(
|
142
|
+
::Google::Cloud::Dataproc::V1::BatchController::Stub,
|
143
|
+
credentials: credentials,
|
144
|
+
endpoint: @config.endpoint,
|
145
|
+
channel_args: @config.channel_args,
|
146
|
+
interceptors: @config.interceptors
|
147
|
+
)
|
148
|
+
end
|
149
|
+
|
150
|
+
##
|
151
|
+
# Get the associated client for long-running operations.
|
152
|
+
#
|
153
|
+
# @return [::Google::Cloud::Dataproc::V1::BatchController::Operations]
|
154
|
+
#
|
155
|
+
attr_reader :operations_client
|
156
|
+
|
157
|
+
# Service calls
|
158
|
+
|
159
|
+
##
|
160
|
+
# Creates a batch workload that executes asynchronously.
|
161
|
+
#
|
162
|
+
# @overload create_batch(request, options = nil)
|
163
|
+
# Pass arguments to `create_batch` via a request object, either of type
|
164
|
+
# {::Google::Cloud::Dataproc::V1::CreateBatchRequest} or an equivalent Hash.
|
165
|
+
#
|
166
|
+
# @param request [::Google::Cloud::Dataproc::V1::CreateBatchRequest, ::Hash]
|
167
|
+
# A request object representing the call parameters. Required. To specify no
|
168
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
169
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
170
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
171
|
+
#
|
172
|
+
# @overload create_batch(parent: nil, batch: nil, batch_id: nil, request_id: nil)
|
173
|
+
# Pass arguments to `create_batch` via keyword arguments. Note that at
|
174
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
175
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
176
|
+
#
|
177
|
+
# @param parent [::String]
|
178
|
+
# Required. The parent resource where this batch will be created.
|
179
|
+
# @param batch [::Google::Cloud::Dataproc::V1::Batch, ::Hash]
|
180
|
+
# Required. The batch to create.
|
181
|
+
# @param batch_id [::String]
|
182
|
+
# Optional. The ID to use for the batch, which will become the final component of
|
183
|
+
# the batch's resource name.
|
184
|
+
#
|
185
|
+
# This value must be 4-63 characters. Valid characters are `/[a-z][0-9]-/`.
|
186
|
+
# @param request_id [::String]
|
187
|
+
# Optional. A unique ID used to identify the request. If the service
|
188
|
+
# receives two
|
189
|
+
# [CreateBatchRequest](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.CreateBatchRequest)s
|
190
|
+
# with the same request_id, the second request is ignored and the
|
191
|
+
# Operation that corresponds to the first Batch created and stored
|
192
|
+
# in the backend is returned.
|
193
|
+
#
|
194
|
+
# Recommendation: Set this value to a
|
195
|
+
# [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier).
|
196
|
+
#
|
197
|
+
# The value must contain only letters (a-z, A-Z), numbers (0-9),
|
198
|
+
# underscores (_), and hyphens (-). The maximum length is 40 characters.
|
199
|
+
#
|
200
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
201
|
+
# @yieldparam response [::Gapic::Operation]
|
202
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
203
|
+
#
|
204
|
+
# @return [::Gapic::Operation]
|
205
|
+
#
|
206
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
207
|
+
#
|
208
|
+
# @example Basic example
|
209
|
+
# require "google/cloud/dataproc/v1"
|
210
|
+
#
|
211
|
+
# # Create a client object. The client can be reused for multiple calls.
|
212
|
+
# client = Google::Cloud::Dataproc::V1::BatchController::Client.new
|
213
|
+
#
|
214
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
215
|
+
# request = Google::Cloud::Dataproc::V1::CreateBatchRequest.new
|
216
|
+
#
|
217
|
+
# # Call the create_batch method.
|
218
|
+
# result = client.create_batch request
|
219
|
+
#
|
220
|
+
# # The returned object is of type Gapic::Operation. You can use this
|
221
|
+
# # object to check the status of an operation, cancel it, or wait
|
222
|
+
# # for results. Here is how to block until completion:
|
223
|
+
# result.wait_until_done! timeout: 60
|
224
|
+
# if result.response?
|
225
|
+
# p result.response
|
226
|
+
# else
|
227
|
+
# puts "Error!"
|
228
|
+
# end
|
229
|
+
#
|
230
|
+
def create_batch request, options = nil
|
231
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
232
|
+
|
233
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dataproc::V1::CreateBatchRequest
|
234
|
+
|
235
|
+
# Converts hash and nil to an options object
|
236
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
237
|
+
|
238
|
+
# Customize the options with defaults
|
239
|
+
metadata = @config.rpcs.create_batch.metadata.to_h
|
240
|
+
|
241
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
242
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
243
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
244
|
+
gapic_version: ::Google::Cloud::Dataproc::V1::VERSION
|
245
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
246
|
+
|
247
|
+
header_params = {}
|
248
|
+
if request.parent
|
249
|
+
header_params["parent"] = request.parent
|
250
|
+
end
|
251
|
+
|
252
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
253
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
254
|
+
|
255
|
+
options.apply_defaults timeout: @config.rpcs.create_batch.timeout,
|
256
|
+
metadata: metadata,
|
257
|
+
retry_policy: @config.rpcs.create_batch.retry_policy
|
258
|
+
|
259
|
+
options.apply_defaults timeout: @config.timeout,
|
260
|
+
metadata: @config.metadata,
|
261
|
+
retry_policy: @config.retry_policy
|
262
|
+
|
263
|
+
@batch_controller_stub.call_rpc :create_batch, request, options: options do |response, operation|
|
264
|
+
response = ::Gapic::Operation.new response, @operations_client, options: options
|
265
|
+
yield response, operation if block_given?
|
266
|
+
return response
|
267
|
+
end
|
268
|
+
rescue ::GRPC::BadStatus => e
|
269
|
+
raise ::Google::Cloud::Error.from_error(e)
|
270
|
+
end
|
271
|
+
|
272
|
+
##
|
273
|
+
# Gets the batch workload resource representation.
|
274
|
+
#
|
275
|
+
# @overload get_batch(request, options = nil)
|
276
|
+
# Pass arguments to `get_batch` via a request object, either of type
|
277
|
+
# {::Google::Cloud::Dataproc::V1::GetBatchRequest} or an equivalent Hash.
|
278
|
+
#
|
279
|
+
# @param request [::Google::Cloud::Dataproc::V1::GetBatchRequest, ::Hash]
|
280
|
+
# A request object representing the call parameters. Required. To specify no
|
281
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
282
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
283
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
284
|
+
#
|
285
|
+
# @overload get_batch(name: nil)
|
286
|
+
# Pass arguments to `get_batch` via keyword arguments. Note that at
|
287
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
288
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
289
|
+
#
|
290
|
+
# @param name [::String]
|
291
|
+
# Required. The name of the batch to retrieve.
|
292
|
+
#
|
293
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
294
|
+
# @yieldparam response [::Google::Cloud::Dataproc::V1::Batch]
|
295
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
296
|
+
#
|
297
|
+
# @return [::Google::Cloud::Dataproc::V1::Batch]
|
298
|
+
#
|
299
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
300
|
+
#
|
301
|
+
# @example Basic example
|
302
|
+
# require "google/cloud/dataproc/v1"
|
303
|
+
#
|
304
|
+
# # Create a client object. The client can be reused for multiple calls.
|
305
|
+
# client = Google::Cloud::Dataproc::V1::BatchController::Client.new
|
306
|
+
#
|
307
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
308
|
+
# request = Google::Cloud::Dataproc::V1::GetBatchRequest.new
|
309
|
+
#
|
310
|
+
# # Call the get_batch method.
|
311
|
+
# result = client.get_batch request
|
312
|
+
#
|
313
|
+
# # The returned object is of type Google::Cloud::Dataproc::V1::Batch.
|
314
|
+
# p result
|
315
|
+
#
|
316
|
+
def get_batch request, options = nil
|
317
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
318
|
+
|
319
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dataproc::V1::GetBatchRequest
|
320
|
+
|
321
|
+
# Converts hash and nil to an options object
|
322
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
323
|
+
|
324
|
+
# Customize the options with defaults
|
325
|
+
metadata = @config.rpcs.get_batch.metadata.to_h
|
326
|
+
|
327
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
328
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
329
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
330
|
+
gapic_version: ::Google::Cloud::Dataproc::V1::VERSION
|
331
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
332
|
+
|
333
|
+
header_params = {}
|
334
|
+
if request.name
|
335
|
+
header_params["name"] = request.name
|
336
|
+
end
|
337
|
+
|
338
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
339
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
340
|
+
|
341
|
+
options.apply_defaults timeout: @config.rpcs.get_batch.timeout,
|
342
|
+
metadata: metadata,
|
343
|
+
retry_policy: @config.rpcs.get_batch.retry_policy
|
344
|
+
|
345
|
+
options.apply_defaults timeout: @config.timeout,
|
346
|
+
metadata: @config.metadata,
|
347
|
+
retry_policy: @config.retry_policy
|
348
|
+
|
349
|
+
@batch_controller_stub.call_rpc :get_batch, request, options: options do |response, operation|
|
350
|
+
yield response, operation if block_given?
|
351
|
+
return response
|
352
|
+
end
|
353
|
+
rescue ::GRPC::BadStatus => e
|
354
|
+
raise ::Google::Cloud::Error.from_error(e)
|
355
|
+
end
|
356
|
+
|
357
|
+
##
|
358
|
+
# Lists batch workloads.
|
359
|
+
#
|
360
|
+
# @overload list_batches(request, options = nil)
|
361
|
+
# Pass arguments to `list_batches` via a request object, either of type
|
362
|
+
# {::Google::Cloud::Dataproc::V1::ListBatchesRequest} or an equivalent Hash.
|
363
|
+
#
|
364
|
+
# @param request [::Google::Cloud::Dataproc::V1::ListBatchesRequest, ::Hash]
|
365
|
+
# A request object representing the call parameters. Required. To specify no
|
366
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
367
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
368
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
369
|
+
#
|
370
|
+
# @overload list_batches(parent: nil, page_size: nil, page_token: nil)
|
371
|
+
# Pass arguments to `list_batches` via keyword arguments. Note that at
|
372
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
373
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
374
|
+
#
|
375
|
+
# @param parent [::String]
|
376
|
+
# Required. The parent, which owns this collection of batches.
|
377
|
+
# @param page_size [::Integer]
|
378
|
+
# Optional. The maximum number of batches to return in each response.
|
379
|
+
# The service may return fewer than this value.
|
380
|
+
# The default page size is 20; the maximum page size is 1000.
|
381
|
+
# @param page_token [::String]
|
382
|
+
# Optional. A page token received from a previous `ListBatches` call.
|
383
|
+
# Provide this token to retrieve the subsequent page.
|
384
|
+
#
|
385
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
386
|
+
# @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Dataproc::V1::Batch>]
|
387
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
388
|
+
#
|
389
|
+
# @return [::Gapic::PagedEnumerable<::Google::Cloud::Dataproc::V1::Batch>]
|
390
|
+
#
|
391
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
392
|
+
#
|
393
|
+
# @example Basic example
|
394
|
+
# require "google/cloud/dataproc/v1"
|
395
|
+
#
|
396
|
+
# # Create a client object. The client can be reused for multiple calls.
|
397
|
+
# client = Google::Cloud::Dataproc::V1::BatchController::Client.new
|
398
|
+
#
|
399
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
400
|
+
# request = Google::Cloud::Dataproc::V1::ListBatchesRequest.new
|
401
|
+
#
|
402
|
+
# # Call the list_batches method.
|
403
|
+
# result = client.list_batches request
|
404
|
+
#
|
405
|
+
# # The returned object is of type Gapic::PagedEnumerable. You can
|
406
|
+
# # iterate over all elements by calling #each, and the enumerable
|
407
|
+
# # will lazily make API calls to fetch subsequent pages. Other
|
408
|
+
# # methods are also available for managing paging directly.
|
409
|
+
# result.each do |response|
|
410
|
+
# # Each element is of type ::Google::Cloud::Dataproc::V1::Batch.
|
411
|
+
# p response
|
412
|
+
# end
|
413
|
+
#
|
414
|
+
def list_batches request, options = nil
|
415
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
416
|
+
|
417
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dataproc::V1::ListBatchesRequest
|
418
|
+
|
419
|
+
# Converts hash and nil to an options object
|
420
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
421
|
+
|
422
|
+
# Customize the options with defaults
|
423
|
+
metadata = @config.rpcs.list_batches.metadata.to_h
|
424
|
+
|
425
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
426
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
427
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
428
|
+
gapic_version: ::Google::Cloud::Dataproc::V1::VERSION
|
429
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
430
|
+
|
431
|
+
header_params = {}
|
432
|
+
if request.parent
|
433
|
+
header_params["parent"] = request.parent
|
434
|
+
end
|
435
|
+
|
436
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
437
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
438
|
+
|
439
|
+
options.apply_defaults timeout: @config.rpcs.list_batches.timeout,
|
440
|
+
metadata: metadata,
|
441
|
+
retry_policy: @config.rpcs.list_batches.retry_policy
|
442
|
+
|
443
|
+
options.apply_defaults timeout: @config.timeout,
|
444
|
+
metadata: @config.metadata,
|
445
|
+
retry_policy: @config.retry_policy
|
446
|
+
|
447
|
+
@batch_controller_stub.call_rpc :list_batches, request, options: options do |response, operation|
|
448
|
+
response = ::Gapic::PagedEnumerable.new @batch_controller_stub, :list_batches, request, response, operation, options
|
449
|
+
yield response, operation if block_given?
|
450
|
+
return response
|
451
|
+
end
|
452
|
+
rescue ::GRPC::BadStatus => e
|
453
|
+
raise ::Google::Cloud::Error.from_error(e)
|
454
|
+
end
|
455
|
+
|
456
|
+
##
|
457
|
+
# Deletes the batch workload resource. If the batch is not in terminal state,
|
458
|
+
# the delete fails and the response returns `FAILED_PRECONDITION`.
|
459
|
+
#
|
460
|
+
# @overload delete_batch(request, options = nil)
|
461
|
+
# Pass arguments to `delete_batch` via a request object, either of type
|
462
|
+
# {::Google::Cloud::Dataproc::V1::DeleteBatchRequest} or an equivalent Hash.
|
463
|
+
#
|
464
|
+
# @param request [::Google::Cloud::Dataproc::V1::DeleteBatchRequest, ::Hash]
|
465
|
+
# A request object representing the call parameters. Required. To specify no
|
466
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
467
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
468
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
469
|
+
#
|
470
|
+
# @overload delete_batch(name: nil)
|
471
|
+
# Pass arguments to `delete_batch` via keyword arguments. Note that at
|
472
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
473
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
474
|
+
#
|
475
|
+
# @param name [::String]
|
476
|
+
# Required. The name of the batch resource to delete.
|
477
|
+
#
|
478
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
479
|
+
# @yieldparam response [::Google::Protobuf::Empty]
|
480
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
481
|
+
#
|
482
|
+
# @return [::Google::Protobuf::Empty]
|
483
|
+
#
|
484
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
485
|
+
#
|
486
|
+
# @example Basic example
|
487
|
+
# require "google/cloud/dataproc/v1"
|
488
|
+
#
|
489
|
+
# # Create a client object. The client can be reused for multiple calls.
|
490
|
+
# client = Google::Cloud::Dataproc::V1::BatchController::Client.new
|
491
|
+
#
|
492
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
493
|
+
# request = Google::Cloud::Dataproc::V1::DeleteBatchRequest.new
|
494
|
+
#
|
495
|
+
# # Call the delete_batch method.
|
496
|
+
# result = client.delete_batch request
|
497
|
+
#
|
498
|
+
# # The returned object is of type Google::Protobuf::Empty.
|
499
|
+
# p result
|
500
|
+
#
|
501
|
+
def delete_batch request, options = nil
|
502
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
503
|
+
|
504
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dataproc::V1::DeleteBatchRequest
|
505
|
+
|
506
|
+
# Converts hash and nil to an options object
|
507
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
508
|
+
|
509
|
+
# Customize the options with defaults
|
510
|
+
metadata = @config.rpcs.delete_batch.metadata.to_h
|
511
|
+
|
512
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
513
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
514
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
515
|
+
gapic_version: ::Google::Cloud::Dataproc::V1::VERSION
|
516
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
517
|
+
|
518
|
+
header_params = {}
|
519
|
+
if request.name
|
520
|
+
header_params["name"] = request.name
|
521
|
+
end
|
522
|
+
|
523
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
524
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
525
|
+
|
526
|
+
options.apply_defaults timeout: @config.rpcs.delete_batch.timeout,
|
527
|
+
metadata: metadata,
|
528
|
+
retry_policy: @config.rpcs.delete_batch.retry_policy
|
529
|
+
|
530
|
+
options.apply_defaults timeout: @config.timeout,
|
531
|
+
metadata: @config.metadata,
|
532
|
+
retry_policy: @config.retry_policy
|
533
|
+
|
534
|
+
@batch_controller_stub.call_rpc :delete_batch, request, options: options do |response, operation|
|
535
|
+
yield response, operation if block_given?
|
536
|
+
return response
|
537
|
+
end
|
538
|
+
rescue ::GRPC::BadStatus => e
|
539
|
+
raise ::Google::Cloud::Error.from_error(e)
|
540
|
+
end
|
541
|
+
|
542
|
+
##
|
543
|
+
# Configuration class for the BatchController API.
|
544
|
+
#
|
545
|
+
# This class represents the configuration for BatchController,
|
546
|
+
# providing control over timeouts, retry behavior, logging, transport
|
547
|
+
# parameters, and other low-level controls. Certain parameters can also be
|
548
|
+
# applied individually to specific RPCs. See
|
549
|
+
# {::Google::Cloud::Dataproc::V1::BatchController::Client::Configuration::Rpcs}
|
550
|
+
# for a list of RPCs that can be configured independently.
|
551
|
+
#
|
552
|
+
# Configuration can be applied globally to all clients, or to a single client
|
553
|
+
# on construction.
|
554
|
+
#
|
555
|
+
# @example
|
556
|
+
#
|
557
|
+
# # Modify the global config, setting the timeout for
|
558
|
+
# # create_batch to 20 seconds,
|
559
|
+
# # and all remaining timeouts to 10 seconds.
|
560
|
+
# ::Google::Cloud::Dataproc::V1::BatchController::Client.configure do |config|
|
561
|
+
# config.timeout = 10.0
|
562
|
+
# config.rpcs.create_batch.timeout = 20.0
|
563
|
+
# end
|
564
|
+
#
|
565
|
+
# # Apply the above configuration only to a new client.
|
566
|
+
# client = ::Google::Cloud::Dataproc::V1::BatchController::Client.new do |config|
|
567
|
+
# config.timeout = 10.0
|
568
|
+
# config.rpcs.create_batch.timeout = 20.0
|
569
|
+
# end
|
570
|
+
#
|
571
|
+
# @!attribute [rw] endpoint
|
572
|
+
# The hostname or hostname:port of the service endpoint.
|
573
|
+
# Defaults to `"dataproc.googleapis.com"`.
|
574
|
+
# @return [::String]
|
575
|
+
# @!attribute [rw] credentials
|
576
|
+
# Credentials to send with calls. You may provide any of the following types:
|
577
|
+
# * (`String`) The path to a service account key file in JSON format
|
578
|
+
# * (`Hash`) A service account key as a Hash
|
579
|
+
# * (`Google::Auth::Credentials`) A googleauth credentials object
|
580
|
+
# (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
|
581
|
+
# * (`Signet::OAuth2::Client`) A signet oauth2 client object
|
582
|
+
# (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
|
583
|
+
# * (`GRPC::Core::Channel`) a gRPC channel with included credentials
|
584
|
+
# * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
|
585
|
+
# * (`nil`) indicating no credentials
|
586
|
+
# @return [::Object]
|
587
|
+
# @!attribute [rw] scope
|
588
|
+
# The OAuth scopes
|
589
|
+
# @return [::Array<::String>]
|
590
|
+
# @!attribute [rw] lib_name
|
591
|
+
# The library name as recorded in instrumentation and logging
|
592
|
+
# @return [::String]
|
593
|
+
# @!attribute [rw] lib_version
|
594
|
+
# The library version as recorded in instrumentation and logging
|
595
|
+
# @return [::String]
|
596
|
+
# @!attribute [rw] channel_args
|
597
|
+
# Extra parameters passed to the gRPC channel. Note: this is ignored if a
|
598
|
+
# `GRPC::Core::Channel` object is provided as the credential.
|
599
|
+
# @return [::Hash]
|
600
|
+
# @!attribute [rw] interceptors
|
601
|
+
# An array of interceptors that are run before calls are executed.
|
602
|
+
# @return [::Array<::GRPC::ClientInterceptor>]
|
603
|
+
# @!attribute [rw] timeout
|
604
|
+
# The call timeout in seconds.
|
605
|
+
# @return [::Numeric]
|
606
|
+
# @!attribute [rw] metadata
|
607
|
+
# Additional gRPC headers to be sent with the call.
|
608
|
+
# @return [::Hash{::Symbol=>::String}]
|
609
|
+
# @!attribute [rw] retry_policy
|
610
|
+
# The retry policy. The value is a hash with the following keys:
|
611
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
612
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
613
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
614
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
615
|
+
# trigger a retry.
|
616
|
+
# @return [::Hash]
|
617
|
+
# @!attribute [rw] quota_project
|
618
|
+
# A separate project against which to charge quota.
|
619
|
+
# @return [::String]
|
620
|
+
#
|
621
|
+
class Configuration
|
622
|
+
extend ::Gapic::Config
|
623
|
+
|
624
|
+
config_attr :endpoint, "dataproc.googleapis.com", ::String
|
625
|
+
config_attr :credentials, nil do |value|
|
626
|
+
allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
|
627
|
+
allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
|
628
|
+
allowed.any? { |klass| klass === value }
|
629
|
+
end
|
630
|
+
config_attr :scope, nil, ::String, ::Array, nil
|
631
|
+
config_attr :lib_name, nil, ::String, nil
|
632
|
+
config_attr :lib_version, nil, ::String, nil
|
633
|
+
config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
|
634
|
+
config_attr :interceptors, nil, ::Array, nil
|
635
|
+
config_attr :timeout, nil, ::Numeric, nil
|
636
|
+
config_attr :metadata, nil, ::Hash, nil
|
637
|
+
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
|
638
|
+
config_attr :quota_project, nil, ::String, nil
|
639
|
+
|
640
|
+
# @private
|
641
|
+
def initialize parent_config = nil
|
642
|
+
@parent_config = parent_config unless parent_config.nil?
|
643
|
+
|
644
|
+
yield self if block_given?
|
645
|
+
end
|
646
|
+
|
647
|
+
##
|
648
|
+
# Configurations for individual RPCs
|
649
|
+
# @return [Rpcs]
|
650
|
+
#
|
651
|
+
def rpcs
|
652
|
+
@rpcs ||= begin
|
653
|
+
parent_rpcs = nil
|
654
|
+
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
|
655
|
+
Rpcs.new parent_rpcs
|
656
|
+
end
|
657
|
+
end
|
658
|
+
|
659
|
+
##
|
660
|
+
# Configuration RPC class for the BatchController API.
|
661
|
+
#
|
662
|
+
# Includes fields providing the configuration for each RPC in this service.
|
663
|
+
# Each configuration object is of type `Gapic::Config::Method` and includes
|
664
|
+
# the following configuration fields:
|
665
|
+
#
|
666
|
+
# * `timeout` (*type:* `Numeric`) - The call timeout in seconds
|
667
|
+
# * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
|
668
|
+
# * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
|
669
|
+
# include the following keys:
|
670
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
671
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
672
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
673
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
674
|
+
# trigger a retry.
|
675
|
+
#
|
676
|
+
class Rpcs
|
677
|
+
##
|
678
|
+
# RPC-specific configuration for `create_batch`
|
679
|
+
# @return [::Gapic::Config::Method]
|
680
|
+
#
|
681
|
+
attr_reader :create_batch
|
682
|
+
##
|
683
|
+
# RPC-specific configuration for `get_batch`
|
684
|
+
# @return [::Gapic::Config::Method]
|
685
|
+
#
|
686
|
+
attr_reader :get_batch
|
687
|
+
##
|
688
|
+
# RPC-specific configuration for `list_batches`
|
689
|
+
# @return [::Gapic::Config::Method]
|
690
|
+
#
|
691
|
+
attr_reader :list_batches
|
692
|
+
##
|
693
|
+
# RPC-specific configuration for `delete_batch`
|
694
|
+
# @return [::Gapic::Config::Method]
|
695
|
+
#
|
696
|
+
attr_reader :delete_batch
|
697
|
+
|
698
|
+
# @private
|
699
|
+
def initialize parent_rpcs = nil
|
700
|
+
create_batch_config = parent_rpcs.create_batch if parent_rpcs.respond_to? :create_batch
|
701
|
+
@create_batch = ::Gapic::Config::Method.new create_batch_config
|
702
|
+
get_batch_config = parent_rpcs.get_batch if parent_rpcs.respond_to? :get_batch
|
703
|
+
@get_batch = ::Gapic::Config::Method.new get_batch_config
|
704
|
+
list_batches_config = parent_rpcs.list_batches if parent_rpcs.respond_to? :list_batches
|
705
|
+
@list_batches = ::Gapic::Config::Method.new list_batches_config
|
706
|
+
delete_batch_config = parent_rpcs.delete_batch if parent_rpcs.respond_to? :delete_batch
|
707
|
+
@delete_batch = ::Gapic::Config::Method.new delete_batch_config
|
708
|
+
|
709
|
+
yield self if block_given?
|
710
|
+
end
|
711
|
+
end
|
712
|
+
end
|
713
|
+
end
|
714
|
+
end
|
715
|
+
end
|
716
|
+
end
|
717
|
+
end
|
718
|
+
end
|