google-cloud-storage_transfer-v1 0.4.0 → 0.5.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.
@@ -0,0 +1,1381 @@
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/storagetransfer/v1/transfer_pb"
21
+ require "google/cloud/storage_transfer/v1/storage_transfer_service/rest/service_stub"
22
+
23
+ module Google
24
+ module Cloud
25
+ module StorageTransfer
26
+ module V1
27
+ module StorageTransferService
28
+ module Rest
29
+ ##
30
+ # REST client for the StorageTransferService service.
31
+ #
32
+ # Storage Transfer Service and its protos.
33
+ # Transfers data between between Google Cloud Storage buckets or from a data
34
+ # source external to Google to a Cloud Storage bucket.
35
+ #
36
+ class Client
37
+ include Paths
38
+
39
+ # @private
40
+ attr_reader :storage_transfer_service_stub
41
+
42
+ ##
43
+ # Configure the StorageTransferService Client class.
44
+ #
45
+ # See {::Google::Cloud::StorageTransfer::V1::StorageTransferService::Rest::Client::Configuration}
46
+ # for a description of the configuration fields.
47
+ #
48
+ # @example
49
+ #
50
+ # # Modify the configuration for all StorageTransferService clients
51
+ # ::Google::Cloud::StorageTransfer::V1::StorageTransferService::Rest::Client.configure do |config|
52
+ # config.timeout = 10.0
53
+ # end
54
+ #
55
+ # @yield [config] Configure the Client client.
56
+ # @yieldparam config [Client::Configuration]
57
+ #
58
+ # @return [Client::Configuration]
59
+ #
60
+ def self.configure
61
+ @configure ||= begin
62
+ namespace = ["Google", "Cloud", "StorageTransfer", "V1"]
63
+ parent_config = while namespace.any?
64
+ parent_name = namespace.join "::"
65
+ parent_const = const_get parent_name
66
+ break parent_const.configure if parent_const.respond_to? :configure
67
+ namespace.pop
68
+ end
69
+ default_config = Client::Configuration.new parent_config
70
+
71
+ default_config.timeout = 60.0
72
+ default_config.retry_policy = {
73
+ initial_delay: 1.0, max_delay: 60.0, multiplier: 2, retry_codes: [14]
74
+ }
75
+
76
+ default_config.rpcs.create_transfer_job.timeout = 60.0
77
+
78
+ default_config
79
+ end
80
+ yield @configure if block_given?
81
+ @configure
82
+ end
83
+
84
+ ##
85
+ # Configure the StorageTransferService Client instance.
86
+ #
87
+ # The configuration is set to the derived mode, meaning that values can be changed,
88
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
89
+ # should be made on {Client.configure}.
90
+ #
91
+ # See {::Google::Cloud::StorageTransfer::V1::StorageTransferService::Rest::Client::Configuration}
92
+ # for a description of the configuration fields.
93
+ #
94
+ # @yield [config] Configure the Client client.
95
+ # @yieldparam config [Client::Configuration]
96
+ #
97
+ # @return [Client::Configuration]
98
+ #
99
+ def configure
100
+ yield @config if block_given?
101
+ @config
102
+ end
103
+
104
+ ##
105
+ # Create a new StorageTransferService REST client object.
106
+ #
107
+ # @example
108
+ #
109
+ # # Create a client using the default configuration
110
+ # client = ::Google::Cloud::StorageTransfer::V1::StorageTransferService::Rest::Client.new
111
+ #
112
+ # # Create a client using a custom configuration
113
+ # client = ::Google::Cloud::StorageTransfer::V1::StorageTransferService::Rest::Client.new do |config|
114
+ # config.timeout = 10.0
115
+ # end
116
+ #
117
+ # @yield [config] Configure the StorageTransferService client.
118
+ # @yieldparam config [Client::Configuration]
119
+ #
120
+ def initialize
121
+ # Create the configuration object
122
+ @config = Configuration.new Client.configure
123
+
124
+ # Yield the configuration if needed
125
+ yield @config if block_given?
126
+
127
+ # Create credentials
128
+ credentials = @config.credentials
129
+ # Use self-signed JWT if the endpoint is unchanged from default,
130
+ # but only if the default endpoint does not have a region prefix.
131
+ enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
132
+ !@config.endpoint.split(".").first.include?("-")
133
+ credentials ||= Credentials.default scope: @config.scope,
134
+ enable_self_signed_jwt: enable_self_signed_jwt
135
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
136
+ credentials = Credentials.new credentials, scope: @config.scope
137
+ end
138
+
139
+ @quota_project_id = @config.quota_project
140
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
141
+
142
+ @operations_client = ::Google::Cloud::StorageTransfer::V1::StorageTransferService::Rest::Operations.new do |config|
143
+ config.credentials = credentials
144
+ config.quota_project = @quota_project_id
145
+ config.endpoint = @config.endpoint
146
+ end
147
+
148
+ @storage_transfer_service_stub = ::Google::Cloud::StorageTransfer::V1::StorageTransferService::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials
149
+ end
150
+
151
+ ##
152
+ # Get the associated client for long-running operations.
153
+ #
154
+ # @return [::Google::Cloud::StorageTransfer::V1::StorageTransferService::Rest::Operations]
155
+ #
156
+ attr_reader :operations_client
157
+
158
+ # Service calls
159
+
160
+ ##
161
+ # Returns the Google service account that is used by Storage Transfer
162
+ # Service to access buckets in the project where transfers
163
+ # run or in other projects. Each Google service account is associated
164
+ # with one Google Cloud project. Users
165
+ # should add this service account to the Google Cloud Storage bucket
166
+ # ACLs to grant access to Storage Transfer Service. This service
167
+ # account is created and owned by Storage Transfer Service and can
168
+ # only be used by Storage Transfer Service.
169
+ #
170
+ # @overload get_google_service_account(request, options = nil)
171
+ # Pass arguments to `get_google_service_account` via a request object, either of type
172
+ # {::Google::Cloud::StorageTransfer::V1::GetGoogleServiceAccountRequest} or an equivalent Hash.
173
+ #
174
+ # @param request [::Google::Cloud::StorageTransfer::V1::GetGoogleServiceAccountRequest, ::Hash]
175
+ # A request object representing the call parameters. Required. To specify no
176
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
177
+ # @param options [::Gapic::CallOptions, ::Hash]
178
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
179
+ #
180
+ # @overload get_google_service_account(project_id: nil)
181
+ # Pass arguments to `get_google_service_account` via keyword arguments. Note that at
182
+ # least one keyword argument is required. To specify no parameters, or to keep all
183
+ # the default parameter values, pass an empty Hash as a request object (see above).
184
+ #
185
+ # @param project_id [::String]
186
+ # Required. The ID of the Google Cloud project that the Google service
187
+ # account is associated with.
188
+ # @yield [result, operation] Access the result along with the TransportOperation object
189
+ # @yieldparam result [::Google::Cloud::StorageTransfer::V1::GoogleServiceAccount]
190
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
191
+ #
192
+ # @return [::Google::Cloud::StorageTransfer::V1::GoogleServiceAccount]
193
+ #
194
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
195
+ def get_google_service_account request, options = nil
196
+ raise ::ArgumentError, "request must be provided" if request.nil?
197
+
198
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::StorageTransfer::V1::GetGoogleServiceAccountRequest
199
+
200
+ # Converts hash and nil to an options object
201
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
202
+
203
+ # Customize the options with defaults
204
+ call_metadata = @config.rpcs.get_google_service_account.metadata.to_h
205
+
206
+ # Set x-goog-api-client and x-goog-user-project headers
207
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
208
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
209
+ gapic_version: ::Google::Cloud::StorageTransfer::V1::VERSION,
210
+ transports_version_send: [:rest]
211
+
212
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
213
+
214
+ options.apply_defaults timeout: @config.rpcs.get_google_service_account.timeout,
215
+ metadata: call_metadata,
216
+ retry_policy: @config.rpcs.get_google_service_account.retry_policy
217
+
218
+ options.apply_defaults timeout: @config.timeout,
219
+ metadata: @config.metadata,
220
+ retry_policy: @config.retry_policy
221
+
222
+ @storage_transfer_service_stub.get_google_service_account request, options do |result, operation|
223
+ yield result, operation if block_given?
224
+ return result
225
+ end
226
+ rescue ::Gapic::Rest::Error => e
227
+ raise ::Google::Cloud::Error.from_error(e)
228
+ end
229
+
230
+ ##
231
+ # Creates a transfer job that runs periodically.
232
+ #
233
+ # @overload create_transfer_job(request, options = nil)
234
+ # Pass arguments to `create_transfer_job` via a request object, either of type
235
+ # {::Google::Cloud::StorageTransfer::V1::CreateTransferJobRequest} or an equivalent Hash.
236
+ #
237
+ # @param request [::Google::Cloud::StorageTransfer::V1::CreateTransferJobRequest, ::Hash]
238
+ # A request object representing the call parameters. Required. To specify no
239
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
240
+ # @param options [::Gapic::CallOptions, ::Hash]
241
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
242
+ #
243
+ # @overload create_transfer_job(transfer_job: nil)
244
+ # Pass arguments to `create_transfer_job` via keyword arguments. Note that at
245
+ # least one keyword argument is required. To specify no parameters, or to keep all
246
+ # the default parameter values, pass an empty Hash as a request object (see above).
247
+ #
248
+ # @param transfer_job [::Google::Cloud::StorageTransfer::V1::TransferJob, ::Hash]
249
+ # Required. The job to create.
250
+ # @yield [result, operation] Access the result along with the TransportOperation object
251
+ # @yieldparam result [::Google::Cloud::StorageTransfer::V1::TransferJob]
252
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
253
+ #
254
+ # @return [::Google::Cloud::StorageTransfer::V1::TransferJob]
255
+ #
256
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
257
+ def create_transfer_job request, options = nil
258
+ raise ::ArgumentError, "request must be provided" if request.nil?
259
+
260
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::StorageTransfer::V1::CreateTransferJobRequest
261
+
262
+ # Converts hash and nil to an options object
263
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
264
+
265
+ # Customize the options with defaults
266
+ call_metadata = @config.rpcs.create_transfer_job.metadata.to_h
267
+
268
+ # Set x-goog-api-client and x-goog-user-project headers
269
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
270
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
271
+ gapic_version: ::Google::Cloud::StorageTransfer::V1::VERSION,
272
+ transports_version_send: [:rest]
273
+
274
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
275
+
276
+ options.apply_defaults timeout: @config.rpcs.create_transfer_job.timeout,
277
+ metadata: call_metadata,
278
+ retry_policy: @config.rpcs.create_transfer_job.retry_policy
279
+
280
+ options.apply_defaults timeout: @config.timeout,
281
+ metadata: @config.metadata,
282
+ retry_policy: @config.retry_policy
283
+
284
+ @storage_transfer_service_stub.create_transfer_job request, options do |result, operation|
285
+ yield result, operation if block_given?
286
+ return result
287
+ end
288
+ rescue ::Gapic::Rest::Error => e
289
+ raise ::Google::Cloud::Error.from_error(e)
290
+ end
291
+
292
+ ##
293
+ # Updates a transfer job. Updating a job's transfer spec does not affect
294
+ # transfer operations that are running already.
295
+ #
296
+ # **Note:** The job's {::Google::Cloud::StorageTransfer::V1::TransferJob#status status} field can be modified
297
+ # using this RPC (for example, to set a job's status to
298
+ # {::Google::Cloud::StorageTransfer::V1::TransferJob::Status::DELETED DELETED},
299
+ # {::Google::Cloud::StorageTransfer::V1::TransferJob::Status::DISABLED DISABLED}, or
300
+ # {::Google::Cloud::StorageTransfer::V1::TransferJob::Status::ENABLED ENABLED}).
301
+ #
302
+ # @overload update_transfer_job(request, options = nil)
303
+ # Pass arguments to `update_transfer_job` via a request object, either of type
304
+ # {::Google::Cloud::StorageTransfer::V1::UpdateTransferJobRequest} or an equivalent Hash.
305
+ #
306
+ # @param request [::Google::Cloud::StorageTransfer::V1::UpdateTransferJobRequest, ::Hash]
307
+ # A request object representing the call parameters. Required. To specify no
308
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
309
+ # @param options [::Gapic::CallOptions, ::Hash]
310
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
311
+ #
312
+ # @overload update_transfer_job(job_name: nil, project_id: nil, transfer_job: nil, update_transfer_job_field_mask: nil)
313
+ # Pass arguments to `update_transfer_job` via keyword arguments. Note that at
314
+ # least one keyword argument is required. To specify no parameters, or to keep all
315
+ # the default parameter values, pass an empty Hash as a request object (see above).
316
+ #
317
+ # @param job_name [::String]
318
+ # Required. The name of job to update.
319
+ # @param project_id [::String]
320
+ # Required. The ID of the Google Cloud project that owns the
321
+ # job.
322
+ # @param transfer_job [::Google::Cloud::StorageTransfer::V1::TransferJob, ::Hash]
323
+ # Required. The job to update. `transferJob` is expected to specify one or more of
324
+ # five fields: {::Google::Cloud::StorageTransfer::V1::TransferJob#description description},
325
+ # {::Google::Cloud::StorageTransfer::V1::TransferJob#transfer_spec transfer_spec},
326
+ # {::Google::Cloud::StorageTransfer::V1::TransferJob#notification_config notification_config},
327
+ # {::Google::Cloud::StorageTransfer::V1::TransferJob#logging_config logging_config}, and
328
+ # {::Google::Cloud::StorageTransfer::V1::TransferJob#status status}. An `UpdateTransferJobRequest` that specifies
329
+ # other fields are rejected with the error
330
+ # {::Google::Rpc::Code::INVALID_ARGUMENT INVALID_ARGUMENT}. Updating a job status
331
+ # to {::Google::Cloud::StorageTransfer::V1::TransferJob::Status::DELETED DELETED} requires
332
+ # `storagetransfer.jobs.delete` permission.
333
+ # @param update_transfer_job_field_mask [::Google::Protobuf::FieldMask, ::Hash]
334
+ # The field mask of the fields in `transferJob` that are to be updated in
335
+ # this request. Fields in `transferJob` that can be updated are:
336
+ # {::Google::Cloud::StorageTransfer::V1::TransferJob#description description},
337
+ # {::Google::Cloud::StorageTransfer::V1::TransferJob#transfer_spec transfer_spec},
338
+ # {::Google::Cloud::StorageTransfer::V1::TransferJob#notification_config notification_config},
339
+ # {::Google::Cloud::StorageTransfer::V1::TransferJob#logging_config logging_config}, and
340
+ # {::Google::Cloud::StorageTransfer::V1::TransferJob#status status}. To update the `transfer_spec` of the job, a
341
+ # complete transfer specification must be provided. An incomplete
342
+ # specification missing any required fields is rejected with the error
343
+ # {::Google::Rpc::Code::INVALID_ARGUMENT INVALID_ARGUMENT}.
344
+ # @yield [result, operation] Access the result along with the TransportOperation object
345
+ # @yieldparam result [::Google::Cloud::StorageTransfer::V1::TransferJob]
346
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
347
+ #
348
+ # @return [::Google::Cloud::StorageTransfer::V1::TransferJob]
349
+ #
350
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
351
+ def update_transfer_job request, options = nil
352
+ raise ::ArgumentError, "request must be provided" if request.nil?
353
+
354
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::StorageTransfer::V1::UpdateTransferJobRequest
355
+
356
+ # Converts hash and nil to an options object
357
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
358
+
359
+ # Customize the options with defaults
360
+ call_metadata = @config.rpcs.update_transfer_job.metadata.to_h
361
+
362
+ # Set x-goog-api-client and x-goog-user-project headers
363
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
364
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
365
+ gapic_version: ::Google::Cloud::StorageTransfer::V1::VERSION,
366
+ transports_version_send: [:rest]
367
+
368
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
369
+
370
+ options.apply_defaults timeout: @config.rpcs.update_transfer_job.timeout,
371
+ metadata: call_metadata,
372
+ retry_policy: @config.rpcs.update_transfer_job.retry_policy
373
+
374
+ options.apply_defaults timeout: @config.timeout,
375
+ metadata: @config.metadata,
376
+ retry_policy: @config.retry_policy
377
+
378
+ @storage_transfer_service_stub.update_transfer_job request, options do |result, operation|
379
+ yield result, operation if block_given?
380
+ return result
381
+ end
382
+ rescue ::Gapic::Rest::Error => e
383
+ raise ::Google::Cloud::Error.from_error(e)
384
+ end
385
+
386
+ ##
387
+ # Gets a transfer job.
388
+ #
389
+ # @overload get_transfer_job(request, options = nil)
390
+ # Pass arguments to `get_transfer_job` via a request object, either of type
391
+ # {::Google::Cloud::StorageTransfer::V1::GetTransferJobRequest} or an equivalent Hash.
392
+ #
393
+ # @param request [::Google::Cloud::StorageTransfer::V1::GetTransferJobRequest, ::Hash]
394
+ # A request object representing the call parameters. Required. To specify no
395
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
396
+ # @param options [::Gapic::CallOptions, ::Hash]
397
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
398
+ #
399
+ # @overload get_transfer_job(job_name: nil, project_id: nil)
400
+ # Pass arguments to `get_transfer_job` via keyword arguments. Note that at
401
+ # least one keyword argument is required. To specify no parameters, or to keep all
402
+ # the default parameter values, pass an empty Hash as a request object (see above).
403
+ #
404
+ # @param job_name [::String]
405
+ # Required. The job to get.
406
+ # @param project_id [::String]
407
+ # Required. The ID of the Google Cloud project that owns the
408
+ # job.
409
+ # @yield [result, operation] Access the result along with the TransportOperation object
410
+ # @yieldparam result [::Google::Cloud::StorageTransfer::V1::TransferJob]
411
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
412
+ #
413
+ # @return [::Google::Cloud::StorageTransfer::V1::TransferJob]
414
+ #
415
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
416
+ def get_transfer_job request, options = nil
417
+ raise ::ArgumentError, "request must be provided" if request.nil?
418
+
419
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::StorageTransfer::V1::GetTransferJobRequest
420
+
421
+ # Converts hash and nil to an options object
422
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
423
+
424
+ # Customize the options with defaults
425
+ call_metadata = @config.rpcs.get_transfer_job.metadata.to_h
426
+
427
+ # Set x-goog-api-client and x-goog-user-project headers
428
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
429
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
430
+ gapic_version: ::Google::Cloud::StorageTransfer::V1::VERSION,
431
+ transports_version_send: [:rest]
432
+
433
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
434
+
435
+ options.apply_defaults timeout: @config.rpcs.get_transfer_job.timeout,
436
+ metadata: call_metadata,
437
+ retry_policy: @config.rpcs.get_transfer_job.retry_policy
438
+
439
+ options.apply_defaults timeout: @config.timeout,
440
+ metadata: @config.metadata,
441
+ retry_policy: @config.retry_policy
442
+
443
+ @storage_transfer_service_stub.get_transfer_job request, options do |result, operation|
444
+ yield result, operation if block_given?
445
+ return result
446
+ end
447
+ rescue ::Gapic::Rest::Error => e
448
+ raise ::Google::Cloud::Error.from_error(e)
449
+ end
450
+
451
+ ##
452
+ # Lists transfer jobs.
453
+ #
454
+ # @overload list_transfer_jobs(request, options = nil)
455
+ # Pass arguments to `list_transfer_jobs` via a request object, either of type
456
+ # {::Google::Cloud::StorageTransfer::V1::ListTransferJobsRequest} or an equivalent Hash.
457
+ #
458
+ # @param request [::Google::Cloud::StorageTransfer::V1::ListTransferJobsRequest, ::Hash]
459
+ # A request object representing the call parameters. Required. To specify no
460
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
461
+ # @param options [::Gapic::CallOptions, ::Hash]
462
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
463
+ #
464
+ # @overload list_transfer_jobs(filter: nil, page_size: nil, page_token: nil)
465
+ # Pass arguments to `list_transfer_jobs` via keyword arguments. Note that at
466
+ # least one keyword argument is required. To specify no parameters, or to keep all
467
+ # the default parameter values, pass an empty Hash as a request object (see above).
468
+ #
469
+ # @param filter [::String]
470
+ # Required. A list of query parameters specified as JSON text in the form of:
471
+ # `{"projectId":"my_project_id",
472
+ # "jobNames":["jobid1","jobid2",...],
473
+ # "jobStatuses":["status1","status2",...]}`
474
+ #
475
+ # Since `jobNames` and `jobStatuses` support multiple values, their values
476
+ # must be specified with array notation. `projectId` is required.
477
+ # `jobNames` and `jobStatuses` are optional. The valid values for
478
+ # `jobStatuses` are case-insensitive:
479
+ # {::Google::Cloud::StorageTransfer::V1::TransferJob::Status::ENABLED ENABLED},
480
+ # {::Google::Cloud::StorageTransfer::V1::TransferJob::Status::DISABLED DISABLED}, and
481
+ # {::Google::Cloud::StorageTransfer::V1::TransferJob::Status::DELETED DELETED}.
482
+ # @param page_size [::Integer]
483
+ # The list page size. The max allowed value is 256.
484
+ # @param page_token [::String]
485
+ # The list page token.
486
+ # @yield [result, operation] Access the result along with the TransportOperation object
487
+ # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::StorageTransfer::V1::TransferJob>]
488
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
489
+ #
490
+ # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::StorageTransfer::V1::TransferJob>]
491
+ #
492
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
493
+ def list_transfer_jobs request, options = nil
494
+ raise ::ArgumentError, "request must be provided" if request.nil?
495
+
496
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::StorageTransfer::V1::ListTransferJobsRequest
497
+
498
+ # Converts hash and nil to an options object
499
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
500
+
501
+ # Customize the options with defaults
502
+ call_metadata = @config.rpcs.list_transfer_jobs.metadata.to_h
503
+
504
+ # Set x-goog-api-client and x-goog-user-project headers
505
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
506
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
507
+ gapic_version: ::Google::Cloud::StorageTransfer::V1::VERSION,
508
+ transports_version_send: [:rest]
509
+
510
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
511
+
512
+ options.apply_defaults timeout: @config.rpcs.list_transfer_jobs.timeout,
513
+ metadata: call_metadata,
514
+ retry_policy: @config.rpcs.list_transfer_jobs.retry_policy
515
+
516
+ options.apply_defaults timeout: @config.timeout,
517
+ metadata: @config.metadata,
518
+ retry_policy: @config.retry_policy
519
+
520
+ @storage_transfer_service_stub.list_transfer_jobs request, options do |result, operation|
521
+ result = ::Gapic::Rest::PagedEnumerable.new @storage_transfer_service_stub, :list_transfer_jobs, "transfer_jobs", request, result, options
522
+ yield result, operation if block_given?
523
+ return result
524
+ end
525
+ rescue ::Gapic::Rest::Error => e
526
+ raise ::Google::Cloud::Error.from_error(e)
527
+ end
528
+
529
+ ##
530
+ # Pauses a transfer operation.
531
+ #
532
+ # @overload pause_transfer_operation(request, options = nil)
533
+ # Pass arguments to `pause_transfer_operation` via a request object, either of type
534
+ # {::Google::Cloud::StorageTransfer::V1::PauseTransferOperationRequest} or an equivalent Hash.
535
+ #
536
+ # @param request [::Google::Cloud::StorageTransfer::V1::PauseTransferOperationRequest, ::Hash]
537
+ # A request object representing the call parameters. Required. To specify no
538
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
539
+ # @param options [::Gapic::CallOptions, ::Hash]
540
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
541
+ #
542
+ # @overload pause_transfer_operation(name: nil)
543
+ # Pass arguments to `pause_transfer_operation` via keyword arguments. Note that at
544
+ # least one keyword argument is required. To specify no parameters, or to keep all
545
+ # the default parameter values, pass an empty Hash as a request object (see above).
546
+ #
547
+ # @param name [::String]
548
+ # Required. The name of the transfer operation.
549
+ # @yield [result, operation] Access the result along with the TransportOperation object
550
+ # @yieldparam result [::Google::Protobuf::Empty]
551
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
552
+ #
553
+ # @return [::Google::Protobuf::Empty]
554
+ #
555
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
556
+ def pause_transfer_operation request, options = nil
557
+ raise ::ArgumentError, "request must be provided" if request.nil?
558
+
559
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::StorageTransfer::V1::PauseTransferOperationRequest
560
+
561
+ # Converts hash and nil to an options object
562
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
563
+
564
+ # Customize the options with defaults
565
+ call_metadata = @config.rpcs.pause_transfer_operation.metadata.to_h
566
+
567
+ # Set x-goog-api-client and x-goog-user-project headers
568
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
569
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
570
+ gapic_version: ::Google::Cloud::StorageTransfer::V1::VERSION,
571
+ transports_version_send: [:rest]
572
+
573
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
574
+
575
+ options.apply_defaults timeout: @config.rpcs.pause_transfer_operation.timeout,
576
+ metadata: call_metadata,
577
+ retry_policy: @config.rpcs.pause_transfer_operation.retry_policy
578
+
579
+ options.apply_defaults timeout: @config.timeout,
580
+ metadata: @config.metadata,
581
+ retry_policy: @config.retry_policy
582
+
583
+ @storage_transfer_service_stub.pause_transfer_operation request, options do |result, operation|
584
+ yield result, operation if block_given?
585
+ return result
586
+ end
587
+ rescue ::Gapic::Rest::Error => e
588
+ raise ::Google::Cloud::Error.from_error(e)
589
+ end
590
+
591
+ ##
592
+ # Resumes a transfer operation that is paused.
593
+ #
594
+ # @overload resume_transfer_operation(request, options = nil)
595
+ # Pass arguments to `resume_transfer_operation` via a request object, either of type
596
+ # {::Google::Cloud::StorageTransfer::V1::ResumeTransferOperationRequest} or an equivalent Hash.
597
+ #
598
+ # @param request [::Google::Cloud::StorageTransfer::V1::ResumeTransferOperationRequest, ::Hash]
599
+ # A request object representing the call parameters. Required. To specify no
600
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
601
+ # @param options [::Gapic::CallOptions, ::Hash]
602
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
603
+ #
604
+ # @overload resume_transfer_operation(name: nil)
605
+ # Pass arguments to `resume_transfer_operation` via keyword arguments. Note that at
606
+ # least one keyword argument is required. To specify no parameters, or to keep all
607
+ # the default parameter values, pass an empty Hash as a request object (see above).
608
+ #
609
+ # @param name [::String]
610
+ # Required. The name of the transfer operation.
611
+ # @yield [result, operation] Access the result along with the TransportOperation object
612
+ # @yieldparam result [::Google::Protobuf::Empty]
613
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
614
+ #
615
+ # @return [::Google::Protobuf::Empty]
616
+ #
617
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
618
+ def resume_transfer_operation request, options = nil
619
+ raise ::ArgumentError, "request must be provided" if request.nil?
620
+
621
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::StorageTransfer::V1::ResumeTransferOperationRequest
622
+
623
+ # Converts hash and nil to an options object
624
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
625
+
626
+ # Customize the options with defaults
627
+ call_metadata = @config.rpcs.resume_transfer_operation.metadata.to_h
628
+
629
+ # Set x-goog-api-client and x-goog-user-project headers
630
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
631
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
632
+ gapic_version: ::Google::Cloud::StorageTransfer::V1::VERSION,
633
+ transports_version_send: [:rest]
634
+
635
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
636
+
637
+ options.apply_defaults timeout: @config.rpcs.resume_transfer_operation.timeout,
638
+ metadata: call_metadata,
639
+ retry_policy: @config.rpcs.resume_transfer_operation.retry_policy
640
+
641
+ options.apply_defaults timeout: @config.timeout,
642
+ metadata: @config.metadata,
643
+ retry_policy: @config.retry_policy
644
+
645
+ @storage_transfer_service_stub.resume_transfer_operation request, options do |result, operation|
646
+ yield result, operation if block_given?
647
+ return result
648
+ end
649
+ rescue ::Gapic::Rest::Error => e
650
+ raise ::Google::Cloud::Error.from_error(e)
651
+ end
652
+
653
+ ##
654
+ # Attempts to start a new TransferOperation for the current TransferJob. A
655
+ # TransferJob has a maximum of one active TransferOperation. If this method
656
+ # is called while a TransferOperation is active, an error will be returned.
657
+ #
658
+ # @overload run_transfer_job(request, options = nil)
659
+ # Pass arguments to `run_transfer_job` via a request object, either of type
660
+ # {::Google::Cloud::StorageTransfer::V1::RunTransferJobRequest} or an equivalent Hash.
661
+ #
662
+ # @param request [::Google::Cloud::StorageTransfer::V1::RunTransferJobRequest, ::Hash]
663
+ # A request object representing the call parameters. Required. To specify no
664
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
665
+ # @param options [::Gapic::CallOptions, ::Hash]
666
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
667
+ #
668
+ # @overload run_transfer_job(job_name: nil, project_id: nil)
669
+ # Pass arguments to `run_transfer_job` via keyword arguments. Note that at
670
+ # least one keyword argument is required. To specify no parameters, or to keep all
671
+ # the default parameter values, pass an empty Hash as a request object (see above).
672
+ #
673
+ # @param job_name [::String]
674
+ # Required. The name of the transfer job.
675
+ # @param project_id [::String]
676
+ # Required. The ID of the Google Cloud project that owns the transfer
677
+ # job.
678
+ # @yield [result, operation] Access the result along with the TransportOperation object
679
+ # @yieldparam result [::Gapic::Operation]
680
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
681
+ #
682
+ # @return [::Gapic::Operation]
683
+ #
684
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
685
+ def run_transfer_job request, options = nil
686
+ raise ::ArgumentError, "request must be provided" if request.nil?
687
+
688
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::StorageTransfer::V1::RunTransferJobRequest
689
+
690
+ # Converts hash and nil to an options object
691
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
692
+
693
+ # Customize the options with defaults
694
+ call_metadata = @config.rpcs.run_transfer_job.metadata.to_h
695
+
696
+ # Set x-goog-api-client and x-goog-user-project headers
697
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
698
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
699
+ gapic_version: ::Google::Cloud::StorageTransfer::V1::VERSION,
700
+ transports_version_send: [:rest]
701
+
702
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
703
+
704
+ options.apply_defaults timeout: @config.rpcs.run_transfer_job.timeout,
705
+ metadata: call_metadata,
706
+ retry_policy: @config.rpcs.run_transfer_job.retry_policy
707
+
708
+ options.apply_defaults timeout: @config.timeout,
709
+ metadata: @config.metadata,
710
+ retry_policy: @config.retry_policy
711
+
712
+ @storage_transfer_service_stub.run_transfer_job request, options do |result, operation|
713
+ result = ::Gapic::Operation.new result, @operations_client, options: options
714
+ yield result, operation if block_given?
715
+ return result
716
+ end
717
+ rescue ::Gapic::Rest::Error => e
718
+ raise ::Google::Cloud::Error.from_error(e)
719
+ end
720
+
721
+ ##
722
+ # Deletes a transfer job. Deleting a transfer job sets its status to
723
+ # {::Google::Cloud::StorageTransfer::V1::TransferJob::Status::DELETED DELETED}.
724
+ #
725
+ # @overload delete_transfer_job(request, options = nil)
726
+ # Pass arguments to `delete_transfer_job` via a request object, either of type
727
+ # {::Google::Cloud::StorageTransfer::V1::DeleteTransferJobRequest} or an equivalent Hash.
728
+ #
729
+ # @param request [::Google::Cloud::StorageTransfer::V1::DeleteTransferJobRequest, ::Hash]
730
+ # A request object representing the call parameters. Required. To specify no
731
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
732
+ # @param options [::Gapic::CallOptions, ::Hash]
733
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
734
+ #
735
+ # @overload delete_transfer_job(job_name: nil, project_id: nil)
736
+ # Pass arguments to `delete_transfer_job` via keyword arguments. Note that at
737
+ # least one keyword argument is required. To specify no parameters, or to keep all
738
+ # the default parameter values, pass an empty Hash as a request object (see above).
739
+ #
740
+ # @param job_name [::String]
741
+ # Required. The job to delete.
742
+ # @param project_id [::String]
743
+ # Required. The ID of the Google Cloud project that owns the
744
+ # job.
745
+ # @yield [result, operation] Access the result along with the TransportOperation object
746
+ # @yieldparam result [::Google::Protobuf::Empty]
747
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
748
+ #
749
+ # @return [::Google::Protobuf::Empty]
750
+ #
751
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
752
+ def delete_transfer_job request, options = nil
753
+ raise ::ArgumentError, "request must be provided" if request.nil?
754
+
755
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::StorageTransfer::V1::DeleteTransferJobRequest
756
+
757
+ # Converts hash and nil to an options object
758
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
759
+
760
+ # Customize the options with defaults
761
+ call_metadata = @config.rpcs.delete_transfer_job.metadata.to_h
762
+
763
+ # Set x-goog-api-client and x-goog-user-project headers
764
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
765
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
766
+ gapic_version: ::Google::Cloud::StorageTransfer::V1::VERSION,
767
+ transports_version_send: [:rest]
768
+
769
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
770
+
771
+ options.apply_defaults timeout: @config.rpcs.delete_transfer_job.timeout,
772
+ metadata: call_metadata,
773
+ retry_policy: @config.rpcs.delete_transfer_job.retry_policy
774
+
775
+ options.apply_defaults timeout: @config.timeout,
776
+ metadata: @config.metadata,
777
+ retry_policy: @config.retry_policy
778
+
779
+ @storage_transfer_service_stub.delete_transfer_job request, options do |result, operation|
780
+ yield result, operation if block_given?
781
+ return result
782
+ end
783
+ rescue ::Gapic::Rest::Error => e
784
+ raise ::Google::Cloud::Error.from_error(e)
785
+ end
786
+
787
+ ##
788
+ # Creates an agent pool resource.
789
+ #
790
+ # @overload create_agent_pool(request, options = nil)
791
+ # Pass arguments to `create_agent_pool` via a request object, either of type
792
+ # {::Google::Cloud::StorageTransfer::V1::CreateAgentPoolRequest} or an equivalent Hash.
793
+ #
794
+ # @param request [::Google::Cloud::StorageTransfer::V1::CreateAgentPoolRequest, ::Hash]
795
+ # A request object representing the call parameters. Required. To specify no
796
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
797
+ # @param options [::Gapic::CallOptions, ::Hash]
798
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
799
+ #
800
+ # @overload create_agent_pool(project_id: nil, agent_pool: nil, agent_pool_id: nil)
801
+ # Pass arguments to `create_agent_pool` via keyword arguments. Note that at
802
+ # least one keyword argument is required. To specify no parameters, or to keep all
803
+ # the default parameter values, pass an empty Hash as a request object (see above).
804
+ #
805
+ # @param project_id [::String]
806
+ # Required. The ID of the Google Cloud project that owns the
807
+ # agent pool.
808
+ # @param agent_pool [::Google::Cloud::StorageTransfer::V1::AgentPool, ::Hash]
809
+ # Required. The agent pool to create.
810
+ # @param agent_pool_id [::String]
811
+ # Required. The ID of the agent pool to create.
812
+ #
813
+ # The `agent_pool_id` must meet the following requirements:
814
+ #
815
+ # * Length of 128 characters or less.
816
+ # * Not start with the string `goog`.
817
+ # * Start with a lowercase ASCII character, followed by:
818
+ # * Zero or more: lowercase Latin alphabet characters, numerals,
819
+ # hyphens (`-`), periods (`.`), underscores (`_`), or tildes (`~`).
820
+ # * One or more numerals or lowercase ASCII characters.
821
+ #
822
+ # As expressed by the regular expression:
823
+ # `^(?!goog)[a-z]([a-z0-9-._~]*[a-z0-9])?$`.
824
+ # @yield [result, operation] Access the result along with the TransportOperation object
825
+ # @yieldparam result [::Google::Cloud::StorageTransfer::V1::AgentPool]
826
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
827
+ #
828
+ # @return [::Google::Cloud::StorageTransfer::V1::AgentPool]
829
+ #
830
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
831
+ def create_agent_pool request, options = nil
832
+ raise ::ArgumentError, "request must be provided" if request.nil?
833
+
834
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::StorageTransfer::V1::CreateAgentPoolRequest
835
+
836
+ # Converts hash and nil to an options object
837
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
838
+
839
+ # Customize the options with defaults
840
+ call_metadata = @config.rpcs.create_agent_pool.metadata.to_h
841
+
842
+ # Set x-goog-api-client and x-goog-user-project headers
843
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
844
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
845
+ gapic_version: ::Google::Cloud::StorageTransfer::V1::VERSION,
846
+ transports_version_send: [:rest]
847
+
848
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
849
+
850
+ options.apply_defaults timeout: @config.rpcs.create_agent_pool.timeout,
851
+ metadata: call_metadata,
852
+ retry_policy: @config.rpcs.create_agent_pool.retry_policy
853
+
854
+ options.apply_defaults timeout: @config.timeout,
855
+ metadata: @config.metadata,
856
+ retry_policy: @config.retry_policy
857
+
858
+ @storage_transfer_service_stub.create_agent_pool request, options do |result, operation|
859
+ yield result, operation if block_given?
860
+ return result
861
+ end
862
+ rescue ::Gapic::Rest::Error => e
863
+ raise ::Google::Cloud::Error.from_error(e)
864
+ end
865
+
866
+ ##
867
+ # Updates an existing agent pool resource.
868
+ #
869
+ # @overload update_agent_pool(request, options = nil)
870
+ # Pass arguments to `update_agent_pool` via a request object, either of type
871
+ # {::Google::Cloud::StorageTransfer::V1::UpdateAgentPoolRequest} or an equivalent Hash.
872
+ #
873
+ # @param request [::Google::Cloud::StorageTransfer::V1::UpdateAgentPoolRequest, ::Hash]
874
+ # A request object representing the call parameters. Required. To specify no
875
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
876
+ # @param options [::Gapic::CallOptions, ::Hash]
877
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
878
+ #
879
+ # @overload update_agent_pool(agent_pool: nil, update_mask: nil)
880
+ # Pass arguments to `update_agent_pool` via keyword arguments. Note that at
881
+ # least one keyword argument is required. To specify no parameters, or to keep all
882
+ # the default parameter values, pass an empty Hash as a request object (see above).
883
+ #
884
+ # @param agent_pool [::Google::Cloud::StorageTransfer::V1::AgentPool, ::Hash]
885
+ # Required. The agent pool to update. `agent_pool` is expected to specify following
886
+ # fields:
887
+ #
888
+ # * {::Google::Cloud::StorageTransfer::V1::AgentPool#name name}
889
+ #
890
+ # * {::Google::Cloud::StorageTransfer::V1::AgentPool#display_name display_name}
891
+ #
892
+ # * {::Google::Cloud::StorageTransfer::V1::AgentPool#bandwidth_limit bandwidth_limit}
893
+ # An `UpdateAgentPoolRequest` with any other fields is rejected
894
+ # with the error {::Google::Rpc::Code::INVALID_ARGUMENT INVALID_ARGUMENT}.
895
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
896
+ # The [field mask]
897
+ # (https://developers.google.com/protocol-buffers/docs/reference/google.protobuf)
898
+ # of the fields in `agentPool` to update in this request.
899
+ # The following `agentPool` fields can be updated:
900
+ #
901
+ # * {::Google::Cloud::StorageTransfer::V1::AgentPool#display_name display_name}
902
+ #
903
+ # * {::Google::Cloud::StorageTransfer::V1::AgentPool#bandwidth_limit bandwidth_limit}
904
+ # @yield [result, operation] Access the result along with the TransportOperation object
905
+ # @yieldparam result [::Google::Cloud::StorageTransfer::V1::AgentPool]
906
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
907
+ #
908
+ # @return [::Google::Cloud::StorageTransfer::V1::AgentPool]
909
+ #
910
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
911
+ def update_agent_pool request, options = nil
912
+ raise ::ArgumentError, "request must be provided" if request.nil?
913
+
914
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::StorageTransfer::V1::UpdateAgentPoolRequest
915
+
916
+ # Converts hash and nil to an options object
917
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
918
+
919
+ # Customize the options with defaults
920
+ call_metadata = @config.rpcs.update_agent_pool.metadata.to_h
921
+
922
+ # Set x-goog-api-client and x-goog-user-project headers
923
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
924
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
925
+ gapic_version: ::Google::Cloud::StorageTransfer::V1::VERSION,
926
+ transports_version_send: [:rest]
927
+
928
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
929
+
930
+ options.apply_defaults timeout: @config.rpcs.update_agent_pool.timeout,
931
+ metadata: call_metadata,
932
+ retry_policy: @config.rpcs.update_agent_pool.retry_policy
933
+
934
+ options.apply_defaults timeout: @config.timeout,
935
+ metadata: @config.metadata,
936
+ retry_policy: @config.retry_policy
937
+
938
+ @storage_transfer_service_stub.update_agent_pool request, options do |result, operation|
939
+ yield result, operation if block_given?
940
+ return result
941
+ end
942
+ rescue ::Gapic::Rest::Error => e
943
+ raise ::Google::Cloud::Error.from_error(e)
944
+ end
945
+
946
+ ##
947
+ # Gets an agent pool.
948
+ #
949
+ # @overload get_agent_pool(request, options = nil)
950
+ # Pass arguments to `get_agent_pool` via a request object, either of type
951
+ # {::Google::Cloud::StorageTransfer::V1::GetAgentPoolRequest} or an equivalent Hash.
952
+ #
953
+ # @param request [::Google::Cloud::StorageTransfer::V1::GetAgentPoolRequest, ::Hash]
954
+ # A request object representing the call parameters. Required. To specify no
955
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
956
+ # @param options [::Gapic::CallOptions, ::Hash]
957
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
958
+ #
959
+ # @overload get_agent_pool(name: nil)
960
+ # Pass arguments to `get_agent_pool` via keyword arguments. Note that at
961
+ # least one keyword argument is required. To specify no parameters, or to keep all
962
+ # the default parameter values, pass an empty Hash as a request object (see above).
963
+ #
964
+ # @param name [::String]
965
+ # Required. The name of the agent pool to get.
966
+ # @yield [result, operation] Access the result along with the TransportOperation object
967
+ # @yieldparam result [::Google::Cloud::StorageTransfer::V1::AgentPool]
968
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
969
+ #
970
+ # @return [::Google::Cloud::StorageTransfer::V1::AgentPool]
971
+ #
972
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
973
+ def get_agent_pool request, options = nil
974
+ raise ::ArgumentError, "request must be provided" if request.nil?
975
+
976
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::StorageTransfer::V1::GetAgentPoolRequest
977
+
978
+ # Converts hash and nil to an options object
979
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
980
+
981
+ # Customize the options with defaults
982
+ call_metadata = @config.rpcs.get_agent_pool.metadata.to_h
983
+
984
+ # Set x-goog-api-client and x-goog-user-project headers
985
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
986
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
987
+ gapic_version: ::Google::Cloud::StorageTransfer::V1::VERSION,
988
+ transports_version_send: [:rest]
989
+
990
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
991
+
992
+ options.apply_defaults timeout: @config.rpcs.get_agent_pool.timeout,
993
+ metadata: call_metadata,
994
+ retry_policy: @config.rpcs.get_agent_pool.retry_policy
995
+
996
+ options.apply_defaults timeout: @config.timeout,
997
+ metadata: @config.metadata,
998
+ retry_policy: @config.retry_policy
999
+
1000
+ @storage_transfer_service_stub.get_agent_pool request, options do |result, operation|
1001
+ yield result, operation if block_given?
1002
+ return result
1003
+ end
1004
+ rescue ::Gapic::Rest::Error => e
1005
+ raise ::Google::Cloud::Error.from_error(e)
1006
+ end
1007
+
1008
+ ##
1009
+ # Lists agent pools.
1010
+ #
1011
+ # @overload list_agent_pools(request, options = nil)
1012
+ # Pass arguments to `list_agent_pools` via a request object, either of type
1013
+ # {::Google::Cloud::StorageTransfer::V1::ListAgentPoolsRequest} or an equivalent Hash.
1014
+ #
1015
+ # @param request [::Google::Cloud::StorageTransfer::V1::ListAgentPoolsRequest, ::Hash]
1016
+ # A request object representing the call parameters. Required. To specify no
1017
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1018
+ # @param options [::Gapic::CallOptions, ::Hash]
1019
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
1020
+ #
1021
+ # @overload list_agent_pools(project_id: nil, filter: nil, page_size: nil, page_token: nil)
1022
+ # Pass arguments to `list_agent_pools` via keyword arguments. Note that at
1023
+ # least one keyword argument is required. To specify no parameters, or to keep all
1024
+ # the default parameter values, pass an empty Hash as a request object (see above).
1025
+ #
1026
+ # @param project_id [::String]
1027
+ # Required. The ID of the Google Cloud project that owns the job.
1028
+ # @param filter [::String]
1029
+ # An optional list of query parameters specified as JSON text in the
1030
+ # form of:
1031
+ #
1032
+ # `{"agentPoolNames":["agentpool1","agentpool2",...]}`
1033
+ #
1034
+ # Since `agentPoolNames` support multiple values, its values must be
1035
+ # specified with array notation. When the filter is either empty or not
1036
+ # provided, the list returns all agent pools for the project.
1037
+ # @param page_size [::Integer]
1038
+ # The list page size. The max allowed value is `256`.
1039
+ # @param page_token [::String]
1040
+ # The list page token.
1041
+ # @yield [result, operation] Access the result along with the TransportOperation object
1042
+ # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::StorageTransfer::V1::AgentPool>]
1043
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
1044
+ #
1045
+ # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::StorageTransfer::V1::AgentPool>]
1046
+ #
1047
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
1048
+ def list_agent_pools request, options = nil
1049
+ raise ::ArgumentError, "request must be provided" if request.nil?
1050
+
1051
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::StorageTransfer::V1::ListAgentPoolsRequest
1052
+
1053
+ # Converts hash and nil to an options object
1054
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1055
+
1056
+ # Customize the options with defaults
1057
+ call_metadata = @config.rpcs.list_agent_pools.metadata.to_h
1058
+
1059
+ # Set x-goog-api-client and x-goog-user-project headers
1060
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1061
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1062
+ gapic_version: ::Google::Cloud::StorageTransfer::V1::VERSION,
1063
+ transports_version_send: [:rest]
1064
+
1065
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1066
+
1067
+ options.apply_defaults timeout: @config.rpcs.list_agent_pools.timeout,
1068
+ metadata: call_metadata,
1069
+ retry_policy: @config.rpcs.list_agent_pools.retry_policy
1070
+
1071
+ options.apply_defaults timeout: @config.timeout,
1072
+ metadata: @config.metadata,
1073
+ retry_policy: @config.retry_policy
1074
+
1075
+ @storage_transfer_service_stub.list_agent_pools request, options do |result, operation|
1076
+ result = ::Gapic::Rest::PagedEnumerable.new @storage_transfer_service_stub, :list_agent_pools, "agent_pools", request, result, options
1077
+ yield result, operation if block_given?
1078
+ return result
1079
+ end
1080
+ rescue ::Gapic::Rest::Error => e
1081
+ raise ::Google::Cloud::Error.from_error(e)
1082
+ end
1083
+
1084
+ ##
1085
+ # Deletes an agent pool.
1086
+ #
1087
+ # @overload delete_agent_pool(request, options = nil)
1088
+ # Pass arguments to `delete_agent_pool` via a request object, either of type
1089
+ # {::Google::Cloud::StorageTransfer::V1::DeleteAgentPoolRequest} or an equivalent Hash.
1090
+ #
1091
+ # @param request [::Google::Cloud::StorageTransfer::V1::DeleteAgentPoolRequest, ::Hash]
1092
+ # A request object representing the call parameters. Required. To specify no
1093
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1094
+ # @param options [::Gapic::CallOptions, ::Hash]
1095
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
1096
+ #
1097
+ # @overload delete_agent_pool(name: nil)
1098
+ # Pass arguments to `delete_agent_pool` via keyword arguments. Note that at
1099
+ # least one keyword argument is required. To specify no parameters, or to keep all
1100
+ # the default parameter values, pass an empty Hash as a request object (see above).
1101
+ #
1102
+ # @param name [::String]
1103
+ # Required. The name of the agent pool to delete.
1104
+ # @yield [result, operation] Access the result along with the TransportOperation object
1105
+ # @yieldparam result [::Google::Protobuf::Empty]
1106
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
1107
+ #
1108
+ # @return [::Google::Protobuf::Empty]
1109
+ #
1110
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
1111
+ def delete_agent_pool request, options = nil
1112
+ raise ::ArgumentError, "request must be provided" if request.nil?
1113
+
1114
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::StorageTransfer::V1::DeleteAgentPoolRequest
1115
+
1116
+ # Converts hash and nil to an options object
1117
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1118
+
1119
+ # Customize the options with defaults
1120
+ call_metadata = @config.rpcs.delete_agent_pool.metadata.to_h
1121
+
1122
+ # Set x-goog-api-client and x-goog-user-project headers
1123
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1124
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1125
+ gapic_version: ::Google::Cloud::StorageTransfer::V1::VERSION,
1126
+ transports_version_send: [:rest]
1127
+
1128
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1129
+
1130
+ options.apply_defaults timeout: @config.rpcs.delete_agent_pool.timeout,
1131
+ metadata: call_metadata,
1132
+ retry_policy: @config.rpcs.delete_agent_pool.retry_policy
1133
+
1134
+ options.apply_defaults timeout: @config.timeout,
1135
+ metadata: @config.metadata,
1136
+ retry_policy: @config.retry_policy
1137
+
1138
+ @storage_transfer_service_stub.delete_agent_pool request, options do |result, operation|
1139
+ yield result, operation if block_given?
1140
+ return result
1141
+ end
1142
+ rescue ::Gapic::Rest::Error => e
1143
+ raise ::Google::Cloud::Error.from_error(e)
1144
+ end
1145
+
1146
+ ##
1147
+ # Configuration class for the StorageTransferService REST API.
1148
+ #
1149
+ # This class represents the configuration for StorageTransferService REST,
1150
+ # providing control over timeouts, retry behavior, logging, transport
1151
+ # parameters, and other low-level controls. Certain parameters can also be
1152
+ # applied individually to specific RPCs. See
1153
+ # {::Google::Cloud::StorageTransfer::V1::StorageTransferService::Rest::Client::Configuration::Rpcs}
1154
+ # for a list of RPCs that can be configured independently.
1155
+ #
1156
+ # Configuration can be applied globally to all clients, or to a single client
1157
+ # on construction.
1158
+ #
1159
+ # @example
1160
+ #
1161
+ # # Modify the global config, setting the timeout for
1162
+ # # get_google_service_account to 20 seconds,
1163
+ # # and all remaining timeouts to 10 seconds.
1164
+ # ::Google::Cloud::StorageTransfer::V1::StorageTransferService::Rest::Client.configure do |config|
1165
+ # config.timeout = 10.0
1166
+ # config.rpcs.get_google_service_account.timeout = 20.0
1167
+ # end
1168
+ #
1169
+ # # Apply the above configuration only to a new client.
1170
+ # client = ::Google::Cloud::StorageTransfer::V1::StorageTransferService::Rest::Client.new do |config|
1171
+ # config.timeout = 10.0
1172
+ # config.rpcs.get_google_service_account.timeout = 20.0
1173
+ # end
1174
+ #
1175
+ # @!attribute [rw] endpoint
1176
+ # The hostname or hostname:port of the service endpoint.
1177
+ # Defaults to `"storagetransfer.googleapis.com"`.
1178
+ # @return [::String]
1179
+ # @!attribute [rw] credentials
1180
+ # Credentials to send with calls. You may provide any of the following types:
1181
+ # * (`String`) The path to a service account key file in JSON format
1182
+ # * (`Hash`) A service account key as a Hash
1183
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
1184
+ # (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
1185
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
1186
+ # (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
1187
+ # * (`nil`) indicating no credentials
1188
+ # @return [::Object]
1189
+ # @!attribute [rw] scope
1190
+ # The OAuth scopes
1191
+ # @return [::Array<::String>]
1192
+ # @!attribute [rw] lib_name
1193
+ # The library name as recorded in instrumentation and logging
1194
+ # @return [::String]
1195
+ # @!attribute [rw] lib_version
1196
+ # The library version as recorded in instrumentation and logging
1197
+ # @return [::String]
1198
+ # @!attribute [rw] timeout
1199
+ # The call timeout in seconds.
1200
+ # @return [::Numeric]
1201
+ # @!attribute [rw] metadata
1202
+ # Additional headers to be sent with the call.
1203
+ # @return [::Hash{::Symbol=>::String}]
1204
+ # @!attribute [rw] retry_policy
1205
+ # The retry policy. The value is a hash with the following keys:
1206
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
1207
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
1208
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
1209
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
1210
+ # trigger a retry.
1211
+ # @return [::Hash]
1212
+ # @!attribute [rw] quota_project
1213
+ # A separate project against which to charge quota.
1214
+ # @return [::String]
1215
+ #
1216
+ class Configuration
1217
+ extend ::Gapic::Config
1218
+
1219
+ config_attr :endpoint, "storagetransfer.googleapis.com", ::String
1220
+ config_attr :credentials, nil do |value|
1221
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
1222
+ allowed.any? { |klass| klass === value }
1223
+ end
1224
+ config_attr :scope, nil, ::String, ::Array, nil
1225
+ config_attr :lib_name, nil, ::String, nil
1226
+ config_attr :lib_version, nil, ::String, nil
1227
+ config_attr :timeout, nil, ::Numeric, nil
1228
+ config_attr :metadata, nil, ::Hash, nil
1229
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
1230
+ config_attr :quota_project, nil, ::String, nil
1231
+
1232
+ # @private
1233
+ def initialize parent_config = nil
1234
+ @parent_config = parent_config unless parent_config.nil?
1235
+
1236
+ yield self if block_given?
1237
+ end
1238
+
1239
+ ##
1240
+ # Configurations for individual RPCs
1241
+ # @return [Rpcs]
1242
+ #
1243
+ def rpcs
1244
+ @rpcs ||= begin
1245
+ parent_rpcs = nil
1246
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
1247
+ Rpcs.new parent_rpcs
1248
+ end
1249
+ end
1250
+
1251
+ ##
1252
+ # Configuration RPC class for the StorageTransferService API.
1253
+ #
1254
+ # Includes fields providing the configuration for each RPC in this service.
1255
+ # Each configuration object is of type `Gapic::Config::Method` and includes
1256
+ # the following configuration fields:
1257
+ #
1258
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
1259
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
1260
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
1261
+ # include the following keys:
1262
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
1263
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
1264
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
1265
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
1266
+ # trigger a retry.
1267
+ #
1268
+ class Rpcs
1269
+ ##
1270
+ # RPC-specific configuration for `get_google_service_account`
1271
+ # @return [::Gapic::Config::Method]
1272
+ #
1273
+ attr_reader :get_google_service_account
1274
+ ##
1275
+ # RPC-specific configuration for `create_transfer_job`
1276
+ # @return [::Gapic::Config::Method]
1277
+ #
1278
+ attr_reader :create_transfer_job
1279
+ ##
1280
+ # RPC-specific configuration for `update_transfer_job`
1281
+ # @return [::Gapic::Config::Method]
1282
+ #
1283
+ attr_reader :update_transfer_job
1284
+ ##
1285
+ # RPC-specific configuration for `get_transfer_job`
1286
+ # @return [::Gapic::Config::Method]
1287
+ #
1288
+ attr_reader :get_transfer_job
1289
+ ##
1290
+ # RPC-specific configuration for `list_transfer_jobs`
1291
+ # @return [::Gapic::Config::Method]
1292
+ #
1293
+ attr_reader :list_transfer_jobs
1294
+ ##
1295
+ # RPC-specific configuration for `pause_transfer_operation`
1296
+ # @return [::Gapic::Config::Method]
1297
+ #
1298
+ attr_reader :pause_transfer_operation
1299
+ ##
1300
+ # RPC-specific configuration for `resume_transfer_operation`
1301
+ # @return [::Gapic::Config::Method]
1302
+ #
1303
+ attr_reader :resume_transfer_operation
1304
+ ##
1305
+ # RPC-specific configuration for `run_transfer_job`
1306
+ # @return [::Gapic::Config::Method]
1307
+ #
1308
+ attr_reader :run_transfer_job
1309
+ ##
1310
+ # RPC-specific configuration for `delete_transfer_job`
1311
+ # @return [::Gapic::Config::Method]
1312
+ #
1313
+ attr_reader :delete_transfer_job
1314
+ ##
1315
+ # RPC-specific configuration for `create_agent_pool`
1316
+ # @return [::Gapic::Config::Method]
1317
+ #
1318
+ attr_reader :create_agent_pool
1319
+ ##
1320
+ # RPC-specific configuration for `update_agent_pool`
1321
+ # @return [::Gapic::Config::Method]
1322
+ #
1323
+ attr_reader :update_agent_pool
1324
+ ##
1325
+ # RPC-specific configuration for `get_agent_pool`
1326
+ # @return [::Gapic::Config::Method]
1327
+ #
1328
+ attr_reader :get_agent_pool
1329
+ ##
1330
+ # RPC-specific configuration for `list_agent_pools`
1331
+ # @return [::Gapic::Config::Method]
1332
+ #
1333
+ attr_reader :list_agent_pools
1334
+ ##
1335
+ # RPC-specific configuration for `delete_agent_pool`
1336
+ # @return [::Gapic::Config::Method]
1337
+ #
1338
+ attr_reader :delete_agent_pool
1339
+
1340
+ # @private
1341
+ def initialize parent_rpcs = nil
1342
+ get_google_service_account_config = parent_rpcs.get_google_service_account if parent_rpcs.respond_to? :get_google_service_account
1343
+ @get_google_service_account = ::Gapic::Config::Method.new get_google_service_account_config
1344
+ create_transfer_job_config = parent_rpcs.create_transfer_job if parent_rpcs.respond_to? :create_transfer_job
1345
+ @create_transfer_job = ::Gapic::Config::Method.new create_transfer_job_config
1346
+ update_transfer_job_config = parent_rpcs.update_transfer_job if parent_rpcs.respond_to? :update_transfer_job
1347
+ @update_transfer_job = ::Gapic::Config::Method.new update_transfer_job_config
1348
+ get_transfer_job_config = parent_rpcs.get_transfer_job if parent_rpcs.respond_to? :get_transfer_job
1349
+ @get_transfer_job = ::Gapic::Config::Method.new get_transfer_job_config
1350
+ list_transfer_jobs_config = parent_rpcs.list_transfer_jobs if parent_rpcs.respond_to? :list_transfer_jobs
1351
+ @list_transfer_jobs = ::Gapic::Config::Method.new list_transfer_jobs_config
1352
+ pause_transfer_operation_config = parent_rpcs.pause_transfer_operation if parent_rpcs.respond_to? :pause_transfer_operation
1353
+ @pause_transfer_operation = ::Gapic::Config::Method.new pause_transfer_operation_config
1354
+ resume_transfer_operation_config = parent_rpcs.resume_transfer_operation if parent_rpcs.respond_to? :resume_transfer_operation
1355
+ @resume_transfer_operation = ::Gapic::Config::Method.new resume_transfer_operation_config
1356
+ run_transfer_job_config = parent_rpcs.run_transfer_job if parent_rpcs.respond_to? :run_transfer_job
1357
+ @run_transfer_job = ::Gapic::Config::Method.new run_transfer_job_config
1358
+ delete_transfer_job_config = parent_rpcs.delete_transfer_job if parent_rpcs.respond_to? :delete_transfer_job
1359
+ @delete_transfer_job = ::Gapic::Config::Method.new delete_transfer_job_config
1360
+ create_agent_pool_config = parent_rpcs.create_agent_pool if parent_rpcs.respond_to? :create_agent_pool
1361
+ @create_agent_pool = ::Gapic::Config::Method.new create_agent_pool_config
1362
+ update_agent_pool_config = parent_rpcs.update_agent_pool if parent_rpcs.respond_to? :update_agent_pool
1363
+ @update_agent_pool = ::Gapic::Config::Method.new update_agent_pool_config
1364
+ get_agent_pool_config = parent_rpcs.get_agent_pool if parent_rpcs.respond_to? :get_agent_pool
1365
+ @get_agent_pool = ::Gapic::Config::Method.new get_agent_pool_config
1366
+ list_agent_pools_config = parent_rpcs.list_agent_pools if parent_rpcs.respond_to? :list_agent_pools
1367
+ @list_agent_pools = ::Gapic::Config::Method.new list_agent_pools_config
1368
+ delete_agent_pool_config = parent_rpcs.delete_agent_pool if parent_rpcs.respond_to? :delete_agent_pool
1369
+ @delete_agent_pool = ::Gapic::Config::Method.new delete_agent_pool_config
1370
+
1371
+ yield self if block_given?
1372
+ end
1373
+ end
1374
+ end
1375
+ end
1376
+ end
1377
+ end
1378
+ end
1379
+ end
1380
+ end
1381
+ end