google-cloud-backupdr-v1 0.a → 0.2.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.
Files changed (36) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +12 -0
  3. data/AUTHENTICATION.md +122 -0
  4. data/README.md +144 -8
  5. data/lib/google/cloud/backupdr/v1/backupdr/client.rb +833 -0
  6. data/lib/google/cloud/backupdr/v1/backupdr/credentials.rb +47 -0
  7. data/lib/google/cloud/backupdr/v1/backupdr/operations.rb +809 -0
  8. data/lib/google/cloud/backupdr/v1/backupdr/paths.rb +69 -0
  9. data/lib/google/cloud/backupdr/v1/backupdr/rest/client.rb +787 -0
  10. data/lib/google/cloud/backupdr/v1/backupdr/rest/operations.rb +902 -0
  11. data/lib/google/cloud/backupdr/v1/backupdr/rest/service_stub.rb +306 -0
  12. data/lib/google/cloud/backupdr/v1/backupdr/rest.rb +54 -0
  13. data/lib/google/cloud/backupdr/v1/backupdr.rb +56 -0
  14. data/lib/google/cloud/backupdr/v1/backupdr_pb.rb +66 -0
  15. data/lib/google/cloud/backupdr/v1/backupdr_services_pb.rb +51 -0
  16. data/lib/google/cloud/backupdr/v1/bindings_override.rb +135 -0
  17. data/lib/google/cloud/backupdr/v1/rest.rb +38 -0
  18. data/lib/google/cloud/backupdr/v1/version.rb +8 -3
  19. data/lib/google/cloud/backupdr/v1.rb +45 -0
  20. data/lib/google-cloud-backupdr-v1.rb +21 -0
  21. data/proto_docs/README.md +4 -0
  22. data/proto_docs/google/api/client.rb +399 -0
  23. data/proto_docs/google/api/field_behavior.rb +85 -0
  24. data/proto_docs/google/api/launch_stage.rb +71 -0
  25. data/proto_docs/google/api/resource.rb +222 -0
  26. data/proto_docs/google/cloud/backupdr/v1/backupdr.rb +362 -0
  27. data/proto_docs/google/longrunning/operations.rb +164 -0
  28. data/proto_docs/google/protobuf/any.rb +145 -0
  29. data/proto_docs/google/protobuf/duration.rb +98 -0
  30. data/proto_docs/google/protobuf/empty.rb +34 -0
  31. data/proto_docs/google/protobuf/field_mask.rb +229 -0
  32. data/proto_docs/google/protobuf/timestamp.rb +127 -0
  33. data/proto_docs/google/protobuf/wrappers.rb +121 -0
  34. data/proto_docs/google/rpc/status.rb +48 -0
  35. data/proto_docs/google/type/expr.rb +75 -0
  36. metadata +115 -10
@@ -0,0 +1,787 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2024 Google LLC
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # https://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ # Auto-generated by gapic-generator-ruby. DO NOT EDIT!
18
+
19
+ require "google/cloud/errors"
20
+ require "google/cloud/backupdr/v1/backupdr_pb"
21
+ require "google/cloud/backupdr/v1/backupdr/rest/service_stub"
22
+ require "google/cloud/location/rest"
23
+ require "google/iam/v1/rest"
24
+
25
+ module Google
26
+ module Cloud
27
+ module BackupDR
28
+ module V1
29
+ module BackupDR
30
+ module Rest
31
+ ##
32
+ # REST client for the BackupDR service.
33
+ #
34
+ # The BackupDR Service
35
+ #
36
+ class Client
37
+ # @private
38
+ API_VERSION = ""
39
+
40
+ # @private
41
+ DEFAULT_ENDPOINT_TEMPLATE = "backupdr.$UNIVERSE_DOMAIN$"
42
+
43
+ include Paths
44
+
45
+ # @private
46
+ attr_reader :backup_dr_stub
47
+
48
+ ##
49
+ # Configure the BackupDR Client class.
50
+ #
51
+ # See {::Google::Cloud::BackupDR::V1::BackupDR::Rest::Client::Configuration}
52
+ # for a description of the configuration fields.
53
+ #
54
+ # @example
55
+ #
56
+ # # Modify the configuration for all BackupDR clients
57
+ # ::Google::Cloud::BackupDR::V1::BackupDR::Rest::Client.configure do |config|
58
+ # config.timeout = 10.0
59
+ # end
60
+ #
61
+ # @yield [config] Configure the Client client.
62
+ # @yieldparam config [Client::Configuration]
63
+ #
64
+ # @return [Client::Configuration]
65
+ #
66
+ def self.configure
67
+ @configure ||= begin
68
+ namespace = ["Google", "Cloud", "BackupDR", "V1"]
69
+ parent_config = while namespace.any?
70
+ parent_name = namespace.join "::"
71
+ parent_const = const_get parent_name
72
+ break parent_const.configure if parent_const.respond_to? :configure
73
+ namespace.pop
74
+ end
75
+ default_config = Client::Configuration.new parent_config
76
+
77
+ default_config.rpcs.list_management_servers.timeout = 60.0
78
+ default_config.rpcs.list_management_servers.retry_policy = {
79
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
80
+ }
81
+
82
+ default_config.rpcs.get_management_server.timeout = 60.0
83
+ default_config.rpcs.get_management_server.retry_policy = {
84
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
85
+ }
86
+
87
+ default_config.rpcs.create_management_server.timeout = 60.0
88
+
89
+ default_config.rpcs.delete_management_server.timeout = 60.0
90
+
91
+ default_config
92
+ end
93
+ yield @configure if block_given?
94
+ @configure
95
+ end
96
+
97
+ ##
98
+ # Configure the BackupDR Client instance.
99
+ #
100
+ # The configuration is set to the derived mode, meaning that values can be changed,
101
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
102
+ # should be made on {Client.configure}.
103
+ #
104
+ # See {::Google::Cloud::BackupDR::V1::BackupDR::Rest::Client::Configuration}
105
+ # for a description of the configuration fields.
106
+ #
107
+ # @yield [config] Configure the Client client.
108
+ # @yieldparam config [Client::Configuration]
109
+ #
110
+ # @return [Client::Configuration]
111
+ #
112
+ def configure
113
+ yield @config if block_given?
114
+ @config
115
+ end
116
+
117
+ ##
118
+ # The effective universe domain
119
+ #
120
+ # @return [String]
121
+ #
122
+ def universe_domain
123
+ @backup_dr_stub.universe_domain
124
+ end
125
+
126
+ ##
127
+ # Create a new BackupDR REST client object.
128
+ #
129
+ # @example
130
+ #
131
+ # # Create a client using the default configuration
132
+ # client = ::Google::Cloud::BackupDR::V1::BackupDR::Rest::Client.new
133
+ #
134
+ # # Create a client using a custom configuration
135
+ # client = ::Google::Cloud::BackupDR::V1::BackupDR::Rest::Client.new do |config|
136
+ # config.timeout = 10.0
137
+ # end
138
+ #
139
+ # @yield [config] Configure the BackupDR client.
140
+ # @yieldparam config [Client::Configuration]
141
+ #
142
+ def initialize
143
+ # Create the configuration object
144
+ @config = Configuration.new Client.configure
145
+
146
+ # Yield the configuration if needed
147
+ yield @config if block_given?
148
+
149
+ # Create credentials
150
+ credentials = @config.credentials
151
+ # Use self-signed JWT if the endpoint is unchanged from default,
152
+ # but only if the default endpoint does not have a region prefix.
153
+ enable_self_signed_jwt = @config.endpoint.nil? ||
154
+ (@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
155
+ !@config.endpoint.split(".").first.include?("-"))
156
+ credentials ||= Credentials.default scope: @config.scope,
157
+ enable_self_signed_jwt: enable_self_signed_jwt
158
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
159
+ credentials = Credentials.new credentials, scope: @config.scope
160
+ end
161
+
162
+ @quota_project_id = @config.quota_project
163
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
164
+
165
+ @operations_client = ::Google::Cloud::BackupDR::V1::BackupDR::Rest::Operations.new do |config|
166
+ config.credentials = credentials
167
+ config.quota_project = @quota_project_id
168
+ config.endpoint = @config.endpoint
169
+ config.universe_domain = @config.universe_domain
170
+ end
171
+
172
+ @backup_dr_stub = ::Google::Cloud::BackupDR::V1::BackupDR::Rest::ServiceStub.new(
173
+ endpoint: @config.endpoint,
174
+ endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
175
+ universe_domain: @config.universe_domain,
176
+ credentials: credentials
177
+ )
178
+
179
+ @location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config|
180
+ config.credentials = credentials
181
+ config.quota_project = @quota_project_id
182
+ config.endpoint = @backup_dr_stub.endpoint
183
+ config.universe_domain = @backup_dr_stub.universe_domain
184
+ config.bindings_override = @config.bindings_override
185
+ end
186
+
187
+ @iam_policy_client = Google::Iam::V1::IAMPolicy::Rest::Client.new do |config|
188
+ config.credentials = credentials
189
+ config.quota_project = @quota_project_id
190
+ config.endpoint = @backup_dr_stub.endpoint
191
+ config.universe_domain = @backup_dr_stub.universe_domain
192
+ config.bindings_override = @config.bindings_override
193
+ end
194
+ end
195
+
196
+ ##
197
+ # Get the associated client for long-running operations.
198
+ #
199
+ # @return [::Google::Cloud::BackupDR::V1::BackupDR::Rest::Operations]
200
+ #
201
+ attr_reader :operations_client
202
+
203
+ ##
204
+ # Get the associated client for mix-in of the Locations.
205
+ #
206
+ # @return [Google::Cloud::Location::Locations::Rest::Client]
207
+ #
208
+ attr_reader :location_client
209
+
210
+ ##
211
+ # Get the associated client for mix-in of the IAMPolicy.
212
+ #
213
+ # @return [Google::Iam::V1::IAMPolicy::Rest::Client]
214
+ #
215
+ attr_reader :iam_policy_client
216
+
217
+ # Service calls
218
+
219
+ ##
220
+ # Lists ManagementServers in a given project and location.
221
+ #
222
+ # @overload list_management_servers(request, options = nil)
223
+ # Pass arguments to `list_management_servers` via a request object, either of type
224
+ # {::Google::Cloud::BackupDR::V1::ListManagementServersRequest} or an equivalent Hash.
225
+ #
226
+ # @param request [::Google::Cloud::BackupDR::V1::ListManagementServersRequest, ::Hash]
227
+ # A request object representing the call parameters. Required. To specify no
228
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
229
+ # @param options [::Gapic::CallOptions, ::Hash]
230
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
231
+ #
232
+ # @overload list_management_servers(parent: nil, page_size: nil, page_token: nil, filter: nil, order_by: nil)
233
+ # Pass arguments to `list_management_servers` via keyword arguments. Note that at
234
+ # least one keyword argument is required. To specify no parameters, or to keep all
235
+ # the default parameter values, pass an empty Hash as a request object (see above).
236
+ #
237
+ # @param parent [::String]
238
+ # Required. The project and location for which to retrieve management servers
239
+ # information, in the format `projects/{project_id}/locations/{location}`. In
240
+ # Cloud BackupDR, locations map to GCP regions, for example **us-central1**.
241
+ # To retrieve management servers for all locations, use "-" for the
242
+ # `{location}` value.
243
+ # @param page_size [::Integer]
244
+ # Optional. Requested page size. Server may return fewer items than
245
+ # requested. If unspecified, server will pick an appropriate default.
246
+ # @param page_token [::String]
247
+ # Optional. A token identifying a page of results the server should return.
248
+ # @param filter [::String]
249
+ # Optional. Filtering results.
250
+ # @param order_by [::String]
251
+ # Optional. Hint for how to order the results.
252
+ # @yield [result, operation] Access the result along with the TransportOperation object
253
+ # @yieldparam result [::Google::Cloud::BackupDR::V1::ListManagementServersResponse]
254
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
255
+ #
256
+ # @return [::Google::Cloud::BackupDR::V1::ListManagementServersResponse]
257
+ #
258
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
259
+ #
260
+ # @example Basic example
261
+ # require "google/cloud/backupdr/v1"
262
+ #
263
+ # # Create a client object. The client can be reused for multiple calls.
264
+ # client = Google::Cloud::BackupDR::V1::BackupDR::Rest::Client.new
265
+ #
266
+ # # Create a request. To set request fields, pass in keyword arguments.
267
+ # request = Google::Cloud::BackupDR::V1::ListManagementServersRequest.new
268
+ #
269
+ # # Call the list_management_servers method.
270
+ # result = client.list_management_servers request
271
+ #
272
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
273
+ # # over elements, and API calls will be issued to fetch pages as needed.
274
+ # result.each do |item|
275
+ # # Each element is of type ::Google::Cloud::BackupDR::V1::ManagementServer.
276
+ # p item
277
+ # end
278
+ #
279
+ def list_management_servers request, options = nil
280
+ raise ::ArgumentError, "request must be provided" if request.nil?
281
+
282
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::BackupDR::V1::ListManagementServersRequest
283
+
284
+ # Converts hash and nil to an options object
285
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
286
+
287
+ # Customize the options with defaults
288
+ call_metadata = @config.rpcs.list_management_servers.metadata.to_h
289
+
290
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
291
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
292
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
293
+ gapic_version: ::Google::Cloud::BackupDR::V1::VERSION,
294
+ transports_version_send: [:rest]
295
+
296
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
297
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
298
+
299
+ options.apply_defaults timeout: @config.rpcs.list_management_servers.timeout,
300
+ metadata: call_metadata,
301
+ retry_policy: @config.rpcs.list_management_servers.retry_policy
302
+
303
+ options.apply_defaults timeout: @config.timeout,
304
+ metadata: @config.metadata,
305
+ retry_policy: @config.retry_policy
306
+
307
+ @backup_dr_stub.list_management_servers request, options do |result, operation|
308
+ yield result, operation if block_given?
309
+ return result
310
+ end
311
+ rescue ::Gapic::Rest::Error => e
312
+ raise ::Google::Cloud::Error.from_error(e)
313
+ end
314
+
315
+ ##
316
+ # Gets details of a single ManagementServer.
317
+ #
318
+ # @overload get_management_server(request, options = nil)
319
+ # Pass arguments to `get_management_server` via a request object, either of type
320
+ # {::Google::Cloud::BackupDR::V1::GetManagementServerRequest} or an equivalent Hash.
321
+ #
322
+ # @param request [::Google::Cloud::BackupDR::V1::GetManagementServerRequest, ::Hash]
323
+ # A request object representing the call parameters. Required. To specify no
324
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
325
+ # @param options [::Gapic::CallOptions, ::Hash]
326
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
327
+ #
328
+ # @overload get_management_server(name: nil)
329
+ # Pass arguments to `get_management_server` via keyword arguments. Note that at
330
+ # least one keyword argument is required. To specify no parameters, or to keep all
331
+ # the default parameter values, pass an empty Hash as a request object (see above).
332
+ #
333
+ # @param name [::String]
334
+ # Required. Name of the management server resource name, in the format
335
+ # `projects/{project_id}/locations/{location}/managementServers/{resource_name}`
336
+ # @yield [result, operation] Access the result along with the TransportOperation object
337
+ # @yieldparam result [::Google::Cloud::BackupDR::V1::ManagementServer]
338
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
339
+ #
340
+ # @return [::Google::Cloud::BackupDR::V1::ManagementServer]
341
+ #
342
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
343
+ #
344
+ # @example Basic example
345
+ # require "google/cloud/backupdr/v1"
346
+ #
347
+ # # Create a client object. The client can be reused for multiple calls.
348
+ # client = Google::Cloud::BackupDR::V1::BackupDR::Rest::Client.new
349
+ #
350
+ # # Create a request. To set request fields, pass in keyword arguments.
351
+ # request = Google::Cloud::BackupDR::V1::GetManagementServerRequest.new
352
+ #
353
+ # # Call the get_management_server method.
354
+ # result = client.get_management_server request
355
+ #
356
+ # # The returned object is of type Google::Cloud::BackupDR::V1::ManagementServer.
357
+ # p result
358
+ #
359
+ def get_management_server request, options = nil
360
+ raise ::ArgumentError, "request must be provided" if request.nil?
361
+
362
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::BackupDR::V1::GetManagementServerRequest
363
+
364
+ # Converts hash and nil to an options object
365
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
366
+
367
+ # Customize the options with defaults
368
+ call_metadata = @config.rpcs.get_management_server.metadata.to_h
369
+
370
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
371
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
372
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
373
+ gapic_version: ::Google::Cloud::BackupDR::V1::VERSION,
374
+ transports_version_send: [:rest]
375
+
376
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
377
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
378
+
379
+ options.apply_defaults timeout: @config.rpcs.get_management_server.timeout,
380
+ metadata: call_metadata,
381
+ retry_policy: @config.rpcs.get_management_server.retry_policy
382
+
383
+ options.apply_defaults timeout: @config.timeout,
384
+ metadata: @config.metadata,
385
+ retry_policy: @config.retry_policy
386
+
387
+ @backup_dr_stub.get_management_server request, options do |result, operation|
388
+ yield result, operation if block_given?
389
+ return result
390
+ end
391
+ rescue ::Gapic::Rest::Error => e
392
+ raise ::Google::Cloud::Error.from_error(e)
393
+ end
394
+
395
+ ##
396
+ # Creates a new ManagementServer in a given project and location.
397
+ #
398
+ # @overload create_management_server(request, options = nil)
399
+ # Pass arguments to `create_management_server` via a request object, either of type
400
+ # {::Google::Cloud::BackupDR::V1::CreateManagementServerRequest} or an equivalent Hash.
401
+ #
402
+ # @param request [::Google::Cloud::BackupDR::V1::CreateManagementServerRequest, ::Hash]
403
+ # A request object representing the call parameters. Required. To specify no
404
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
405
+ # @param options [::Gapic::CallOptions, ::Hash]
406
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
407
+ #
408
+ # @overload create_management_server(parent: nil, management_server_id: nil, management_server: nil, request_id: nil)
409
+ # Pass arguments to `create_management_server` via keyword arguments. Note that at
410
+ # least one keyword argument is required. To specify no parameters, or to keep all
411
+ # the default parameter values, pass an empty Hash as a request object (see above).
412
+ #
413
+ # @param parent [::String]
414
+ # Required. The management server project and location in the format
415
+ # `projects/{project_id}/locations/{location}`. In Cloud Backup and DR
416
+ # locations map to GCP regions, for example **us-central1**.
417
+ # @param management_server_id [::String]
418
+ # Required. The name of the management server to create. The name must be
419
+ # unique for the specified project and location.
420
+ # @param management_server [::Google::Cloud::BackupDR::V1::ManagementServer, ::Hash]
421
+ # Required. A [management server
422
+ # resource][google.cloud.backupdr.v1.ManagementServer]
423
+ # @param request_id [::String]
424
+ # Optional. An optional request ID to identify requests. Specify a unique
425
+ # request ID so that if you must retry your request, the server will know to
426
+ # ignore the request if it has already been completed. The server will
427
+ # guarantee that for at least 60 minutes since the first request.
428
+ #
429
+ # For example, consider a situation where you make an initial request and
430
+ # the request times out. If you make the request again with the same request
431
+ # ID, the server can check if original operation with the same request ID
432
+ # was received, and if so, will ignore the second request. This prevents
433
+ # clients from accidentally creating duplicate commitments.
434
+ #
435
+ # The request ID must be a valid UUID with the exception that zero UUID is
436
+ # not supported (00000000-0000-0000-0000-000000000000).
437
+ # @yield [result, operation] Access the result along with the TransportOperation object
438
+ # @yieldparam result [::Gapic::Operation]
439
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
440
+ #
441
+ # @return [::Gapic::Operation]
442
+ #
443
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
444
+ #
445
+ # @example Basic example
446
+ # require "google/cloud/backupdr/v1"
447
+ #
448
+ # # Create a client object. The client can be reused for multiple calls.
449
+ # client = Google::Cloud::BackupDR::V1::BackupDR::Rest::Client.new
450
+ #
451
+ # # Create a request. To set request fields, pass in keyword arguments.
452
+ # request = Google::Cloud::BackupDR::V1::CreateManagementServerRequest.new
453
+ #
454
+ # # Call the create_management_server method.
455
+ # result = client.create_management_server request
456
+ #
457
+ # # The returned object is of type Gapic::Operation. You can use it to
458
+ # # check the status of an operation, cancel it, or wait for results.
459
+ # # Here is how to wait for a response.
460
+ # result.wait_until_done! timeout: 60
461
+ # if result.response?
462
+ # p result.response
463
+ # else
464
+ # puts "No response received."
465
+ # end
466
+ #
467
+ def create_management_server request, options = nil
468
+ raise ::ArgumentError, "request must be provided" if request.nil?
469
+
470
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::BackupDR::V1::CreateManagementServerRequest
471
+
472
+ # Converts hash and nil to an options object
473
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
474
+
475
+ # Customize the options with defaults
476
+ call_metadata = @config.rpcs.create_management_server.metadata.to_h
477
+
478
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
479
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
480
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
481
+ gapic_version: ::Google::Cloud::BackupDR::V1::VERSION,
482
+ transports_version_send: [:rest]
483
+
484
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
485
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
486
+
487
+ options.apply_defaults timeout: @config.rpcs.create_management_server.timeout,
488
+ metadata: call_metadata,
489
+ retry_policy: @config.rpcs.create_management_server.retry_policy
490
+
491
+ options.apply_defaults timeout: @config.timeout,
492
+ metadata: @config.metadata,
493
+ retry_policy: @config.retry_policy
494
+
495
+ @backup_dr_stub.create_management_server request, options do |result, operation|
496
+ result = ::Gapic::Operation.new result, @operations_client, options: options
497
+ yield result, operation if block_given?
498
+ return result
499
+ end
500
+ rescue ::Gapic::Rest::Error => e
501
+ raise ::Google::Cloud::Error.from_error(e)
502
+ end
503
+
504
+ ##
505
+ # Deletes a single ManagementServer.
506
+ #
507
+ # @overload delete_management_server(request, options = nil)
508
+ # Pass arguments to `delete_management_server` via a request object, either of type
509
+ # {::Google::Cloud::BackupDR::V1::DeleteManagementServerRequest} or an equivalent Hash.
510
+ #
511
+ # @param request [::Google::Cloud::BackupDR::V1::DeleteManagementServerRequest, ::Hash]
512
+ # A request object representing the call parameters. Required. To specify no
513
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
514
+ # @param options [::Gapic::CallOptions, ::Hash]
515
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
516
+ #
517
+ # @overload delete_management_server(name: nil, request_id: nil)
518
+ # Pass arguments to `delete_management_server` via keyword arguments. Note that at
519
+ # least one keyword argument is required. To specify no parameters, or to keep all
520
+ # the default parameter values, pass an empty Hash as a request object (see above).
521
+ #
522
+ # @param name [::String]
523
+ # Required. Name of the resource
524
+ # @param request_id [::String]
525
+ # Optional. An optional request ID to identify requests. Specify a unique
526
+ # request ID so that if you must retry your request, the server will know to
527
+ # ignore the request if it has already been completed. The server will
528
+ # guarantee that for at least 60 minutes after the first request.
529
+ #
530
+ # For example, consider a situation where you make an initial request and
531
+ # the request times out. If you make the request again with the same request
532
+ # ID, the server can check if original operation with the same request ID
533
+ # was received, and if so, will ignore the second request. This prevents
534
+ # clients from accidentally creating duplicate commitments.
535
+ #
536
+ # The request ID must be a valid UUID with the exception that zero UUID is
537
+ # not supported (00000000-0000-0000-0000-000000000000).
538
+ # @yield [result, operation] Access the result along with the TransportOperation object
539
+ # @yieldparam result [::Gapic::Operation]
540
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
541
+ #
542
+ # @return [::Gapic::Operation]
543
+ #
544
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
545
+ #
546
+ # @example Basic example
547
+ # require "google/cloud/backupdr/v1"
548
+ #
549
+ # # Create a client object. The client can be reused for multiple calls.
550
+ # client = Google::Cloud::BackupDR::V1::BackupDR::Rest::Client.new
551
+ #
552
+ # # Create a request. To set request fields, pass in keyword arguments.
553
+ # request = Google::Cloud::BackupDR::V1::DeleteManagementServerRequest.new
554
+ #
555
+ # # Call the delete_management_server method.
556
+ # result = client.delete_management_server request
557
+ #
558
+ # # The returned object is of type Gapic::Operation. You can use it to
559
+ # # check the status of an operation, cancel it, or wait for results.
560
+ # # Here is how to wait for a response.
561
+ # result.wait_until_done! timeout: 60
562
+ # if result.response?
563
+ # p result.response
564
+ # else
565
+ # puts "No response received."
566
+ # end
567
+ #
568
+ def delete_management_server request, options = nil
569
+ raise ::ArgumentError, "request must be provided" if request.nil?
570
+
571
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::BackupDR::V1::DeleteManagementServerRequest
572
+
573
+ # Converts hash and nil to an options object
574
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
575
+
576
+ # Customize the options with defaults
577
+ call_metadata = @config.rpcs.delete_management_server.metadata.to_h
578
+
579
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
580
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
581
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
582
+ gapic_version: ::Google::Cloud::BackupDR::V1::VERSION,
583
+ transports_version_send: [:rest]
584
+
585
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
586
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
587
+
588
+ options.apply_defaults timeout: @config.rpcs.delete_management_server.timeout,
589
+ metadata: call_metadata,
590
+ retry_policy: @config.rpcs.delete_management_server.retry_policy
591
+
592
+ options.apply_defaults timeout: @config.timeout,
593
+ metadata: @config.metadata,
594
+ retry_policy: @config.retry_policy
595
+
596
+ @backup_dr_stub.delete_management_server request, options do |result, operation|
597
+ result = ::Gapic::Operation.new result, @operations_client, options: options
598
+ yield result, operation if block_given?
599
+ return result
600
+ end
601
+ rescue ::Gapic::Rest::Error => e
602
+ raise ::Google::Cloud::Error.from_error(e)
603
+ end
604
+
605
+ ##
606
+ # Configuration class for the BackupDR REST API.
607
+ #
608
+ # This class represents the configuration for BackupDR REST,
609
+ # providing control over timeouts, retry behavior, logging, transport
610
+ # parameters, and other low-level controls. Certain parameters can also be
611
+ # applied individually to specific RPCs. See
612
+ # {::Google::Cloud::BackupDR::V1::BackupDR::Rest::Client::Configuration::Rpcs}
613
+ # for a list of RPCs that can be configured independently.
614
+ #
615
+ # Configuration can be applied globally to all clients, or to a single client
616
+ # on construction.
617
+ #
618
+ # @example
619
+ #
620
+ # # Modify the global config, setting the timeout for
621
+ # # list_management_servers to 20 seconds,
622
+ # # and all remaining timeouts to 10 seconds.
623
+ # ::Google::Cloud::BackupDR::V1::BackupDR::Rest::Client.configure do |config|
624
+ # config.timeout = 10.0
625
+ # config.rpcs.list_management_servers.timeout = 20.0
626
+ # end
627
+ #
628
+ # # Apply the above configuration only to a new client.
629
+ # client = ::Google::Cloud::BackupDR::V1::BackupDR::Rest::Client.new do |config|
630
+ # config.timeout = 10.0
631
+ # config.rpcs.list_management_servers.timeout = 20.0
632
+ # end
633
+ #
634
+ # @!attribute [rw] endpoint
635
+ # A custom service endpoint, as a hostname or hostname:port. The default is
636
+ # nil, indicating to use the default endpoint in the current universe domain.
637
+ # @return [::String,nil]
638
+ # @!attribute [rw] credentials
639
+ # Credentials to send with calls. You may provide any of the following types:
640
+ # * (`String`) The path to a service account key file in JSON format
641
+ # * (`Hash`) A service account key as a Hash
642
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
643
+ # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
644
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
645
+ # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
646
+ # * (`nil`) indicating no credentials
647
+ # @return [::Object]
648
+ # @!attribute [rw] scope
649
+ # The OAuth scopes
650
+ # @return [::Array<::String>]
651
+ # @!attribute [rw] lib_name
652
+ # The library name as recorded in instrumentation and logging
653
+ # @return [::String]
654
+ # @!attribute [rw] lib_version
655
+ # The library version as recorded in instrumentation and logging
656
+ # @return [::String]
657
+ # @!attribute [rw] timeout
658
+ # The call timeout in seconds.
659
+ # @return [::Numeric]
660
+ # @!attribute [rw] metadata
661
+ # Additional headers to be sent with the call.
662
+ # @return [::Hash{::Symbol=>::String}]
663
+ # @!attribute [rw] retry_policy
664
+ # The retry policy. The value is a hash with the following keys:
665
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
666
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
667
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
668
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
669
+ # trigger a retry.
670
+ # @return [::Hash]
671
+ # @!attribute [rw] quota_project
672
+ # A separate project against which to charge quota.
673
+ # @return [::String]
674
+ # @!attribute [rw] universe_domain
675
+ # The universe domain within which to make requests. This determines the
676
+ # default endpoint URL. The default value of nil uses the environment
677
+ # universe (usually the default "googleapis.com" universe).
678
+ # @return [::String,nil]
679
+ #
680
+ class Configuration
681
+ extend ::Gapic::Config
682
+
683
+ # @private
684
+ # The endpoint specific to the default "googleapis.com" universe. Deprecated.
685
+ DEFAULT_ENDPOINT = "backupdr.googleapis.com"
686
+
687
+ config_attr :endpoint, nil, ::String, nil
688
+ config_attr :credentials, nil do |value|
689
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
690
+ allowed.any? { |klass| klass === value }
691
+ end
692
+ config_attr :scope, nil, ::String, ::Array, nil
693
+ config_attr :lib_name, nil, ::String, nil
694
+ config_attr :lib_version, nil, ::String, nil
695
+ config_attr :timeout, nil, ::Numeric, nil
696
+ config_attr :metadata, nil, ::Hash, nil
697
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
698
+ config_attr :quota_project, nil, ::String, nil
699
+ config_attr :universe_domain, nil, ::String, nil
700
+
701
+ # @private
702
+ # Overrides for http bindings for the RPCs of this service
703
+ # are only used when this service is used as mixin, and only
704
+ # by the host service.
705
+ # @return [::Hash{::Symbol=>::Array<::Gapic::Rest::GrpcTranscoder::HttpBinding>}]
706
+ config_attr :bindings_override, {}, ::Hash, nil
707
+
708
+ # @private
709
+ def initialize parent_config = nil
710
+ @parent_config = parent_config unless parent_config.nil?
711
+
712
+ yield self if block_given?
713
+ end
714
+
715
+ ##
716
+ # Configurations for individual RPCs
717
+ # @return [Rpcs]
718
+ #
719
+ def rpcs
720
+ @rpcs ||= begin
721
+ parent_rpcs = nil
722
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
723
+ Rpcs.new parent_rpcs
724
+ end
725
+ end
726
+
727
+ ##
728
+ # Configuration RPC class for the BackupDR API.
729
+ #
730
+ # Includes fields providing the configuration for each RPC in this service.
731
+ # Each configuration object is of type `Gapic::Config::Method` and includes
732
+ # the following configuration fields:
733
+ #
734
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
735
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
736
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
737
+ # include the following keys:
738
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
739
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
740
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
741
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
742
+ # trigger a retry.
743
+ #
744
+ class Rpcs
745
+ ##
746
+ # RPC-specific configuration for `list_management_servers`
747
+ # @return [::Gapic::Config::Method]
748
+ #
749
+ attr_reader :list_management_servers
750
+ ##
751
+ # RPC-specific configuration for `get_management_server`
752
+ # @return [::Gapic::Config::Method]
753
+ #
754
+ attr_reader :get_management_server
755
+ ##
756
+ # RPC-specific configuration for `create_management_server`
757
+ # @return [::Gapic::Config::Method]
758
+ #
759
+ attr_reader :create_management_server
760
+ ##
761
+ # RPC-specific configuration for `delete_management_server`
762
+ # @return [::Gapic::Config::Method]
763
+ #
764
+ attr_reader :delete_management_server
765
+
766
+ # @private
767
+ def initialize parent_rpcs = nil
768
+ list_management_servers_config = parent_rpcs.list_management_servers if parent_rpcs.respond_to? :list_management_servers
769
+ @list_management_servers = ::Gapic::Config::Method.new list_management_servers_config
770
+ get_management_server_config = parent_rpcs.get_management_server if parent_rpcs.respond_to? :get_management_server
771
+ @get_management_server = ::Gapic::Config::Method.new get_management_server_config
772
+ create_management_server_config = parent_rpcs.create_management_server if parent_rpcs.respond_to? :create_management_server
773
+ @create_management_server = ::Gapic::Config::Method.new create_management_server_config
774
+ delete_management_server_config = parent_rpcs.delete_management_server if parent_rpcs.respond_to? :delete_management_server
775
+ @delete_management_server = ::Gapic::Config::Method.new delete_management_server_config
776
+
777
+ yield self if block_given?
778
+ end
779
+ end
780
+ end
781
+ end
782
+ end
783
+ end
784
+ end
785
+ end
786
+ end
787
+ end