google-cloud-storage_batch_operations-v1 0.a → 0.1.1

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.
Files changed (36) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +12 -0
  3. data/AUTHENTICATION.md +122 -0
  4. data/README.md +154 -8
  5. data/lib/google/cloud/storage_batch_operations/v1/bindings_override.rb +102 -0
  6. data/lib/google/cloud/storage_batch_operations/v1/rest.rb +38 -0
  7. data/lib/google/cloud/storage_batch_operations/v1/storage_batch_operations/client.rb +928 -0
  8. data/lib/google/cloud/storage_batch_operations/v1/storage_batch_operations/credentials.rb +47 -0
  9. data/lib/google/cloud/storage_batch_operations/v1/storage_batch_operations/operations.rb +813 -0
  10. data/lib/google/cloud/storage_batch_operations/v1/storage_batch_operations/paths.rb +90 -0
  11. data/lib/google/cloud/storage_batch_operations/v1/storage_batch_operations/rest/client.rb +875 -0
  12. data/lib/google/cloud/storage_batch_operations/v1/storage_batch_operations/rest/operations.rb +914 -0
  13. data/lib/google/cloud/storage_batch_operations/v1/storage_batch_operations/rest/service_stub.rb +388 -0
  14. data/lib/google/cloud/storage_batch_operations/v1/storage_batch_operations/rest.rb +57 -0
  15. data/lib/google/cloud/storage_batch_operations/v1/storage_batch_operations.rb +59 -0
  16. data/lib/google/cloud/storage_batch_operations/v1/version.rb +7 -2
  17. data/lib/google/cloud/storage_batch_operations/v1.rb +45 -0
  18. data/lib/google/cloud/storagebatchoperations/v1/storage_batch_operations_pb.rb +60 -0
  19. data/lib/google/cloud/storagebatchoperations/v1/storage_batch_operations_services_pb.rb +56 -0
  20. data/lib/google/cloud/storagebatchoperations/v1/storage_batch_operations_types_pb.rb +64 -0
  21. data/lib/google-cloud-storage_batch_operations-v1.rb +21 -0
  22. data/proto_docs/README.md +4 -0
  23. data/proto_docs/google/api/client.rb +473 -0
  24. data/proto_docs/google/api/field_behavior.rb +85 -0
  25. data/proto_docs/google/api/launch_stage.rb +71 -0
  26. data/proto_docs/google/api/resource.rb +227 -0
  27. data/proto_docs/google/cloud/storagebatchoperations/v1/storage_batch_operations.rb +167 -0
  28. data/proto_docs/google/cloud/storagebatchoperations/v1/storage_batch_operations_types.rb +372 -0
  29. data/proto_docs/google/longrunning/operations.rb +173 -0
  30. data/proto_docs/google/protobuf/any.rb +145 -0
  31. data/proto_docs/google/protobuf/duration.rb +98 -0
  32. data/proto_docs/google/protobuf/empty.rb +34 -0
  33. data/proto_docs/google/protobuf/timestamp.rb +127 -0
  34. data/proto_docs/google/rpc/code.rb +185 -0
  35. data/proto_docs/google/rpc/status.rb +48 -0
  36. metadata +95 -9
@@ -0,0 +1,875 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2025 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/storagebatchoperations/v1/storage_batch_operations_pb"
21
+ require "google/cloud/storage_batch_operations/v1/storage_batch_operations/rest/service_stub"
22
+ require "google/cloud/location/rest"
23
+
24
+ module Google
25
+ module Cloud
26
+ module StorageBatchOperations
27
+ module V1
28
+ module StorageBatchOperations
29
+ module Rest
30
+ ##
31
+ # REST client for the StorageBatchOperations service.
32
+ #
33
+ # Storage Batch Operations offers a managed experience to perform batch
34
+ # operations on millions of Cloud Storage objects in a serverless fashion. With
35
+ # this service, you can automate and simplify large scale API operations
36
+ # performed on Cloud Storage objects.
37
+ #
38
+ class Client
39
+ # @private
40
+ API_VERSION = ""
41
+
42
+ # @private
43
+ DEFAULT_ENDPOINT_TEMPLATE = "storagebatchoperations.$UNIVERSE_DOMAIN$"
44
+
45
+ include Paths
46
+
47
+ # @private
48
+ attr_reader :storage_batch_operations_stub
49
+
50
+ ##
51
+ # Configure the StorageBatchOperations Client class.
52
+ #
53
+ # See {::Google::Cloud::StorageBatchOperations::V1::StorageBatchOperations::Rest::Client::Configuration}
54
+ # for a description of the configuration fields.
55
+ #
56
+ # @example
57
+ #
58
+ # # Modify the configuration for all StorageBatchOperations clients
59
+ # ::Google::Cloud::StorageBatchOperations::V1::StorageBatchOperations::Rest::Client.configure do |config|
60
+ # config.timeout = 10.0
61
+ # end
62
+ #
63
+ # @yield [config] Configure the Client client.
64
+ # @yieldparam config [Client::Configuration]
65
+ #
66
+ # @return [Client::Configuration]
67
+ #
68
+ def self.configure
69
+ @configure ||= begin
70
+ namespace = ["Google", "Cloud", "StorageBatchOperations", "V1"]
71
+ parent_config = while namespace.any?
72
+ parent_name = namespace.join "::"
73
+ parent_const = const_get parent_name
74
+ break parent_const.configure if parent_const.respond_to? :configure
75
+ namespace.pop
76
+ end
77
+ default_config = Client::Configuration.new parent_config
78
+
79
+ default_config.rpcs.list_jobs.timeout = 60.0
80
+ default_config.rpcs.list_jobs.retry_policy = {
81
+ initial_delay: 1.0, max_delay: 60.0, multiplier: 2, retry_codes: [14]
82
+ }
83
+
84
+ default_config.rpcs.get_job.timeout = 60.0
85
+ default_config.rpcs.get_job.retry_policy = {
86
+ initial_delay: 1.0, max_delay: 60.0, multiplier: 2, retry_codes: [14]
87
+ }
88
+
89
+ default_config.rpcs.create_job.timeout = 60.0
90
+
91
+ default_config.rpcs.delete_job.timeout = 60.0
92
+
93
+ default_config.rpcs.cancel_job.timeout = 60.0
94
+ default_config.rpcs.cancel_job.retry_policy = {
95
+ initial_delay: 1.0, max_delay: 60.0, multiplier: 2, retry_codes: [14]
96
+ }
97
+
98
+ default_config
99
+ end
100
+ yield @configure if block_given?
101
+ @configure
102
+ end
103
+
104
+ ##
105
+ # Configure the StorageBatchOperations Client instance.
106
+ #
107
+ # The configuration is set to the derived mode, meaning that values can be changed,
108
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
109
+ # should be made on {Client.configure}.
110
+ #
111
+ # See {::Google::Cloud::StorageBatchOperations::V1::StorageBatchOperations::Rest::Client::Configuration}
112
+ # for a description of the configuration fields.
113
+ #
114
+ # @yield [config] Configure the Client client.
115
+ # @yieldparam config [Client::Configuration]
116
+ #
117
+ # @return [Client::Configuration]
118
+ #
119
+ def configure
120
+ yield @config if block_given?
121
+ @config
122
+ end
123
+
124
+ ##
125
+ # The effective universe domain
126
+ #
127
+ # @return [String]
128
+ #
129
+ def universe_domain
130
+ @storage_batch_operations_stub.universe_domain
131
+ end
132
+
133
+ ##
134
+ # Create a new StorageBatchOperations REST client object.
135
+ #
136
+ # @example
137
+ #
138
+ # # Create a client using the default configuration
139
+ # client = ::Google::Cloud::StorageBatchOperations::V1::StorageBatchOperations::Rest::Client.new
140
+ #
141
+ # # Create a client using a custom configuration
142
+ # client = ::Google::Cloud::StorageBatchOperations::V1::StorageBatchOperations::Rest::Client.new do |config|
143
+ # config.timeout = 10.0
144
+ # end
145
+ #
146
+ # @yield [config] Configure the StorageBatchOperations client.
147
+ # @yieldparam config [Client::Configuration]
148
+ #
149
+ def initialize
150
+ # Create the configuration object
151
+ @config = Configuration.new Client.configure
152
+
153
+ # Yield the configuration if needed
154
+ yield @config if block_given?
155
+
156
+ # Create credentials
157
+ credentials = @config.credentials
158
+ # Use self-signed JWT if the endpoint is unchanged from default,
159
+ # but only if the default endpoint does not have a region prefix.
160
+ enable_self_signed_jwt = @config.endpoint.nil? ||
161
+ (@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
162
+ !@config.endpoint.split(".").first.include?("-"))
163
+ credentials ||= Credentials.default scope: @config.scope,
164
+ enable_self_signed_jwt: enable_self_signed_jwt
165
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
166
+ credentials = Credentials.new credentials, scope: @config.scope
167
+ end
168
+
169
+ @quota_project_id = @config.quota_project
170
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
171
+
172
+ @operations_client = ::Google::Cloud::StorageBatchOperations::V1::StorageBatchOperations::Rest::Operations.new do |config|
173
+ config.credentials = credentials
174
+ config.quota_project = @quota_project_id
175
+ config.endpoint = @config.endpoint
176
+ config.universe_domain = @config.universe_domain
177
+ end
178
+
179
+ @storage_batch_operations_stub = ::Google::Cloud::StorageBatchOperations::V1::StorageBatchOperations::Rest::ServiceStub.new(
180
+ endpoint: @config.endpoint,
181
+ endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
182
+ universe_domain: @config.universe_domain,
183
+ credentials: credentials,
184
+ logger: @config.logger
185
+ )
186
+
187
+ @storage_batch_operations_stub.logger(stub: true)&.info do |entry|
188
+ entry.set_system_name
189
+ entry.set_service
190
+ entry.message = "Created client for #{entry.service}"
191
+ entry.set_credentials_fields credentials
192
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
193
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
194
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
195
+ end
196
+
197
+ @location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config|
198
+ config.credentials = credentials
199
+ config.quota_project = @quota_project_id
200
+ config.endpoint = @storage_batch_operations_stub.endpoint
201
+ config.universe_domain = @storage_batch_operations_stub.universe_domain
202
+ config.bindings_override = @config.bindings_override
203
+ config.logger = @storage_batch_operations_stub.logger if config.respond_to? :logger=
204
+ end
205
+ end
206
+
207
+ ##
208
+ # Get the associated client for long-running operations.
209
+ #
210
+ # @return [::Google::Cloud::StorageBatchOperations::V1::StorageBatchOperations::Rest::Operations]
211
+ #
212
+ attr_reader :operations_client
213
+
214
+ ##
215
+ # Get the associated client for mix-in of the Locations.
216
+ #
217
+ # @return [Google::Cloud::Location::Locations::Rest::Client]
218
+ #
219
+ attr_reader :location_client
220
+
221
+ ##
222
+ # The logger used for request/response debug logging.
223
+ #
224
+ # @return [Logger]
225
+ #
226
+ def logger
227
+ @storage_batch_operations_stub.logger
228
+ end
229
+
230
+ # Service calls
231
+
232
+ ##
233
+ # Lists Jobs in a given project and location.
234
+ #
235
+ # @overload list_jobs(request, options = nil)
236
+ # Pass arguments to `list_jobs` via a request object, either of type
237
+ # {::Google::Cloud::StorageBatchOperations::V1::ListJobsRequest} or an equivalent Hash.
238
+ #
239
+ # @param request [::Google::Cloud::StorageBatchOperations::V1::ListJobsRequest, ::Hash]
240
+ # A request object representing the call parameters. Required. To specify no
241
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
242
+ # @param options [::Gapic::CallOptions, ::Hash]
243
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
244
+ #
245
+ # @overload list_jobs(parent: nil, filter: nil, page_size: nil, page_token: nil, order_by: nil)
246
+ # Pass arguments to `list_jobs` via keyword arguments. Note that at
247
+ # least one keyword argument is required. To specify no parameters, or to keep all
248
+ # the default parameter values, pass an empty Hash as a request object (see above).
249
+ #
250
+ # @param parent [::String]
251
+ # Required. Format: projects/\\{project_id}/locations/\\{location_id} .
252
+ # @param filter [::String]
253
+ # Optional. Filters results as defined by https://google.aip.dev/160.
254
+ # @param page_size [::Integer]
255
+ # Optional. The list page size. default page size is 100.
256
+ # @param page_token [::String]
257
+ # Optional. The list page token.
258
+ # @param order_by [::String]
259
+ # Optional. Field to sort by. Supported fields are name, create_time.
260
+ # @yield [result, operation] Access the result along with the TransportOperation object
261
+ # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::StorageBatchOperations::V1::Job>]
262
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
263
+ #
264
+ # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::StorageBatchOperations::V1::Job>]
265
+ #
266
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
267
+ #
268
+ # @example Basic example
269
+ # require "google/cloud/storage_batch_operations/v1"
270
+ #
271
+ # # Create a client object. The client can be reused for multiple calls.
272
+ # client = Google::Cloud::StorageBatchOperations::V1::StorageBatchOperations::Rest::Client.new
273
+ #
274
+ # # Create a request. To set request fields, pass in keyword arguments.
275
+ # request = Google::Cloud::StorageBatchOperations::V1::ListJobsRequest.new
276
+ #
277
+ # # Call the list_jobs method.
278
+ # result = client.list_jobs request
279
+ #
280
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
281
+ # # over elements, and API calls will be issued to fetch pages as needed.
282
+ # result.each do |item|
283
+ # # Each element is of type ::Google::Cloud::StorageBatchOperations::V1::Job.
284
+ # p item
285
+ # end
286
+ #
287
+ def list_jobs request, options = nil
288
+ raise ::ArgumentError, "request must be provided" if request.nil?
289
+
290
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::StorageBatchOperations::V1::ListJobsRequest
291
+
292
+ # Converts hash and nil to an options object
293
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
294
+
295
+ # Customize the options with defaults
296
+ call_metadata = @config.rpcs.list_jobs.metadata.to_h
297
+
298
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
299
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
300
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
301
+ gapic_version: ::Google::Cloud::StorageBatchOperations::V1::VERSION,
302
+ transports_version_send: [:rest]
303
+
304
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
305
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
306
+
307
+ options.apply_defaults timeout: @config.rpcs.list_jobs.timeout,
308
+ metadata: call_metadata,
309
+ retry_policy: @config.rpcs.list_jobs.retry_policy
310
+
311
+ options.apply_defaults timeout: @config.timeout,
312
+ metadata: @config.metadata,
313
+ retry_policy: @config.retry_policy
314
+
315
+ @storage_batch_operations_stub.list_jobs request, options do |result, operation|
316
+ result = ::Gapic::Rest::PagedEnumerable.new @storage_batch_operations_stub, :list_jobs, "jobs", request, result, options
317
+ yield result, operation if block_given?
318
+ throw :response, result
319
+ end
320
+ rescue ::Gapic::Rest::Error => e
321
+ raise ::Google::Cloud::Error.from_error(e)
322
+ end
323
+
324
+ ##
325
+ # Gets a batch job.
326
+ #
327
+ # @overload get_job(request, options = nil)
328
+ # Pass arguments to `get_job` via a request object, either of type
329
+ # {::Google::Cloud::StorageBatchOperations::V1::GetJobRequest} or an equivalent Hash.
330
+ #
331
+ # @param request [::Google::Cloud::StorageBatchOperations::V1::GetJobRequest, ::Hash]
332
+ # A request object representing the call parameters. Required. To specify no
333
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
334
+ # @param options [::Gapic::CallOptions, ::Hash]
335
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
336
+ #
337
+ # @overload get_job(name: nil)
338
+ # Pass arguments to `get_job` via keyword arguments. Note that at
339
+ # least one keyword argument is required. To specify no parameters, or to keep all
340
+ # the default parameter values, pass an empty Hash as a request object (see above).
341
+ #
342
+ # @param name [::String]
343
+ # Required. `name` of the job to retrieve.
344
+ # Format: projects/\\{project_id}/locations/\\{location_id}/jobs/\\{job_id} .
345
+ # @yield [result, operation] Access the result along with the TransportOperation object
346
+ # @yieldparam result [::Google::Cloud::StorageBatchOperations::V1::Job]
347
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
348
+ #
349
+ # @return [::Google::Cloud::StorageBatchOperations::V1::Job]
350
+ #
351
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
352
+ #
353
+ # @example Basic example
354
+ # require "google/cloud/storage_batch_operations/v1"
355
+ #
356
+ # # Create a client object. The client can be reused for multiple calls.
357
+ # client = Google::Cloud::StorageBatchOperations::V1::StorageBatchOperations::Rest::Client.new
358
+ #
359
+ # # Create a request. To set request fields, pass in keyword arguments.
360
+ # request = Google::Cloud::StorageBatchOperations::V1::GetJobRequest.new
361
+ #
362
+ # # Call the get_job method.
363
+ # result = client.get_job request
364
+ #
365
+ # # The returned object is of type Google::Cloud::StorageBatchOperations::V1::Job.
366
+ # p result
367
+ #
368
+ def get_job request, options = nil
369
+ raise ::ArgumentError, "request must be provided" if request.nil?
370
+
371
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::StorageBatchOperations::V1::GetJobRequest
372
+
373
+ # Converts hash and nil to an options object
374
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
375
+
376
+ # Customize the options with defaults
377
+ call_metadata = @config.rpcs.get_job.metadata.to_h
378
+
379
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
380
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
381
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
382
+ gapic_version: ::Google::Cloud::StorageBatchOperations::V1::VERSION,
383
+ transports_version_send: [:rest]
384
+
385
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
386
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
387
+
388
+ options.apply_defaults timeout: @config.rpcs.get_job.timeout,
389
+ metadata: call_metadata,
390
+ retry_policy: @config.rpcs.get_job.retry_policy
391
+
392
+ options.apply_defaults timeout: @config.timeout,
393
+ metadata: @config.metadata,
394
+ retry_policy: @config.retry_policy
395
+
396
+ @storage_batch_operations_stub.get_job request, options do |result, operation|
397
+ yield result, operation if block_given?
398
+ end
399
+ rescue ::Gapic::Rest::Error => e
400
+ raise ::Google::Cloud::Error.from_error(e)
401
+ end
402
+
403
+ ##
404
+ # Creates a batch job.
405
+ #
406
+ # @overload create_job(request, options = nil)
407
+ # Pass arguments to `create_job` via a request object, either of type
408
+ # {::Google::Cloud::StorageBatchOperations::V1::CreateJobRequest} or an equivalent Hash.
409
+ #
410
+ # @param request [::Google::Cloud::StorageBatchOperations::V1::CreateJobRequest, ::Hash]
411
+ # A request object representing the call parameters. Required. To specify no
412
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
413
+ # @param options [::Gapic::CallOptions, ::Hash]
414
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
415
+ #
416
+ # @overload create_job(parent: nil, job_id: nil, job: nil, request_id: nil)
417
+ # Pass arguments to `create_job` via keyword arguments. Note that at
418
+ # least one keyword argument is required. To specify no parameters, or to keep all
419
+ # the default parameter values, pass an empty Hash as a request object (see above).
420
+ #
421
+ # @param parent [::String]
422
+ # Required. Value for parent.
423
+ # @param job_id [::String]
424
+ # Required. The optional `job_id` for this Job . If not
425
+ # specified, an id is generated. `job_id` should be no more than 128
426
+ # characters and must include only characters available in DNS names, as
427
+ # defined by RFC-1123.
428
+ # @param job [::Google::Cloud::StorageBatchOperations::V1::Job, ::Hash]
429
+ # Required. The resource being created
430
+ # @param request_id [::String]
431
+ # Optional. An optional request ID to identify requests. Specify a unique
432
+ # request ID in case you need to retry your request. Requests with same
433
+ # `request_id` will ignored for at least 60 minutes since the first request.
434
+ # The request ID must be a valid UUID with the exception that zero UUID is
435
+ # not supported (00000000-0000-0000-0000-000000000000).
436
+ # @yield [result, operation] Access the result along with the TransportOperation object
437
+ # @yieldparam result [::Gapic::Operation]
438
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
439
+ #
440
+ # @return [::Gapic::Operation]
441
+ #
442
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
443
+ #
444
+ # @example Basic example
445
+ # require "google/cloud/storage_batch_operations/v1"
446
+ #
447
+ # # Create a client object. The client can be reused for multiple calls.
448
+ # client = Google::Cloud::StorageBatchOperations::V1::StorageBatchOperations::Rest::Client.new
449
+ #
450
+ # # Create a request. To set request fields, pass in keyword arguments.
451
+ # request = Google::Cloud::StorageBatchOperations::V1::CreateJobRequest.new
452
+ #
453
+ # # Call the create_job method.
454
+ # result = client.create_job request
455
+ #
456
+ # # The returned object is of type Gapic::Operation. You can use it to
457
+ # # check the status of an operation, cancel it, or wait for results.
458
+ # # Here is how to wait for a response.
459
+ # result.wait_until_done! timeout: 60
460
+ # if result.response?
461
+ # p result.response
462
+ # else
463
+ # puts "No response received."
464
+ # end
465
+ #
466
+ def create_job request, options = nil
467
+ raise ::ArgumentError, "request must be provided" if request.nil?
468
+
469
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::StorageBatchOperations::V1::CreateJobRequest
470
+
471
+ # Converts hash and nil to an options object
472
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
473
+
474
+ # Customize the options with defaults
475
+ call_metadata = @config.rpcs.create_job.metadata.to_h
476
+
477
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
478
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
479
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
480
+ gapic_version: ::Google::Cloud::StorageBatchOperations::V1::VERSION,
481
+ transports_version_send: [:rest]
482
+
483
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
484
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
485
+
486
+ options.apply_defaults timeout: @config.rpcs.create_job.timeout,
487
+ metadata: call_metadata,
488
+ retry_policy: @config.rpcs.create_job.retry_policy
489
+
490
+ options.apply_defaults timeout: @config.timeout,
491
+ metadata: @config.metadata,
492
+ retry_policy: @config.retry_policy
493
+
494
+ @storage_batch_operations_stub.create_job request, options do |result, operation|
495
+ result = ::Gapic::Operation.new result, @operations_client, options: options
496
+ yield result, operation if block_given?
497
+ throw :response, result
498
+ end
499
+ rescue ::Gapic::Rest::Error => e
500
+ raise ::Google::Cloud::Error.from_error(e)
501
+ end
502
+
503
+ ##
504
+ # Deletes a batch job.
505
+ #
506
+ # @overload delete_job(request, options = nil)
507
+ # Pass arguments to `delete_job` via a request object, either of type
508
+ # {::Google::Cloud::StorageBatchOperations::V1::DeleteJobRequest} or an equivalent Hash.
509
+ #
510
+ # @param request [::Google::Cloud::StorageBatchOperations::V1::DeleteJobRequest, ::Hash]
511
+ # A request object representing the call parameters. Required. To specify no
512
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
513
+ # @param options [::Gapic::CallOptions, ::Hash]
514
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
515
+ #
516
+ # @overload delete_job(name: nil, request_id: nil)
517
+ # Pass arguments to `delete_job` via keyword arguments. Note that at
518
+ # least one keyword argument is required. To specify no parameters, or to keep all
519
+ # the default parameter values, pass an empty Hash as a request object (see above).
520
+ #
521
+ # @param name [::String]
522
+ # Required. The `name` of the job to delete.
523
+ # Format: projects/\\{project_id}/locations/\\{location_id}/jobs/\\{job_id} .
524
+ # @param request_id [::String]
525
+ # Optional. An optional request ID to identify requests. Specify a unique
526
+ # request ID in case you need to retry your request. Requests with same
527
+ # `request_id` will ignored for at least 60 minutes since the first request.
528
+ # The request ID must be a valid UUID with the exception that zero UUID is
529
+ # not supported (00000000-0000-0000-0000-000000000000).
530
+ # @yield [result, operation] Access the result along with the TransportOperation object
531
+ # @yieldparam result [::Google::Protobuf::Empty]
532
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
533
+ #
534
+ # @return [::Google::Protobuf::Empty]
535
+ #
536
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
537
+ #
538
+ # @example Basic example
539
+ # require "google/cloud/storage_batch_operations/v1"
540
+ #
541
+ # # Create a client object. The client can be reused for multiple calls.
542
+ # client = Google::Cloud::StorageBatchOperations::V1::StorageBatchOperations::Rest::Client.new
543
+ #
544
+ # # Create a request. To set request fields, pass in keyword arguments.
545
+ # request = Google::Cloud::StorageBatchOperations::V1::DeleteJobRequest.new
546
+ #
547
+ # # Call the delete_job method.
548
+ # result = client.delete_job request
549
+ #
550
+ # # The returned object is of type Google::Protobuf::Empty.
551
+ # p result
552
+ #
553
+ def delete_job request, options = nil
554
+ raise ::ArgumentError, "request must be provided" if request.nil?
555
+
556
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::StorageBatchOperations::V1::DeleteJobRequest
557
+
558
+ # Converts hash and nil to an options object
559
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
560
+
561
+ # Customize the options with defaults
562
+ call_metadata = @config.rpcs.delete_job.metadata.to_h
563
+
564
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
565
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
566
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
567
+ gapic_version: ::Google::Cloud::StorageBatchOperations::V1::VERSION,
568
+ transports_version_send: [:rest]
569
+
570
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
571
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
572
+
573
+ options.apply_defaults timeout: @config.rpcs.delete_job.timeout,
574
+ metadata: call_metadata,
575
+ retry_policy: @config.rpcs.delete_job.retry_policy
576
+
577
+ options.apply_defaults timeout: @config.timeout,
578
+ metadata: @config.metadata,
579
+ retry_policy: @config.retry_policy
580
+
581
+ @storage_batch_operations_stub.delete_job request, options do |result, operation|
582
+ yield result, operation if block_given?
583
+ end
584
+ rescue ::Gapic::Rest::Error => e
585
+ raise ::Google::Cloud::Error.from_error(e)
586
+ end
587
+
588
+ ##
589
+ # Cancels a batch job.
590
+ #
591
+ # @overload cancel_job(request, options = nil)
592
+ # Pass arguments to `cancel_job` via a request object, either of type
593
+ # {::Google::Cloud::StorageBatchOperations::V1::CancelJobRequest} or an equivalent Hash.
594
+ #
595
+ # @param request [::Google::Cloud::StorageBatchOperations::V1::CancelJobRequest, ::Hash]
596
+ # A request object representing the call parameters. Required. To specify no
597
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
598
+ # @param options [::Gapic::CallOptions, ::Hash]
599
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
600
+ #
601
+ # @overload cancel_job(name: nil, request_id: nil)
602
+ # Pass arguments to `cancel_job` via keyword arguments. Note that at
603
+ # least one keyword argument is required. To specify no parameters, or to keep all
604
+ # the default parameter values, pass an empty Hash as a request object (see above).
605
+ #
606
+ # @param name [::String]
607
+ # Required. The `name` of the job to cancel.
608
+ # Format: projects/\\{project_id}/locations/\\{location_id}/jobs/\\{job_id}.
609
+ # @param request_id [::String]
610
+ # Optional. An optional request ID to identify requests. Specify a unique
611
+ # request ID in case you need to retry your request. Requests with same
612
+ # `request_id` will ignored for at least 60 minutes since the first request.
613
+ # The request ID must be a valid UUID with the exception that zero UUID is
614
+ # not supported (00000000-0000-0000-0000-000000000000).
615
+ # @yield [result, operation] Access the result along with the TransportOperation object
616
+ # @yieldparam result [::Google::Cloud::StorageBatchOperations::V1::CancelJobResponse]
617
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
618
+ #
619
+ # @return [::Google::Cloud::StorageBatchOperations::V1::CancelJobResponse]
620
+ #
621
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
622
+ #
623
+ # @example Basic example
624
+ # require "google/cloud/storage_batch_operations/v1"
625
+ #
626
+ # # Create a client object. The client can be reused for multiple calls.
627
+ # client = Google::Cloud::StorageBatchOperations::V1::StorageBatchOperations::Rest::Client.new
628
+ #
629
+ # # Create a request. To set request fields, pass in keyword arguments.
630
+ # request = Google::Cloud::StorageBatchOperations::V1::CancelJobRequest.new
631
+ #
632
+ # # Call the cancel_job method.
633
+ # result = client.cancel_job request
634
+ #
635
+ # # The returned object is of type Google::Cloud::StorageBatchOperations::V1::CancelJobResponse.
636
+ # p result
637
+ #
638
+ def cancel_job request, options = nil
639
+ raise ::ArgumentError, "request must be provided" if request.nil?
640
+
641
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::StorageBatchOperations::V1::CancelJobRequest
642
+
643
+ # Converts hash and nil to an options object
644
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
645
+
646
+ # Customize the options with defaults
647
+ call_metadata = @config.rpcs.cancel_job.metadata.to_h
648
+
649
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
650
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
651
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
652
+ gapic_version: ::Google::Cloud::StorageBatchOperations::V1::VERSION,
653
+ transports_version_send: [:rest]
654
+
655
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
656
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
657
+
658
+ options.apply_defaults timeout: @config.rpcs.cancel_job.timeout,
659
+ metadata: call_metadata,
660
+ retry_policy: @config.rpcs.cancel_job.retry_policy
661
+
662
+ options.apply_defaults timeout: @config.timeout,
663
+ metadata: @config.metadata,
664
+ retry_policy: @config.retry_policy
665
+
666
+ @storage_batch_operations_stub.cancel_job request, options do |result, operation|
667
+ yield result, operation if block_given?
668
+ end
669
+ rescue ::Gapic::Rest::Error => e
670
+ raise ::Google::Cloud::Error.from_error(e)
671
+ end
672
+
673
+ ##
674
+ # Configuration class for the StorageBatchOperations REST API.
675
+ #
676
+ # This class represents the configuration for StorageBatchOperations REST,
677
+ # providing control over timeouts, retry behavior, logging, transport
678
+ # parameters, and other low-level controls. Certain parameters can also be
679
+ # applied individually to specific RPCs. See
680
+ # {::Google::Cloud::StorageBatchOperations::V1::StorageBatchOperations::Rest::Client::Configuration::Rpcs}
681
+ # for a list of RPCs that can be configured independently.
682
+ #
683
+ # Configuration can be applied globally to all clients, or to a single client
684
+ # on construction.
685
+ #
686
+ # @example
687
+ #
688
+ # # Modify the global config, setting the timeout for
689
+ # # list_jobs to 20 seconds,
690
+ # # and all remaining timeouts to 10 seconds.
691
+ # ::Google::Cloud::StorageBatchOperations::V1::StorageBatchOperations::Rest::Client.configure do |config|
692
+ # config.timeout = 10.0
693
+ # config.rpcs.list_jobs.timeout = 20.0
694
+ # end
695
+ #
696
+ # # Apply the above configuration only to a new client.
697
+ # client = ::Google::Cloud::StorageBatchOperations::V1::StorageBatchOperations::Rest::Client.new do |config|
698
+ # config.timeout = 10.0
699
+ # config.rpcs.list_jobs.timeout = 20.0
700
+ # end
701
+ #
702
+ # @!attribute [rw] endpoint
703
+ # A custom service endpoint, as a hostname or hostname:port. The default is
704
+ # nil, indicating to use the default endpoint in the current universe domain.
705
+ # @return [::String,nil]
706
+ # @!attribute [rw] credentials
707
+ # Credentials to send with calls. You may provide any of the following types:
708
+ # * (`String`) The path to a service account key file in JSON format
709
+ # * (`Hash`) A service account key as a Hash
710
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
711
+ # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
712
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
713
+ # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
714
+ # * (`nil`) indicating no credentials
715
+ #
716
+ # Warning: If you accept a credential configuration (JSON file or Hash) from an
717
+ # external source for authentication to Google Cloud, you must validate it before
718
+ # providing it to a Google API client library. Providing an unvalidated credential
719
+ # configuration to Google APIs can compromise the security of your systems and data.
720
+ # For more information, refer to [Validate credential configurations from external
721
+ # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
722
+ # @return [::Object]
723
+ # @!attribute [rw] scope
724
+ # The OAuth scopes
725
+ # @return [::Array<::String>]
726
+ # @!attribute [rw] lib_name
727
+ # The library name as recorded in instrumentation and logging
728
+ # @return [::String]
729
+ # @!attribute [rw] lib_version
730
+ # The library version as recorded in instrumentation and logging
731
+ # @return [::String]
732
+ # @!attribute [rw] timeout
733
+ # The call timeout in seconds.
734
+ # @return [::Numeric]
735
+ # @!attribute [rw] metadata
736
+ # Additional headers to be sent with the call.
737
+ # @return [::Hash{::Symbol=>::String}]
738
+ # @!attribute [rw] retry_policy
739
+ # The retry policy. The value is a hash with the following keys:
740
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
741
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
742
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
743
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
744
+ # trigger a retry.
745
+ # @return [::Hash]
746
+ # @!attribute [rw] quota_project
747
+ # A separate project against which to charge quota.
748
+ # @return [::String]
749
+ # @!attribute [rw] universe_domain
750
+ # The universe domain within which to make requests. This determines the
751
+ # default endpoint URL. The default value of nil uses the environment
752
+ # universe (usually the default "googleapis.com" universe).
753
+ # @return [::String,nil]
754
+ # @!attribute [rw] logger
755
+ # A custom logger to use for request/response debug logging, or the value
756
+ # `:default` (the default) to construct a default logger, or `nil` to
757
+ # explicitly disable logging.
758
+ # @return [::Logger,:default,nil]
759
+ #
760
+ class Configuration
761
+ extend ::Gapic::Config
762
+
763
+ # @private
764
+ # The endpoint specific to the default "googleapis.com" universe. Deprecated.
765
+ DEFAULT_ENDPOINT = "storagebatchoperations.googleapis.com"
766
+
767
+ config_attr :endpoint, nil, ::String, nil
768
+ config_attr :credentials, nil do |value|
769
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
770
+ allowed.any? { |klass| klass === value }
771
+ end
772
+ config_attr :scope, nil, ::String, ::Array, nil
773
+ config_attr :lib_name, nil, ::String, nil
774
+ config_attr :lib_version, nil, ::String, nil
775
+ config_attr :timeout, nil, ::Numeric, nil
776
+ config_attr :metadata, nil, ::Hash, nil
777
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
778
+ config_attr :quota_project, nil, ::String, nil
779
+ config_attr :universe_domain, nil, ::String, nil
780
+
781
+ # @private
782
+ # Overrides for http bindings for the RPCs of this service
783
+ # are only used when this service is used as mixin, and only
784
+ # by the host service.
785
+ # @return [::Hash{::Symbol=>::Array<::Gapic::Rest::GrpcTranscoder::HttpBinding>}]
786
+ config_attr :bindings_override, {}, ::Hash, nil
787
+ config_attr :logger, :default, ::Logger, nil, :default
788
+
789
+ # @private
790
+ def initialize parent_config = nil
791
+ @parent_config = parent_config unless parent_config.nil?
792
+
793
+ yield self if block_given?
794
+ end
795
+
796
+ ##
797
+ # Configurations for individual RPCs
798
+ # @return [Rpcs]
799
+ #
800
+ def rpcs
801
+ @rpcs ||= begin
802
+ parent_rpcs = nil
803
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
804
+ Rpcs.new parent_rpcs
805
+ end
806
+ end
807
+
808
+ ##
809
+ # Configuration RPC class for the StorageBatchOperations API.
810
+ #
811
+ # Includes fields providing the configuration for each RPC in this service.
812
+ # Each configuration object is of type `Gapic::Config::Method` and includes
813
+ # the following configuration fields:
814
+ #
815
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
816
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
817
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
818
+ # include the following keys:
819
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
820
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
821
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
822
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
823
+ # trigger a retry.
824
+ #
825
+ class Rpcs
826
+ ##
827
+ # RPC-specific configuration for `list_jobs`
828
+ # @return [::Gapic::Config::Method]
829
+ #
830
+ attr_reader :list_jobs
831
+ ##
832
+ # RPC-specific configuration for `get_job`
833
+ # @return [::Gapic::Config::Method]
834
+ #
835
+ attr_reader :get_job
836
+ ##
837
+ # RPC-specific configuration for `create_job`
838
+ # @return [::Gapic::Config::Method]
839
+ #
840
+ attr_reader :create_job
841
+ ##
842
+ # RPC-specific configuration for `delete_job`
843
+ # @return [::Gapic::Config::Method]
844
+ #
845
+ attr_reader :delete_job
846
+ ##
847
+ # RPC-specific configuration for `cancel_job`
848
+ # @return [::Gapic::Config::Method]
849
+ #
850
+ attr_reader :cancel_job
851
+
852
+ # @private
853
+ def initialize parent_rpcs = nil
854
+ list_jobs_config = parent_rpcs.list_jobs if parent_rpcs.respond_to? :list_jobs
855
+ @list_jobs = ::Gapic::Config::Method.new list_jobs_config
856
+ get_job_config = parent_rpcs.get_job if parent_rpcs.respond_to? :get_job
857
+ @get_job = ::Gapic::Config::Method.new get_job_config
858
+ create_job_config = parent_rpcs.create_job if parent_rpcs.respond_to? :create_job
859
+ @create_job = ::Gapic::Config::Method.new create_job_config
860
+ delete_job_config = parent_rpcs.delete_job if parent_rpcs.respond_to? :delete_job
861
+ @delete_job = ::Gapic::Config::Method.new delete_job_config
862
+ cancel_job_config = parent_rpcs.cancel_job if parent_rpcs.respond_to? :cancel_job
863
+ @cancel_job = ::Gapic::Config::Method.new cancel_job_config
864
+
865
+ yield self if block_given?
866
+ end
867
+ end
868
+ end
869
+ end
870
+ end
871
+ end
872
+ end
873
+ end
874
+ end
875
+ end