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