google-cloud-storage_transfer-v1 0.1.0 → 0.2.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.
@@ -32,6 +32,8 @@ module Google
32
32
  # source external to Google to a Cloud Storage bucket.
33
33
  #
34
34
  class Client
35
+ include Paths
36
+
35
37
  # @private
36
38
  attr_reader :storage_transfer_service_stub
37
39
 
@@ -64,7 +66,7 @@ module Google
64
66
  end
65
67
  default_config = Client::Configuration.new parent_config
66
68
 
67
- default_config.timeout = 60.0
69
+ default_config.timeout = 30.0
68
70
 
69
71
  default_config
70
72
  end
@@ -137,6 +139,7 @@ module Google
137
139
 
138
140
  @operations_client = Operations.new do |config|
139
141
  config.credentials = credentials
142
+ config.quota_project = @quota_project_id
140
143
  config.endpoint = @config.endpoint
141
144
  end
142
145
 
@@ -162,7 +165,7 @@ module Google
162
165
  # Returns the Google service account that is used by Storage Transfer
163
166
  # Service to access buckets in the project where transfers
164
167
  # run or in other projects. Each Google service account is associated
165
- # with one Google Cloud Platform Console project. Users
168
+ # with one Google Cloud project. Users
166
169
  # should add this service account to the Google Cloud Storage bucket
167
170
  # ACLs to grant access to Storage Transfer Service. This service
168
171
  # account is created and owned by Storage Transfer Service and can
@@ -184,8 +187,8 @@ module Google
184
187
  # the default parameter values, pass an empty Hash as a request object (see above).
185
188
  #
186
189
  # @param project_id [::String]
187
- # Required. The ID of the Google Cloud Platform Console project that the
188
- # Google service account is associated with.
190
+ # Required. The ID of the Google Cloud project that the Google service
191
+ # account is associated with.
189
192
  #
190
193
  # @yield [response, operation] Access the result along with the RPC operation
191
194
  # @yieldparam response [::Google::Cloud::StorageTransfer::V1::GoogleServiceAccount]
@@ -195,6 +198,21 @@ module Google
195
198
  #
196
199
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
197
200
  #
201
+ # @example Basic example
202
+ # require "google/cloud/storage_transfer/v1"
203
+ #
204
+ # # Create a client object. The client can be reused for multiple calls.
205
+ # client = Google::Cloud::StorageTransfer::V1::StorageTransferService::Client.new
206
+ #
207
+ # # Create a request. To set request fields, pass in keyword arguments.
208
+ # request = Google::Cloud::StorageTransfer::V1::GetGoogleServiceAccountRequest.new
209
+ #
210
+ # # Call the get_google_service_account method.
211
+ # result = client.get_google_service_account request
212
+ #
213
+ # # The returned object is of type Google::Cloud::StorageTransfer::V1::GoogleServiceAccount.
214
+ # p result
215
+ #
198
216
  def get_google_service_account request, options = nil
199
217
  raise ::ArgumentError, "request must be provided" if request.nil?
200
218
 
@@ -212,9 +230,11 @@ module Google
212
230
  gapic_version: ::Google::Cloud::StorageTransfer::V1::VERSION
213
231
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
214
232
 
215
- header_params = {
216
- "project_id" => request.project_id
217
- }
233
+ header_params = {}
234
+ if request.project_id
235
+ header_params["project_id"] = request.project_id
236
+ end
237
+
218
238
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
219
239
  metadata[:"x-goog-request-params"] ||= request_params_header
220
240
 
@@ -263,6 +283,21 @@ module Google
263
283
  #
264
284
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
265
285
  #
286
+ # @example Basic example
287
+ # require "google/cloud/storage_transfer/v1"
288
+ #
289
+ # # Create a client object. The client can be reused for multiple calls.
290
+ # client = Google::Cloud::StorageTransfer::V1::StorageTransferService::Client.new
291
+ #
292
+ # # Create a request. To set request fields, pass in keyword arguments.
293
+ # request = Google::Cloud::StorageTransfer::V1::CreateTransferJobRequest.new
294
+ #
295
+ # # Call the create_transfer_job method.
296
+ # result = client.create_transfer_job request
297
+ #
298
+ # # The returned object is of type Google::Cloud::StorageTransfer::V1::TransferJob.
299
+ # p result
300
+ #
266
301
  def create_transfer_job request, options = nil
267
302
  raise ::ArgumentError, "request must be provided" if request.nil?
268
303
 
@@ -300,8 +335,8 @@ module Google
300
335
  # Updates a transfer job. Updating a job's transfer spec does not affect
301
336
  # transfer operations that are running already.
302
337
  #
303
- # **Note:** The job's {::Google::Cloud::StorageTransfer::V1::TransferJob#status status}
304
- # field can be modified using this RPC (for example, to set a job's status to
338
+ # **Note:** The job's {::Google::Cloud::StorageTransfer::V1::TransferJob#status status} field can be modified
339
+ # using this RPC (for example, to set a job's status to
305
340
  # {::Google::Cloud::StorageTransfer::V1::TransferJob::Status::DELETED DELETED},
306
341
  # {::Google::Cloud::StorageTransfer::V1::TransferJob::Status::DISABLED DISABLED}, or
307
342
  # {::Google::Cloud::StorageTransfer::V1::TransferJob::Status::ENABLED ENABLED}).
@@ -324,19 +359,18 @@ module Google
324
359
  # @param job_name [::String]
325
360
  # Required. The name of job to update.
326
361
  # @param project_id [::String]
327
- # Required. The ID of the Google Cloud Platform Console project that owns the
362
+ # Required. The ID of the Google Cloud project that owns the
328
363
  # job.
329
364
  # @param transfer_job [::Google::Cloud::StorageTransfer::V1::TransferJob, ::Hash]
330
- # Required. The job to update. `transferJob` is expected to specify only
331
- # four fields:
332
- # {::Google::Cloud::StorageTransfer::V1::TransferJob#description description},
365
+ # Required. The job to update. `transferJob` is expected to specify one or more of
366
+ # five fields: {::Google::Cloud::StorageTransfer::V1::TransferJob#description description},
333
367
  # {::Google::Cloud::StorageTransfer::V1::TransferJob#transfer_spec transfer_spec},
334
368
  # {::Google::Cloud::StorageTransfer::V1::TransferJob#notification_config notification_config},
335
- # and {::Google::Cloud::StorageTransfer::V1::TransferJob#status status}. An
336
- # `UpdateTransferJobRequest` that specifies other fields are rejected with
337
- # the error {::Google::Rpc::Code::INVALID_ARGUMENT INVALID_ARGUMENT}. Updating a
338
- # job status to
339
- # {::Google::Cloud::StorageTransfer::V1::TransferJob::Status::DELETED DELETED} requires
369
+ # {::Google::Cloud::StorageTransfer::V1::TransferJob#logging_config logging_config}, and
370
+ # {::Google::Cloud::StorageTransfer::V1::TransferJob#status status}. An `UpdateTransferJobRequest` that specifies
371
+ # other fields are rejected with the error
372
+ # {::Google::Rpc::Code::INVALID_ARGUMENT INVALID_ARGUMENT}. Updating a job status
373
+ # to {::Google::Cloud::StorageTransfer::V1::TransferJob::Status::DELETED DELETED} requires
340
374
  # `storagetransfer.jobs.delete` permissions.
341
375
  # @param update_transfer_job_field_mask [::Google::Protobuf::FieldMask, ::Hash]
342
376
  # The field mask of the fields in `transferJob` that are to be updated in
@@ -344,10 +378,10 @@ module Google
344
378
  # {::Google::Cloud::StorageTransfer::V1::TransferJob#description description},
345
379
  # {::Google::Cloud::StorageTransfer::V1::TransferJob#transfer_spec transfer_spec},
346
380
  # {::Google::Cloud::StorageTransfer::V1::TransferJob#notification_config notification_config},
347
- # and {::Google::Cloud::StorageTransfer::V1::TransferJob#status status}. To update the
348
- # `transfer_spec` of the job, a complete transfer specification must be
349
- # provided. An incomplete specification missing any required fields is
350
- # rejected with the error
381
+ # {::Google::Cloud::StorageTransfer::V1::TransferJob#logging_config logging_config}, and
382
+ # {::Google::Cloud::StorageTransfer::V1::TransferJob#status status}. To update the `transfer_spec` of the job, a
383
+ # complete transfer specification must be provided. An incomplete
384
+ # specification missing any required fields is rejected with the error
351
385
  # {::Google::Rpc::Code::INVALID_ARGUMENT INVALID_ARGUMENT}.
352
386
  #
353
387
  # @yield [response, operation] Access the result along with the RPC operation
@@ -358,6 +392,21 @@ module Google
358
392
  #
359
393
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
360
394
  #
395
+ # @example Basic example
396
+ # require "google/cloud/storage_transfer/v1"
397
+ #
398
+ # # Create a client object. The client can be reused for multiple calls.
399
+ # client = Google::Cloud::StorageTransfer::V1::StorageTransferService::Client.new
400
+ #
401
+ # # Create a request. To set request fields, pass in keyword arguments.
402
+ # request = Google::Cloud::StorageTransfer::V1::UpdateTransferJobRequest.new
403
+ #
404
+ # # Call the update_transfer_job method.
405
+ # result = client.update_transfer_job request
406
+ #
407
+ # # The returned object is of type Google::Cloud::StorageTransfer::V1::TransferJob.
408
+ # p result
409
+ #
361
410
  def update_transfer_job request, options = nil
362
411
  raise ::ArgumentError, "request must be provided" if request.nil?
363
412
 
@@ -375,9 +424,11 @@ module Google
375
424
  gapic_version: ::Google::Cloud::StorageTransfer::V1::VERSION
376
425
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
377
426
 
378
- header_params = {
379
- "job_name" => request.job_name
380
- }
427
+ header_params = {}
428
+ if request.job_name
429
+ header_params["job_name"] = request.job_name
430
+ end
431
+
381
432
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
382
433
  metadata[:"x-goog-request-params"] ||= request_params_header
383
434
 
@@ -416,10 +467,9 @@ module Google
416
467
  # the default parameter values, pass an empty Hash as a request object (see above).
417
468
  #
418
469
  # @param job_name [::String]
419
- # Required.
420
- # The job to get.
470
+ # Required. The job to get.
421
471
  # @param project_id [::String]
422
- # Required. The ID of the Google Cloud Platform Console project that owns the
472
+ # Required. The ID of the Google Cloud project that owns the
423
473
  # job.
424
474
  #
425
475
  # @yield [response, operation] Access the result along with the RPC operation
@@ -430,6 +480,21 @@ module Google
430
480
  #
431
481
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
432
482
  #
483
+ # @example Basic example
484
+ # require "google/cloud/storage_transfer/v1"
485
+ #
486
+ # # Create a client object. The client can be reused for multiple calls.
487
+ # client = Google::Cloud::StorageTransfer::V1::StorageTransferService::Client.new
488
+ #
489
+ # # Create a request. To set request fields, pass in keyword arguments.
490
+ # request = Google::Cloud::StorageTransfer::V1::GetTransferJobRequest.new
491
+ #
492
+ # # Call the get_transfer_job method.
493
+ # result = client.get_transfer_job request
494
+ #
495
+ # # The returned object is of type Google::Cloud::StorageTransfer::V1::TransferJob.
496
+ # p result
497
+ #
433
498
  def get_transfer_job request, options = nil
434
499
  raise ::ArgumentError, "request must be provided" if request.nil?
435
500
 
@@ -447,9 +512,11 @@ module Google
447
512
  gapic_version: ::Google::Cloud::StorageTransfer::V1::VERSION
448
513
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
449
514
 
450
- header_params = {
451
- "job_name" => request.job_name
452
- }
515
+ header_params = {}
516
+ if request.job_name
517
+ header_params["job_name"] = request.job_name
518
+ end
519
+
453
520
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
454
521
  metadata[:"x-goog-request-params"] ||= request_params_header
455
522
 
@@ -513,6 +580,27 @@ module Google
513
580
  #
514
581
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
515
582
  #
583
+ # @example Basic example
584
+ # require "google/cloud/storage_transfer/v1"
585
+ #
586
+ # # Create a client object. The client can be reused for multiple calls.
587
+ # client = Google::Cloud::StorageTransfer::V1::StorageTransferService::Client.new
588
+ #
589
+ # # Create a request. To set request fields, pass in keyword arguments.
590
+ # request = Google::Cloud::StorageTransfer::V1::ListTransferJobsRequest.new
591
+ #
592
+ # # Call the list_transfer_jobs method.
593
+ # result = client.list_transfer_jobs request
594
+ #
595
+ # # The returned object is of type Gapic::PagedEnumerable. You can
596
+ # # iterate over all elements by calling #each, and the enumerable
597
+ # # will lazily make API calls to fetch subsequent pages. Other
598
+ # # methods are also available for managing paging directly.
599
+ # result.each do |response|
600
+ # # Each element is of type ::Google::Cloud::StorageTransfer::V1::TransferJob.
601
+ # p response
602
+ # end
603
+ #
516
604
  def list_transfer_jobs request, options = nil
517
605
  raise ::ArgumentError, "request must be provided" if request.nil?
518
606
 
@@ -576,6 +664,21 @@ module Google
576
664
  #
577
665
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
578
666
  #
667
+ # @example Basic example
668
+ # require "google/cloud/storage_transfer/v1"
669
+ #
670
+ # # Create a client object. The client can be reused for multiple calls.
671
+ # client = Google::Cloud::StorageTransfer::V1::StorageTransferService::Client.new
672
+ #
673
+ # # Create a request. To set request fields, pass in keyword arguments.
674
+ # request = Google::Cloud::StorageTransfer::V1::PauseTransferOperationRequest.new
675
+ #
676
+ # # Call the pause_transfer_operation method.
677
+ # result = client.pause_transfer_operation request
678
+ #
679
+ # # The returned object is of type Google::Protobuf::Empty.
680
+ # p result
681
+ #
579
682
  def pause_transfer_operation request, options = nil
580
683
  raise ::ArgumentError, "request must be provided" if request.nil?
581
684
 
@@ -593,9 +696,11 @@ module Google
593
696
  gapic_version: ::Google::Cloud::StorageTransfer::V1::VERSION
594
697
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
595
698
 
596
- header_params = {
597
- "name" => request.name
598
- }
699
+ header_params = {}
700
+ if request.name
701
+ header_params["name"] = request.name
702
+ end
703
+
599
704
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
600
705
  metadata[:"x-goog-request-params"] ||= request_params_header
601
706
 
@@ -644,6 +749,21 @@ module Google
644
749
  #
645
750
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
646
751
  #
752
+ # @example Basic example
753
+ # require "google/cloud/storage_transfer/v1"
754
+ #
755
+ # # Create a client object. The client can be reused for multiple calls.
756
+ # client = Google::Cloud::StorageTransfer::V1::StorageTransferService::Client.new
757
+ #
758
+ # # Create a request. To set request fields, pass in keyword arguments.
759
+ # request = Google::Cloud::StorageTransfer::V1::ResumeTransferOperationRequest.new
760
+ #
761
+ # # Call the resume_transfer_operation method.
762
+ # result = client.resume_transfer_operation request
763
+ #
764
+ # # The returned object is of type Google::Protobuf::Empty.
765
+ # p result
766
+ #
647
767
  def resume_transfer_operation request, options = nil
648
768
  raise ::ArgumentError, "request must be provided" if request.nil?
649
769
 
@@ -661,9 +781,11 @@ module Google
661
781
  gapic_version: ::Google::Cloud::StorageTransfer::V1::VERSION
662
782
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
663
783
 
664
- header_params = {
665
- "name" => request.name
666
- }
784
+ header_params = {}
785
+ if request.name
786
+ header_params["name"] = request.name
787
+ end
788
+
667
789
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
668
790
  metadata[:"x-goog-request-params"] ||= request_params_header
669
791
 
@@ -686,7 +808,7 @@ module Google
686
808
  ##
687
809
  # Attempts to start a new TransferOperation for the current TransferJob. A
688
810
  # TransferJob has a maximum of one active TransferOperation. If this method
689
- # is called while a TransferOperation is active, an error wil be returned.
811
+ # is called while a TransferOperation is active, an error will be returned.
690
812
  #
691
813
  # @overload run_transfer_job(request, options = nil)
692
814
  # Pass arguments to `run_transfer_job` via a request object, either of type
@@ -706,8 +828,8 @@ module Google
706
828
  # @param job_name [::String]
707
829
  # Required. The name of the transfer job.
708
830
  # @param project_id [::String]
709
- # Required. The ID of the Google Cloud Platform Console project that owns the
710
- # transfer job.
831
+ # Required. The ID of the Google Cloud project that owns the transfer
832
+ # job.
711
833
  #
712
834
  # @yield [response, operation] Access the result along with the RPC operation
713
835
  # @yieldparam response [::Gapic::Operation]
@@ -717,6 +839,28 @@ module Google
717
839
  #
718
840
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
719
841
  #
842
+ # @example Basic example
843
+ # require "google/cloud/storage_transfer/v1"
844
+ #
845
+ # # Create a client object. The client can be reused for multiple calls.
846
+ # client = Google::Cloud::StorageTransfer::V1::StorageTransferService::Client.new
847
+ #
848
+ # # Create a request. To set request fields, pass in keyword arguments.
849
+ # request = Google::Cloud::StorageTransfer::V1::RunTransferJobRequest.new
850
+ #
851
+ # # Call the run_transfer_job method.
852
+ # result = client.run_transfer_job request
853
+ #
854
+ # # The returned object is of type Gapic::Operation. You can use this
855
+ # # object to check the status of an operation, cancel it, or wait
856
+ # # for results. Here is how to block until completion:
857
+ # result.wait_until_done! timeout: 60
858
+ # if result.response?
859
+ # p result.response
860
+ # else
861
+ # puts "Error!"
862
+ # end
863
+ #
720
864
  def run_transfer_job request, options = nil
721
865
  raise ::ArgumentError, "request must be provided" if request.nil?
722
866
 
@@ -734,9 +878,11 @@ module Google
734
878
  gapic_version: ::Google::Cloud::StorageTransfer::V1::VERSION
735
879
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
736
880
 
737
- header_params = {
738
- "job_name" => request.job_name
739
- }
881
+ header_params = {}
882
+ if request.job_name
883
+ header_params["job_name"] = request.job_name
884
+ end
885
+
740
886
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
741
887
  metadata[:"x-goog-request-params"] ||= request_params_header
742
888
 
@@ -757,6 +903,486 @@ module Google
757
903
  raise ::Google::Cloud::Error.from_error(e)
758
904
  end
759
905
 
906
+ ##
907
+ # Creates an agent pool resource.
908
+ #
909
+ # @overload create_agent_pool(request, options = nil)
910
+ # Pass arguments to `create_agent_pool` via a request object, either of type
911
+ # {::Google::Cloud::StorageTransfer::V1::CreateAgentPoolRequest} or an equivalent Hash.
912
+ #
913
+ # @param request [::Google::Cloud::StorageTransfer::V1::CreateAgentPoolRequest, ::Hash]
914
+ # A request object representing the call parameters. Required. To specify no
915
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
916
+ # @param options [::Gapic::CallOptions, ::Hash]
917
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
918
+ #
919
+ # @overload create_agent_pool(project_id: nil, agent_pool: nil, agent_pool_id: nil)
920
+ # Pass arguments to `create_agent_pool` via keyword arguments. Note that at
921
+ # least one keyword argument is required. To specify no parameters, or to keep all
922
+ # the default parameter values, pass an empty Hash as a request object (see above).
923
+ #
924
+ # @param project_id [::String]
925
+ # Required. The ID of the Google Cloud project that owns the
926
+ # agent pool.
927
+ # @param agent_pool [::Google::Cloud::StorageTransfer::V1::AgentPool, ::Hash]
928
+ # Required. The agent pool to create.
929
+ # @param agent_pool_id [::String]
930
+ # Required. The ID of the agent pool to create.
931
+ #
932
+ # The `agent_pool_id` must meet the following requirements:
933
+ #
934
+ # * Length of 128 characters or less.
935
+ # * Not start with the string `goog`.
936
+ # * Start with a lowercase ASCII character, followed by:
937
+ # * Zero or more: lowercase Latin alphabet characters, numerals,
938
+ # hyphens (`-`), periods (`.`), underscores (`_`), or tildes (`~`).
939
+ # * One or more numerals or lowercase ASCII characters.
940
+ #
941
+ # As expressed by the regular expression:
942
+ # `^(?!goog)[a-z]([a-z0-9-._~]*[a-z0-9])?$`.
943
+ #
944
+ # @yield [response, operation] Access the result along with the RPC operation
945
+ # @yieldparam response [::Google::Cloud::StorageTransfer::V1::AgentPool]
946
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
947
+ #
948
+ # @return [::Google::Cloud::StorageTransfer::V1::AgentPool]
949
+ #
950
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
951
+ #
952
+ # @example Basic example
953
+ # require "google/cloud/storage_transfer/v1"
954
+ #
955
+ # # Create a client object. The client can be reused for multiple calls.
956
+ # client = Google::Cloud::StorageTransfer::V1::StorageTransferService::Client.new
957
+ #
958
+ # # Create a request. To set request fields, pass in keyword arguments.
959
+ # request = Google::Cloud::StorageTransfer::V1::CreateAgentPoolRequest.new
960
+ #
961
+ # # Call the create_agent_pool method.
962
+ # result = client.create_agent_pool request
963
+ #
964
+ # # The returned object is of type Google::Cloud::StorageTransfer::V1::AgentPool.
965
+ # p result
966
+ #
967
+ def create_agent_pool request, options = nil
968
+ raise ::ArgumentError, "request must be provided" if request.nil?
969
+
970
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::StorageTransfer::V1::CreateAgentPoolRequest
971
+
972
+ # Converts hash and nil to an options object
973
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
974
+
975
+ # Customize the options with defaults
976
+ metadata = @config.rpcs.create_agent_pool.metadata.to_h
977
+
978
+ # Set x-goog-api-client and x-goog-user-project headers
979
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
980
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
981
+ gapic_version: ::Google::Cloud::StorageTransfer::V1::VERSION
982
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
983
+
984
+ header_params = {}
985
+ if request.project_id
986
+ header_params["project_id"] = request.project_id
987
+ end
988
+
989
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
990
+ metadata[:"x-goog-request-params"] ||= request_params_header
991
+
992
+ options.apply_defaults timeout: @config.rpcs.create_agent_pool.timeout,
993
+ metadata: metadata,
994
+ retry_policy: @config.rpcs.create_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.call_rpc :create_agent_pool, request, options: options do |response, operation|
1001
+ yield response, operation if block_given?
1002
+ return response
1003
+ end
1004
+ rescue ::GRPC::BadStatus => e
1005
+ raise ::Google::Cloud::Error.from_error(e)
1006
+ end
1007
+
1008
+ ##
1009
+ # Updates an existing agent pool resource.
1010
+ #
1011
+ # @overload update_agent_pool(request, options = nil)
1012
+ # Pass arguments to `update_agent_pool` via a request object, either of type
1013
+ # {::Google::Cloud::StorageTransfer::V1::UpdateAgentPoolRequest} or an equivalent Hash.
1014
+ #
1015
+ # @param request [::Google::Cloud::StorageTransfer::V1::UpdateAgentPoolRequest, ::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 update_agent_pool(agent_pool: nil, update_mask: nil)
1022
+ # Pass arguments to `update_agent_pool` 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 agent_pool [::Google::Cloud::StorageTransfer::V1::AgentPool, ::Hash]
1027
+ # Required. The agent pool to update. `agent_pool` is expected to specify following
1028
+ # fields:
1029
+ #
1030
+ # * {::Google::Cloud::StorageTransfer::V1::AgentPool#name name}
1031
+ #
1032
+ # * {::Google::Cloud::StorageTransfer::V1::AgentPool#display_name display_name}
1033
+ #
1034
+ # * {::Google::Cloud::StorageTransfer::V1::AgentPool#bandwidth_limit bandwidth_limit}
1035
+ # An `UpdateAgentPoolRequest` with any other fields is rejected
1036
+ # with the error {::Google::Rpc::Code::INVALID_ARGUMENT INVALID_ARGUMENT}.
1037
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
1038
+ # The [field mask]
1039
+ # (https://developers.google.com/protocol-buffers/docs/reference/google.protobuf)
1040
+ # of the fields in `agentPool` to update in this request.
1041
+ # The following `agentPool` fields can be updated:
1042
+ #
1043
+ # * {::Google::Cloud::StorageTransfer::V1::AgentPool#display_name display_name}
1044
+ #
1045
+ # * {::Google::Cloud::StorageTransfer::V1::AgentPool#bandwidth_limit bandwidth_limit}
1046
+ #
1047
+ # @yield [response, operation] Access the result along with the RPC operation
1048
+ # @yieldparam response [::Google::Cloud::StorageTransfer::V1::AgentPool]
1049
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
1050
+ #
1051
+ # @return [::Google::Cloud::StorageTransfer::V1::AgentPool]
1052
+ #
1053
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
1054
+ #
1055
+ # @example Basic example
1056
+ # require "google/cloud/storage_transfer/v1"
1057
+ #
1058
+ # # Create a client object. The client can be reused for multiple calls.
1059
+ # client = Google::Cloud::StorageTransfer::V1::StorageTransferService::Client.new
1060
+ #
1061
+ # # Create a request. To set request fields, pass in keyword arguments.
1062
+ # request = Google::Cloud::StorageTransfer::V1::UpdateAgentPoolRequest.new
1063
+ #
1064
+ # # Call the update_agent_pool method.
1065
+ # result = client.update_agent_pool request
1066
+ #
1067
+ # # The returned object is of type Google::Cloud::StorageTransfer::V1::AgentPool.
1068
+ # p result
1069
+ #
1070
+ def update_agent_pool request, options = nil
1071
+ raise ::ArgumentError, "request must be provided" if request.nil?
1072
+
1073
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::StorageTransfer::V1::UpdateAgentPoolRequest
1074
+
1075
+ # Converts hash and nil to an options object
1076
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1077
+
1078
+ # Customize the options with defaults
1079
+ metadata = @config.rpcs.update_agent_pool.metadata.to_h
1080
+
1081
+ # Set x-goog-api-client and x-goog-user-project headers
1082
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1083
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1084
+ gapic_version: ::Google::Cloud::StorageTransfer::V1::VERSION
1085
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1086
+
1087
+ header_params = {}
1088
+ if request.agent_pool&.name
1089
+ header_params["agent_pool.name"] = request.agent_pool.name
1090
+ end
1091
+
1092
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1093
+ metadata[:"x-goog-request-params"] ||= request_params_header
1094
+
1095
+ options.apply_defaults timeout: @config.rpcs.update_agent_pool.timeout,
1096
+ metadata: metadata,
1097
+ retry_policy: @config.rpcs.update_agent_pool.retry_policy
1098
+
1099
+ options.apply_defaults timeout: @config.timeout,
1100
+ metadata: @config.metadata,
1101
+ retry_policy: @config.retry_policy
1102
+
1103
+ @storage_transfer_service_stub.call_rpc :update_agent_pool, request, options: options do |response, operation|
1104
+ yield response, operation if block_given?
1105
+ return response
1106
+ end
1107
+ rescue ::GRPC::BadStatus => e
1108
+ raise ::Google::Cloud::Error.from_error(e)
1109
+ end
1110
+
1111
+ ##
1112
+ # Gets an agent pool.
1113
+ #
1114
+ # @overload get_agent_pool(request, options = nil)
1115
+ # Pass arguments to `get_agent_pool` via a request object, either of type
1116
+ # {::Google::Cloud::StorageTransfer::V1::GetAgentPoolRequest} or an equivalent Hash.
1117
+ #
1118
+ # @param request [::Google::Cloud::StorageTransfer::V1::GetAgentPoolRequest, ::Hash]
1119
+ # A request object representing the call parameters. Required. To specify no
1120
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1121
+ # @param options [::Gapic::CallOptions, ::Hash]
1122
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
1123
+ #
1124
+ # @overload get_agent_pool(name: nil)
1125
+ # Pass arguments to `get_agent_pool` via keyword arguments. Note that at
1126
+ # least one keyword argument is required. To specify no parameters, or to keep all
1127
+ # the default parameter values, pass an empty Hash as a request object (see above).
1128
+ #
1129
+ # @param name [::String]
1130
+ # Required. The name of the agent pool to get.
1131
+ #
1132
+ # @yield [response, operation] Access the result along with the RPC operation
1133
+ # @yieldparam response [::Google::Cloud::StorageTransfer::V1::AgentPool]
1134
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
1135
+ #
1136
+ # @return [::Google::Cloud::StorageTransfer::V1::AgentPool]
1137
+ #
1138
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
1139
+ #
1140
+ # @example Basic example
1141
+ # require "google/cloud/storage_transfer/v1"
1142
+ #
1143
+ # # Create a client object. The client can be reused for multiple calls.
1144
+ # client = Google::Cloud::StorageTransfer::V1::StorageTransferService::Client.new
1145
+ #
1146
+ # # Create a request. To set request fields, pass in keyword arguments.
1147
+ # request = Google::Cloud::StorageTransfer::V1::GetAgentPoolRequest.new
1148
+ #
1149
+ # # Call the get_agent_pool method.
1150
+ # result = client.get_agent_pool request
1151
+ #
1152
+ # # The returned object is of type Google::Cloud::StorageTransfer::V1::AgentPool.
1153
+ # p result
1154
+ #
1155
+ def get_agent_pool request, options = nil
1156
+ raise ::ArgumentError, "request must be provided" if request.nil?
1157
+
1158
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::StorageTransfer::V1::GetAgentPoolRequest
1159
+
1160
+ # Converts hash and nil to an options object
1161
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1162
+
1163
+ # Customize the options with defaults
1164
+ metadata = @config.rpcs.get_agent_pool.metadata.to_h
1165
+
1166
+ # Set x-goog-api-client and x-goog-user-project headers
1167
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1168
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1169
+ gapic_version: ::Google::Cloud::StorageTransfer::V1::VERSION
1170
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1171
+
1172
+ header_params = {}
1173
+ if request.name
1174
+ header_params["name"] = request.name
1175
+ end
1176
+
1177
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1178
+ metadata[:"x-goog-request-params"] ||= request_params_header
1179
+
1180
+ options.apply_defaults timeout: @config.rpcs.get_agent_pool.timeout,
1181
+ metadata: metadata,
1182
+ retry_policy: @config.rpcs.get_agent_pool.retry_policy
1183
+
1184
+ options.apply_defaults timeout: @config.timeout,
1185
+ metadata: @config.metadata,
1186
+ retry_policy: @config.retry_policy
1187
+
1188
+ @storage_transfer_service_stub.call_rpc :get_agent_pool, request, options: options do |response, operation|
1189
+ yield response, operation if block_given?
1190
+ return response
1191
+ end
1192
+ rescue ::GRPC::BadStatus => e
1193
+ raise ::Google::Cloud::Error.from_error(e)
1194
+ end
1195
+
1196
+ ##
1197
+ # Lists agent pools.
1198
+ #
1199
+ # @overload list_agent_pools(request, options = nil)
1200
+ # Pass arguments to `list_agent_pools` via a request object, either of type
1201
+ # {::Google::Cloud::StorageTransfer::V1::ListAgentPoolsRequest} or an equivalent Hash.
1202
+ #
1203
+ # @param request [::Google::Cloud::StorageTransfer::V1::ListAgentPoolsRequest, ::Hash]
1204
+ # A request object representing the call parameters. Required. To specify no
1205
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1206
+ # @param options [::Gapic::CallOptions, ::Hash]
1207
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
1208
+ #
1209
+ # @overload list_agent_pools(project_id: nil, filter: nil, page_size: nil, page_token: nil)
1210
+ # Pass arguments to `list_agent_pools` via keyword arguments. Note that at
1211
+ # least one keyword argument is required. To specify no parameters, or to keep all
1212
+ # the default parameter values, pass an empty Hash as a request object (see above).
1213
+ #
1214
+ # @param project_id [::String]
1215
+ # Required. The ID of the Google Cloud project that owns the job.
1216
+ # @param filter [::String]
1217
+ # An optional list of query parameters specified as JSON text in the
1218
+ # form of:
1219
+ #
1220
+ # `{"agentPoolNames":["agentpool1","agentpool2",...]}`
1221
+ #
1222
+ # Since `agentPoolNames` support multiple values, its values must be
1223
+ # specified with array notation. When the filter is either empty or not
1224
+ # provided, the list returns all agent pools for the project.
1225
+ # @param page_size [::Integer]
1226
+ # The list page size. The max allowed value is `256`.
1227
+ # @param page_token [::String]
1228
+ # The list page token.
1229
+ #
1230
+ # @yield [response, operation] Access the result along with the RPC operation
1231
+ # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::StorageTransfer::V1::AgentPool>]
1232
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
1233
+ #
1234
+ # @return [::Gapic::PagedEnumerable<::Google::Cloud::StorageTransfer::V1::AgentPool>]
1235
+ #
1236
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
1237
+ #
1238
+ # @example Basic example
1239
+ # require "google/cloud/storage_transfer/v1"
1240
+ #
1241
+ # # Create a client object. The client can be reused for multiple calls.
1242
+ # client = Google::Cloud::StorageTransfer::V1::StorageTransferService::Client.new
1243
+ #
1244
+ # # Create a request. To set request fields, pass in keyword arguments.
1245
+ # request = Google::Cloud::StorageTransfer::V1::ListAgentPoolsRequest.new
1246
+ #
1247
+ # # Call the list_agent_pools method.
1248
+ # result = client.list_agent_pools request
1249
+ #
1250
+ # # The returned object is of type Gapic::PagedEnumerable. You can
1251
+ # # iterate over all elements by calling #each, and the enumerable
1252
+ # # will lazily make API calls to fetch subsequent pages. Other
1253
+ # # methods are also available for managing paging directly.
1254
+ # result.each do |response|
1255
+ # # Each element is of type ::Google::Cloud::StorageTransfer::V1::AgentPool.
1256
+ # p response
1257
+ # end
1258
+ #
1259
+ def list_agent_pools request, options = nil
1260
+ raise ::ArgumentError, "request must be provided" if request.nil?
1261
+
1262
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::StorageTransfer::V1::ListAgentPoolsRequest
1263
+
1264
+ # Converts hash and nil to an options object
1265
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1266
+
1267
+ # Customize the options with defaults
1268
+ metadata = @config.rpcs.list_agent_pools.metadata.to_h
1269
+
1270
+ # Set x-goog-api-client and x-goog-user-project headers
1271
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1272
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1273
+ gapic_version: ::Google::Cloud::StorageTransfer::V1::VERSION
1274
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1275
+
1276
+ header_params = {}
1277
+ if request.project_id
1278
+ header_params["project_id"] = request.project_id
1279
+ end
1280
+
1281
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1282
+ metadata[:"x-goog-request-params"] ||= request_params_header
1283
+
1284
+ options.apply_defaults timeout: @config.rpcs.list_agent_pools.timeout,
1285
+ metadata: metadata,
1286
+ retry_policy: @config.rpcs.list_agent_pools.retry_policy
1287
+
1288
+ options.apply_defaults timeout: @config.timeout,
1289
+ metadata: @config.metadata,
1290
+ retry_policy: @config.retry_policy
1291
+
1292
+ @storage_transfer_service_stub.call_rpc :list_agent_pools, request, options: options do |response, operation|
1293
+ response = ::Gapic::PagedEnumerable.new @storage_transfer_service_stub, :list_agent_pools, request, response, operation, options
1294
+ yield response, operation if block_given?
1295
+ return response
1296
+ end
1297
+ rescue ::GRPC::BadStatus => e
1298
+ raise ::Google::Cloud::Error.from_error(e)
1299
+ end
1300
+
1301
+ ##
1302
+ # Deletes an agent pool.
1303
+ #
1304
+ # @overload delete_agent_pool(request, options = nil)
1305
+ # Pass arguments to `delete_agent_pool` via a request object, either of type
1306
+ # {::Google::Cloud::StorageTransfer::V1::DeleteAgentPoolRequest} or an equivalent Hash.
1307
+ #
1308
+ # @param request [::Google::Cloud::StorageTransfer::V1::DeleteAgentPoolRequest, ::Hash]
1309
+ # A request object representing the call parameters. Required. To specify no
1310
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1311
+ # @param options [::Gapic::CallOptions, ::Hash]
1312
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
1313
+ #
1314
+ # @overload delete_agent_pool(name: nil)
1315
+ # Pass arguments to `delete_agent_pool` via keyword arguments. Note that at
1316
+ # least one keyword argument is required. To specify no parameters, or to keep all
1317
+ # the default parameter values, pass an empty Hash as a request object (see above).
1318
+ #
1319
+ # @param name [::String]
1320
+ # Required. The name of the agent pool to delete.
1321
+ #
1322
+ # @yield [response, operation] Access the result along with the RPC operation
1323
+ # @yieldparam response [::Google::Protobuf::Empty]
1324
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
1325
+ #
1326
+ # @return [::Google::Protobuf::Empty]
1327
+ #
1328
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
1329
+ #
1330
+ # @example Basic example
1331
+ # require "google/cloud/storage_transfer/v1"
1332
+ #
1333
+ # # Create a client object. The client can be reused for multiple calls.
1334
+ # client = Google::Cloud::StorageTransfer::V1::StorageTransferService::Client.new
1335
+ #
1336
+ # # Create a request. To set request fields, pass in keyword arguments.
1337
+ # request = Google::Cloud::StorageTransfer::V1::DeleteAgentPoolRequest.new
1338
+ #
1339
+ # # Call the delete_agent_pool method.
1340
+ # result = client.delete_agent_pool request
1341
+ #
1342
+ # # The returned object is of type Google::Protobuf::Empty.
1343
+ # p result
1344
+ #
1345
+ def delete_agent_pool request, options = nil
1346
+ raise ::ArgumentError, "request must be provided" if request.nil?
1347
+
1348
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::StorageTransfer::V1::DeleteAgentPoolRequest
1349
+
1350
+ # Converts hash and nil to an options object
1351
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1352
+
1353
+ # Customize the options with defaults
1354
+ metadata = @config.rpcs.delete_agent_pool.metadata.to_h
1355
+
1356
+ # Set x-goog-api-client and x-goog-user-project headers
1357
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1358
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1359
+ gapic_version: ::Google::Cloud::StorageTransfer::V1::VERSION
1360
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1361
+
1362
+ header_params = {}
1363
+ if request.name
1364
+ header_params["name"] = request.name
1365
+ end
1366
+
1367
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1368
+ metadata[:"x-goog-request-params"] ||= request_params_header
1369
+
1370
+ options.apply_defaults timeout: @config.rpcs.delete_agent_pool.timeout,
1371
+ metadata: metadata,
1372
+ retry_policy: @config.rpcs.delete_agent_pool.retry_policy
1373
+
1374
+ options.apply_defaults timeout: @config.timeout,
1375
+ metadata: @config.metadata,
1376
+ retry_policy: @config.retry_policy
1377
+
1378
+ @storage_transfer_service_stub.call_rpc :delete_agent_pool, request, options: options do |response, operation|
1379
+ yield response, operation if block_given?
1380
+ return response
1381
+ end
1382
+ rescue ::GRPC::BadStatus => e
1383
+ raise ::Google::Cloud::Error.from_error(e)
1384
+ end
1385
+
760
1386
  ##
761
1387
  # Configuration class for the StorageTransferService API.
762
1388
  #
@@ -932,6 +1558,31 @@ module Google
932
1558
  # @return [::Gapic::Config::Method]
933
1559
  #
934
1560
  attr_reader :run_transfer_job
1561
+ ##
1562
+ # RPC-specific configuration for `create_agent_pool`
1563
+ # @return [::Gapic::Config::Method]
1564
+ #
1565
+ attr_reader :create_agent_pool
1566
+ ##
1567
+ # RPC-specific configuration for `update_agent_pool`
1568
+ # @return [::Gapic::Config::Method]
1569
+ #
1570
+ attr_reader :update_agent_pool
1571
+ ##
1572
+ # RPC-specific configuration for `get_agent_pool`
1573
+ # @return [::Gapic::Config::Method]
1574
+ #
1575
+ attr_reader :get_agent_pool
1576
+ ##
1577
+ # RPC-specific configuration for `list_agent_pools`
1578
+ # @return [::Gapic::Config::Method]
1579
+ #
1580
+ attr_reader :list_agent_pools
1581
+ ##
1582
+ # RPC-specific configuration for `delete_agent_pool`
1583
+ # @return [::Gapic::Config::Method]
1584
+ #
1585
+ attr_reader :delete_agent_pool
935
1586
 
936
1587
  # @private
937
1588
  def initialize parent_rpcs = nil
@@ -951,6 +1602,16 @@ module Google
951
1602
  @resume_transfer_operation = ::Gapic::Config::Method.new resume_transfer_operation_config
952
1603
  run_transfer_job_config = parent_rpcs.run_transfer_job if parent_rpcs.respond_to? :run_transfer_job
953
1604
  @run_transfer_job = ::Gapic::Config::Method.new run_transfer_job_config
1605
+ create_agent_pool_config = parent_rpcs.create_agent_pool if parent_rpcs.respond_to? :create_agent_pool
1606
+ @create_agent_pool = ::Gapic::Config::Method.new create_agent_pool_config
1607
+ update_agent_pool_config = parent_rpcs.update_agent_pool if parent_rpcs.respond_to? :update_agent_pool
1608
+ @update_agent_pool = ::Gapic::Config::Method.new update_agent_pool_config
1609
+ get_agent_pool_config = parent_rpcs.get_agent_pool if parent_rpcs.respond_to? :get_agent_pool
1610
+ @get_agent_pool = ::Gapic::Config::Method.new get_agent_pool_config
1611
+ list_agent_pools_config = parent_rpcs.list_agent_pools if parent_rpcs.respond_to? :list_agent_pools
1612
+ @list_agent_pools = ::Gapic::Config::Method.new list_agent_pools_config
1613
+ delete_agent_pool_config = parent_rpcs.delete_agent_pool if parent_rpcs.respond_to? :delete_agent_pool
1614
+ @delete_agent_pool = ::Gapic::Config::Method.new delete_agent_pool_config
954
1615
 
955
1616
  yield self if block_given?
956
1617
  end