google-cloud-storage_transfer-v1 0.8.0 → 1.4.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.
@@ -177,10 +186,11 @@ module Google
177
186
  # Customize the options with defaults
178
187
  metadata = @config.rpcs.list_operations.metadata.to_h
179
188
 
180
- # Set x-goog-api-client and x-goog-user-project headers
189
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
181
190
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
182
191
  lib_name: @config.lib_name, lib_version: @config.lib_version,
183
192
  gapic_version: ::Google::Cloud::StorageTransfer::V1::VERSION
193
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
184
194
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
185
195
 
186
196
  header_params = {}
@@ -203,7 +213,7 @@ module Google
203
213
  wrap_lro_operation = ->(op_response) { ::Gapic::Operation.new op_response, @operations_client }
204
214
  response = ::Gapic::PagedEnumerable.new @operations_stub, :list_operations, request, response, operation, options, format_resource: wrap_lro_operation
205
215
  yield response, operation if block_given?
206
- return response
216
+ throw :response, response
207
217
  end
208
218
  rescue ::GRPC::BadStatus => e
209
219
  raise ::Google::Cloud::Error.from_error(e)
@@ -273,10 +283,11 @@ module Google
273
283
  # Customize the options with defaults
274
284
  metadata = @config.rpcs.get_operation.metadata.to_h
275
285
 
276
- # Set x-goog-api-client and x-goog-user-project headers
286
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
277
287
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
278
288
  lib_name: @config.lib_name, lib_version: @config.lib_version,
279
289
  gapic_version: ::Google::Cloud::StorageTransfer::V1::VERSION
290
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
280
291
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
281
292
 
282
293
  header_params = {}
@@ -298,7 +309,7 @@ module Google
298
309
  @operations_stub.call_rpc :get_operation, request, options: options do |response, operation|
299
310
  response = ::Gapic::Operation.new response, @operations_client, options: options
300
311
  yield response, operation if block_given?
301
- return response
312
+ throw :response, response
302
313
  end
303
314
  rescue ::GRPC::BadStatus => e
304
315
  raise ::Google::Cloud::Error.from_error(e)
@@ -362,10 +373,11 @@ module Google
362
373
  # Customize the options with defaults
363
374
  metadata = @config.rpcs.delete_operation.metadata.to_h
364
375
 
365
- # Set x-goog-api-client and x-goog-user-project headers
376
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
366
377
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
367
378
  lib_name: @config.lib_name, lib_version: @config.lib_version,
368
379
  gapic_version: ::Google::Cloud::StorageTransfer::V1::VERSION
380
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
369
381
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
370
382
 
371
383
  header_params = {}
@@ -386,7 +398,6 @@ module Google
386
398
 
387
399
  @operations_stub.call_rpc :delete_operation, request, options: options do |response, operation|
388
400
  yield response, operation if block_given?
389
- return response
390
401
  end
391
402
  rescue ::GRPC::BadStatus => e
392
403
  raise ::Google::Cloud::Error.from_error(e)
@@ -401,8 +412,9 @@ module Google
401
412
  # other methods to check whether the cancellation succeeded or whether the
402
413
  # operation completed despite cancellation. On successful cancellation,
403
414
  # 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`.
415
+ # an {::Google::Longrunning::Operation#error Operation.error} value with a
416
+ # {::Google::Rpc::Status#code google.rpc.Status.code} of `1`, corresponding to
417
+ # `Code.CANCELLED`.
406
418
  #
407
419
  # @overload cancel_operation(request, options = nil)
408
420
  # Pass arguments to `cancel_operation` via a request object, either of type
@@ -456,10 +468,11 @@ module Google
456
468
  # Customize the options with defaults
457
469
  metadata = @config.rpcs.cancel_operation.metadata.to_h
458
470
 
459
- # Set x-goog-api-client and x-goog-user-project headers
471
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
460
472
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
461
473
  lib_name: @config.lib_name, lib_version: @config.lib_version,
462
474
  gapic_version: ::Google::Cloud::StorageTransfer::V1::VERSION
475
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
463
476
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
464
477
 
465
478
  header_params = {}
@@ -480,7 +493,6 @@ module Google
480
493
 
481
494
  @operations_stub.call_rpc :cancel_operation, request, options: options do |response, operation|
482
495
  yield response, operation if block_given?
483
- return response
484
496
  end
485
497
  rescue ::GRPC::BadStatus => e
486
498
  raise ::Google::Cloud::Error.from_error(e)
@@ -560,10 +572,11 @@ module Google
560
572
  # Customize the options with defaults
561
573
  metadata = @config.rpcs.wait_operation.metadata.to_h
562
574
 
563
- # Set x-goog-api-client and x-goog-user-project headers
575
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
564
576
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
565
577
  lib_name: @config.lib_name, lib_version: @config.lib_version,
566
578
  gapic_version: ::Google::Cloud::StorageTransfer::V1::VERSION
579
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
567
580
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
568
581
 
569
582
  options.apply_defaults timeout: @config.rpcs.wait_operation.timeout,
@@ -577,7 +590,7 @@ module Google
577
590
  @operations_stub.call_rpc :wait_operation, request, options: options do |response, operation|
578
591
  response = ::Gapic::Operation.new response, @operations_client, options: options
579
592
  yield response, operation if block_given?
580
- return response
593
+ throw :response, response
581
594
  end
582
595
  rescue ::GRPC::BadStatus => e
583
596
  raise ::Google::Cloud::Error.from_error(e)
@@ -613,9 +626,9 @@ module Google
613
626
  # end
614
627
  #
615
628
  # @!attribute [rw] endpoint
616
- # The hostname or hostname:port of the service endpoint.
617
- # Defaults to `"storagetransfer.googleapis.com"`.
618
- # @return [::String]
629
+ # A custom service endpoint, as a hostname or hostname:port. The default is
630
+ # nil, indicating to use the default endpoint in the current universe domain.
631
+ # @return [::String,nil]
619
632
  # @!attribute [rw] credentials
620
633
  # Credentials to send with calls. You may provide any of the following types:
621
634
  # * (`String`) The path to a service account key file in JSON format
@@ -627,6 +640,13 @@ module Google
627
640
  # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
628
641
  # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
629
642
  # * (`nil`) indicating no credentials
643
+ #
644
+ # Warning: If you accept a credential configuration (JSON file or Hash) from an
645
+ # external source for authentication to Google Cloud, you must validate it before
646
+ # providing it to a Google API client library. Providing an unvalidated credential
647
+ # configuration to Google APIs can compromise the security of your systems and data.
648
+ # For more information, refer to [Validate credential configurations from external
649
+ # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
630
650
  # @return [::Object]
631
651
  # @!attribute [rw] scope
632
652
  # The OAuth scopes
@@ -661,13 +681,25 @@ module Google
661
681
  # @!attribute [rw] quota_project
662
682
  # A separate project against which to charge quota.
663
683
  # @return [::String]
684
+ # @!attribute [rw] universe_domain
685
+ # The universe domain within which to make requests. This determines the
686
+ # default endpoint URL. The default value of nil uses the environment
687
+ # universe (usually the default "googleapis.com" universe).
688
+ # @return [::String,nil]
689
+ # @!attribute [rw] logger
690
+ # A custom logger to use for request/response debug logging, or the value
691
+ # `:default` (the default) to construct a default logger, or `nil` to
692
+ # explicitly disable logging.
693
+ # @return [::Logger,:default,nil]
664
694
  #
665
695
  class Configuration
666
696
  extend ::Gapic::Config
667
697
 
698
+ # @private
699
+ # The endpoint specific to the default "googleapis.com" universe. Deprecated.
668
700
  DEFAULT_ENDPOINT = "storagetransfer.googleapis.com"
669
701
 
670
- config_attr :endpoint, DEFAULT_ENDPOINT, ::String
702
+ config_attr :endpoint, nil, ::String, nil
671
703
  config_attr :credentials, nil do |value|
672
704
  allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
673
705
  allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
@@ -682,6 +714,8 @@ module Google
682
714
  config_attr :metadata, nil, ::Hash, nil
683
715
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
684
716
  config_attr :quota_project, nil, ::String, nil
717
+ config_attr :universe_domain, nil, ::String, nil
718
+ config_attr :logger, :default, ::Logger, nil, :default
685
719
 
686
720
  # @private
687
721
  def initialize parent_config = nil