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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 30d56fe88312adab0f82fd466083541e92473ea1419a1738ba9ab7447798ed9f
4
- data.tar.gz: bfd0a4c2b0372673dd2e2306a26078deb811ea6c81d80fc366f4e9af9a8191f2
3
+ metadata.gz: 9fa01e0715e898523351ce55d543b15cb4fef4f5a6832165414dd5cf6f0e84f0
4
+ data.tar.gz: e0abc5c51bf018120a2ca8e02f35dbc889be463cebe98da7d8b54e9588ad58dd
5
5
  SHA512:
6
- metadata.gz: 7dbef25f62cec4c779b4aadc9c99eccaf1ae2060372bbca52f9503e7b1623fdb140761efcc921c5cb92dd0fe2d42dcb91f237ea501d990727d453125ce355c10
7
- data.tar.gz: 62abd37c3fa56d0caa7ee94aa33a29d72befe1a494610f38894960c3a165e2dd3f98c84cc6f831ded1a1575d22eab5572f9e7854060136c2e523c7c27c4f2b70
6
+ metadata.gz: bb128f38fd07b2d80f3ded24e2e16d26d6736a2c5173c54db9de0d273aeace7a0371e4b8532d9485b78bb0074ec2a6c150f5a8bcb34036ac4743267a041fab0c
7
+ data.tar.gz: 16ae3195edb316ae9c416a7c25ec4c442217abded0dfae806e6a671ffefbd6726b186be0d74175a66ecf9212ce0bb57967bc4f7c754a982ff28d88a36ae854da
data/README.md CHANGED
@@ -43,40 +43,50 @@ for class and method documentation.
43
43
  See also the [Product Documentation](https://cloud.google.com/backup-disaster-recovery/docs/reference/rpc)
44
44
  for general usage information.
45
45
 
46
- ## Enabling Logging
47
-
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/current/stdlibs/logger/Logger.html) as shown below,
50
- or a [`Google::Cloud::Logging::Logger`](https://cloud.google.com/ruby/docs/reference/google-cloud-logging/latest)
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
- and the gRPC [spec_helper.rb](https://github.com/grpc/grpc/blob/master/src/ruby/spec/spec_helper.rb) for additional information.
53
-
54
- Configuring a Ruby stdlib logger:
46
+ ## Debug Logging
47
+
48
+ This library comes with opt-in Debug Logging that can help you troubleshoot
49
+ your application's integration with the API. When logging is activated, key
50
+ events such as requests and responses, along with data payloads and metadata
51
+ such as headers and client configuration, are logged to the standard error
52
+ stream.
53
+
54
+ **WARNING:** Client Library Debug Logging includes your data payloads in
55
+ plaintext, which could include sensitive data such as PII for yourself or your
56
+ customers, private keys, or other security data that could be compromising if
57
+ leaked. Always practice good data hygiene with your application logs, and follow
58
+ the principle of least access. Google also recommends that Client Library Debug
59
+ Logging be enabled only temporarily during active debugging, and not used
60
+ permanently in production.
61
+
62
+ To enable logging, set the environment variable `GOOGLE_SDK_RUBY_LOGGING_GEMS`
63
+ to the value `all`. Alternatively, you can set the value to a comma-delimited
64
+ list of client library gem names. This will select the default logging behavior,
65
+ which writes logs to the standard error stream. On a local workstation, this may
66
+ result in logs appearing on the console. When running on a Google Cloud hosting
67
+ service such as [Google Cloud Run](https://cloud.google.com/run), this generally
68
+ results in logs appearing alongside your application logs in the
69
+ [Google Cloud Logging](https://cloud.google.com/logging/) service.
70
+
71
+ You can customize logging by modifying the `logger` configuration when
72
+ constructing a client object. For example:
55
73
 
56
74
  ```ruby
75
+ require "google/cloud/backupdr/v1"
57
76
  require "logger"
58
77
 
59
- module MyLogger
60
- LOGGER = Logger.new $stderr, level: Logger::WARN
61
- def logger
62
- LOGGER
63
- end
64
- end
65
-
66
- # Define a gRPC module-level logger method before grpc/logconfig.rb loads.
67
- module GRPC
68
- extend MyLogger
78
+ client = ::Google::Cloud::BackupDR::V1::BackupDR::Client.new do |config|
79
+ config.logger = Logger.new "my-app.log"
69
80
  end
70
81
  ```
71
82
 
72
-
73
83
  ## Google Cloud Samples
74
84
 
75
85
  To browse ready to use code samples check [Google Cloud Samples](https://cloud.google.com/docs/samples).
76
86
 
77
87
  ## Supported Ruby Versions
78
88
 
79
- This library is supported on Ruby 2.7+.
89
+ This library is supported on Ruby 3.0+.
80
90
 
81
91
  Google provides official support for Ruby versions that are actively supported
82
92
  by Ruby Core—that is, Ruby versions that are either in normal maintenance or
@@ -139,6 +139,11 @@ module Google
139
139
 
140
140
  default_config.rpcs.restore_backup.timeout = 60.0
141
141
 
142
+ default_config.rpcs.initialize_service.timeout = 60.0
143
+ default_config.rpcs.initialize_service.retry_policy = {
144
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
145
+ }
146
+
142
147
  default_config
143
148
  end
144
149
  yield @configure if block_given?
@@ -233,14 +238,26 @@ module Google
233
238
  universe_domain: @config.universe_domain,
234
239
  channel_args: @config.channel_args,
235
240
  interceptors: @config.interceptors,
236
- channel_pool_config: @config.channel_pool
241
+ channel_pool_config: @config.channel_pool,
242
+ logger: @config.logger
237
243
  )
238
244
 
245
+ @backup_dr_stub.stub_logger&.info do |entry|
246
+ entry.set_system_name
247
+ entry.set_service
248
+ entry.message = "Created client for #{entry.service}"
249
+ entry.set_credentials_fields credentials
250
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
251
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
252
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
253
+ end
254
+
239
255
  @location_client = Google::Cloud::Location::Locations::Client.new do |config|
240
256
  config.credentials = credentials
241
257
  config.quota_project = @quota_project_id
242
258
  config.endpoint = @backup_dr_stub.endpoint
243
259
  config.universe_domain = @backup_dr_stub.universe_domain
260
+ config.logger = @backup_dr_stub.logger if config.respond_to? :logger=
244
261
  end
245
262
 
246
263
  @iam_policy_client = Google::Iam::V1::IAMPolicy::Client.new do |config|
@@ -248,6 +265,7 @@ module Google
248
265
  config.quota_project = @quota_project_id
249
266
  config.endpoint = @backup_dr_stub.endpoint
250
267
  config.universe_domain = @backup_dr_stub.universe_domain
268
+ config.logger = @backup_dr_stub.logger if config.respond_to? :logger=
251
269
  end
252
270
  end
253
271
 
@@ -272,6 +290,15 @@ module Google
272
290
  #
273
291
  attr_reader :iam_policy_client
274
292
 
293
+ ##
294
+ # The logger used for request/response debug logging.
295
+ #
296
+ # @return [Logger]
297
+ #
298
+ def logger
299
+ @backup_dr_stub.logger
300
+ end
301
+
275
302
  # Service calls
276
303
 
277
304
  ##
@@ -373,7 +400,7 @@ module Google
373
400
  @backup_dr_stub.call_rpc :list_management_servers, request, options: options do |response, operation|
374
401
  response = ::Gapic::PagedEnumerable.new @backup_dr_stub, :list_management_servers, request, response, operation, options
375
402
  yield response, operation if block_given?
376
- return response
403
+ throw :response, response
377
404
  end
378
405
  rescue ::GRPC::BadStatus => e
379
406
  raise ::Google::Cloud::Error.from_error(e)
@@ -460,7 +487,6 @@ module Google
460
487
 
461
488
  @backup_dr_stub.call_rpc :get_management_server, request, options: options do |response, operation|
462
489
  yield response, operation if block_given?
463
- return response
464
490
  end
465
491
  rescue ::GRPC::BadStatus => e
466
492
  raise ::Google::Cloud::Error.from_error(e)
@@ -576,7 +602,7 @@ module Google
576
602
  @backup_dr_stub.call_rpc :create_management_server, request, options: options do |response, operation|
577
603
  response = ::Gapic::Operation.new response, @operations_client, options: options
578
604
  yield response, operation if block_given?
579
- return response
605
+ throw :response, response
580
606
  end
581
607
  rescue ::GRPC::BadStatus => e
582
608
  raise ::Google::Cloud::Error.from_error(e)
@@ -684,7 +710,7 @@ module Google
684
710
  @backup_dr_stub.call_rpc :delete_management_server, request, options: options do |response, operation|
685
711
  response = ::Gapic::Operation.new response, @operations_client, options: options
686
712
  yield response, operation if block_given?
687
- return response
713
+ throw :response, response
688
714
  end
689
715
  rescue ::GRPC::BadStatus => e
690
716
  raise ::Google::Cloud::Error.from_error(e)
@@ -801,7 +827,7 @@ module Google
801
827
  @backup_dr_stub.call_rpc :create_backup_vault, request, options: options do |response, operation|
802
828
  response = ::Gapic::Operation.new response, @operations_client, options: options
803
829
  yield response, operation if block_given?
804
- return response
830
+ throw :response, response
805
831
  end
806
832
  rescue ::GRPC::BadStatus => e
807
833
  raise ::Google::Cloud::Error.from_error(e)
@@ -909,7 +935,7 @@ module Google
909
935
  @backup_dr_stub.call_rpc :list_backup_vaults, request, options: options do |response, operation|
910
936
  response = ::Gapic::PagedEnumerable.new @backup_dr_stub, :list_backup_vaults, request, response, operation, options
911
937
  yield response, operation if block_given?
912
- return response
938
+ throw :response, response
913
939
  end
914
940
  rescue ::GRPC::BadStatus => e
915
941
  raise ::Google::Cloud::Error.from_error(e)
@@ -1016,7 +1042,7 @@ module Google
1016
1042
  @backup_dr_stub.call_rpc :fetch_usable_backup_vaults, request, options: options do |response, operation|
1017
1043
  response = ::Gapic::PagedEnumerable.new @backup_dr_stub, :fetch_usable_backup_vaults, request, response, operation, options
1018
1044
  yield response, operation if block_given?
1019
- return response
1045
+ throw :response, response
1020
1046
  end
1021
1047
  rescue ::GRPC::BadStatus => e
1022
1048
  raise ::Google::Cloud::Error.from_error(e)
@@ -1106,7 +1132,6 @@ module Google
1106
1132
 
1107
1133
  @backup_dr_stub.call_rpc :get_backup_vault, request, options: options do |response, operation|
1108
1134
  yield response, operation if block_given?
1109
- return response
1110
1135
  end
1111
1136
  rescue ::GRPC::BadStatus => e
1112
1137
  raise ::Google::Cloud::Error.from_error(e)
@@ -1226,7 +1251,7 @@ module Google
1226
1251
  @backup_dr_stub.call_rpc :update_backup_vault, request, options: options do |response, operation|
1227
1252
  response = ::Gapic::Operation.new response, @operations_client, options: options
1228
1253
  yield response, operation if block_given?
1229
- return response
1254
+ throw :response, response
1230
1255
  end
1231
1256
  rescue ::GRPC::BadStatus => e
1232
1257
  raise ::Google::Cloud::Error.from_error(e)
@@ -1245,7 +1270,7 @@ module Google
1245
1270
  # @param options [::Gapic::CallOptions, ::Hash]
1246
1271
  # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
1247
1272
  #
1248
- # @overload delete_backup_vault(name: nil, request_id: nil, force: nil, etag: nil, validate_only: nil, allow_missing: nil)
1273
+ # @overload delete_backup_vault(name: nil, request_id: nil, force: nil, etag: nil, validate_only: nil, allow_missing: nil, ignore_backup_plan_references: nil)
1249
1274
  # Pass arguments to `delete_backup_vault` via keyword arguments. Note that at
1250
1275
  # least one keyword argument is required. To specify no parameters, or to keep all
1251
1276
  # the default parameter values, pass an empty Hash as a request object (see above).
@@ -1279,6 +1304,9 @@ module Google
1279
1304
  # @param allow_missing [::Boolean]
1280
1305
  # Optional. If true and the BackupVault is not found, the request will
1281
1306
  # succeed but no action will be taken.
1307
+ # @param ignore_backup_plan_references [::Boolean]
1308
+ # Optional. If set to true, backupvault deletion will proceed even if there
1309
+ # are backup plans referencing the backupvault. The default is 'false'.
1282
1310
  #
1283
1311
  # @yield [response, operation] Access the result along with the RPC operation
1284
1312
  # @yieldparam response [::Gapic::Operation]
@@ -1347,7 +1375,7 @@ module Google
1347
1375
  @backup_dr_stub.call_rpc :delete_backup_vault, request, options: options do |response, operation|
1348
1376
  response = ::Gapic::Operation.new response, @operations_client, options: options
1349
1377
  yield response, operation if block_given?
1350
- return response
1378
+ throw :response, response
1351
1379
  end
1352
1380
  rescue ::GRPC::BadStatus => e
1353
1381
  raise ::Google::Cloud::Error.from_error(e)
@@ -1452,7 +1480,7 @@ module Google
1452
1480
  @backup_dr_stub.call_rpc :list_data_sources, request, options: options do |response, operation|
1453
1481
  response = ::Gapic::PagedEnumerable.new @backup_dr_stub, :list_data_sources, request, response, operation, options
1454
1482
  yield response, operation if block_given?
1455
- return response
1483
+ throw :response, response
1456
1484
  end
1457
1485
  rescue ::GRPC::BadStatus => e
1458
1486
  raise ::Google::Cloud::Error.from_error(e)
@@ -1539,7 +1567,6 @@ module Google
1539
1567
 
1540
1568
  @backup_dr_stub.call_rpc :get_data_source, request, options: options do |response, operation|
1541
1569
  yield response, operation if block_given?
1542
- return response
1543
1570
  end
1544
1571
  rescue ::GRPC::BadStatus => e
1545
1572
  raise ::Google::Cloud::Error.from_error(e)
@@ -1655,7 +1682,7 @@ module Google
1655
1682
  @backup_dr_stub.call_rpc :update_data_source, request, options: options do |response, operation|
1656
1683
  response = ::Gapic::Operation.new response, @operations_client, options: options
1657
1684
  yield response, operation if block_given?
1658
- return response
1685
+ throw :response, response
1659
1686
  end
1660
1687
  rescue ::GRPC::BadStatus => e
1661
1688
  raise ::Google::Cloud::Error.from_error(e)
@@ -1763,7 +1790,7 @@ module Google
1763
1790
  @backup_dr_stub.call_rpc :list_backups, request, options: options do |response, operation|
1764
1791
  response = ::Gapic::PagedEnumerable.new @backup_dr_stub, :list_backups, request, response, operation, options
1765
1792
  yield response, operation if block_given?
1766
- return response
1793
+ throw :response, response
1767
1794
  end
1768
1795
  rescue ::GRPC::BadStatus => e
1769
1796
  raise ::Google::Cloud::Error.from_error(e)
@@ -1853,7 +1880,6 @@ module Google
1853
1880
 
1854
1881
  @backup_dr_stub.call_rpc :get_backup, request, options: options do |response, operation|
1855
1882
  yield response, operation if block_given?
1856
- return response
1857
1883
  end
1858
1884
  rescue ::GRPC::BadStatus => e
1859
1885
  raise ::Google::Cloud::Error.from_error(e)
@@ -1967,7 +1993,7 @@ module Google
1967
1993
  @backup_dr_stub.call_rpc :update_backup, request, options: options do |response, operation|
1968
1994
  response = ::Gapic::Operation.new response, @operations_client, options: options
1969
1995
  yield response, operation if block_given?
1970
- return response
1996
+ throw :response, response
1971
1997
  end
1972
1998
  rescue ::GRPC::BadStatus => e
1973
1999
  raise ::Google::Cloud::Error.from_error(e)
@@ -2075,7 +2101,7 @@ module Google
2075
2101
  @backup_dr_stub.call_rpc :delete_backup, request, options: options do |response, operation|
2076
2102
  response = ::Gapic::Operation.new response, @operations_client, options: options
2077
2103
  yield response, operation if block_given?
2078
- return response
2104
+ throw :response, response
2079
2105
  end
2080
2106
  rescue ::GRPC::BadStatus => e
2081
2107
  raise ::Google::Cloud::Error.from_error(e)
@@ -2188,7 +2214,7 @@ module Google
2188
2214
  @backup_dr_stub.call_rpc :restore_backup, request, options: options do |response, operation|
2189
2215
  response = ::Gapic::Operation.new response, @operations_client, options: options
2190
2216
  yield response, operation if block_given?
2191
- return response
2217
+ throw :response, response
2192
2218
  end
2193
2219
  rescue ::GRPC::BadStatus => e
2194
2220
  raise ::Google::Cloud::Error.from_error(e)
@@ -2305,7 +2331,7 @@ module Google
2305
2331
  @backup_dr_stub.call_rpc :create_backup_plan, request, options: options do |response, operation|
2306
2332
  response = ::Gapic::Operation.new response, @operations_client, options: options
2307
2333
  yield response, operation if block_given?
2308
- return response
2334
+ throw :response, response
2309
2335
  end
2310
2336
  rescue ::GRPC::BadStatus => e
2311
2337
  raise ::Google::Cloud::Error.from_error(e)
@@ -2393,7 +2419,6 @@ module Google
2393
2419
 
2394
2420
  @backup_dr_stub.call_rpc :get_backup_plan, request, options: options do |response, operation|
2395
2421
  yield response, operation if block_given?
2396
- return response
2397
2422
  end
2398
2423
  rescue ::GRPC::BadStatus => e
2399
2424
  raise ::Google::Cloud::Error.from_error(e)
@@ -2506,7 +2531,7 @@ module Google
2506
2531
  @backup_dr_stub.call_rpc :list_backup_plans, request, options: options do |response, operation|
2507
2532
  response = ::Gapic::PagedEnumerable.new @backup_dr_stub, :list_backup_plans, request, response, operation, options
2508
2533
  yield response, operation if block_given?
2509
- return response
2534
+ throw :response, response
2510
2535
  end
2511
2536
  rescue ::GRPC::BadStatus => e
2512
2537
  raise ::Google::Cloud::Error.from_error(e)
@@ -2616,7 +2641,7 @@ module Google
2616
2641
  @backup_dr_stub.call_rpc :delete_backup_plan, request, options: options do |response, operation|
2617
2642
  response = ::Gapic::Operation.new response, @operations_client, options: options
2618
2643
  yield response, operation if block_given?
2619
- return response
2644
+ throw :response, response
2620
2645
  end
2621
2646
  rescue ::GRPC::BadStatus => e
2622
2647
  raise ::Google::Cloud::Error.from_error(e)
@@ -2731,7 +2756,7 @@ module Google
2731
2756
  @backup_dr_stub.call_rpc :create_backup_plan_association, request, options: options do |response, operation|
2732
2757
  response = ::Gapic::Operation.new response, @operations_client, options: options
2733
2758
  yield response, operation if block_given?
2734
- return response
2759
+ throw :response, response
2735
2760
  end
2736
2761
  rescue ::GRPC::BadStatus => e
2737
2762
  raise ::Google::Cloud::Error.from_error(e)
@@ -2818,7 +2843,6 @@ module Google
2818
2843
 
2819
2844
  @backup_dr_stub.call_rpc :get_backup_plan_association, request, options: options do |response, operation|
2820
2845
  yield response, operation if block_given?
2821
- return response
2822
2846
  end
2823
2847
  rescue ::GRPC::BadStatus => e
2824
2848
  raise ::Google::Cloud::Error.from_error(e)
@@ -2921,7 +2945,7 @@ module Google
2921
2945
  @backup_dr_stub.call_rpc :list_backup_plan_associations, request, options: options do |response, operation|
2922
2946
  response = ::Gapic::PagedEnumerable.new @backup_dr_stub, :list_backup_plan_associations, request, response, operation, options
2923
2947
  yield response, operation if block_given?
2924
- return response
2948
+ throw :response, response
2925
2949
  end
2926
2950
  rescue ::GRPC::BadStatus => e
2927
2951
  raise ::Google::Cloud::Error.from_error(e)
@@ -3030,7 +3054,7 @@ module Google
3030
3054
  @backup_dr_stub.call_rpc :delete_backup_plan_association, request, options: options do |response, operation|
3031
3055
  response = ::Gapic::Operation.new response, @operations_client, options: options
3032
3056
  yield response, operation if block_given?
3033
- return response
3057
+ throw :response, response
3034
3058
  end
3035
3059
  rescue ::GRPC::BadStatus => e
3036
3060
  raise ::Google::Cloud::Error.from_error(e)
@@ -3141,7 +3165,121 @@ module Google
3141
3165
  @backup_dr_stub.call_rpc :trigger_backup, request, options: options do |response, operation|
3142
3166
  response = ::Gapic::Operation.new response, @operations_client, options: options
3143
3167
  yield response, operation if block_given?
3144
- return response
3168
+ throw :response, response
3169
+ end
3170
+ rescue ::GRPC::BadStatus => e
3171
+ raise ::Google::Cloud::Error.from_error(e)
3172
+ end
3173
+
3174
+ ##
3175
+ # Initializes the service related config for a project.
3176
+ #
3177
+ # @overload initialize_service(request, options = nil)
3178
+ # Pass arguments to `initialize_service` via a request object, either of type
3179
+ # {::Google::Cloud::BackupDR::V1::InitializeServiceRequest} or an equivalent Hash.
3180
+ #
3181
+ # @param request [::Google::Cloud::BackupDR::V1::InitializeServiceRequest, ::Hash]
3182
+ # A request object representing the call parameters. Required. To specify no
3183
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
3184
+ # @param options [::Gapic::CallOptions, ::Hash]
3185
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
3186
+ #
3187
+ # @overload initialize_service(name: nil, resource_type: nil, request_id: nil)
3188
+ # Pass arguments to `initialize_service` via keyword arguments. Note that at
3189
+ # least one keyword argument is required. To specify no parameters, or to keep all
3190
+ # the default parameter values, pass an empty Hash as a request object (see above).
3191
+ #
3192
+ # @param name [::String]
3193
+ # Required. The resource name of the serviceConfig used to initialize the
3194
+ # service. Format:
3195
+ # `projects/{project_id}/locations/{location}/serviceConfig`.
3196
+ # @param resource_type [::String]
3197
+ # Required. The resource type to which the default service config will be
3198
+ # applied. Examples include, "compute.googleapis.com/Instance" and
3199
+ # "storage.googleapis.com/Bucket".
3200
+ # @param request_id [::String]
3201
+ # Optional. An optional request ID to identify requests. Specify a unique
3202
+ # request ID so that if you must retry your request, the server will know to
3203
+ # ignore the request if it has already been completed. The server will
3204
+ # guarantee that for at least 60 minutes since the first request.
3205
+ #
3206
+ # For example, consider a situation where you make an initial request and t
3207
+ # he request times out. If you make the request again with the same request
3208
+ # ID, the server can check if original operation with the same request ID
3209
+ # was received, and if so, will ignore the second request. This prevents
3210
+ # clients from accidentally creating duplicate commitments.
3211
+ #
3212
+ # The request ID must be a valid UUID with the exception that zero UUID is
3213
+ # not supported (00000000-0000-0000-0000-000000000000).
3214
+ #
3215
+ # @yield [response, operation] Access the result along with the RPC operation
3216
+ # @yieldparam response [::Gapic::Operation]
3217
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
3218
+ #
3219
+ # @return [::Gapic::Operation]
3220
+ #
3221
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
3222
+ #
3223
+ # @example Basic example
3224
+ # require "google/cloud/backupdr/v1"
3225
+ #
3226
+ # # Create a client object. The client can be reused for multiple calls.
3227
+ # client = Google::Cloud::BackupDR::V1::BackupDR::Client.new
3228
+ #
3229
+ # # Create a request. To set request fields, pass in keyword arguments.
3230
+ # request = Google::Cloud::BackupDR::V1::InitializeServiceRequest.new
3231
+ #
3232
+ # # Call the initialize_service method.
3233
+ # result = client.initialize_service request
3234
+ #
3235
+ # # The returned object is of type Gapic::Operation. You can use it to
3236
+ # # check the status of an operation, cancel it, or wait for results.
3237
+ # # Here is how to wait for a response.
3238
+ # result.wait_until_done! timeout: 60
3239
+ # if result.response?
3240
+ # p result.response
3241
+ # else
3242
+ # puts "No response received."
3243
+ # end
3244
+ #
3245
+ def initialize_service request, options = nil
3246
+ raise ::ArgumentError, "request must be provided" if request.nil?
3247
+
3248
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::BackupDR::V1::InitializeServiceRequest
3249
+
3250
+ # Converts hash and nil to an options object
3251
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
3252
+
3253
+ # Customize the options with defaults
3254
+ metadata = @config.rpcs.initialize_service.metadata.to_h
3255
+
3256
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
3257
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
3258
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
3259
+ gapic_version: ::Google::Cloud::BackupDR::V1::VERSION
3260
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
3261
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
3262
+
3263
+ header_params = {}
3264
+ if request.name
3265
+ header_params["name"] = request.name
3266
+ end
3267
+
3268
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
3269
+ metadata[:"x-goog-request-params"] ||= request_params_header
3270
+
3271
+ options.apply_defaults timeout: @config.rpcs.initialize_service.timeout,
3272
+ metadata: metadata,
3273
+ retry_policy: @config.rpcs.initialize_service.retry_policy
3274
+
3275
+ options.apply_defaults timeout: @config.timeout,
3276
+ metadata: @config.metadata,
3277
+ retry_policy: @config.retry_policy
3278
+
3279
+ @backup_dr_stub.call_rpc :initialize_service, request, options: options do |response, operation|
3280
+ response = ::Gapic::Operation.new response, @operations_client, options: options
3281
+ yield response, operation if block_given?
3282
+ throw :response, response
3145
3283
  end
3146
3284
  rescue ::GRPC::BadStatus => e
3147
3285
  raise ::Google::Cloud::Error.from_error(e)
@@ -3191,6 +3329,13 @@ module Google
3191
3329
  # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
3192
3330
  # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
3193
3331
  # * (`nil`) indicating no credentials
3332
+ #
3333
+ # Warning: If you accept a credential configuration (JSON file or Hash) from an
3334
+ # external source for authentication to Google Cloud, you must validate it before
3335
+ # providing it to a Google API client library. Providing an unvalidated credential
3336
+ # configuration to Google APIs can compromise the security of your systems and data.
3337
+ # For more information, refer to [Validate credential configurations from external
3338
+ # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
3194
3339
  # @return [::Object]
3195
3340
  # @!attribute [rw] scope
3196
3341
  # The OAuth scopes
@@ -3230,6 +3375,11 @@ module Google
3230
3375
  # default endpoint URL. The default value of nil uses the environment
3231
3376
  # universe (usually the default "googleapis.com" universe).
3232
3377
  # @return [::String,nil]
3378
+ # @!attribute [rw] logger
3379
+ # A custom logger to use for request/response debug logging, or the value
3380
+ # `:default` (the default) to construct a default logger, or `nil` to
3381
+ # explicitly disable logging.
3382
+ # @return [::Logger,:default,nil]
3233
3383
  #
3234
3384
  class Configuration
3235
3385
  extend ::Gapic::Config
@@ -3254,6 +3404,7 @@ module Google
3254
3404
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
3255
3405
  config_attr :quota_project, nil, ::String, nil
3256
3406
  config_attr :universe_domain, nil, ::String, nil
3407
+ config_attr :logger, :default, ::Logger, nil, :default
3257
3408
 
3258
3409
  # @private
3259
3410
  def initialize parent_config = nil
@@ -3435,6 +3586,11 @@ module Google
3435
3586
  # @return [::Gapic::Config::Method]
3436
3587
  #
3437
3588
  attr_reader :trigger_backup
3589
+ ##
3590
+ # RPC-specific configuration for `initialize_service`
3591
+ # @return [::Gapic::Config::Method]
3592
+ #
3593
+ attr_reader :initialize_service
3438
3594
 
3439
3595
  # @private
3440
3596
  def initialize parent_rpcs = nil
@@ -3492,6 +3648,8 @@ module Google
3492
3648
  @delete_backup_plan_association = ::Gapic::Config::Method.new delete_backup_plan_association_config
3493
3649
  trigger_backup_config = parent_rpcs.trigger_backup if parent_rpcs.respond_to? :trigger_backup
3494
3650
  @trigger_backup = ::Gapic::Config::Method.new trigger_backup_config
3651
+ initialize_service_config = parent_rpcs.initialize_service if parent_rpcs.respond_to? :initialize_service
3652
+ @initialize_service = ::Gapic::Config::Method.new initialize_service_config
3495
3653
 
3496
3654
  yield self if block_given?
3497
3655
  end
@@ -213,7 +213,7 @@ module Google
213
213
  wrap_lro_operation = ->(op_response) { ::Gapic::Operation.new op_response, @operations_client }
214
214
  response = ::Gapic::PagedEnumerable.new @operations_stub, :list_operations, request, response, operation, options, format_resource: wrap_lro_operation
215
215
  yield response, operation if block_given?
216
- return response
216
+ throw :response, response
217
217
  end
218
218
  rescue ::GRPC::BadStatus => e
219
219
  raise ::Google::Cloud::Error.from_error(e)
@@ -309,7 +309,7 @@ module Google
309
309
  @operations_stub.call_rpc :get_operation, request, options: options do |response, operation|
310
310
  response = ::Gapic::Operation.new response, @operations_client, options: options
311
311
  yield response, operation if block_given?
312
- return response
312
+ throw :response, response
313
313
  end
314
314
  rescue ::GRPC::BadStatus => e
315
315
  raise ::Google::Cloud::Error.from_error(e)
@@ -398,7 +398,6 @@ module Google
398
398
 
399
399
  @operations_stub.call_rpc :delete_operation, request, options: options do |response, operation|
400
400
  yield response, operation if block_given?
401
- return response
402
401
  end
403
402
  rescue ::GRPC::BadStatus => e
404
403
  raise ::Google::Cloud::Error.from_error(e)
@@ -494,7 +493,6 @@ module Google
494
493
 
495
494
  @operations_stub.call_rpc :cancel_operation, request, options: options do |response, operation|
496
495
  yield response, operation if block_given?
497
- return response
498
496
  end
499
497
  rescue ::GRPC::BadStatus => e
500
498
  raise ::Google::Cloud::Error.from_error(e)
@@ -592,7 +590,7 @@ module Google
592
590
  @operations_stub.call_rpc :wait_operation, request, options: options do |response, operation|
593
591
  response = ::Gapic::Operation.new response, @operations_client, options: options
594
592
  yield response, operation if block_given?
595
- return response
593
+ throw :response, response
596
594
  end
597
595
  rescue ::GRPC::BadStatus => e
598
596
  raise ::Google::Cloud::Error.from_error(e)
@@ -642,6 +640,13 @@ module Google
642
640
  # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
643
641
  # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
644
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).
645
650
  # @return [::Object]
646
651
  # @!attribute [rw] scope
647
652
  # The OAuth scopes
@@ -681,6 +686,11 @@ module Google
681
686
  # default endpoint URL. The default value of nil uses the environment
682
687
  # universe (usually the default "googleapis.com" universe).
683
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]
684
694
  #
685
695
  class Configuration
686
696
  extend ::Gapic::Config
@@ -705,6 +715,7 @@ module Google
705
715
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
706
716
  config_attr :quota_project, nil, ::String, nil
707
717
  config_attr :universe_domain, nil, ::String, nil
718
+ config_attr :logger, :default, ::Logger, nil, :default
708
719
 
709
720
  # @private
710
721
  def initialize parent_config = nil