google-cloud-batch-v1 0.6.0 → 0.7.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/batch/v1/batch_pb.rb +1 -0
- data/lib/google/cloud/batch/v1/batch_service/client.rb +16 -34
- data/lib/google/cloud/batch/v1/batch_service/operations.rb +12 -14
- data/lib/google/cloud/batch/v1/batch_service/rest/client.rb +810 -0
- data/lib/google/cloud/batch/v1/batch_service/rest/operations.rb +793 -0
- data/lib/google/cloud/batch/v1/batch_service/rest/service_stub.rb +403 -0
- data/lib/google/cloud/batch/v1/batch_service/rest.rb +56 -0
- data/lib/google/cloud/batch/v1/batch_service.rb +6 -0
- data/lib/google/cloud/batch/v1/bindings_override.rb +102 -0
- data/lib/google/cloud/batch/v1/rest.rb +38 -0
- data/lib/google/cloud/batch/v1/task_pb.rb +1 -0
- data/lib/google/cloud/batch/v1/version.rb +1 -1
- data/lib/google/cloud/batch/v1.rb +5 -0
- data/lib/google/iam/v1/bindings_override.rb +100 -0
- data/lib/google/iam/v1/iam_policy/client.rb +639 -0
- data/lib/google/iam/v1/iam_policy/credentials.rb +42 -0
- data/lib/google/iam/v1/iam_policy/rest/client.rb +558 -0
- data/lib/google/iam/v1/iam_policy/rest/service_stub.rb +226 -0
- data/lib/google/iam/v1/iam_policy/rest.rb +75 -0
- data/lib/google/iam/v1/iam_policy.rb +77 -0
- data/lib/google/iam/v1/rest.rb +36 -0
- data/lib/google/iam/v1.rb +43 -0
- data/lib/google-cloud-batch-v1.rb +1 -0
- data/proto_docs/google/cloud/batch/v1/batch.rb +4 -4
- data/proto_docs/google/cloud/batch/v1/job.rb +2 -1
- data/proto_docs/google/cloud/batch/v1/task.rb +27 -7
- data/proto_docs/google/iam/v1/iam_policy.rb +87 -0
- data/proto_docs/google/iam/v1/options.rb +50 -0
- data/proto_docs/google/iam/v1/policy.rb +418 -0
- metadata +32 -20
@@ -0,0 +1,810 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2023 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/batch/v1/batch_pb"
|
21
|
+
require "google/cloud/batch/v1/batch_service/rest/service_stub"
|
22
|
+
require "google/cloud/location/rest"
|
23
|
+
|
24
|
+
module Google
|
25
|
+
module Cloud
|
26
|
+
module Batch
|
27
|
+
module V1
|
28
|
+
module BatchService
|
29
|
+
module Rest
|
30
|
+
##
|
31
|
+
# REST client for the BatchService service.
|
32
|
+
#
|
33
|
+
# Google Batch Service.
|
34
|
+
# The service manages user submitted batch jobs and allocates Google Compute
|
35
|
+
# Engine VM instances to run the jobs.
|
36
|
+
#
|
37
|
+
class Client
|
38
|
+
include Paths
|
39
|
+
|
40
|
+
# @private
|
41
|
+
attr_reader :batch_service_stub
|
42
|
+
|
43
|
+
##
|
44
|
+
# Configure the BatchService Client class.
|
45
|
+
#
|
46
|
+
# See {::Google::Cloud::Batch::V1::BatchService::Rest::Client::Configuration}
|
47
|
+
# for a description of the configuration fields.
|
48
|
+
#
|
49
|
+
# @example
|
50
|
+
#
|
51
|
+
# # Modify the configuration for all BatchService clients
|
52
|
+
# ::Google::Cloud::Batch::V1::BatchService::Rest::Client.configure do |config|
|
53
|
+
# config.timeout = 10.0
|
54
|
+
# end
|
55
|
+
#
|
56
|
+
# @yield [config] Configure the Client client.
|
57
|
+
# @yieldparam config [Client::Configuration]
|
58
|
+
#
|
59
|
+
# @return [Client::Configuration]
|
60
|
+
#
|
61
|
+
def self.configure
|
62
|
+
@configure ||= begin
|
63
|
+
namespace = ["Google", "Cloud", "Batch", "V1"]
|
64
|
+
parent_config = while namespace.any?
|
65
|
+
parent_name = namespace.join "::"
|
66
|
+
parent_const = const_get parent_name
|
67
|
+
break parent_const.configure if parent_const.respond_to? :configure
|
68
|
+
namespace.pop
|
69
|
+
end
|
70
|
+
default_config = Client::Configuration.new parent_config
|
71
|
+
|
72
|
+
default_config.rpcs.create_job.timeout = 60.0
|
73
|
+
|
74
|
+
default_config.rpcs.get_job.timeout = 60.0
|
75
|
+
default_config.rpcs.get_job.retry_policy = {
|
76
|
+
initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
|
77
|
+
}
|
78
|
+
|
79
|
+
default_config.rpcs.delete_job.timeout = 60.0
|
80
|
+
|
81
|
+
default_config.rpcs.list_jobs.timeout = 60.0
|
82
|
+
default_config.rpcs.list_jobs.retry_policy = {
|
83
|
+
initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
|
84
|
+
}
|
85
|
+
|
86
|
+
default_config.rpcs.get_task.timeout = 60.0
|
87
|
+
default_config.rpcs.get_task.retry_policy = {
|
88
|
+
initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
|
89
|
+
}
|
90
|
+
|
91
|
+
default_config.rpcs.list_tasks.timeout = 60.0
|
92
|
+
default_config.rpcs.list_tasks.retry_policy = {
|
93
|
+
initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
|
94
|
+
}
|
95
|
+
|
96
|
+
default_config
|
97
|
+
end
|
98
|
+
yield @configure if block_given?
|
99
|
+
@configure
|
100
|
+
end
|
101
|
+
|
102
|
+
##
|
103
|
+
# Configure the BatchService Client instance.
|
104
|
+
#
|
105
|
+
# The configuration is set to the derived mode, meaning that values can be changed,
|
106
|
+
# but structural changes (adding new fields, etc.) are not allowed. Structural changes
|
107
|
+
# should be made on {Client.configure}.
|
108
|
+
#
|
109
|
+
# See {::Google::Cloud::Batch::V1::BatchService::Rest::Client::Configuration}
|
110
|
+
# for a description of the configuration fields.
|
111
|
+
#
|
112
|
+
# @yield [config] Configure the Client client.
|
113
|
+
# @yieldparam config [Client::Configuration]
|
114
|
+
#
|
115
|
+
# @return [Client::Configuration]
|
116
|
+
#
|
117
|
+
def configure
|
118
|
+
yield @config if block_given?
|
119
|
+
@config
|
120
|
+
end
|
121
|
+
|
122
|
+
##
|
123
|
+
# Create a new BatchService REST client object.
|
124
|
+
#
|
125
|
+
# @example
|
126
|
+
#
|
127
|
+
# # Create a client using the default configuration
|
128
|
+
# client = ::Google::Cloud::Batch::V1::BatchService::Rest::Client.new
|
129
|
+
#
|
130
|
+
# # Create a client using a custom configuration
|
131
|
+
# client = ::Google::Cloud::Batch::V1::BatchService::Rest::Client.new do |config|
|
132
|
+
# config.timeout = 10.0
|
133
|
+
# end
|
134
|
+
#
|
135
|
+
# @yield [config] Configure the BatchService client.
|
136
|
+
# @yieldparam config [Client::Configuration]
|
137
|
+
#
|
138
|
+
def initialize
|
139
|
+
# Create the configuration object
|
140
|
+
@config = Configuration.new Client.configure
|
141
|
+
|
142
|
+
# Yield the configuration if needed
|
143
|
+
yield @config if block_given?
|
144
|
+
|
145
|
+
# Create credentials
|
146
|
+
credentials = @config.credentials
|
147
|
+
# Use self-signed JWT if the endpoint is unchanged from default,
|
148
|
+
# but only if the default endpoint does not have a region prefix.
|
149
|
+
enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
|
150
|
+
!@config.endpoint.split(".").first.include?("-")
|
151
|
+
credentials ||= Credentials.default scope: @config.scope,
|
152
|
+
enable_self_signed_jwt: enable_self_signed_jwt
|
153
|
+
if credentials.is_a?(::String) || credentials.is_a?(::Hash)
|
154
|
+
credentials = Credentials.new credentials, scope: @config.scope
|
155
|
+
end
|
156
|
+
|
157
|
+
@quota_project_id = @config.quota_project
|
158
|
+
@quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
|
159
|
+
|
160
|
+
@operations_client = ::Google::Cloud::Batch::V1::BatchService::Rest::Operations.new do |config|
|
161
|
+
config.credentials = credentials
|
162
|
+
config.quota_project = @quota_project_id
|
163
|
+
config.endpoint = @config.endpoint
|
164
|
+
end
|
165
|
+
|
166
|
+
@location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config|
|
167
|
+
config.credentials = credentials
|
168
|
+
config.quota_project = @quota_project_id
|
169
|
+
config.endpoint = @config.endpoint
|
170
|
+
config.bindings_override = @config.bindings_override
|
171
|
+
end
|
172
|
+
|
173
|
+
@batch_service_stub = ::Google::Cloud::Batch::V1::BatchService::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials
|
174
|
+
end
|
175
|
+
|
176
|
+
##
|
177
|
+
# Get the associated client for long-running operations.
|
178
|
+
#
|
179
|
+
# @return [::Google::Cloud::Batch::V1::BatchService::Rest::Operations]
|
180
|
+
#
|
181
|
+
attr_reader :operations_client
|
182
|
+
|
183
|
+
##
|
184
|
+
# Get the associated client for mix-in of the Locations.
|
185
|
+
#
|
186
|
+
# @return [Google::Cloud::Location::Locations::Rest::Client]
|
187
|
+
#
|
188
|
+
attr_reader :location_client
|
189
|
+
|
190
|
+
# Service calls
|
191
|
+
|
192
|
+
##
|
193
|
+
# Create a Job.
|
194
|
+
#
|
195
|
+
# @overload create_job(request, options = nil)
|
196
|
+
# Pass arguments to `create_job` via a request object, either of type
|
197
|
+
# {::Google::Cloud::Batch::V1::CreateJobRequest} or an equivalent Hash.
|
198
|
+
#
|
199
|
+
# @param request [::Google::Cloud::Batch::V1::CreateJobRequest, ::Hash]
|
200
|
+
# A request object representing the call parameters. Required. To specify no
|
201
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
202
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
203
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
204
|
+
#
|
205
|
+
# @overload create_job(parent: nil, job_id: nil, job: nil, request_id: nil)
|
206
|
+
# Pass arguments to `create_job` via keyword arguments. Note that at
|
207
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
208
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
209
|
+
#
|
210
|
+
# @param parent [::String]
|
211
|
+
# Required. The parent resource name where the Job will be created.
|
212
|
+
# Pattern: "projects/\\{project}/locations/\\{location}"
|
213
|
+
# @param job_id [::String]
|
214
|
+
# ID used to uniquely identify the Job within its parent scope.
|
215
|
+
# This field should contain at most 63 characters and must start with
|
216
|
+
# lowercase characters.
|
217
|
+
# Only lowercase characters, numbers and '-' are accepted.
|
218
|
+
# The '-' character cannot be the first or the last one.
|
219
|
+
# A system generated ID will be used if the field is not set.
|
220
|
+
#
|
221
|
+
# The job.name field in the request will be ignored and the created resource
|
222
|
+
# name of the Job will be "\\{parent}/jobs/\\{job_id}".
|
223
|
+
# @param job [::Google::Cloud::Batch::V1::Job, ::Hash]
|
224
|
+
# Required. The Job to create.
|
225
|
+
# @param request_id [::String]
|
226
|
+
# Optional. An optional request ID to identify requests. Specify a unique
|
227
|
+
# request ID so that if you must retry your request, the server will know to
|
228
|
+
# ignore the request if it has already been completed. The server will
|
229
|
+
# guarantee that for at least 60 minutes since the first request.
|
230
|
+
#
|
231
|
+
# For example, consider a situation where you make an initial request and
|
232
|
+
# the request times out. If you make the request again with the same request
|
233
|
+
# ID, the server can check if original operation with the same request ID
|
234
|
+
# was received, and if so, will ignore the second request. This prevents
|
235
|
+
# clients from accidentally creating duplicate commitments.
|
236
|
+
#
|
237
|
+
# The request ID must be a valid UUID with the exception that zero UUID is
|
238
|
+
# not supported (00000000-0000-0000-0000-000000000000).
|
239
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
240
|
+
# @yieldparam result [::Google::Cloud::Batch::V1::Job]
|
241
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
242
|
+
#
|
243
|
+
# @return [::Google::Cloud::Batch::V1::Job]
|
244
|
+
#
|
245
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
246
|
+
def create_job request, options = nil
|
247
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
248
|
+
|
249
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Batch::V1::CreateJobRequest
|
250
|
+
|
251
|
+
# Converts hash and nil to an options object
|
252
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
253
|
+
|
254
|
+
# Customize the options with defaults
|
255
|
+
call_metadata = @config.rpcs.create_job.metadata.to_h
|
256
|
+
|
257
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
258
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
259
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
260
|
+
gapic_version: ::Google::Cloud::Batch::V1::VERSION,
|
261
|
+
transports_version_send: [:rest]
|
262
|
+
|
263
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
264
|
+
|
265
|
+
options.apply_defaults timeout: @config.rpcs.create_job.timeout,
|
266
|
+
metadata: call_metadata,
|
267
|
+
retry_policy: @config.rpcs.create_job.retry_policy
|
268
|
+
|
269
|
+
options.apply_defaults timeout: @config.timeout,
|
270
|
+
metadata: @config.metadata,
|
271
|
+
retry_policy: @config.retry_policy
|
272
|
+
|
273
|
+
@batch_service_stub.create_job request, options do |result, operation|
|
274
|
+
yield result, operation if block_given?
|
275
|
+
return result
|
276
|
+
end
|
277
|
+
rescue ::Gapic::Rest::Error => e
|
278
|
+
raise ::Google::Cloud::Error.from_error(e)
|
279
|
+
end
|
280
|
+
|
281
|
+
##
|
282
|
+
# Get a Job specified by its resource name.
|
283
|
+
#
|
284
|
+
# @overload get_job(request, options = nil)
|
285
|
+
# Pass arguments to `get_job` via a request object, either of type
|
286
|
+
# {::Google::Cloud::Batch::V1::GetJobRequest} or an equivalent Hash.
|
287
|
+
#
|
288
|
+
# @param request [::Google::Cloud::Batch::V1::GetJobRequest, ::Hash]
|
289
|
+
# A request object representing the call parameters. Required. To specify no
|
290
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
291
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
292
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
293
|
+
#
|
294
|
+
# @overload get_job(name: nil)
|
295
|
+
# Pass arguments to `get_job` via keyword arguments. Note that at
|
296
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
297
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
298
|
+
#
|
299
|
+
# @param name [::String]
|
300
|
+
# Required. Job name.
|
301
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
302
|
+
# @yieldparam result [::Google::Cloud::Batch::V1::Job]
|
303
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
304
|
+
#
|
305
|
+
# @return [::Google::Cloud::Batch::V1::Job]
|
306
|
+
#
|
307
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
308
|
+
def get_job request, options = nil
|
309
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
310
|
+
|
311
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Batch::V1::GetJobRequest
|
312
|
+
|
313
|
+
# Converts hash and nil to an options object
|
314
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
315
|
+
|
316
|
+
# Customize the options with defaults
|
317
|
+
call_metadata = @config.rpcs.get_job.metadata.to_h
|
318
|
+
|
319
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
320
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
321
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
322
|
+
gapic_version: ::Google::Cloud::Batch::V1::VERSION,
|
323
|
+
transports_version_send: [:rest]
|
324
|
+
|
325
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
326
|
+
|
327
|
+
options.apply_defaults timeout: @config.rpcs.get_job.timeout,
|
328
|
+
metadata: call_metadata,
|
329
|
+
retry_policy: @config.rpcs.get_job.retry_policy
|
330
|
+
|
331
|
+
options.apply_defaults timeout: @config.timeout,
|
332
|
+
metadata: @config.metadata,
|
333
|
+
retry_policy: @config.retry_policy
|
334
|
+
|
335
|
+
@batch_service_stub.get_job request, options do |result, operation|
|
336
|
+
yield result, operation if block_given?
|
337
|
+
return result
|
338
|
+
end
|
339
|
+
rescue ::Gapic::Rest::Error => e
|
340
|
+
raise ::Google::Cloud::Error.from_error(e)
|
341
|
+
end
|
342
|
+
|
343
|
+
##
|
344
|
+
# Delete a Job.
|
345
|
+
#
|
346
|
+
# @overload delete_job(request, options = nil)
|
347
|
+
# Pass arguments to `delete_job` via a request object, either of type
|
348
|
+
# {::Google::Cloud::Batch::V1::DeleteJobRequest} or an equivalent Hash.
|
349
|
+
#
|
350
|
+
# @param request [::Google::Cloud::Batch::V1::DeleteJobRequest, ::Hash]
|
351
|
+
# A request object representing the call parameters. Required. To specify no
|
352
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
353
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
354
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
355
|
+
#
|
356
|
+
# @overload delete_job(name: nil, reason: nil, request_id: nil)
|
357
|
+
# Pass arguments to `delete_job` via keyword arguments. Note that at
|
358
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
359
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
360
|
+
#
|
361
|
+
# @param name [::String]
|
362
|
+
# Job name.
|
363
|
+
# @param reason [::String]
|
364
|
+
# Optional. Reason for this deletion.
|
365
|
+
# @param request_id [::String]
|
366
|
+
# Optional. An optional request ID to identify requests. Specify a unique
|
367
|
+
# request ID so that if you must retry your request, the server will know to
|
368
|
+
# ignore the request if it has already been completed. The server will
|
369
|
+
# guarantee that for at least 60 minutes after the first request.
|
370
|
+
#
|
371
|
+
# For example, consider a situation where you make an initial request and
|
372
|
+
# the request times out. If you make the request again with the same request
|
373
|
+
# ID, the server can check if original operation with the same request ID
|
374
|
+
# was received, and if so, will ignore the second request. This prevents
|
375
|
+
# clients from accidentally creating duplicate commitments.
|
376
|
+
#
|
377
|
+
# The request ID must be a valid UUID with the exception that zero UUID is
|
378
|
+
# not supported (00000000-0000-0000-0000-000000000000).
|
379
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
380
|
+
# @yieldparam result [::Gapic::Operation]
|
381
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
382
|
+
#
|
383
|
+
# @return [::Gapic::Operation]
|
384
|
+
#
|
385
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
386
|
+
def delete_job request, options = nil
|
387
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
388
|
+
|
389
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Batch::V1::DeleteJobRequest
|
390
|
+
|
391
|
+
# Converts hash and nil to an options object
|
392
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
393
|
+
|
394
|
+
# Customize the options with defaults
|
395
|
+
call_metadata = @config.rpcs.delete_job.metadata.to_h
|
396
|
+
|
397
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
398
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
399
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
400
|
+
gapic_version: ::Google::Cloud::Batch::V1::VERSION,
|
401
|
+
transports_version_send: [:rest]
|
402
|
+
|
403
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
404
|
+
|
405
|
+
options.apply_defaults timeout: @config.rpcs.delete_job.timeout,
|
406
|
+
metadata: call_metadata,
|
407
|
+
retry_policy: @config.rpcs.delete_job.retry_policy
|
408
|
+
|
409
|
+
options.apply_defaults timeout: @config.timeout,
|
410
|
+
metadata: @config.metadata,
|
411
|
+
retry_policy: @config.retry_policy
|
412
|
+
|
413
|
+
@batch_service_stub.delete_job request, options do |result, operation|
|
414
|
+
result = ::Gapic::Operation.new result, @operations_client, options: options
|
415
|
+
yield result, operation if block_given?
|
416
|
+
return result
|
417
|
+
end
|
418
|
+
rescue ::Gapic::Rest::Error => e
|
419
|
+
raise ::Google::Cloud::Error.from_error(e)
|
420
|
+
end
|
421
|
+
|
422
|
+
##
|
423
|
+
# List all Jobs for a project within a region.
|
424
|
+
#
|
425
|
+
# @overload list_jobs(request, options = nil)
|
426
|
+
# Pass arguments to `list_jobs` via a request object, either of type
|
427
|
+
# {::Google::Cloud::Batch::V1::ListJobsRequest} or an equivalent Hash.
|
428
|
+
#
|
429
|
+
# @param request [::Google::Cloud::Batch::V1::ListJobsRequest, ::Hash]
|
430
|
+
# A request object representing the call parameters. Required. To specify no
|
431
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
432
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
433
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
434
|
+
#
|
435
|
+
# @overload list_jobs(parent: nil, filter: nil, page_size: nil, page_token: nil)
|
436
|
+
# Pass arguments to `list_jobs` via keyword arguments. Note that at
|
437
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
438
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
439
|
+
#
|
440
|
+
# @param parent [::String]
|
441
|
+
# Parent path.
|
442
|
+
# @param filter [::String]
|
443
|
+
# List filter.
|
444
|
+
# @param page_size [::Integer]
|
445
|
+
# Page size.
|
446
|
+
# @param page_token [::String]
|
447
|
+
# Page token.
|
448
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
449
|
+
# @yieldparam result [::Google::Cloud::Batch::V1::ListJobsResponse]
|
450
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
451
|
+
#
|
452
|
+
# @return [::Google::Cloud::Batch::V1::ListJobsResponse]
|
453
|
+
#
|
454
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
455
|
+
def list_jobs request, options = nil
|
456
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
457
|
+
|
458
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Batch::V1::ListJobsRequest
|
459
|
+
|
460
|
+
# Converts hash and nil to an options object
|
461
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
462
|
+
|
463
|
+
# Customize the options with defaults
|
464
|
+
call_metadata = @config.rpcs.list_jobs.metadata.to_h
|
465
|
+
|
466
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
467
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
468
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
469
|
+
gapic_version: ::Google::Cloud::Batch::V1::VERSION,
|
470
|
+
transports_version_send: [:rest]
|
471
|
+
|
472
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
473
|
+
|
474
|
+
options.apply_defaults timeout: @config.rpcs.list_jobs.timeout,
|
475
|
+
metadata: call_metadata,
|
476
|
+
retry_policy: @config.rpcs.list_jobs.retry_policy
|
477
|
+
|
478
|
+
options.apply_defaults timeout: @config.timeout,
|
479
|
+
metadata: @config.metadata,
|
480
|
+
retry_policy: @config.retry_policy
|
481
|
+
|
482
|
+
@batch_service_stub.list_jobs request, options do |result, operation|
|
483
|
+
yield result, operation if block_given?
|
484
|
+
return result
|
485
|
+
end
|
486
|
+
rescue ::Gapic::Rest::Error => e
|
487
|
+
raise ::Google::Cloud::Error.from_error(e)
|
488
|
+
end
|
489
|
+
|
490
|
+
##
|
491
|
+
# Return a single Task.
|
492
|
+
#
|
493
|
+
# @overload get_task(request, options = nil)
|
494
|
+
# Pass arguments to `get_task` via a request object, either of type
|
495
|
+
# {::Google::Cloud::Batch::V1::GetTaskRequest} or an equivalent Hash.
|
496
|
+
#
|
497
|
+
# @param request [::Google::Cloud::Batch::V1::GetTaskRequest, ::Hash]
|
498
|
+
# A request object representing the call parameters. Required. To specify no
|
499
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
500
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
501
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
502
|
+
#
|
503
|
+
# @overload get_task(name: nil)
|
504
|
+
# Pass arguments to `get_task` via keyword arguments. Note that at
|
505
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
506
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
507
|
+
#
|
508
|
+
# @param name [::String]
|
509
|
+
# Required. Task name.
|
510
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
511
|
+
# @yieldparam result [::Google::Cloud::Batch::V1::Task]
|
512
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
513
|
+
#
|
514
|
+
# @return [::Google::Cloud::Batch::V1::Task]
|
515
|
+
#
|
516
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
517
|
+
def get_task request, options = nil
|
518
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
519
|
+
|
520
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Batch::V1::GetTaskRequest
|
521
|
+
|
522
|
+
# Converts hash and nil to an options object
|
523
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
524
|
+
|
525
|
+
# Customize the options with defaults
|
526
|
+
call_metadata = @config.rpcs.get_task.metadata.to_h
|
527
|
+
|
528
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
529
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
530
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
531
|
+
gapic_version: ::Google::Cloud::Batch::V1::VERSION,
|
532
|
+
transports_version_send: [:rest]
|
533
|
+
|
534
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
535
|
+
|
536
|
+
options.apply_defaults timeout: @config.rpcs.get_task.timeout,
|
537
|
+
metadata: call_metadata,
|
538
|
+
retry_policy: @config.rpcs.get_task.retry_policy
|
539
|
+
|
540
|
+
options.apply_defaults timeout: @config.timeout,
|
541
|
+
metadata: @config.metadata,
|
542
|
+
retry_policy: @config.retry_policy
|
543
|
+
|
544
|
+
@batch_service_stub.get_task request, options do |result, operation|
|
545
|
+
yield result, operation if block_given?
|
546
|
+
return result
|
547
|
+
end
|
548
|
+
rescue ::Gapic::Rest::Error => e
|
549
|
+
raise ::Google::Cloud::Error.from_error(e)
|
550
|
+
end
|
551
|
+
|
552
|
+
##
|
553
|
+
# List Tasks associated with a job.
|
554
|
+
#
|
555
|
+
# @overload list_tasks(request, options = nil)
|
556
|
+
# Pass arguments to `list_tasks` via a request object, either of type
|
557
|
+
# {::Google::Cloud::Batch::V1::ListTasksRequest} or an equivalent Hash.
|
558
|
+
#
|
559
|
+
# @param request [::Google::Cloud::Batch::V1::ListTasksRequest, ::Hash]
|
560
|
+
# A request object representing the call parameters. Required. To specify no
|
561
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
562
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
563
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
564
|
+
#
|
565
|
+
# @overload list_tasks(parent: nil, filter: nil, page_size: nil, page_token: nil)
|
566
|
+
# Pass arguments to `list_tasks` via keyword arguments. Note that at
|
567
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
568
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
569
|
+
#
|
570
|
+
# @param parent [::String]
|
571
|
+
# Required. Name of a TaskGroup from which Tasks are being requested.
|
572
|
+
# Pattern:
|
573
|
+
# "projects/\\{project}/locations/\\{location}/jobs/\\{job}/taskGroups/\\{task_group}"
|
574
|
+
# @param filter [::String]
|
575
|
+
# Task filter, null filter matches all Tasks.
|
576
|
+
# Filter string should be of the format State=TaskStatus.State e.g.
|
577
|
+
# State=RUNNING
|
578
|
+
# @param page_size [::Integer]
|
579
|
+
# Page size.
|
580
|
+
# @param page_token [::String]
|
581
|
+
# Page token.
|
582
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
583
|
+
# @yieldparam result [::Google::Cloud::Batch::V1::ListTasksResponse]
|
584
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
585
|
+
#
|
586
|
+
# @return [::Google::Cloud::Batch::V1::ListTasksResponse]
|
587
|
+
#
|
588
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
589
|
+
def list_tasks request, options = nil
|
590
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
591
|
+
|
592
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Batch::V1::ListTasksRequest
|
593
|
+
|
594
|
+
# Converts hash and nil to an options object
|
595
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
596
|
+
|
597
|
+
# Customize the options with defaults
|
598
|
+
call_metadata = @config.rpcs.list_tasks.metadata.to_h
|
599
|
+
|
600
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
601
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
602
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
603
|
+
gapic_version: ::Google::Cloud::Batch::V1::VERSION,
|
604
|
+
transports_version_send: [:rest]
|
605
|
+
|
606
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
607
|
+
|
608
|
+
options.apply_defaults timeout: @config.rpcs.list_tasks.timeout,
|
609
|
+
metadata: call_metadata,
|
610
|
+
retry_policy: @config.rpcs.list_tasks.retry_policy
|
611
|
+
|
612
|
+
options.apply_defaults timeout: @config.timeout,
|
613
|
+
metadata: @config.metadata,
|
614
|
+
retry_policy: @config.retry_policy
|
615
|
+
|
616
|
+
@batch_service_stub.list_tasks request, options do |result, operation|
|
617
|
+
yield result, operation if block_given?
|
618
|
+
return result
|
619
|
+
end
|
620
|
+
rescue ::Gapic::Rest::Error => e
|
621
|
+
raise ::Google::Cloud::Error.from_error(e)
|
622
|
+
end
|
623
|
+
|
624
|
+
##
|
625
|
+
# Configuration class for the BatchService REST API.
|
626
|
+
#
|
627
|
+
# This class represents the configuration for BatchService REST,
|
628
|
+
# providing control over timeouts, retry behavior, logging, transport
|
629
|
+
# parameters, and other low-level controls. Certain parameters can also be
|
630
|
+
# applied individually to specific RPCs. See
|
631
|
+
# {::Google::Cloud::Batch::V1::BatchService::Rest::Client::Configuration::Rpcs}
|
632
|
+
# for a list of RPCs that can be configured independently.
|
633
|
+
#
|
634
|
+
# Configuration can be applied globally to all clients, or to a single client
|
635
|
+
# on construction.
|
636
|
+
#
|
637
|
+
# @example
|
638
|
+
#
|
639
|
+
# # Modify the global config, setting the timeout for
|
640
|
+
# # create_job to 20 seconds,
|
641
|
+
# # and all remaining timeouts to 10 seconds.
|
642
|
+
# ::Google::Cloud::Batch::V1::BatchService::Rest::Client.configure do |config|
|
643
|
+
# config.timeout = 10.0
|
644
|
+
# config.rpcs.create_job.timeout = 20.0
|
645
|
+
# end
|
646
|
+
#
|
647
|
+
# # Apply the above configuration only to a new client.
|
648
|
+
# client = ::Google::Cloud::Batch::V1::BatchService::Rest::Client.new do |config|
|
649
|
+
# config.timeout = 10.0
|
650
|
+
# config.rpcs.create_job.timeout = 20.0
|
651
|
+
# end
|
652
|
+
#
|
653
|
+
# @!attribute [rw] endpoint
|
654
|
+
# The hostname or hostname:port of the service endpoint.
|
655
|
+
# Defaults to `"batch.googleapis.com"`.
|
656
|
+
# @return [::String]
|
657
|
+
# @!attribute [rw] credentials
|
658
|
+
# Credentials to send with calls. You may provide any of the following types:
|
659
|
+
# * (`String`) The path to a service account key file in JSON format
|
660
|
+
# * (`Hash`) A service account key as a Hash
|
661
|
+
# * (`Google::Auth::Credentials`) A googleauth credentials object
|
662
|
+
# (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
|
663
|
+
# * (`Signet::OAuth2::Client`) A signet oauth2 client object
|
664
|
+
# (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
|
665
|
+
# * (`nil`) indicating no credentials
|
666
|
+
# @return [::Object]
|
667
|
+
# @!attribute [rw] scope
|
668
|
+
# The OAuth scopes
|
669
|
+
# @return [::Array<::String>]
|
670
|
+
# @!attribute [rw] lib_name
|
671
|
+
# The library name as recorded in instrumentation and logging
|
672
|
+
# @return [::String]
|
673
|
+
# @!attribute [rw] lib_version
|
674
|
+
# The library version as recorded in instrumentation and logging
|
675
|
+
# @return [::String]
|
676
|
+
# @!attribute [rw] timeout
|
677
|
+
# The call timeout in seconds.
|
678
|
+
# @return [::Numeric]
|
679
|
+
# @!attribute [rw] metadata
|
680
|
+
# Additional headers to be sent with the call.
|
681
|
+
# @return [::Hash{::Symbol=>::String}]
|
682
|
+
# @!attribute [rw] retry_policy
|
683
|
+
# The retry policy. The value is a hash with the following keys:
|
684
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
685
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
686
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
687
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
688
|
+
# trigger a retry.
|
689
|
+
# @return [::Hash]
|
690
|
+
# @!attribute [rw] quota_project
|
691
|
+
# A separate project against which to charge quota.
|
692
|
+
# @return [::String]
|
693
|
+
#
|
694
|
+
class Configuration
|
695
|
+
extend ::Gapic::Config
|
696
|
+
|
697
|
+
config_attr :endpoint, "batch.googleapis.com", ::String
|
698
|
+
config_attr :credentials, nil do |value|
|
699
|
+
allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
|
700
|
+
allowed.any? { |klass| klass === value }
|
701
|
+
end
|
702
|
+
config_attr :scope, nil, ::String, ::Array, nil
|
703
|
+
config_attr :lib_name, nil, ::String, nil
|
704
|
+
config_attr :lib_version, nil, ::String, nil
|
705
|
+
config_attr :timeout, nil, ::Numeric, nil
|
706
|
+
config_attr :metadata, nil, ::Hash, nil
|
707
|
+
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
|
708
|
+
config_attr :quota_project, nil, ::String, nil
|
709
|
+
|
710
|
+
# @private
|
711
|
+
# Overrides for http bindings for the RPCs of this service
|
712
|
+
# are only used when this service is used as mixin, and only
|
713
|
+
# by the host service.
|
714
|
+
# @return [::Hash{::Symbol=>::Array<::Gapic::Rest::GrpcTranscoder::HttpBinding>}]
|
715
|
+
config_attr :bindings_override, {}, ::Hash, nil
|
716
|
+
|
717
|
+
# @private
|
718
|
+
def initialize parent_config = nil
|
719
|
+
@parent_config = parent_config unless parent_config.nil?
|
720
|
+
|
721
|
+
yield self if block_given?
|
722
|
+
end
|
723
|
+
|
724
|
+
##
|
725
|
+
# Configurations for individual RPCs
|
726
|
+
# @return [Rpcs]
|
727
|
+
#
|
728
|
+
def rpcs
|
729
|
+
@rpcs ||= begin
|
730
|
+
parent_rpcs = nil
|
731
|
+
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
|
732
|
+
Rpcs.new parent_rpcs
|
733
|
+
end
|
734
|
+
end
|
735
|
+
|
736
|
+
##
|
737
|
+
# Configuration RPC class for the BatchService API.
|
738
|
+
#
|
739
|
+
# Includes fields providing the configuration for each RPC in this service.
|
740
|
+
# Each configuration object is of type `Gapic::Config::Method` and includes
|
741
|
+
# the following configuration fields:
|
742
|
+
#
|
743
|
+
# * `timeout` (*type:* `Numeric`) - The call timeout in seconds
|
744
|
+
# * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
|
745
|
+
# * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
|
746
|
+
# include the following keys:
|
747
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
748
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
749
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
750
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
751
|
+
# trigger a retry.
|
752
|
+
#
|
753
|
+
class Rpcs
|
754
|
+
##
|
755
|
+
# RPC-specific configuration for `create_job`
|
756
|
+
# @return [::Gapic::Config::Method]
|
757
|
+
#
|
758
|
+
attr_reader :create_job
|
759
|
+
##
|
760
|
+
# RPC-specific configuration for `get_job`
|
761
|
+
# @return [::Gapic::Config::Method]
|
762
|
+
#
|
763
|
+
attr_reader :get_job
|
764
|
+
##
|
765
|
+
# RPC-specific configuration for `delete_job`
|
766
|
+
# @return [::Gapic::Config::Method]
|
767
|
+
#
|
768
|
+
attr_reader :delete_job
|
769
|
+
##
|
770
|
+
# RPC-specific configuration for `list_jobs`
|
771
|
+
# @return [::Gapic::Config::Method]
|
772
|
+
#
|
773
|
+
attr_reader :list_jobs
|
774
|
+
##
|
775
|
+
# RPC-specific configuration for `get_task`
|
776
|
+
# @return [::Gapic::Config::Method]
|
777
|
+
#
|
778
|
+
attr_reader :get_task
|
779
|
+
##
|
780
|
+
# RPC-specific configuration for `list_tasks`
|
781
|
+
# @return [::Gapic::Config::Method]
|
782
|
+
#
|
783
|
+
attr_reader :list_tasks
|
784
|
+
|
785
|
+
# @private
|
786
|
+
def initialize parent_rpcs = nil
|
787
|
+
create_job_config = parent_rpcs.create_job if parent_rpcs.respond_to? :create_job
|
788
|
+
@create_job = ::Gapic::Config::Method.new create_job_config
|
789
|
+
get_job_config = parent_rpcs.get_job if parent_rpcs.respond_to? :get_job
|
790
|
+
@get_job = ::Gapic::Config::Method.new get_job_config
|
791
|
+
delete_job_config = parent_rpcs.delete_job if parent_rpcs.respond_to? :delete_job
|
792
|
+
@delete_job = ::Gapic::Config::Method.new delete_job_config
|
793
|
+
list_jobs_config = parent_rpcs.list_jobs if parent_rpcs.respond_to? :list_jobs
|
794
|
+
@list_jobs = ::Gapic::Config::Method.new list_jobs_config
|
795
|
+
get_task_config = parent_rpcs.get_task if parent_rpcs.respond_to? :get_task
|
796
|
+
@get_task = ::Gapic::Config::Method.new get_task_config
|
797
|
+
list_tasks_config = parent_rpcs.list_tasks if parent_rpcs.respond_to? :list_tasks
|
798
|
+
@list_tasks = ::Gapic::Config::Method.new list_tasks_config
|
799
|
+
|
800
|
+
yield self if block_given?
|
801
|
+
end
|
802
|
+
end
|
803
|
+
end
|
804
|
+
end
|
805
|
+
end
|
806
|
+
end
|
807
|
+
end
|
808
|
+
end
|
809
|
+
end
|
810
|
+
end
|