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