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