google-cloud-backupdr-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.
@@ -141,6 +141,11 @@ module Google
141
141
 
142
142
  default_config.rpcs.restore_backup.timeout = 60.0
143
143
 
144
+ default_config.rpcs.initialize_service.timeout = 60.0
145
+ default_config.rpcs.initialize_service.retry_policy = {
146
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
147
+ }
148
+
144
149
  default_config
145
150
  end
146
151
  yield @configure if block_given?
@@ -226,15 +231,27 @@ module Google
226
231
  endpoint: @config.endpoint,
227
232
  endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
228
233
  universe_domain: @config.universe_domain,
229
- credentials: credentials
234
+ credentials: credentials,
235
+ logger: @config.logger
230
236
  )
231
237
 
238
+ @backup_dr_stub.logger(stub: true)&.info do |entry|
239
+ entry.set_system_name
240
+ entry.set_service
241
+ entry.message = "Created client for #{entry.service}"
242
+ entry.set_credentials_fields credentials
243
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
244
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
245
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
246
+ end
247
+
232
248
  @location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config|
233
249
  config.credentials = credentials
234
250
  config.quota_project = @quota_project_id
235
251
  config.endpoint = @backup_dr_stub.endpoint
236
252
  config.universe_domain = @backup_dr_stub.universe_domain
237
253
  config.bindings_override = @config.bindings_override
254
+ config.logger = @backup_dr_stub.logger if config.respond_to? :logger=
238
255
  end
239
256
 
240
257
  @iam_policy_client = Google::Iam::V1::IAMPolicy::Rest::Client.new do |config|
@@ -243,6 +260,7 @@ module Google
243
260
  config.endpoint = @backup_dr_stub.endpoint
244
261
  config.universe_domain = @backup_dr_stub.universe_domain
245
262
  config.bindings_override = @config.bindings_override
263
+ config.logger = @backup_dr_stub.logger if config.respond_to? :logger=
246
264
  end
247
265
  end
248
266
 
@@ -267,6 +285,15 @@ module Google
267
285
  #
268
286
  attr_reader :iam_policy_client
269
287
 
288
+ ##
289
+ # The logger used for request/response debug logging.
290
+ #
291
+ # @return [Logger]
292
+ #
293
+ def logger
294
+ @backup_dr_stub.logger
295
+ end
296
+
270
297
  # Service calls
271
298
 
272
299
  ##
@@ -360,7 +387,6 @@ module Google
360
387
 
361
388
  @backup_dr_stub.list_management_servers request, options do |result, operation|
362
389
  yield result, operation if block_given?
363
- return result
364
390
  end
365
391
  rescue ::Gapic::Rest::Error => e
366
392
  raise ::Google::Cloud::Error.from_error(e)
@@ -440,7 +466,6 @@ module Google
440
466
 
441
467
  @backup_dr_stub.get_management_server request, options do |result, operation|
442
468
  yield result, operation if block_given?
443
- return result
444
469
  end
445
470
  rescue ::Gapic::Rest::Error => e
446
471
  raise ::Google::Cloud::Error.from_error(e)
@@ -549,7 +574,7 @@ module Google
549
574
  @backup_dr_stub.create_management_server request, options do |result, operation|
550
575
  result = ::Gapic::Operation.new result, @operations_client, options: options
551
576
  yield result, operation if block_given?
552
- return result
577
+ throw :response, result
553
578
  end
554
579
  rescue ::Gapic::Rest::Error => e
555
580
  raise ::Google::Cloud::Error.from_error(e)
@@ -650,7 +675,7 @@ module Google
650
675
  @backup_dr_stub.delete_management_server request, options do |result, operation|
651
676
  result = ::Gapic::Operation.new result, @operations_client, options: options
652
677
  yield result, operation if block_given?
653
- return result
678
+ throw :response, result
654
679
  end
655
680
  rescue ::Gapic::Rest::Error => e
656
681
  raise ::Google::Cloud::Error.from_error(e)
@@ -760,7 +785,7 @@ module Google
760
785
  @backup_dr_stub.create_backup_vault request, options do |result, operation|
761
786
  result = ::Gapic::Operation.new result, @operations_client, options: options
762
787
  yield result, operation if block_given?
763
- return result
788
+ throw :response, result
764
789
  end
765
790
  rescue ::Gapic::Rest::Error => e
766
791
  raise ::Google::Cloud::Error.from_error(e)
@@ -860,7 +885,6 @@ module Google
860
885
 
861
886
  @backup_dr_stub.list_backup_vaults request, options do |result, operation|
862
887
  yield result, operation if block_given?
863
- return result
864
888
  end
865
889
  rescue ::Gapic::Rest::Error => e
866
890
  raise ::Google::Cloud::Error.from_error(e)
@@ -959,7 +983,6 @@ module Google
959
983
 
960
984
  @backup_dr_stub.fetch_usable_backup_vaults request, options do |result, operation|
961
985
  yield result, operation if block_given?
962
- return result
963
986
  end
964
987
  rescue ::Gapic::Rest::Error => e
965
988
  raise ::Google::Cloud::Error.from_error(e)
@@ -1042,7 +1065,6 @@ module Google
1042
1065
 
1043
1066
  @backup_dr_stub.get_backup_vault request, options do |result, operation|
1044
1067
  yield result, operation if block_given?
1045
- return result
1046
1068
  end
1047
1069
  rescue ::Gapic::Rest::Error => e
1048
1070
  raise ::Google::Cloud::Error.from_error(e)
@@ -1155,7 +1177,7 @@ module Google
1155
1177
  @backup_dr_stub.update_backup_vault request, options do |result, operation|
1156
1178
  result = ::Gapic::Operation.new result, @operations_client, options: options
1157
1179
  yield result, operation if block_given?
1158
- return result
1180
+ throw :response, result
1159
1181
  end
1160
1182
  rescue ::Gapic::Rest::Error => e
1161
1183
  raise ::Google::Cloud::Error.from_error(e)
@@ -1174,7 +1196,7 @@ module Google
1174
1196
  # @param options [::Gapic::CallOptions, ::Hash]
1175
1197
  # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
1176
1198
  #
1177
- # @overload delete_backup_vault(name: nil, request_id: nil, force: nil, etag: nil, validate_only: nil, allow_missing: nil)
1199
+ # @overload delete_backup_vault(name: nil, request_id: nil, force: nil, etag: nil, validate_only: nil, allow_missing: nil, ignore_backup_plan_references: nil)
1178
1200
  # Pass arguments to `delete_backup_vault` via keyword arguments. Note that at
1179
1201
  # least one keyword argument is required. To specify no parameters, or to keep all
1180
1202
  # the default parameter values, pass an empty Hash as a request object (see above).
@@ -1208,6 +1230,9 @@ module Google
1208
1230
  # @param allow_missing [::Boolean]
1209
1231
  # Optional. If true and the BackupVault is not found, the request will
1210
1232
  # succeed but no action will be taken.
1233
+ # @param ignore_backup_plan_references [::Boolean]
1234
+ # Optional. If set to true, backupvault deletion will proceed even if there
1235
+ # are backup plans referencing the backupvault. The default is 'false'.
1211
1236
  # @yield [result, operation] Access the result along with the TransportOperation object
1212
1237
  # @yieldparam result [::Gapic::Operation]
1213
1238
  # @yieldparam operation [::Gapic::Rest::TransportOperation]
@@ -1269,7 +1294,7 @@ module Google
1269
1294
  @backup_dr_stub.delete_backup_vault request, options do |result, operation|
1270
1295
  result = ::Gapic::Operation.new result, @operations_client, options: options
1271
1296
  yield result, operation if block_given?
1272
- return result
1297
+ throw :response, result
1273
1298
  end
1274
1299
  rescue ::Gapic::Rest::Error => e
1275
1300
  raise ::Google::Cloud::Error.from_error(e)
@@ -1366,7 +1391,6 @@ module Google
1366
1391
 
1367
1392
  @backup_dr_stub.list_data_sources request, options do |result, operation|
1368
1393
  yield result, operation if block_given?
1369
- return result
1370
1394
  end
1371
1395
  rescue ::Gapic::Rest::Error => e
1372
1396
  raise ::Google::Cloud::Error.from_error(e)
@@ -1446,7 +1470,6 @@ module Google
1446
1470
 
1447
1471
  @backup_dr_stub.get_data_source request, options do |result, operation|
1448
1472
  yield result, operation if block_given?
1449
- return result
1450
1473
  end
1451
1474
  rescue ::Gapic::Rest::Error => e
1452
1475
  raise ::Google::Cloud::Error.from_error(e)
@@ -1555,7 +1578,7 @@ module Google
1555
1578
  @backup_dr_stub.update_data_source request, options do |result, operation|
1556
1579
  result = ::Gapic::Operation.new result, @operations_client, options: options
1557
1580
  yield result, operation if block_given?
1558
- return result
1581
+ throw :response, result
1559
1582
  end
1560
1583
  rescue ::Gapic::Rest::Error => e
1561
1584
  raise ::Google::Cloud::Error.from_error(e)
@@ -1655,7 +1678,6 @@ module Google
1655
1678
 
1656
1679
  @backup_dr_stub.list_backups request, options do |result, operation|
1657
1680
  yield result, operation if block_given?
1658
- return result
1659
1681
  end
1660
1682
  rescue ::Gapic::Rest::Error => e
1661
1683
  raise ::Google::Cloud::Error.from_error(e)
@@ -1738,7 +1760,6 @@ module Google
1738
1760
 
1739
1761
  @backup_dr_stub.get_backup request, options do |result, operation|
1740
1762
  yield result, operation if block_given?
1741
- return result
1742
1763
  end
1743
1764
  rescue ::Gapic::Rest::Error => e
1744
1765
  raise ::Google::Cloud::Error.from_error(e)
@@ -1845,7 +1866,7 @@ module Google
1845
1866
  @backup_dr_stub.update_backup request, options do |result, operation|
1846
1867
  result = ::Gapic::Operation.new result, @operations_client, options: options
1847
1868
  yield result, operation if block_given?
1848
- return result
1869
+ throw :response, result
1849
1870
  end
1850
1871
  rescue ::Gapic::Rest::Error => e
1851
1872
  raise ::Google::Cloud::Error.from_error(e)
@@ -1946,7 +1967,7 @@ module Google
1946
1967
  @backup_dr_stub.delete_backup request, options do |result, operation|
1947
1968
  result = ::Gapic::Operation.new result, @operations_client, options: options
1948
1969
  yield result, operation if block_given?
1949
- return result
1970
+ throw :response, result
1950
1971
  end
1951
1972
  rescue ::Gapic::Rest::Error => e
1952
1973
  raise ::Google::Cloud::Error.from_error(e)
@@ -2052,7 +2073,7 @@ module Google
2052
2073
  @backup_dr_stub.restore_backup request, options do |result, operation|
2053
2074
  result = ::Gapic::Operation.new result, @operations_client, options: options
2054
2075
  yield result, operation if block_given?
2055
- return result
2076
+ throw :response, result
2056
2077
  end
2057
2078
  rescue ::Gapic::Rest::Error => e
2058
2079
  raise ::Google::Cloud::Error.from_error(e)
@@ -2162,7 +2183,7 @@ module Google
2162
2183
  @backup_dr_stub.create_backup_plan request, options do |result, operation|
2163
2184
  result = ::Gapic::Operation.new result, @operations_client, options: options
2164
2185
  yield result, operation if block_given?
2165
- return result
2186
+ throw :response, result
2166
2187
  end
2167
2188
  rescue ::Gapic::Rest::Error => e
2168
2189
  raise ::Google::Cloud::Error.from_error(e)
@@ -2243,7 +2264,6 @@ module Google
2243
2264
 
2244
2265
  @backup_dr_stub.get_backup_plan request, options do |result, operation|
2245
2266
  yield result, operation if block_given?
2246
- return result
2247
2267
  end
2248
2268
  rescue ::Gapic::Rest::Error => e
2249
2269
  raise ::Google::Cloud::Error.from_error(e)
@@ -2348,7 +2368,6 @@ module Google
2348
2368
 
2349
2369
  @backup_dr_stub.list_backup_plans request, options do |result, operation|
2350
2370
  yield result, operation if block_given?
2351
- return result
2352
2371
  end
2353
2372
  rescue ::Gapic::Rest::Error => e
2354
2373
  raise ::Google::Cloud::Error.from_error(e)
@@ -2451,7 +2470,7 @@ module Google
2451
2470
  @backup_dr_stub.delete_backup_plan request, options do |result, operation|
2452
2471
  result = ::Gapic::Operation.new result, @operations_client, options: options
2453
2472
  yield result, operation if block_given?
2454
- return result
2473
+ throw :response, result
2455
2474
  end
2456
2475
  rescue ::Gapic::Rest::Error => e
2457
2476
  raise ::Google::Cloud::Error.from_error(e)
@@ -2559,7 +2578,7 @@ module Google
2559
2578
  @backup_dr_stub.create_backup_plan_association request, options do |result, operation|
2560
2579
  result = ::Gapic::Operation.new result, @operations_client, options: options
2561
2580
  yield result, operation if block_given?
2562
- return result
2581
+ throw :response, result
2563
2582
  end
2564
2583
  rescue ::Gapic::Rest::Error => e
2565
2584
  raise ::Google::Cloud::Error.from_error(e)
@@ -2639,7 +2658,6 @@ module Google
2639
2658
 
2640
2659
  @backup_dr_stub.get_backup_plan_association request, options do |result, operation|
2641
2660
  yield result, operation if block_given?
2642
- return result
2643
2661
  end
2644
2662
  rescue ::Gapic::Rest::Error => e
2645
2663
  raise ::Google::Cloud::Error.from_error(e)
@@ -2734,7 +2752,6 @@ module Google
2734
2752
 
2735
2753
  @backup_dr_stub.list_backup_plan_associations request, options do |result, operation|
2736
2754
  yield result, operation if block_given?
2737
- return result
2738
2755
  end
2739
2756
  rescue ::Gapic::Rest::Error => e
2740
2757
  raise ::Google::Cloud::Error.from_error(e)
@@ -2836,7 +2853,7 @@ module Google
2836
2853
  @backup_dr_stub.delete_backup_plan_association request, options do |result, operation|
2837
2854
  result = ::Gapic::Operation.new result, @operations_client, options: options
2838
2855
  yield result, operation if block_given?
2839
- return result
2856
+ throw :response, result
2840
2857
  end
2841
2858
  rescue ::Gapic::Rest::Error => e
2842
2859
  raise ::Google::Cloud::Error.from_error(e)
@@ -2940,7 +2957,114 @@ module Google
2940
2957
  @backup_dr_stub.trigger_backup request, options do |result, operation|
2941
2958
  result = ::Gapic::Operation.new result, @operations_client, options: options
2942
2959
  yield result, operation if block_given?
2943
- return result
2960
+ throw :response, result
2961
+ end
2962
+ rescue ::Gapic::Rest::Error => e
2963
+ raise ::Google::Cloud::Error.from_error(e)
2964
+ end
2965
+
2966
+ ##
2967
+ # Initializes the service related config for a project.
2968
+ #
2969
+ # @overload initialize_service(request, options = nil)
2970
+ # Pass arguments to `initialize_service` via a request object, either of type
2971
+ # {::Google::Cloud::BackupDR::V1::InitializeServiceRequest} or an equivalent Hash.
2972
+ #
2973
+ # @param request [::Google::Cloud::BackupDR::V1::InitializeServiceRequest, ::Hash]
2974
+ # A request object representing the call parameters. Required. To specify no
2975
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
2976
+ # @param options [::Gapic::CallOptions, ::Hash]
2977
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
2978
+ #
2979
+ # @overload initialize_service(name: nil, resource_type: nil, request_id: nil)
2980
+ # Pass arguments to `initialize_service` via keyword arguments. Note that at
2981
+ # least one keyword argument is required. To specify no parameters, or to keep all
2982
+ # the default parameter values, pass an empty Hash as a request object (see above).
2983
+ #
2984
+ # @param name [::String]
2985
+ # Required. The resource name of the serviceConfig used to initialize the
2986
+ # service. Format:
2987
+ # `projects/{project_id}/locations/{location}/serviceConfig`.
2988
+ # @param resource_type [::String]
2989
+ # Required. The resource type to which the default service config will be
2990
+ # applied. Examples include, "compute.googleapis.com/Instance" and
2991
+ # "storage.googleapis.com/Bucket".
2992
+ # @param request_id [::String]
2993
+ # Optional. An optional request ID to identify requests. Specify a unique
2994
+ # request ID so that if you must retry your request, the server will know to
2995
+ # ignore the request if it has already been completed. The server will
2996
+ # guarantee that for at least 60 minutes since the first request.
2997
+ #
2998
+ # For example, consider a situation where you make an initial request and t
2999
+ # he request times out. If you make the request again with the same request
3000
+ # ID, the server can check if original operation with the same request ID
3001
+ # was received, and if so, will ignore the second request. This prevents
3002
+ # clients from accidentally creating duplicate commitments.
3003
+ #
3004
+ # The request ID must be a valid UUID with the exception that zero UUID is
3005
+ # not supported (00000000-0000-0000-0000-000000000000).
3006
+ # @yield [result, operation] Access the result along with the TransportOperation object
3007
+ # @yieldparam result [::Gapic::Operation]
3008
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
3009
+ #
3010
+ # @return [::Gapic::Operation]
3011
+ #
3012
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
3013
+ #
3014
+ # @example Basic example
3015
+ # require "google/cloud/backupdr/v1"
3016
+ #
3017
+ # # Create a client object. The client can be reused for multiple calls.
3018
+ # client = Google::Cloud::BackupDR::V1::BackupDR::Rest::Client.new
3019
+ #
3020
+ # # Create a request. To set request fields, pass in keyword arguments.
3021
+ # request = Google::Cloud::BackupDR::V1::InitializeServiceRequest.new
3022
+ #
3023
+ # # Call the initialize_service method.
3024
+ # result = client.initialize_service request
3025
+ #
3026
+ # # The returned object is of type Gapic::Operation. You can use it to
3027
+ # # check the status of an operation, cancel it, or wait for results.
3028
+ # # Here is how to wait for a response.
3029
+ # result.wait_until_done! timeout: 60
3030
+ # if result.response?
3031
+ # p result.response
3032
+ # else
3033
+ # puts "No response received."
3034
+ # end
3035
+ #
3036
+ def initialize_service request, options = nil
3037
+ raise ::ArgumentError, "request must be provided" if request.nil?
3038
+
3039
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::BackupDR::V1::InitializeServiceRequest
3040
+
3041
+ # Converts hash and nil to an options object
3042
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
3043
+
3044
+ # Customize the options with defaults
3045
+ call_metadata = @config.rpcs.initialize_service.metadata.to_h
3046
+
3047
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
3048
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
3049
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
3050
+ gapic_version: ::Google::Cloud::BackupDR::V1::VERSION,
3051
+ transports_version_send: [:rest]
3052
+
3053
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
3054
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
3055
+
3056
+ options.apply_defaults timeout: @config.rpcs.initialize_service.timeout,
3057
+ metadata: call_metadata,
3058
+ retry_policy: @config.rpcs.initialize_service.retry_policy
3059
+
3060
+ options.apply_defaults timeout: @config.timeout,
3061
+ metadata: @config.metadata,
3062
+ retry_policy: @config.retry_policy
3063
+
3064
+ @backup_dr_stub.initialize_service request, options do |result, operation|
3065
+ result = ::Gapic::Operation.new result, @operations_client, options: options
3066
+ yield result, operation if block_given?
3067
+ throw :response, result
2944
3068
  end
2945
3069
  rescue ::Gapic::Rest::Error => e
2946
3070
  raise ::Google::Cloud::Error.from_error(e)
@@ -2988,6 +3112,13 @@ module Google
2988
3112
  # * (`Signet::OAuth2::Client`) A signet oauth2 client object
2989
3113
  # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
2990
3114
  # * (`nil`) indicating no credentials
3115
+ #
3116
+ # Warning: If you accept a credential configuration (JSON file or Hash) from an
3117
+ # external source for authentication to Google Cloud, you must validate it before
3118
+ # providing it to a Google API client library. Providing an unvalidated credential
3119
+ # configuration to Google APIs can compromise the security of your systems and data.
3120
+ # For more information, refer to [Validate credential configurations from external
3121
+ # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
2991
3122
  # @return [::Object]
2992
3123
  # @!attribute [rw] scope
2993
3124
  # The OAuth scopes
@@ -3020,6 +3151,11 @@ module Google
3020
3151
  # default endpoint URL. The default value of nil uses the environment
3021
3152
  # universe (usually the default "googleapis.com" universe).
3022
3153
  # @return [::String,nil]
3154
+ # @!attribute [rw] logger
3155
+ # A custom logger to use for request/response debug logging, or the value
3156
+ # `:default` (the default) to construct a default logger, or `nil` to
3157
+ # explicitly disable logging.
3158
+ # @return [::Logger,:default,nil]
3023
3159
  #
3024
3160
  class Configuration
3025
3161
  extend ::Gapic::Config
@@ -3048,6 +3184,7 @@ module Google
3048
3184
  # by the host service.
3049
3185
  # @return [::Hash{::Symbol=>::Array<::Gapic::Rest::GrpcTranscoder::HttpBinding>}]
3050
3186
  config_attr :bindings_override, {}, ::Hash, nil
3187
+ config_attr :logger, :default, ::Logger, nil, :default
3051
3188
 
3052
3189
  # @private
3053
3190
  def initialize parent_config = nil
@@ -3221,6 +3358,11 @@ module Google
3221
3358
  # @return [::Gapic::Config::Method]
3222
3359
  #
3223
3360
  attr_reader :trigger_backup
3361
+ ##
3362
+ # RPC-specific configuration for `initialize_service`
3363
+ # @return [::Gapic::Config::Method]
3364
+ #
3365
+ attr_reader :initialize_service
3224
3366
 
3225
3367
  # @private
3226
3368
  def initialize parent_rpcs = nil
@@ -3278,6 +3420,8 @@ module Google
3278
3420
  @delete_backup_plan_association = ::Gapic::Config::Method.new delete_backup_plan_association_config
3279
3421
  trigger_backup_config = parent_rpcs.trigger_backup if parent_rpcs.respond_to? :trigger_backup
3280
3422
  @trigger_backup = ::Gapic::Config::Method.new trigger_backup_config
3423
+ initialize_service_config = parent_rpcs.initialize_service if parent_rpcs.respond_to? :initialize_service
3424
+ @initialize_service = ::Gapic::Config::Method.new initialize_service_config
3281
3425
 
3282
3426
  yield self if block_given?
3283
3427
  end
@@ -196,7 +196,7 @@ module Google
196
196
  @operations_stub.list_operations request, options do |result, operation|
197
197
  result = ::Gapic::Rest::PagedEnumerable.new @operations_stub, :list_operations, "operations", request, result, options
198
198
  yield result, operation if block_given?
199
- return result
199
+ throw :response, result
200
200
  end
201
201
  rescue ::Gapic::Rest::Error => e
202
202
  raise ::Google::Cloud::Error.from_error(e)
@@ -285,7 +285,7 @@ module Google
285
285
  @operations_stub.get_operation request, options do |result, operation|
286
286
  result = ::Gapic::Operation.new result, @operations_client, options: options
287
287
  yield result, operation if block_given?
288
- return result
288
+ throw :response, result
289
289
  end
290
290
  rescue ::Gapic::Rest::Error => e
291
291
  raise ::Google::Cloud::Error.from_error(e)
@@ -367,7 +367,6 @@ module Google
367
367
 
368
368
  @operations_stub.delete_operation request, options do |result, operation|
369
369
  yield result, operation if block_given?
370
- return result
371
370
  end
372
371
  rescue ::Gapic::Rest::Error => e
373
372
  raise ::Google::Cloud::Error.from_error(e)
@@ -456,7 +455,6 @@ module Google
456
455
 
457
456
  @operations_stub.cancel_operation request, options do |result, operation|
458
457
  yield result, operation if block_given?
459
- return result
460
458
  end
461
459
  rescue ::Gapic::Rest::Error => e
462
460
  raise ::Google::Cloud::Error.from_error(e)
@@ -504,6 +502,13 @@ module Google
504
502
  # * (`Signet::OAuth2::Client`) A signet oauth2 client object
505
503
  # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
506
504
  # * (`nil`) indicating no credentials
505
+ #
506
+ # Warning: If you accept a credential configuration (JSON file or Hash) from an
507
+ # external source for authentication to Google Cloud, you must validate it before
508
+ # providing it to a Google API client library. Providing an unvalidated credential
509
+ # configuration to Google APIs can compromise the security of your systems and data.
510
+ # For more information, refer to [Validate credential configurations from external
511
+ # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
507
512
  # @return [::Object]
508
513
  # @!attribute [rw] scope
509
514
  # The OAuth scopes
@@ -536,6 +541,11 @@ module Google
536
541
  # default endpoint URL. The default value of nil uses the environment
537
542
  # universe (usually the default "googleapis.com" universe).
538
543
  # @return [::String,nil]
544
+ # @!attribute [rw] logger
545
+ # A custom logger to use for request/response debug logging, or the value
546
+ # `:default` (the default) to construct a default logger, or `nil` to
547
+ # explicitly disable logging.
548
+ # @return [::Logger,:default,nil]
539
549
  #
540
550
  class Configuration
541
551
  extend ::Gapic::Config
@@ -557,6 +567,7 @@ module Google
557
567
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
558
568
  config_attr :quota_project, nil, ::String, nil
559
569
  config_attr :universe_domain, nil, ::String, nil
570
+ config_attr :logger, :default, ::Logger, nil, :default
560
571
 
561
572
  # @private
562
573
  def initialize parent_config = nil
@@ -676,16 +687,18 @@ module Google
676
687
 
677
688
  response = @client_stub.make_http_request(
678
689
  verb,
679
- uri: uri,
680
- body: body || "",
681
- params: query_string_params,
690
+ uri: uri,
691
+ body: body || "",
692
+ params: query_string_params,
693
+ method_name: "list_operations",
682
694
  options: options
683
695
  )
684
696
  operation = ::Gapic::Rest::TransportOperation.new response
685
697
  result = ::Google::Longrunning::ListOperationsResponse.decode_json response.body, ignore_unknown_fields: true
686
-
687
- yield result, operation if block_given?
688
- result
698
+ catch :response do
699
+ yield result, operation if block_given?
700
+ result
701
+ end
689
702
  end
690
703
 
691
704
  ##
@@ -714,16 +727,18 @@ module Google
714
727
 
715
728
  response = @client_stub.make_http_request(
716
729
  verb,
717
- uri: uri,
718
- body: body || "",
719
- params: query_string_params,
730
+ uri: uri,
731
+ body: body || "",
732
+ params: query_string_params,
733
+ method_name: "get_operation",
720
734
  options: options
721
735
  )
722
736
  operation = ::Gapic::Rest::TransportOperation.new response
723
737
  result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true
724
-
725
- yield result, operation if block_given?
726
- result
738
+ catch :response do
739
+ yield result, operation if block_given?
740
+ result
741
+ end
727
742
  end
728
743
 
729
744
  ##
@@ -752,16 +767,18 @@ module Google
752
767
 
753
768
  response = @client_stub.make_http_request(
754
769
  verb,
755
- uri: uri,
756
- body: body || "",
757
- params: query_string_params,
770
+ uri: uri,
771
+ body: body || "",
772
+ params: query_string_params,
773
+ method_name: "delete_operation",
758
774
  options: options
759
775
  )
760
776
  operation = ::Gapic::Rest::TransportOperation.new response
761
777
  result = ::Google::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true
762
-
763
- yield result, operation if block_given?
764
- result
778
+ catch :response do
779
+ yield result, operation if block_given?
780
+ result
781
+ end
765
782
  end
766
783
 
767
784
  ##
@@ -790,16 +807,18 @@ module Google
790
807
 
791
808
  response = @client_stub.make_http_request(
792
809
  verb,
793
- uri: uri,
794
- body: body || "",
795
- params: query_string_params,
810
+ uri: uri,
811
+ body: body || "",
812
+ params: query_string_params,
813
+ method_name: "cancel_operation",
796
814
  options: options
797
815
  )
798
816
  operation = ::Gapic::Rest::TransportOperation.new response
799
817
  result = ::Google::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true
800
-
801
- yield result, operation if block_given?
802
- result
818
+ catch :response do
819
+ yield result, operation if block_given?
820
+ result
821
+ end
803
822
  end
804
823
 
805
824
  ##