google-cloud-storage_transfer-v1 0.3.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 40ca77c02f4a6e403441548a57d2b36cf900798b38104168c38523a31b5c8c48
4
- data.tar.gz: 979478a9632e396f100c6c3baae7dcee3f66cfc5d8bd0f798b868089d5a3cbcf
3
+ metadata.gz: c56312327a5b6109f223205eac3f6aab3a7fdd9d7f108cedac8ac4df14300719
4
+ data.tar.gz: 6635a127cf70f9b8087720e7ee4f0c61e156e6b16f3e10c6adbcbd5187faa05f
5
5
  SHA512:
6
- metadata.gz: 5cc2ee55f3a694c9adeb843b4faea81709760989df0b9c2898ea751fee1d1f99c4e2ba6b560c875497d5f1d7ddc40f91dd2230b2910d5b9d2604a27f1128f185
7
- data.tar.gz: ff5dfdfeb9851fd8cf177f9162c1b5dbe5eef038ca8e8fc37957f5c6b6a0aac96fc4e45fbf8f00472101862da32bb5a73ecf620ad3f45970108e2a8044991b2f
6
+ metadata.gz: 7653113070f45bd525544710de7cf7e5c8eef71ed471f3558782a742f92bcc38edae80abdbf936d4f19f2498c1588e8bab163234d65a6c9af3e0d81579e28d8e
7
+ data.tar.gz: 000f8b4af98b20061cb2418dc278425b8e8316ec4bf7213a6892005c9cc32297335c68aafbba5162263b693345d643419194f5c85b54cc5f99efc2cb9bebdace
data/AUTHENTICATION.md CHANGED
@@ -112,7 +112,7 @@ credentials are discovered.
112
112
  To configure your system for this, simply:
113
113
 
114
114
  1. [Download and install the Cloud SDK](https://cloud.google.com/sdk)
115
- 2. Authenticate using OAuth 2.0 `$ gcloud auth login`
115
+ 2. Authenticate using OAuth 2.0 `$ gcloud auth application-default login`
116
116
  3. Write code as if already authenticated.
117
117
 
118
118
  **NOTE:** This is _not_ recommended for running in production. The Cloud SDK
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Ruby Client for the Storage Transfer Service V1 API
2
2
 
3
- API Client library for the Storage Transfer Service V1 API
3
+ Transfers data from external data sources to a Google Cloud Storage bucket or between Google Cloud Storage buckets.
4
4
 
5
5
  Storage Transfer Service allows you to quickly import online data into Cloud Storage. You can also set up a repeating schedule for transferring data, as well as transfer data within Cloud Storage, from one bucket to another.
6
6
 
@@ -46,7 +46,7 @@ for general usage information.
46
46
  ## Enabling Logging
47
47
 
48
48
  To enable logging for this library, set the logger for the underlying [gRPC](https://github.com/grpc/grpc/tree/master/src/ruby) library.
49
- The logger that you set may be a Ruby stdlib [`Logger`](https://ruby-doc.org/stdlib/libdoc/logger/rdoc/Logger.html) as shown below,
49
+ The logger that you set may be a Ruby stdlib [`Logger`](https://ruby-doc.org/current/stdlibs/logger/Logger.html) as shown below,
50
50
  or a [`Google::Cloud::Logging::Logger`](https://googleapis.dev/ruby/google-cloud-logging/latest)
51
51
  that will write logs to [Cloud Logging](https://cloud.google.com/logging/). See [grpc/logconfig.rb](https://github.com/grpc/grpc/blob/master/src/ruby/lib/grpc/logconfig.rb)
52
52
  and the gRPC [spec_helper.rb](https://github.com/grpc/grpc/blob/master/src/ruby/spec/spec_helper.rb) for additional information.
@@ -0,0 +1,37 @@
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/storage_transfer/v1/storage_transfer_service/rest"
20
+ require "google/cloud/storage_transfer/v1/version"
21
+
22
+ module Google
23
+ module Cloud
24
+ module StorageTransfer
25
+ ##
26
+ # To load just the REST part of this package, including all its services, and instantiate a REST client:
27
+ #
28
+ # @example
29
+ #
30
+ # require "google/cloud/storage_transfer/v1/rest"
31
+ # client = ::Google::Cloud::StorageTransfer::V1::StorageTransferService::Rest::Client.new
32
+ #
33
+ module V1
34
+ end
35
+ end
36
+ end
37
+ end
@@ -66,7 +66,12 @@ module Google
66
66
  end
67
67
  default_config = Client::Configuration.new parent_config
68
68
 
69
- default_config.timeout = 30.0
69
+ default_config.timeout = 60.0
70
+ default_config.retry_policy = {
71
+ initial_delay: 1.0, max_delay: 60.0, multiplier: 2, retry_codes: [14]
72
+ }
73
+
74
+ default_config.rpcs.create_transfer_job.timeout = 60.0
70
75
 
71
76
  default_config
72
77
  end
@@ -371,7 +376,7 @@ module Google
371
376
  # other fields are rejected with the error
372
377
  # {::Google::Rpc::Code::INVALID_ARGUMENT INVALID_ARGUMENT}. Updating a job status
373
378
  # to {::Google::Cloud::StorageTransfer::V1::TransferJob::Status::DELETED DELETED} requires
374
- # `storagetransfer.jobs.delete` permissions.
379
+ # `storagetransfer.jobs.delete` permission.
375
380
  # @param update_transfer_job_field_mask [::Google::Protobuf::FieldMask, ::Hash]
376
381
  # The field mask of the fields in `transferJob` that are to be updated in
377
382
  # this request. Fields in `transferJob` that can be updated are:
@@ -592,13 +597,11 @@ module Google
592
597
  # # Call the list_transfer_jobs method.
593
598
  # result = client.list_transfer_jobs request
594
599
  #
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
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
601
+ # # over elements, and API calls will be issued to fetch pages as needed.
602
+ # result.each do |item|
600
603
  # # Each element is of type ::Google::Cloud::StorageTransfer::V1::TransferJob.
601
- # p response
604
+ # p item
602
605
  # end
603
606
  #
604
607
  def list_transfer_jobs request, options = nil
@@ -851,14 +854,14 @@ module Google
851
854
  # # Call the run_transfer_job method.
852
855
  # result = client.run_transfer_job request
853
856
  #
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
+ # # The returned object is of type Gapic::Operation. You can use it to
858
+ # # check the status of an operation, cancel it, or wait for results.
859
+ # # Here is how to wait for a response.
857
860
  # result.wait_until_done! timeout: 60
858
861
  # if result.response?
859
862
  # p result.response
860
863
  # else
861
- # puts "Error!"
864
+ # puts "No response received."
862
865
  # end
863
866
  #
864
867
  def run_transfer_job request, options = nil
@@ -903,6 +906,95 @@ module Google
903
906
  raise ::Google::Cloud::Error.from_error(e)
904
907
  end
905
908
 
909
+ ##
910
+ # Deletes a transfer job. Deleting a transfer job sets its status to
911
+ # {::Google::Cloud::StorageTransfer::V1::TransferJob::Status::DELETED DELETED}.
912
+ #
913
+ # @overload delete_transfer_job(request, options = nil)
914
+ # Pass arguments to `delete_transfer_job` via a request object, either of type
915
+ # {::Google::Cloud::StorageTransfer::V1::DeleteTransferJobRequest} or an equivalent Hash.
916
+ #
917
+ # @param request [::Google::Cloud::StorageTransfer::V1::DeleteTransferJobRequest, ::Hash]
918
+ # A request object representing the call parameters. Required. To specify no
919
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
920
+ # @param options [::Gapic::CallOptions, ::Hash]
921
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
922
+ #
923
+ # @overload delete_transfer_job(job_name: nil, project_id: nil)
924
+ # Pass arguments to `delete_transfer_job` via keyword arguments. Note that at
925
+ # least one keyword argument is required. To specify no parameters, or to keep all
926
+ # the default parameter values, pass an empty Hash as a request object (see above).
927
+ #
928
+ # @param job_name [::String]
929
+ # Required. The job to delete.
930
+ # @param project_id [::String]
931
+ # Required. The ID of the Google Cloud project that owns the
932
+ # job.
933
+ #
934
+ # @yield [response, operation] Access the result along with the RPC operation
935
+ # @yieldparam response [::Google::Protobuf::Empty]
936
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
937
+ #
938
+ # @return [::Google::Protobuf::Empty]
939
+ #
940
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
941
+ #
942
+ # @example Basic example
943
+ # require "google/cloud/storage_transfer/v1"
944
+ #
945
+ # # Create a client object. The client can be reused for multiple calls.
946
+ # client = Google::Cloud::StorageTransfer::V1::StorageTransferService::Client.new
947
+ #
948
+ # # Create a request. To set request fields, pass in keyword arguments.
949
+ # request = Google::Cloud::StorageTransfer::V1::DeleteTransferJobRequest.new
950
+ #
951
+ # # Call the delete_transfer_job method.
952
+ # result = client.delete_transfer_job request
953
+ #
954
+ # # The returned object is of type Google::Protobuf::Empty.
955
+ # p result
956
+ #
957
+ def delete_transfer_job request, options = nil
958
+ raise ::ArgumentError, "request must be provided" if request.nil?
959
+
960
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::StorageTransfer::V1::DeleteTransferJobRequest
961
+
962
+ # Converts hash and nil to an options object
963
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
964
+
965
+ # Customize the options with defaults
966
+ metadata = @config.rpcs.delete_transfer_job.metadata.to_h
967
+
968
+ # Set x-goog-api-client and x-goog-user-project headers
969
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
970
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
971
+ gapic_version: ::Google::Cloud::StorageTransfer::V1::VERSION
972
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
973
+
974
+ header_params = {}
975
+ if request.job_name
976
+ header_params["job_name"] = request.job_name
977
+ end
978
+
979
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
980
+ metadata[:"x-goog-request-params"] ||= request_params_header
981
+
982
+ options.apply_defaults timeout: @config.rpcs.delete_transfer_job.timeout,
983
+ metadata: metadata,
984
+ retry_policy: @config.rpcs.delete_transfer_job.retry_policy
985
+
986
+ options.apply_defaults timeout: @config.timeout,
987
+ metadata: @config.metadata,
988
+ retry_policy: @config.retry_policy
989
+
990
+ @storage_transfer_service_stub.call_rpc :delete_transfer_job, request, options: options do |response, operation|
991
+ yield response, operation if block_given?
992
+ return response
993
+ end
994
+ rescue ::GRPC::BadStatus => e
995
+ raise ::Google::Cloud::Error.from_error(e)
996
+ end
997
+
906
998
  ##
907
999
  # Creates an agent pool resource.
908
1000
  #
@@ -1247,13 +1339,11 @@ module Google
1247
1339
  # # Call the list_agent_pools method.
1248
1340
  # result = client.list_agent_pools request
1249
1341
  #
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|
1342
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
1343
+ # # over elements, and API calls will be issued to fetch pages as needed.
1344
+ # result.each do |item|
1255
1345
  # # Each element is of type ::Google::Cloud::StorageTransfer::V1::AgentPool.
1256
- # p response
1346
+ # p item
1257
1347
  # end
1258
1348
  #
1259
1349
  def list_agent_pools request, options = nil
@@ -1559,6 +1649,11 @@ module Google
1559
1649
  #
1560
1650
  attr_reader :run_transfer_job
1561
1651
  ##
1652
+ # RPC-specific configuration for `delete_transfer_job`
1653
+ # @return [::Gapic::Config::Method]
1654
+ #
1655
+ attr_reader :delete_transfer_job
1656
+ ##
1562
1657
  # RPC-specific configuration for `create_agent_pool`
1563
1658
  # @return [::Gapic::Config::Method]
1564
1659
  #
@@ -1602,6 +1697,8 @@ module Google
1602
1697
  @resume_transfer_operation = ::Gapic::Config::Method.new resume_transfer_operation_config
1603
1698
  run_transfer_job_config = parent_rpcs.run_transfer_job if parent_rpcs.respond_to? :run_transfer_job
1604
1699
  @run_transfer_job = ::Gapic::Config::Method.new run_transfer_job_config
1700
+ delete_transfer_job_config = parent_rpcs.delete_transfer_job if parent_rpcs.respond_to? :delete_transfer_job
1701
+ @delete_transfer_job = ::Gapic::Config::Method.new delete_transfer_job_config
1605
1702
  create_agent_pool_config = parent_rpcs.create_agent_pool if parent_rpcs.respond_to? :create_agent_pool
1606
1703
  @create_agent_pool = ::Gapic::Config::Method.new create_agent_pool_config
1607
1704
  update_agent_pool_config = parent_rpcs.update_agent_pool if parent_rpcs.respond_to? :update_agent_pool
@@ -158,13 +158,11 @@ module Google
158
158
  # # Call the list_operations method.
159
159
  # result = client.list_operations request
160
160
  #
161
- # # The returned object is of type Gapic::PagedEnumerable. You can
162
- # # iterate over all elements by calling #each, and the enumerable
163
- # # will lazily make API calls to fetch subsequent pages. Other
164
- # # methods are also available for managing paging directly.
165
- # result.each do |response|
161
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
162
+ # # over elements, and API calls will be issued to fetch pages as needed.
163
+ # result.each do |item|
166
164
  # # Each element is of type ::Google::Longrunning::Operation.
167
- # p response
165
+ # p item
168
166
  # end
169
167
  #
170
168
  def list_operations request, options = nil
@@ -253,14 +251,14 @@ module Google
253
251
  # # Call the get_operation method.
254
252
  # result = client.get_operation request
255
253
  #
256
- # # The returned object is of type Gapic::Operation. You can use this
257
- # # object to check the status of an operation, cancel it, or wait
258
- # # for results. Here is how to block until completion:
254
+ # # The returned object is of type Gapic::Operation. You can use it to
255
+ # # check the status of an operation, cancel it, or wait for results.
256
+ # # Here is how to wait for a response.
259
257
  # result.wait_until_done! timeout: 60
260
258
  # if result.response?
261
259
  # p result.response
262
260
  # else
263
- # puts "Error!"
261
+ # puts "No response received."
264
262
  # end
265
263
  #
266
264
  def get_operation request, options = nil
@@ -540,14 +538,14 @@ module Google
540
538
  # # Call the wait_operation method.
541
539
  # result = client.wait_operation request
542
540
  #
543
- # # The returned object is of type Gapic::Operation. You can use this
544
- # # object to check the status of an operation, cancel it, or wait
545
- # # for results. Here is how to block until completion:
541
+ # # The returned object is of type Gapic::Operation. You can use it to
542
+ # # check the status of an operation, cancel it, or wait for results.
543
+ # # Here is how to wait for a response.
546
544
  # result.wait_until_done! timeout: 60
547
545
  # if result.response?
548
546
  # p result.response
549
547
  # else
550
- # puts "Error!"
548
+ # puts "No response received."
551
549
  # end
552
550
  #
553
551
  def wait_operation request, options = nil