google-cloud-storage_transfer-v1 0.8.0 → 1.10.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.
@@ -26,6 +26,12 @@ module Google
26
26
  module StorageTransferService
27
27
  # Service that implements Longrunning Operations API.
28
28
  class Operations
29
+ # @private
30
+ API_VERSION = ""
31
+
32
+ # @private
33
+ DEFAULT_ENDPOINT_TEMPLATE = "storagetransfer.$UNIVERSE_DOMAIN$"
34
+
29
35
  # @private
30
36
  attr_reader :operations_stub
31
37
 
@@ -60,6 +66,15 @@ module Google
60
66
  @config
61
67
  end
62
68
 
69
+ ##
70
+ # The effective universe domain
71
+ #
72
+ # @return [String]
73
+ #
74
+ def universe_domain
75
+ @operations_stub.universe_domain
76
+ end
77
+
63
78
  ##
64
79
  # Create a new Operations client object.
65
80
  #
@@ -90,8 +105,10 @@ module Google
90
105
 
91
106
  @operations_stub = ::Gapic::ServiceStub.new(
92
107
  ::Google::Longrunning::Operations::Stub,
93
- credentials: credentials,
94
- endpoint: @config.endpoint,
108
+ credentials: credentials,
109
+ endpoint: @config.endpoint,
110
+ endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
111
+ universe_domain: @config.universe_domain,
95
112
  channel_args: @config.channel_args,
96
113
  interceptors: @config.interceptors,
97
114
  channel_pool_config: @config.channel_pool
@@ -107,14 +124,6 @@ module Google
107
124
  # Lists operations that match the specified filter in the request. If the
108
125
  # server doesn't support this method, it returns `UNIMPLEMENTED`.
109
126
  #
110
- # NOTE: the `name` binding allows API services to override the binding
111
- # to use different resource name schemes, such as `users/*/operations`. To
112
- # override the binding, API services can add a binding such as
113
- # `"/v1/{name=users/*}/operations"` to their service configuration.
114
- # For backwards compatibility, the default name includes the operations
115
- # collection id, however overriding users must ensure the name binding
116
- # is the parent resource, without the operations collection id.
117
- #
118
127
  # @overload list_operations(request, options = nil)
119
128
  # Pass arguments to `list_operations` via a request object, either of type
120
129
  # {::Google::Longrunning::ListOperationsRequest} or an equivalent Hash.
@@ -125,7 +134,7 @@ module Google
125
134
  # @param options [::Gapic::CallOptions, ::Hash]
126
135
  # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
127
136
  #
128
- # @overload list_operations(name: nil, filter: nil, page_size: nil, page_token: nil)
137
+ # @overload list_operations(name: nil, filter: nil, page_size: nil, page_token: nil, return_partial_success: nil)
129
138
  # Pass arguments to `list_operations` via keyword arguments. Note that at
130
139
  # least one keyword argument is required. To specify no parameters, or to keep all
131
140
  # the default parameter values, pass an empty Hash as a request object (see above).
@@ -138,6 +147,17 @@ module Google
138
147
  # The standard list page size.
139
148
  # @param page_token [::String]
140
149
  # The standard list page token.
150
+ # @param return_partial_success [::Boolean]
151
+ # When set to `true`, operations that are reachable are returned as normal,
152
+ # and those that are unreachable are returned in the
153
+ # [ListOperationsResponse.unreachable] field.
154
+ #
155
+ # This can only be `true` when reading across collections e.g. when `parent`
156
+ # is set to `"projects/example/locations/-"`.
157
+ #
158
+ # This field is not by default supported and will result in an
159
+ # `UNIMPLEMENTED` error if set unless explicitly documented otherwise in
160
+ # service or product specific documentation.
141
161
  #
142
162
  # @yield [response, operation] Access the result along with the RPC operation
143
163
  # @yieldparam response [::Gapic::PagedEnumerable<::Gapic::Operation>]
@@ -177,10 +197,11 @@ module Google
177
197
  # Customize the options with defaults
178
198
  metadata = @config.rpcs.list_operations.metadata.to_h
179
199
 
180
- # Set x-goog-api-client and x-goog-user-project headers
200
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
181
201
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
182
202
  lib_name: @config.lib_name, lib_version: @config.lib_version,
183
203
  gapic_version: ::Google::Cloud::StorageTransfer::V1::VERSION
204
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
184
205
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
185
206
 
186
207
  header_params = {}
@@ -203,7 +224,7 @@ module Google
203
224
  wrap_lro_operation = ->(op_response) { ::Gapic::Operation.new op_response, @operations_client }
204
225
  response = ::Gapic::PagedEnumerable.new @operations_stub, :list_operations, request, response, operation, options, format_resource: wrap_lro_operation
205
226
  yield response, operation if block_given?
206
- return response
227
+ throw :response, response
207
228
  end
208
229
  rescue ::GRPC::BadStatus => e
209
230
  raise ::Google::Cloud::Error.from_error(e)
@@ -273,10 +294,11 @@ module Google
273
294
  # Customize the options with defaults
274
295
  metadata = @config.rpcs.get_operation.metadata.to_h
275
296
 
276
- # Set x-goog-api-client and x-goog-user-project headers
297
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
277
298
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
278
299
  lib_name: @config.lib_name, lib_version: @config.lib_version,
279
300
  gapic_version: ::Google::Cloud::StorageTransfer::V1::VERSION
301
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
280
302
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
281
303
 
282
304
  header_params = {}
@@ -298,7 +320,7 @@ module Google
298
320
  @operations_stub.call_rpc :get_operation, request, options: options do |response, operation|
299
321
  response = ::Gapic::Operation.new response, @operations_client, options: options
300
322
  yield response, operation if block_given?
301
- return response
323
+ throw :response, response
302
324
  end
303
325
  rescue ::GRPC::BadStatus => e
304
326
  raise ::Google::Cloud::Error.from_error(e)
@@ -362,10 +384,11 @@ module Google
362
384
  # Customize the options with defaults
363
385
  metadata = @config.rpcs.delete_operation.metadata.to_h
364
386
 
365
- # Set x-goog-api-client and x-goog-user-project headers
387
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
366
388
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
367
389
  lib_name: @config.lib_name, lib_version: @config.lib_version,
368
390
  gapic_version: ::Google::Cloud::StorageTransfer::V1::VERSION
391
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
369
392
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
370
393
 
371
394
  header_params = {}
@@ -386,7 +409,6 @@ module Google
386
409
 
387
410
  @operations_stub.call_rpc :delete_operation, request, options: options do |response, operation|
388
411
  yield response, operation if block_given?
389
- return response
390
412
  end
391
413
  rescue ::GRPC::BadStatus => e
392
414
  raise ::Google::Cloud::Error.from_error(e)
@@ -401,8 +423,9 @@ module Google
401
423
  # other methods to check whether the cancellation succeeded or whether the
402
424
  # operation completed despite cancellation. On successful cancellation,
403
425
  # the operation is not deleted; instead, it becomes an operation with
404
- # an {::Google::Longrunning::Operation#error Operation.error} value with a {::Google::Rpc::Status#code google.rpc.Status.code} of 1,
405
- # corresponding to `Code.CANCELLED`.
426
+ # an {::Google::Longrunning::Operation#error Operation.error} value with a
427
+ # {::Google::Rpc::Status#code google.rpc.Status.code} of `1`, corresponding to
428
+ # `Code.CANCELLED`.
406
429
  #
407
430
  # @overload cancel_operation(request, options = nil)
408
431
  # Pass arguments to `cancel_operation` via a request object, either of type
@@ -456,10 +479,11 @@ module Google
456
479
  # Customize the options with defaults
457
480
  metadata = @config.rpcs.cancel_operation.metadata.to_h
458
481
 
459
- # Set x-goog-api-client and x-goog-user-project headers
482
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
460
483
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
461
484
  lib_name: @config.lib_name, lib_version: @config.lib_version,
462
485
  gapic_version: ::Google::Cloud::StorageTransfer::V1::VERSION
486
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
463
487
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
464
488
 
465
489
  header_params = {}
@@ -480,7 +504,6 @@ module Google
480
504
 
481
505
  @operations_stub.call_rpc :cancel_operation, request, options: options do |response, operation|
482
506
  yield response, operation if block_given?
483
- return response
484
507
  end
485
508
  rescue ::GRPC::BadStatus => e
486
509
  raise ::Google::Cloud::Error.from_error(e)
@@ -560,10 +583,11 @@ module Google
560
583
  # Customize the options with defaults
561
584
  metadata = @config.rpcs.wait_operation.metadata.to_h
562
585
 
563
- # Set x-goog-api-client and x-goog-user-project headers
586
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
564
587
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
565
588
  lib_name: @config.lib_name, lib_version: @config.lib_version,
566
589
  gapic_version: ::Google::Cloud::StorageTransfer::V1::VERSION
590
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
567
591
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
568
592
 
569
593
  options.apply_defaults timeout: @config.rpcs.wait_operation.timeout,
@@ -577,7 +601,7 @@ module Google
577
601
  @operations_stub.call_rpc :wait_operation, request, options: options do |response, operation|
578
602
  response = ::Gapic::Operation.new response, @operations_client, options: options
579
603
  yield response, operation if block_given?
580
- return response
604
+ throw :response, response
581
605
  end
582
606
  rescue ::GRPC::BadStatus => e
583
607
  raise ::Google::Cloud::Error.from_error(e)
@@ -613,13 +637,11 @@ module Google
613
637
  # end
614
638
  #
615
639
  # @!attribute [rw] endpoint
616
- # The hostname or hostname:port of the service endpoint.
617
- # Defaults to `"storagetransfer.googleapis.com"`.
618
- # @return [::String]
640
+ # A custom service endpoint, as a hostname or hostname:port. The default is
641
+ # nil, indicating to use the default endpoint in the current universe domain.
642
+ # @return [::String,nil]
619
643
  # @!attribute [rw] credentials
620
644
  # Credentials to send with calls. You may provide any of the following types:
621
- # * (`String`) The path to a service account key file in JSON format
622
- # * (`Hash`) A service account key as a Hash
623
645
  # * (`Google::Auth::Credentials`) A googleauth credentials object
624
646
  # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
625
647
  # * (`Signet::OAuth2::Client`) A signet oauth2 client object
@@ -627,6 +649,32 @@ module Google
627
649
  # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
628
650
  # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
629
651
  # * (`nil`) indicating no credentials
652
+ #
653
+ # @note Warning: Passing a `String` to a keyfile path or a `Hash` of credentials
654
+ # is deprecated. Providing an unvalidated credential configuration to
655
+ # Google APIs can compromise the security of your systems and data.
656
+ #
657
+ # @example
658
+ #
659
+ # # The recommended way to provide credentials is to use the `make_creds` method
660
+ # # on the appropriate credentials class for your environment.
661
+ #
662
+ # require "googleauth"
663
+ #
664
+ # credentials = ::Google::Auth::ServiceAccountCredentials.make_creds(
665
+ # json_key_io: ::File.open("/path/to/keyfile.json")
666
+ # )
667
+ #
668
+ # client = ::Google::Longrunning::Operations::Client.new do |config|
669
+ # config.credentials = credentials
670
+ # end
671
+ #
672
+ # @note Warning: If you accept a credential configuration (JSON file or Hash) from an
673
+ # external source for authentication to Google Cloud, you must validate it before
674
+ # providing it to a Google API client library. Providing an unvalidated credential
675
+ # configuration to Google APIs can compromise the security of your systems and data.
676
+ # For more information, refer to [Validate credential configurations from external
677
+ # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
630
678
  # @return [::Object]
631
679
  # @!attribute [rw] scope
632
680
  # The OAuth scopes
@@ -661,16 +709,28 @@ module Google
661
709
  # @!attribute [rw] quota_project
662
710
  # A separate project against which to charge quota.
663
711
  # @return [::String]
712
+ # @!attribute [rw] universe_domain
713
+ # The universe domain within which to make requests. This determines the
714
+ # default endpoint URL. The default value of nil uses the environment
715
+ # universe (usually the default "googleapis.com" universe).
716
+ # @return [::String,nil]
717
+ # @!attribute [rw] logger
718
+ # A custom logger to use for request/response debug logging, or the value
719
+ # `:default` (the default) to construct a default logger, or `nil` to
720
+ # explicitly disable logging.
721
+ # @return [::Logger,:default,nil]
664
722
  #
665
723
  class Configuration
666
724
  extend ::Gapic::Config
667
725
 
726
+ # @private
727
+ # The endpoint specific to the default "googleapis.com" universe. Deprecated.
668
728
  DEFAULT_ENDPOINT = "storagetransfer.googleapis.com"
669
729
 
670
- config_attr :endpoint, DEFAULT_ENDPOINT, ::String
730
+ config_attr :endpoint, nil, ::String, nil
671
731
  config_attr :credentials, nil do |value|
672
- allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
673
- allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
732
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil]
733
+ allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC::Core::Channel
674
734
  allowed.any? { |klass| klass === value }
675
735
  end
676
736
  config_attr :scope, nil, ::String, ::Array, nil
@@ -682,6 +742,8 @@ module Google
682
742
  config_attr :metadata, nil, ::Hash, nil
683
743
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
684
744
  config_attr :quota_project, nil, ::String, nil
745
+ config_attr :universe_domain, nil, ::String, nil
746
+ config_attr :logger, :default, ::Logger, nil, :default
685
747
 
686
748
  # @private
687
749
  def initialize parent_config = nil