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 Rest
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
  #
@@ -84,8 +99,10 @@ module Google
84
99
  @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
85
100
 
86
101
  @operations_stub = OperationsServiceStub.new(
87
- endpoint: @config.endpoint,
88
- credentials: credentials
102
+ endpoint: @config.endpoint,
103
+ endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
104
+ universe_domain: @config.universe_domain,
105
+ credentials: credentials
89
106
  )
90
107
 
91
108
  # Used by an LRO wrapper for some methods of this service
@@ -98,14 +115,6 @@ module Google
98
115
  # Lists operations that match the specified filter in the request. If the
99
116
  # server doesn't support this method, it returns `UNIMPLEMENTED`.
100
117
  #
101
- # NOTE: the `name` binding allows API services to override the binding
102
- # to use different resource name schemes, such as `users/*/operations`. To
103
- # override the binding, API services can add a binding such as
104
- # `"/v1/{name=users/*}/operations"` to their service configuration.
105
- # For backwards compatibility, the default name includes the operations
106
- # collection id, however overriding users must ensure the name binding
107
- # is the parent resource, without the operations collection id.
108
- #
109
118
  # @overload list_operations(request, options = nil)
110
119
  # Pass arguments to `list_operations` via a request object, either of type
111
120
  # {::Google::Longrunning::ListOperationsRequest} or an equivalent Hash.
@@ -116,7 +125,7 @@ module Google
116
125
  # @param options [::Gapic::CallOptions, ::Hash]
117
126
  # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
118
127
  #
119
- # @overload list_operations(name: nil, filter: nil, page_size: nil, page_token: nil)
128
+ # @overload list_operations(name: nil, filter: nil, page_size: nil, page_token: nil, return_partial_success: nil)
120
129
  # Pass arguments to `list_operations` via keyword arguments. Note that at
121
130
  # least one keyword argument is required. To specify no parameters, or to keep all
122
131
  # the default parameter values, pass an empty Hash as a request object (see above).
@@ -129,6 +138,17 @@ module Google
129
138
  # The standard list page size.
130
139
  # @param page_token [::String]
131
140
  # The standard list page token.
141
+ # @param return_partial_success [::Boolean]
142
+ # When set to `true`, operations that are reachable are returned as normal,
143
+ # and those that are unreachable are returned in the
144
+ # [ListOperationsResponse.unreachable] field.
145
+ #
146
+ # This can only be `true` when reading across collections e.g. when `parent`
147
+ # is set to `"projects/example/locations/-"`.
148
+ #
149
+ # This field is not by default supported and will result in an
150
+ # `UNIMPLEMENTED` error if set unless explicitly documented otherwise in
151
+ # service or product specific documentation.
132
152
  # @yield [result, operation] Access the result along with the TransportOperation object
133
153
  # @yieldparam result [::Gapic::Operation]
134
154
  # @yieldparam operation [::Gapic::Rest::TransportOperation]
@@ -167,12 +187,13 @@ module Google
167
187
  # Customize the options with defaults
168
188
  call_metadata = @config.rpcs.list_operations.metadata.to_h
169
189
 
170
- # Set x-goog-api-client and x-goog-user-project headers
190
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
171
191
  call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
172
192
  lib_name: @config.lib_name, lib_version: @config.lib_version,
173
193
  gapic_version: ::Google::Cloud::StorageTransfer::V1::VERSION,
174
194
  transports_version_send: [:rest]
175
195
 
196
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
176
197
  call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
177
198
 
178
199
  options.apply_defaults timeout: @config.rpcs.list_operations.timeout,
@@ -186,7 +207,7 @@ module Google
186
207
  @operations_stub.list_operations request, options do |result, operation|
187
208
  result = ::Gapic::Rest::PagedEnumerable.new @operations_stub, :list_operations, "operations", request, result, options
188
209
  yield result, operation if block_given?
189
- return result
210
+ throw :response, result
190
211
  end
191
212
  rescue ::Gapic::Rest::Error => e
192
213
  raise ::Google::Cloud::Error.from_error(e)
@@ -255,12 +276,13 @@ module Google
255
276
  # Customize the options with defaults
256
277
  call_metadata = @config.rpcs.get_operation.metadata.to_h
257
278
 
258
- # Set x-goog-api-client and x-goog-user-project headers
279
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
259
280
  call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
260
281
  lib_name: @config.lib_name, lib_version: @config.lib_version,
261
282
  gapic_version: ::Google::Cloud::StorageTransfer::V1::VERSION,
262
283
  transports_version_send: [:rest]
263
284
 
285
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
264
286
  call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
265
287
 
266
288
  options.apply_defaults timeout: @config.rpcs.get_operation.timeout,
@@ -274,7 +296,7 @@ module Google
274
296
  @operations_stub.get_operation request, options do |result, operation|
275
297
  result = ::Gapic::Operation.new result, @operations_client, options: options
276
298
  yield result, operation if block_given?
277
- return result
299
+ throw :response, result
278
300
  end
279
301
  rescue ::Gapic::Rest::Error => e
280
302
  raise ::Google::Cloud::Error.from_error(e)
@@ -337,12 +359,13 @@ module Google
337
359
  # Customize the options with defaults
338
360
  call_metadata = @config.rpcs.delete_operation.metadata.to_h
339
361
 
340
- # Set x-goog-api-client and x-goog-user-project headers
362
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
341
363
  call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
342
364
  lib_name: @config.lib_name, lib_version: @config.lib_version,
343
365
  gapic_version: ::Google::Cloud::StorageTransfer::V1::VERSION,
344
366
  transports_version_send: [:rest]
345
367
 
368
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
346
369
  call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
347
370
 
348
371
  options.apply_defaults timeout: @config.rpcs.delete_operation.timeout,
@@ -355,7 +378,6 @@ module Google
355
378
 
356
379
  @operations_stub.delete_operation request, options do |result, operation|
357
380
  yield result, operation if block_given?
358
- return result
359
381
  end
360
382
  rescue ::Gapic::Rest::Error => e
361
383
  raise ::Google::Cloud::Error.from_error(e)
@@ -370,8 +392,9 @@ module Google
370
392
  # other methods to check whether the cancellation succeeded or whether the
371
393
  # operation completed despite cancellation. On successful cancellation,
372
394
  # the operation is not deleted; instead, it becomes an operation with
373
- # an {::Google::Longrunning::Operation#error Operation.error} value with a {::Google::Rpc::Status#code google.rpc.Status.code} of 1,
374
- # corresponding to `Code.CANCELLED`.
395
+ # an {::Google::Longrunning::Operation#error Operation.error} value with a
396
+ # {::Google::Rpc::Status#code google.rpc.Status.code} of `1`, corresponding to
397
+ # `Code.CANCELLED`.
375
398
  #
376
399
  # @overload cancel_operation(request, options = nil)
377
400
  # Pass arguments to `cancel_operation` via a request object, either of type
@@ -424,12 +447,13 @@ module Google
424
447
  # Customize the options with defaults
425
448
  call_metadata = @config.rpcs.cancel_operation.metadata.to_h
426
449
 
427
- # Set x-goog-api-client and x-goog-user-project headers
450
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
428
451
  call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
429
452
  lib_name: @config.lib_name, lib_version: @config.lib_version,
430
453
  gapic_version: ::Google::Cloud::StorageTransfer::V1::VERSION,
431
454
  transports_version_send: [:rest]
432
455
 
456
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
433
457
  call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
434
458
 
435
459
  options.apply_defaults timeout: @config.rpcs.cancel_operation.timeout,
@@ -442,7 +466,6 @@ module Google
442
466
 
443
467
  @operations_stub.cancel_operation request, options do |result, operation|
444
468
  yield result, operation if block_given?
445
- return result
446
469
  end
447
470
  rescue ::Gapic::Rest::Error => e
448
471
  raise ::Google::Cloud::Error.from_error(e)
@@ -478,9 +501,9 @@ module Google
478
501
  # end
479
502
  #
480
503
  # @!attribute [rw] endpoint
481
- # The hostname or hostname:port of the service endpoint.
482
- # Defaults to `"storagetransfer.googleapis.com"`.
483
- # @return [::String]
504
+ # A custom service endpoint, as a hostname or hostname:port. The default is
505
+ # nil, indicating to use the default endpoint in the current universe domain.
506
+ # @return [::String,nil]
484
507
  # @!attribute [rw] credentials
485
508
  # Credentials to send with calls. You may provide any of the following types:
486
509
  # * (`String`) The path to a service account key file in JSON format
@@ -490,6 +513,13 @@ module Google
490
513
  # * (`Signet::OAuth2::Client`) A signet oauth2 client object
491
514
  # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
492
515
  # * (`nil`) indicating no credentials
516
+ #
517
+ # Warning: If you accept a credential configuration (JSON file or Hash) from an
518
+ # external source for authentication to Google Cloud, you must validate it before
519
+ # providing it to a Google API client library. Providing an unvalidated credential
520
+ # configuration to Google APIs can compromise the security of your systems and data.
521
+ # For more information, refer to [Validate credential configurations from external
522
+ # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
493
523
  # @return [::Object]
494
524
  # @!attribute [rw] scope
495
525
  # The OAuth scopes
@@ -517,15 +547,27 @@ module Google
517
547
  # @!attribute [rw] quota_project
518
548
  # A separate project against which to charge quota.
519
549
  # @return [::String]
550
+ # @!attribute [rw] universe_domain
551
+ # The universe domain within which to make requests. This determines the
552
+ # default endpoint URL. The default value of nil uses the environment
553
+ # universe (usually the default "googleapis.com" universe).
554
+ # @return [::String,nil]
555
+ # @!attribute [rw] logger
556
+ # A custom logger to use for request/response debug logging, or the value
557
+ # `:default` (the default) to construct a default logger, or `nil` to
558
+ # explicitly disable logging.
559
+ # @return [::Logger,:default,nil]
520
560
  #
521
561
  class Configuration
522
562
  extend ::Gapic::Config
523
563
 
564
+ # @private
565
+ # The endpoint specific to the default "googleapis.com" universe. Deprecated.
524
566
  DEFAULT_ENDPOINT = "storagetransfer.googleapis.com"
525
567
 
526
- config_attr :endpoint, DEFAULT_ENDPOINT, ::String
568
+ config_attr :endpoint, nil, ::String, nil
527
569
  config_attr :credentials, nil do |value|
528
- allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
570
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil]
529
571
  allowed.any? { |klass| klass === value }
530
572
  end
531
573
  config_attr :scope, nil, ::String, ::Array, nil
@@ -535,6 +577,8 @@ module Google
535
577
  config_attr :metadata, nil, ::Hash, nil
536
578
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
537
579
  config_attr :quota_project, nil, ::String, nil
580
+ config_attr :universe_domain, nil, ::String, nil
581
+ config_attr :logger, :default, ::Logger, nil, :default
538
582
 
539
583
  # @private
540
584
  def initialize parent_config = nil
@@ -617,12 +661,15 @@ module Google
617
661
  # Service stub contains baseline method implementations
618
662
  # including transcoding, making the REST call, and deserialing the response.
619
663
  class OperationsServiceStub
620
- def initialize endpoint:, credentials:
664
+ def initialize endpoint:, endpoint_template:, universe_domain:, credentials:
621
665
  # These require statements are intentionally placed here to initialize
622
666
  # the REST modules only when it's required.
623
667
  require "gapic/rest"
624
668
 
625
- @client_stub = ::Gapic::Rest::ClientStub.new endpoint: endpoint, credentials: credentials
669
+ @client_stub = ::Gapic::Rest::ClientStub.new endpoint: endpoint,
670
+ endpoint_template: endpoint_template,
671
+ universe_domain: universe_domain,
672
+ credentials: credentials
626
673
  end
627
674
 
628
675
  ##
@@ -651,16 +698,18 @@ module Google
651
698
 
652
699
  response = @client_stub.make_http_request(
653
700
  verb,
654
- uri: uri,
655
- body: body || "",
656
- params: query_string_params,
701
+ uri: uri,
702
+ body: body || "",
703
+ params: query_string_params,
704
+ method_name: "list_operations",
657
705
  options: options
658
706
  )
659
707
  operation = ::Gapic::Rest::TransportOperation.new response
660
708
  result = ::Google::Longrunning::ListOperationsResponse.decode_json response.body, ignore_unknown_fields: true
661
-
662
- yield result, operation if block_given?
663
- result
709
+ catch :response do
710
+ yield result, operation if block_given?
711
+ result
712
+ end
664
713
  end
665
714
 
666
715
  ##
@@ -689,16 +738,18 @@ module Google
689
738
 
690
739
  response = @client_stub.make_http_request(
691
740
  verb,
692
- uri: uri,
693
- body: body || "",
694
- params: query_string_params,
741
+ uri: uri,
742
+ body: body || "",
743
+ params: query_string_params,
744
+ method_name: "get_operation",
695
745
  options: options
696
746
  )
697
747
  operation = ::Gapic::Rest::TransportOperation.new response
698
748
  result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true
699
-
700
- yield result, operation if block_given?
701
- result
749
+ catch :response do
750
+ yield result, operation if block_given?
751
+ result
752
+ end
702
753
  end
703
754
 
704
755
  ##
@@ -727,16 +778,18 @@ module Google
727
778
 
728
779
  response = @client_stub.make_http_request(
729
780
  verb,
730
- uri: uri,
731
- body: body || "",
732
- params: query_string_params,
781
+ uri: uri,
782
+ body: body || "",
783
+ params: query_string_params,
784
+ method_name: "delete_operation",
733
785
  options: options
734
786
  )
735
787
  operation = ::Gapic::Rest::TransportOperation.new response
736
788
  result = ::Google::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true
737
-
738
- yield result, operation if block_given?
739
- result
789
+ catch :response do
790
+ yield result, operation if block_given?
791
+ result
792
+ end
740
793
  end
741
794
 
742
795
  ##
@@ -765,16 +818,18 @@ module Google
765
818
 
766
819
  response = @client_stub.make_http_request(
767
820
  verb,
768
- uri: uri,
769
- body: body || "",
770
- params: query_string_params,
821
+ uri: uri,
822
+ body: body || "",
823
+ params: query_string_params,
824
+ method_name: "cancel_operation",
771
825
  options: options
772
826
  )
773
827
  operation = ::Gapic::Rest::TransportOperation.new response
774
828
  result = ::Google::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true
775
-
776
- yield result, operation if block_given?
777
- result
829
+ catch :response do
830
+ yield result, operation if block_given?
831
+ result
832
+ end
778
833
  end
779
834
 
780
835
  ##