google-cloud-spanner-admin-database-v1 0.10.0 → 0.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/AUTHENTICATION.md +1 -1
- data/README.md +2 -2
- data/lib/google/cloud/spanner/admin/database/v1/database_admin/client.rb +147 -44
- data/lib/google/cloud/spanner/admin/database/v1/database_admin/operations.rb +12 -14
- data/lib/google/cloud/spanner/admin/database/v1/database_admin/rest/client.rb +2121 -0
- data/lib/google/cloud/spanner/admin/database/v1/database_admin/rest/operations.rb +880 -0
- data/lib/google/cloud/spanner/admin/database/v1/database_admin/rest/service_stub.rb +1214 -0
- data/lib/google/cloud/spanner/admin/database/v1/database_admin/rest.rb +63 -0
- data/lib/google/cloud/spanner/admin/database/v1/database_admin.rb +7 -1
- data/lib/google/cloud/spanner/admin/database/v1/rest.rb +41 -0
- data/lib/google/cloud/spanner/admin/database/v1/version.rb +1 -1
- data/lib/google/cloud/spanner/admin/database/v1.rb +7 -2
- data/lib/google/spanner/admin/database/v1/spanner_database_admin_pb.rb +15 -0
- data/lib/google/spanner/admin/database/v1/spanner_database_admin_services_pb.rb +2 -0
- data/proto_docs/google/api/client.rb +318 -0
- data/proto_docs/google/api/launch_stage.rb +71 -0
- data/proto_docs/google/protobuf/empty.rb +0 -2
- data/proto_docs/google/rpc/status.rb +4 -2
- data/proto_docs/google/spanner/admin/database/v1/spanner_database_admin.rb +47 -0
- metadata +16 -8
@@ -0,0 +1,2121 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2023 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/spanner/admin/database/v1/spanner_database_admin_pb"
|
21
|
+
require "google/cloud/spanner/admin/database/v1/database_admin/rest/service_stub"
|
22
|
+
|
23
|
+
module Google
|
24
|
+
module Cloud
|
25
|
+
module Spanner
|
26
|
+
module Admin
|
27
|
+
module Database
|
28
|
+
module V1
|
29
|
+
module DatabaseAdmin
|
30
|
+
module Rest
|
31
|
+
##
|
32
|
+
# REST client for the DatabaseAdmin service.
|
33
|
+
#
|
34
|
+
# Cloud Spanner Database Admin API
|
35
|
+
#
|
36
|
+
# The Cloud Spanner Database Admin API can be used to:
|
37
|
+
# * create, drop, and list databases
|
38
|
+
# * update the schema of pre-existing databases
|
39
|
+
# * create, delete and list backups for a database
|
40
|
+
# * restore a database from an existing backup
|
41
|
+
#
|
42
|
+
class Client
|
43
|
+
include Paths
|
44
|
+
|
45
|
+
# @private
|
46
|
+
attr_reader :database_admin_stub
|
47
|
+
|
48
|
+
##
|
49
|
+
# Configure the DatabaseAdmin Client class.
|
50
|
+
#
|
51
|
+
# See {::Google::Cloud::Spanner::Admin::Database::V1::DatabaseAdmin::Rest::Client::Configuration}
|
52
|
+
# for a description of the configuration fields.
|
53
|
+
#
|
54
|
+
# @example
|
55
|
+
#
|
56
|
+
# # Modify the configuration for all DatabaseAdmin clients
|
57
|
+
# ::Google::Cloud::Spanner::Admin::Database::V1::DatabaseAdmin::Rest::Client.configure do |config|
|
58
|
+
# config.timeout = 10.0
|
59
|
+
# end
|
60
|
+
#
|
61
|
+
# @yield [config] Configure the Client client.
|
62
|
+
# @yieldparam config [Client::Configuration]
|
63
|
+
#
|
64
|
+
# @return [Client::Configuration]
|
65
|
+
#
|
66
|
+
def self.configure
|
67
|
+
@configure ||= begin
|
68
|
+
namespace = ["Google", "Cloud", "Spanner", "Admin", "Database", "V1"]
|
69
|
+
parent_config = while namespace.any?
|
70
|
+
parent_name = namespace.join "::"
|
71
|
+
parent_const = const_get parent_name
|
72
|
+
break parent_const.configure if parent_const.respond_to? :configure
|
73
|
+
namespace.pop
|
74
|
+
end
|
75
|
+
default_config = Client::Configuration.new parent_config
|
76
|
+
|
77
|
+
default_config.rpcs.list_databases.timeout = 3600.0
|
78
|
+
default_config.rpcs.list_databases.retry_policy = {
|
79
|
+
initial_delay: 1.0, max_delay: 32.0, multiplier: 1.3, retry_codes: [14, 4]
|
80
|
+
}
|
81
|
+
|
82
|
+
default_config.rpcs.create_database.timeout = 3600.0
|
83
|
+
|
84
|
+
default_config.rpcs.get_database.timeout = 3600.0
|
85
|
+
default_config.rpcs.get_database.retry_policy = {
|
86
|
+
initial_delay: 1.0, max_delay: 32.0, multiplier: 1.3, retry_codes: [14, 4]
|
87
|
+
}
|
88
|
+
|
89
|
+
default_config.rpcs.update_database_ddl.timeout = 3600.0
|
90
|
+
default_config.rpcs.update_database_ddl.retry_policy = {
|
91
|
+
initial_delay: 1.0, max_delay: 32.0, multiplier: 1.3, retry_codes: [14, 4]
|
92
|
+
}
|
93
|
+
|
94
|
+
default_config.rpcs.drop_database.timeout = 3600.0
|
95
|
+
default_config.rpcs.drop_database.retry_policy = {
|
96
|
+
initial_delay: 1.0, max_delay: 32.0, multiplier: 1.3, retry_codes: [14, 4]
|
97
|
+
}
|
98
|
+
|
99
|
+
default_config.rpcs.get_database_ddl.timeout = 3600.0
|
100
|
+
default_config.rpcs.get_database_ddl.retry_policy = {
|
101
|
+
initial_delay: 1.0, max_delay: 32.0, multiplier: 1.3, retry_codes: [14, 4]
|
102
|
+
}
|
103
|
+
|
104
|
+
default_config.rpcs.set_iam_policy.timeout = 30.0
|
105
|
+
|
106
|
+
default_config.rpcs.get_iam_policy.timeout = 30.0
|
107
|
+
default_config.rpcs.get_iam_policy.retry_policy = {
|
108
|
+
initial_delay: 1.0, max_delay: 32.0, multiplier: 1.3, retry_codes: [14, 4]
|
109
|
+
}
|
110
|
+
|
111
|
+
default_config.rpcs.test_iam_permissions.timeout = 30.0
|
112
|
+
|
113
|
+
default_config.rpcs.create_backup.timeout = 3600.0
|
114
|
+
|
115
|
+
default_config.rpcs.copy_backup.timeout = 3600.0
|
116
|
+
|
117
|
+
default_config.rpcs.get_backup.timeout = 3600.0
|
118
|
+
default_config.rpcs.get_backup.retry_policy = {
|
119
|
+
initial_delay: 1.0, max_delay: 32.0, multiplier: 1.3, retry_codes: [14, 4]
|
120
|
+
}
|
121
|
+
|
122
|
+
default_config.rpcs.update_backup.timeout = 3600.0
|
123
|
+
default_config.rpcs.update_backup.retry_policy = {
|
124
|
+
initial_delay: 1.0, max_delay: 32.0, multiplier: 1.3, retry_codes: [14, 4]
|
125
|
+
}
|
126
|
+
|
127
|
+
default_config.rpcs.delete_backup.timeout = 3600.0
|
128
|
+
default_config.rpcs.delete_backup.retry_policy = {
|
129
|
+
initial_delay: 1.0, max_delay: 32.0, multiplier: 1.3, retry_codes: [14, 4]
|
130
|
+
}
|
131
|
+
|
132
|
+
default_config.rpcs.list_backups.timeout = 3600.0
|
133
|
+
default_config.rpcs.list_backups.retry_policy = {
|
134
|
+
initial_delay: 1.0, max_delay: 32.0, multiplier: 1.3, retry_codes: [14, 4]
|
135
|
+
}
|
136
|
+
|
137
|
+
default_config.rpcs.restore_database.timeout = 3600.0
|
138
|
+
|
139
|
+
default_config.rpcs.list_database_operations.timeout = 3600.0
|
140
|
+
default_config.rpcs.list_database_operations.retry_policy = {
|
141
|
+
initial_delay: 1.0, max_delay: 32.0, multiplier: 1.3, retry_codes: [14, 4]
|
142
|
+
}
|
143
|
+
|
144
|
+
default_config.rpcs.list_backup_operations.timeout = 3600.0
|
145
|
+
default_config.rpcs.list_backup_operations.retry_policy = {
|
146
|
+
initial_delay: 1.0, max_delay: 32.0, multiplier: 1.3, retry_codes: [14, 4]
|
147
|
+
}
|
148
|
+
|
149
|
+
default_config.rpcs.list_database_roles.timeout = 3600.0
|
150
|
+
default_config.rpcs.list_database_roles.retry_policy = {
|
151
|
+
initial_delay: 1.0, max_delay: 32.0, multiplier: 1.3, retry_codes: [14, 4]
|
152
|
+
}
|
153
|
+
|
154
|
+
default_config
|
155
|
+
end
|
156
|
+
yield @configure if block_given?
|
157
|
+
@configure
|
158
|
+
end
|
159
|
+
|
160
|
+
##
|
161
|
+
# Configure the DatabaseAdmin Client instance.
|
162
|
+
#
|
163
|
+
# The configuration is set to the derived mode, meaning that values can be changed,
|
164
|
+
# but structural changes (adding new fields, etc.) are not allowed. Structural changes
|
165
|
+
# should be made on {Client.configure}.
|
166
|
+
#
|
167
|
+
# See {::Google::Cloud::Spanner::Admin::Database::V1::DatabaseAdmin::Rest::Client::Configuration}
|
168
|
+
# for a description of the configuration fields.
|
169
|
+
#
|
170
|
+
# @yield [config] Configure the Client client.
|
171
|
+
# @yieldparam config [Client::Configuration]
|
172
|
+
#
|
173
|
+
# @return [Client::Configuration]
|
174
|
+
#
|
175
|
+
def configure
|
176
|
+
yield @config if block_given?
|
177
|
+
@config
|
178
|
+
end
|
179
|
+
|
180
|
+
##
|
181
|
+
# Create a new DatabaseAdmin REST client object.
|
182
|
+
#
|
183
|
+
# @example
|
184
|
+
#
|
185
|
+
# # Create a client using the default configuration
|
186
|
+
# client = ::Google::Cloud::Spanner::Admin::Database::V1::DatabaseAdmin::Rest::Client.new
|
187
|
+
#
|
188
|
+
# # Create a client using a custom configuration
|
189
|
+
# client = ::Google::Cloud::Spanner::Admin::Database::V1::DatabaseAdmin::Rest::Client.new do |config|
|
190
|
+
# config.timeout = 10.0
|
191
|
+
# end
|
192
|
+
#
|
193
|
+
# @yield [config] Configure the DatabaseAdmin client.
|
194
|
+
# @yieldparam config [Client::Configuration]
|
195
|
+
#
|
196
|
+
def initialize
|
197
|
+
# Create the configuration object
|
198
|
+
@config = Configuration.new Client.configure
|
199
|
+
|
200
|
+
# Yield the configuration if needed
|
201
|
+
yield @config if block_given?
|
202
|
+
|
203
|
+
# Create credentials
|
204
|
+
credentials = @config.credentials
|
205
|
+
# Use self-signed JWT if the endpoint is unchanged from default,
|
206
|
+
# but only if the default endpoint does not have a region prefix.
|
207
|
+
enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
|
208
|
+
!@config.endpoint.split(".").first.include?("-")
|
209
|
+
credentials ||= Credentials.default scope: @config.scope,
|
210
|
+
enable_self_signed_jwt: enable_self_signed_jwt
|
211
|
+
if credentials.is_a?(::String) || credentials.is_a?(::Hash)
|
212
|
+
credentials = Credentials.new credentials, scope: @config.scope
|
213
|
+
end
|
214
|
+
|
215
|
+
@quota_project_id = @config.quota_project
|
216
|
+
@quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
|
217
|
+
|
218
|
+
@operations_client = ::Google::Cloud::Spanner::Admin::Database::V1::DatabaseAdmin::Rest::Operations.new do |config|
|
219
|
+
config.credentials = credentials
|
220
|
+
config.quota_project = @quota_project_id
|
221
|
+
config.endpoint = @config.endpoint
|
222
|
+
end
|
223
|
+
|
224
|
+
@database_admin_stub = ::Google::Cloud::Spanner::Admin::Database::V1::DatabaseAdmin::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials
|
225
|
+
end
|
226
|
+
|
227
|
+
##
|
228
|
+
# Get the associated client for long-running operations.
|
229
|
+
#
|
230
|
+
# @return [::Google::Cloud::Spanner::Admin::Database::V1::DatabaseAdmin::Rest::Operations]
|
231
|
+
#
|
232
|
+
attr_reader :operations_client
|
233
|
+
|
234
|
+
# Service calls
|
235
|
+
|
236
|
+
##
|
237
|
+
# Lists Cloud Spanner databases.
|
238
|
+
#
|
239
|
+
# @overload list_databases(request, options = nil)
|
240
|
+
# Pass arguments to `list_databases` via a request object, either of type
|
241
|
+
# {::Google::Cloud::Spanner::Admin::Database::V1::ListDatabasesRequest} or an equivalent Hash.
|
242
|
+
#
|
243
|
+
# @param request [::Google::Cloud::Spanner::Admin::Database::V1::ListDatabasesRequest, ::Hash]
|
244
|
+
# A request object representing the call parameters. Required. To specify no
|
245
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
246
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
247
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
248
|
+
#
|
249
|
+
# @overload list_databases(parent: nil, page_size: nil, page_token: nil)
|
250
|
+
# Pass arguments to `list_databases` via keyword arguments. Note that at
|
251
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
252
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
253
|
+
#
|
254
|
+
# @param parent [::String]
|
255
|
+
# Required. The instance whose databases should be listed.
|
256
|
+
# Values are of the form `projects/<project>/instances/<instance>`.
|
257
|
+
# @param page_size [::Integer]
|
258
|
+
# Number of databases to be returned in the response. If 0 or less,
|
259
|
+
# defaults to the server's maximum allowed page size.
|
260
|
+
# @param page_token [::String]
|
261
|
+
# If non-empty, `page_token` should contain a
|
262
|
+
# {::Google::Cloud::Spanner::Admin::Database::V1::ListDatabasesResponse#next_page_token next_page_token} from a
|
263
|
+
# previous {::Google::Cloud::Spanner::Admin::Database::V1::ListDatabasesResponse ListDatabasesResponse}.
|
264
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
265
|
+
# @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Spanner::Admin::Database::V1::Database>]
|
266
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
267
|
+
#
|
268
|
+
# @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Spanner::Admin::Database::V1::Database>]
|
269
|
+
#
|
270
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
271
|
+
def list_databases request, options = nil
|
272
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
273
|
+
|
274
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Spanner::Admin::Database::V1::ListDatabasesRequest
|
275
|
+
|
276
|
+
# Converts hash and nil to an options object
|
277
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
278
|
+
|
279
|
+
# Customize the options with defaults
|
280
|
+
call_metadata = @config.rpcs.list_databases.metadata.to_h
|
281
|
+
|
282
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
283
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
284
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
285
|
+
gapic_version: ::Google::Cloud::Spanner::Admin::Database::V1::VERSION,
|
286
|
+
transports_version_send: [:rest]
|
287
|
+
|
288
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
289
|
+
|
290
|
+
options.apply_defaults timeout: @config.rpcs.list_databases.timeout,
|
291
|
+
metadata: call_metadata,
|
292
|
+
retry_policy: @config.rpcs.list_databases.retry_policy
|
293
|
+
|
294
|
+
options.apply_defaults timeout: @config.timeout,
|
295
|
+
metadata: @config.metadata,
|
296
|
+
retry_policy: @config.retry_policy
|
297
|
+
|
298
|
+
@database_admin_stub.list_databases request, options do |result, operation|
|
299
|
+
result = ::Gapic::Rest::PagedEnumerable.new @database_admin_stub, :list_databases, "databases", request, result, options
|
300
|
+
yield result, operation if block_given?
|
301
|
+
return result
|
302
|
+
end
|
303
|
+
rescue ::Gapic::Rest::Error => e
|
304
|
+
raise ::Google::Cloud::Error.from_error(e)
|
305
|
+
end
|
306
|
+
|
307
|
+
##
|
308
|
+
# Creates a new Cloud Spanner database and starts to prepare it for serving.
|
309
|
+
# The returned {::Google::Longrunning::Operation long-running operation} will
|
310
|
+
# have a name of the format `<database_name>/operations/<operation_id>` and
|
311
|
+
# can be used to track preparation of the database. The
|
312
|
+
# {::Google::Longrunning::Operation#metadata metadata} field type is
|
313
|
+
# {::Google::Cloud::Spanner::Admin::Database::V1::CreateDatabaseMetadata CreateDatabaseMetadata}. The
|
314
|
+
# {::Google::Longrunning::Operation#response response} field type is
|
315
|
+
# {::Google::Cloud::Spanner::Admin::Database::V1::Database Database}, if successful.
|
316
|
+
#
|
317
|
+
# @overload create_database(request, options = nil)
|
318
|
+
# Pass arguments to `create_database` via a request object, either of type
|
319
|
+
# {::Google::Cloud::Spanner::Admin::Database::V1::CreateDatabaseRequest} or an equivalent Hash.
|
320
|
+
#
|
321
|
+
# @param request [::Google::Cloud::Spanner::Admin::Database::V1::CreateDatabaseRequest, ::Hash]
|
322
|
+
# A request object representing the call parameters. Required. To specify no
|
323
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
324
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
325
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
326
|
+
#
|
327
|
+
# @overload create_database(parent: nil, create_statement: nil, extra_statements: nil, encryption_config: nil, database_dialect: nil)
|
328
|
+
# Pass arguments to `create_database` via keyword arguments. Note that at
|
329
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
330
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
331
|
+
#
|
332
|
+
# @param parent [::String]
|
333
|
+
# Required. The name of the instance that will serve the new database.
|
334
|
+
# Values are of the form `projects/<project>/instances/<instance>`.
|
335
|
+
# @param create_statement [::String]
|
336
|
+
# Required. A `CREATE DATABASE` statement, which specifies the ID of the
|
337
|
+
# new database. The database ID must conform to the regular expression
|
338
|
+
# `[a-z][a-z0-9_\-]*[a-z0-9]` and be between 2 and 30 characters in length.
|
339
|
+
# If the database ID is a reserved word or if it contains a hyphen, the
|
340
|
+
# database ID must be enclosed in backticks (`` ` ``).
|
341
|
+
# @param extra_statements [::Array<::String>]
|
342
|
+
# Optional. A list of DDL statements to run inside the newly created
|
343
|
+
# database. Statements can create tables, indexes, etc. These
|
344
|
+
# statements execute atomically with the creation of the database:
|
345
|
+
# if there is an error in any statement, the database is not created.
|
346
|
+
# @param encryption_config [::Google::Cloud::Spanner::Admin::Database::V1::EncryptionConfig, ::Hash]
|
347
|
+
# Optional. The encryption configuration for the database. If this field is not
|
348
|
+
# specified, Cloud Spanner will encrypt/decrypt all data at rest using
|
349
|
+
# Google default encryption.
|
350
|
+
# @param database_dialect [::Google::Cloud::Spanner::Admin::Database::V1::DatabaseDialect]
|
351
|
+
# Optional. The dialect of the Cloud Spanner Database.
|
352
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
353
|
+
# @yieldparam result [::Gapic::Operation]
|
354
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
355
|
+
#
|
356
|
+
# @return [::Gapic::Operation]
|
357
|
+
#
|
358
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
359
|
+
def create_database request, options = nil
|
360
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
361
|
+
|
362
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Spanner::Admin::Database::V1::CreateDatabaseRequest
|
363
|
+
|
364
|
+
# Converts hash and nil to an options object
|
365
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
366
|
+
|
367
|
+
# Customize the options with defaults
|
368
|
+
call_metadata = @config.rpcs.create_database.metadata.to_h
|
369
|
+
|
370
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
371
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
372
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
373
|
+
gapic_version: ::Google::Cloud::Spanner::Admin::Database::V1::VERSION,
|
374
|
+
transports_version_send: [:rest]
|
375
|
+
|
376
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
377
|
+
|
378
|
+
options.apply_defaults timeout: @config.rpcs.create_database.timeout,
|
379
|
+
metadata: call_metadata,
|
380
|
+
retry_policy: @config.rpcs.create_database.retry_policy
|
381
|
+
|
382
|
+
options.apply_defaults timeout: @config.timeout,
|
383
|
+
metadata: @config.metadata,
|
384
|
+
retry_policy: @config.retry_policy
|
385
|
+
|
386
|
+
@database_admin_stub.create_database request, options do |result, operation|
|
387
|
+
result = ::Gapic::Operation.new result, @operations_client, options: options
|
388
|
+
yield result, operation if block_given?
|
389
|
+
return result
|
390
|
+
end
|
391
|
+
rescue ::Gapic::Rest::Error => e
|
392
|
+
raise ::Google::Cloud::Error.from_error(e)
|
393
|
+
end
|
394
|
+
|
395
|
+
##
|
396
|
+
# Gets the state of a Cloud Spanner database.
|
397
|
+
#
|
398
|
+
# @overload get_database(request, options = nil)
|
399
|
+
# Pass arguments to `get_database` via a request object, either of type
|
400
|
+
# {::Google::Cloud::Spanner::Admin::Database::V1::GetDatabaseRequest} or an equivalent Hash.
|
401
|
+
#
|
402
|
+
# @param request [::Google::Cloud::Spanner::Admin::Database::V1::GetDatabaseRequest, ::Hash]
|
403
|
+
# A request object representing the call parameters. Required. To specify no
|
404
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
405
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
406
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
407
|
+
#
|
408
|
+
# @overload get_database(name: nil)
|
409
|
+
# Pass arguments to `get_database` via keyword arguments. Note that at
|
410
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
411
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
412
|
+
#
|
413
|
+
# @param name [::String]
|
414
|
+
# Required. The name of the requested database. Values are of the form
|
415
|
+
# `projects/<project>/instances/<instance>/databases/<database>`.
|
416
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
417
|
+
# @yieldparam result [::Google::Cloud::Spanner::Admin::Database::V1::Database]
|
418
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
419
|
+
#
|
420
|
+
# @return [::Google::Cloud::Spanner::Admin::Database::V1::Database]
|
421
|
+
#
|
422
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
423
|
+
def get_database request, options = nil
|
424
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
425
|
+
|
426
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Spanner::Admin::Database::V1::GetDatabaseRequest
|
427
|
+
|
428
|
+
# Converts hash and nil to an options object
|
429
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
430
|
+
|
431
|
+
# Customize the options with defaults
|
432
|
+
call_metadata = @config.rpcs.get_database.metadata.to_h
|
433
|
+
|
434
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
435
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
436
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
437
|
+
gapic_version: ::Google::Cloud::Spanner::Admin::Database::V1::VERSION,
|
438
|
+
transports_version_send: [:rest]
|
439
|
+
|
440
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
441
|
+
|
442
|
+
options.apply_defaults timeout: @config.rpcs.get_database.timeout,
|
443
|
+
metadata: call_metadata,
|
444
|
+
retry_policy: @config.rpcs.get_database.retry_policy
|
445
|
+
|
446
|
+
options.apply_defaults timeout: @config.timeout,
|
447
|
+
metadata: @config.metadata,
|
448
|
+
retry_policy: @config.retry_policy
|
449
|
+
|
450
|
+
@database_admin_stub.get_database request, options do |result, operation|
|
451
|
+
yield result, operation if block_given?
|
452
|
+
return result
|
453
|
+
end
|
454
|
+
rescue ::Gapic::Rest::Error => e
|
455
|
+
raise ::Google::Cloud::Error.from_error(e)
|
456
|
+
end
|
457
|
+
|
458
|
+
##
|
459
|
+
# Updates the schema of a Cloud Spanner database by
|
460
|
+
# creating/altering/dropping tables, columns, indexes, etc. The returned
|
461
|
+
# {::Google::Longrunning::Operation long-running operation} will have a name of
|
462
|
+
# the format `<database_name>/operations/<operation_id>` and can be used to
|
463
|
+
# track execution of the schema change(s). The
|
464
|
+
# {::Google::Longrunning::Operation#metadata metadata} field type is
|
465
|
+
# {::Google::Cloud::Spanner::Admin::Database::V1::UpdateDatabaseDdlMetadata UpdateDatabaseDdlMetadata}. The operation has no response.
|
466
|
+
#
|
467
|
+
# @overload update_database_ddl(request, options = nil)
|
468
|
+
# Pass arguments to `update_database_ddl` via a request object, either of type
|
469
|
+
# {::Google::Cloud::Spanner::Admin::Database::V1::UpdateDatabaseDdlRequest} or an equivalent Hash.
|
470
|
+
#
|
471
|
+
# @param request [::Google::Cloud::Spanner::Admin::Database::V1::UpdateDatabaseDdlRequest, ::Hash]
|
472
|
+
# A request object representing the call parameters. Required. To specify no
|
473
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
474
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
475
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
476
|
+
#
|
477
|
+
# @overload update_database_ddl(database: nil, statements: nil, operation_id: nil)
|
478
|
+
# Pass arguments to `update_database_ddl` via keyword arguments. Note that at
|
479
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
480
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
481
|
+
#
|
482
|
+
# @param database [::String]
|
483
|
+
# Required. The database to update.
|
484
|
+
# @param statements [::Array<::String>]
|
485
|
+
# Required. DDL statements to be applied to the database.
|
486
|
+
# @param operation_id [::String]
|
487
|
+
# If empty, the new update request is assigned an
|
488
|
+
# automatically-generated operation ID. Otherwise, `operation_id`
|
489
|
+
# is used to construct the name of the resulting
|
490
|
+
# {::Google::Longrunning::Operation Operation}.
|
491
|
+
#
|
492
|
+
# Specifying an explicit operation ID simplifies determining
|
493
|
+
# whether the statements were executed in the event that the
|
494
|
+
# {::Google::Cloud::Spanner::Admin::Database::V1::DatabaseAdmin::Rest::Client#update_database_ddl UpdateDatabaseDdl} call is replayed,
|
495
|
+
# or the return value is otherwise lost: the {::Google::Cloud::Spanner::Admin::Database::V1::UpdateDatabaseDdlRequest#database database} and
|
496
|
+
# `operation_id` fields can be combined to form the
|
497
|
+
# {::Google::Longrunning::Operation#name name} of the resulting
|
498
|
+
# {::Google::Longrunning::Operation longrunning.Operation}: `<database>/operations/<operation_id>`.
|
499
|
+
#
|
500
|
+
# `operation_id` should be unique within the database, and must be
|
501
|
+
# a valid identifier: `[a-z][a-z0-9_]*`. Note that
|
502
|
+
# automatically-generated operation IDs always begin with an
|
503
|
+
# underscore. If the named operation already exists,
|
504
|
+
# {::Google::Cloud::Spanner::Admin::Database::V1::DatabaseAdmin::Rest::Client#update_database_ddl UpdateDatabaseDdl} returns
|
505
|
+
# `ALREADY_EXISTS`.
|
506
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
507
|
+
# @yieldparam result [::Gapic::Operation]
|
508
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
509
|
+
#
|
510
|
+
# @return [::Gapic::Operation]
|
511
|
+
#
|
512
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
513
|
+
def update_database_ddl request, options = nil
|
514
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
515
|
+
|
516
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Spanner::Admin::Database::V1::UpdateDatabaseDdlRequest
|
517
|
+
|
518
|
+
# Converts hash and nil to an options object
|
519
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
520
|
+
|
521
|
+
# Customize the options with defaults
|
522
|
+
call_metadata = @config.rpcs.update_database_ddl.metadata.to_h
|
523
|
+
|
524
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
525
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
526
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
527
|
+
gapic_version: ::Google::Cloud::Spanner::Admin::Database::V1::VERSION,
|
528
|
+
transports_version_send: [:rest]
|
529
|
+
|
530
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
531
|
+
|
532
|
+
options.apply_defaults timeout: @config.rpcs.update_database_ddl.timeout,
|
533
|
+
metadata: call_metadata,
|
534
|
+
retry_policy: @config.rpcs.update_database_ddl.retry_policy
|
535
|
+
|
536
|
+
options.apply_defaults timeout: @config.timeout,
|
537
|
+
metadata: @config.metadata,
|
538
|
+
retry_policy: @config.retry_policy
|
539
|
+
|
540
|
+
@database_admin_stub.update_database_ddl request, options do |result, operation|
|
541
|
+
result = ::Gapic::Operation.new result, @operations_client, options: options
|
542
|
+
yield result, operation if block_given?
|
543
|
+
return result
|
544
|
+
end
|
545
|
+
rescue ::Gapic::Rest::Error => e
|
546
|
+
raise ::Google::Cloud::Error.from_error(e)
|
547
|
+
end
|
548
|
+
|
549
|
+
##
|
550
|
+
# Drops (aka deletes) a Cloud Spanner database.
|
551
|
+
# Completed backups for the database will be retained according to their
|
552
|
+
# `expire_time`.
|
553
|
+
# Note: Cloud Spanner might continue to accept requests for a few seconds
|
554
|
+
# after the database has been deleted.
|
555
|
+
#
|
556
|
+
# @overload drop_database(request, options = nil)
|
557
|
+
# Pass arguments to `drop_database` via a request object, either of type
|
558
|
+
# {::Google::Cloud::Spanner::Admin::Database::V1::DropDatabaseRequest} or an equivalent Hash.
|
559
|
+
#
|
560
|
+
# @param request [::Google::Cloud::Spanner::Admin::Database::V1::DropDatabaseRequest, ::Hash]
|
561
|
+
# A request object representing the call parameters. Required. To specify no
|
562
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
563
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
564
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
565
|
+
#
|
566
|
+
# @overload drop_database(database: nil)
|
567
|
+
# Pass arguments to `drop_database` via keyword arguments. Note that at
|
568
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
569
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
570
|
+
#
|
571
|
+
# @param database [::String]
|
572
|
+
# Required. The database to be dropped.
|
573
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
574
|
+
# @yieldparam result [::Google::Protobuf::Empty]
|
575
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
576
|
+
#
|
577
|
+
# @return [::Google::Protobuf::Empty]
|
578
|
+
#
|
579
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
580
|
+
def drop_database request, options = nil
|
581
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
582
|
+
|
583
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Spanner::Admin::Database::V1::DropDatabaseRequest
|
584
|
+
|
585
|
+
# Converts hash and nil to an options object
|
586
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
587
|
+
|
588
|
+
# Customize the options with defaults
|
589
|
+
call_metadata = @config.rpcs.drop_database.metadata.to_h
|
590
|
+
|
591
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
592
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
593
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
594
|
+
gapic_version: ::Google::Cloud::Spanner::Admin::Database::V1::VERSION,
|
595
|
+
transports_version_send: [:rest]
|
596
|
+
|
597
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
598
|
+
|
599
|
+
options.apply_defaults timeout: @config.rpcs.drop_database.timeout,
|
600
|
+
metadata: call_metadata,
|
601
|
+
retry_policy: @config.rpcs.drop_database.retry_policy
|
602
|
+
|
603
|
+
options.apply_defaults timeout: @config.timeout,
|
604
|
+
metadata: @config.metadata,
|
605
|
+
retry_policy: @config.retry_policy
|
606
|
+
|
607
|
+
@database_admin_stub.drop_database request, options do |result, operation|
|
608
|
+
yield result, operation if block_given?
|
609
|
+
return result
|
610
|
+
end
|
611
|
+
rescue ::Gapic::Rest::Error => e
|
612
|
+
raise ::Google::Cloud::Error.from_error(e)
|
613
|
+
end
|
614
|
+
|
615
|
+
##
|
616
|
+
# Returns the schema of a Cloud Spanner database as a list of formatted
|
617
|
+
# DDL statements. This method does not show pending schema updates, those may
|
618
|
+
# be queried using the Operations API.
|
619
|
+
#
|
620
|
+
# @overload get_database_ddl(request, options = nil)
|
621
|
+
# Pass arguments to `get_database_ddl` via a request object, either of type
|
622
|
+
# {::Google::Cloud::Spanner::Admin::Database::V1::GetDatabaseDdlRequest} or an equivalent Hash.
|
623
|
+
#
|
624
|
+
# @param request [::Google::Cloud::Spanner::Admin::Database::V1::GetDatabaseDdlRequest, ::Hash]
|
625
|
+
# A request object representing the call parameters. Required. To specify no
|
626
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
627
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
628
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
629
|
+
#
|
630
|
+
# @overload get_database_ddl(database: nil)
|
631
|
+
# Pass arguments to `get_database_ddl` via keyword arguments. Note that at
|
632
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
633
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
634
|
+
#
|
635
|
+
# @param database [::String]
|
636
|
+
# Required. The database whose schema we wish to get.
|
637
|
+
# Values are of the form
|
638
|
+
# `projects/<project>/instances/<instance>/databases/<database>`
|
639
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
640
|
+
# @yieldparam result [::Google::Cloud::Spanner::Admin::Database::V1::GetDatabaseDdlResponse]
|
641
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
642
|
+
#
|
643
|
+
# @return [::Google::Cloud::Spanner::Admin::Database::V1::GetDatabaseDdlResponse]
|
644
|
+
#
|
645
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
646
|
+
def get_database_ddl request, options = nil
|
647
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
648
|
+
|
649
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Spanner::Admin::Database::V1::GetDatabaseDdlRequest
|
650
|
+
|
651
|
+
# Converts hash and nil to an options object
|
652
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
653
|
+
|
654
|
+
# Customize the options with defaults
|
655
|
+
call_metadata = @config.rpcs.get_database_ddl.metadata.to_h
|
656
|
+
|
657
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
658
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
659
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
660
|
+
gapic_version: ::Google::Cloud::Spanner::Admin::Database::V1::VERSION,
|
661
|
+
transports_version_send: [:rest]
|
662
|
+
|
663
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
664
|
+
|
665
|
+
options.apply_defaults timeout: @config.rpcs.get_database_ddl.timeout,
|
666
|
+
metadata: call_metadata,
|
667
|
+
retry_policy: @config.rpcs.get_database_ddl.retry_policy
|
668
|
+
|
669
|
+
options.apply_defaults timeout: @config.timeout,
|
670
|
+
metadata: @config.metadata,
|
671
|
+
retry_policy: @config.retry_policy
|
672
|
+
|
673
|
+
@database_admin_stub.get_database_ddl request, options do |result, operation|
|
674
|
+
yield result, operation if block_given?
|
675
|
+
return result
|
676
|
+
end
|
677
|
+
rescue ::Gapic::Rest::Error => e
|
678
|
+
raise ::Google::Cloud::Error.from_error(e)
|
679
|
+
end
|
680
|
+
|
681
|
+
##
|
682
|
+
# Sets the access control policy on a database or backup resource.
|
683
|
+
# Replaces any existing policy.
|
684
|
+
#
|
685
|
+
# Authorization requires `spanner.databases.setIamPolicy`
|
686
|
+
# permission on {::Google::Iam::V1::SetIamPolicyRequest#resource resource}.
|
687
|
+
# For backups, authorization requires `spanner.backups.setIamPolicy`
|
688
|
+
# permission on {::Google::Iam::V1::SetIamPolicyRequest#resource resource}.
|
689
|
+
#
|
690
|
+
# @overload set_iam_policy(request, options = nil)
|
691
|
+
# Pass arguments to `set_iam_policy` via a request object, either of type
|
692
|
+
# {::Google::Iam::V1::SetIamPolicyRequest} or an equivalent Hash.
|
693
|
+
#
|
694
|
+
# @param request [::Google::Iam::V1::SetIamPolicyRequest, ::Hash]
|
695
|
+
# A request object representing the call parameters. Required. To specify no
|
696
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
697
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
698
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
699
|
+
#
|
700
|
+
# @overload set_iam_policy(resource: nil, policy: nil, update_mask: nil)
|
701
|
+
# Pass arguments to `set_iam_policy` via keyword arguments. Note that at
|
702
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
703
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
704
|
+
#
|
705
|
+
# @param resource [::String]
|
706
|
+
# REQUIRED: The resource for which the policy is being specified.
|
707
|
+
# See the operation documentation for the appropriate value for this field.
|
708
|
+
# @param policy [::Google::Iam::V1::Policy, ::Hash]
|
709
|
+
# REQUIRED: The complete policy to be applied to the `resource`. The size of
|
710
|
+
# the policy is limited to a few 10s of KB. An empty policy is a
|
711
|
+
# valid policy but certain Cloud Platform services (such as Projects)
|
712
|
+
# might reject them.
|
713
|
+
# @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
|
714
|
+
# OPTIONAL: A FieldMask specifying which fields of the policy to modify. Only
|
715
|
+
# the fields in the mask will be modified. If no mask is provided, the
|
716
|
+
# following default mask is used:
|
717
|
+
#
|
718
|
+
# `paths: "bindings, etag"`
|
719
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
720
|
+
# @yieldparam result [::Google::Iam::V1::Policy]
|
721
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
722
|
+
#
|
723
|
+
# @return [::Google::Iam::V1::Policy]
|
724
|
+
#
|
725
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
726
|
+
def set_iam_policy request, options = nil
|
727
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
728
|
+
|
729
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Iam::V1::SetIamPolicyRequest
|
730
|
+
|
731
|
+
# Converts hash and nil to an options object
|
732
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
733
|
+
|
734
|
+
# Customize the options with defaults
|
735
|
+
call_metadata = @config.rpcs.set_iam_policy.metadata.to_h
|
736
|
+
|
737
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
738
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
739
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
740
|
+
gapic_version: ::Google::Cloud::Spanner::Admin::Database::V1::VERSION,
|
741
|
+
transports_version_send: [:rest]
|
742
|
+
|
743
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
744
|
+
|
745
|
+
options.apply_defaults timeout: @config.rpcs.set_iam_policy.timeout,
|
746
|
+
metadata: call_metadata,
|
747
|
+
retry_policy: @config.rpcs.set_iam_policy.retry_policy
|
748
|
+
|
749
|
+
options.apply_defaults timeout: @config.timeout,
|
750
|
+
metadata: @config.metadata,
|
751
|
+
retry_policy: @config.retry_policy
|
752
|
+
|
753
|
+
@database_admin_stub.set_iam_policy request, options do |result, operation|
|
754
|
+
yield result, operation if block_given?
|
755
|
+
return result
|
756
|
+
end
|
757
|
+
rescue ::Gapic::Rest::Error => e
|
758
|
+
raise ::Google::Cloud::Error.from_error(e)
|
759
|
+
end
|
760
|
+
|
761
|
+
##
|
762
|
+
# Gets the access control policy for a database or backup resource.
|
763
|
+
# Returns an empty policy if a database or backup exists but does not have a
|
764
|
+
# policy set.
|
765
|
+
#
|
766
|
+
# Authorization requires `spanner.databases.getIamPolicy` permission on
|
767
|
+
# {::Google::Iam::V1::GetIamPolicyRequest#resource resource}.
|
768
|
+
# For backups, authorization requires `spanner.backups.getIamPolicy`
|
769
|
+
# permission on {::Google::Iam::V1::GetIamPolicyRequest#resource resource}.
|
770
|
+
#
|
771
|
+
# @overload get_iam_policy(request, options = nil)
|
772
|
+
# Pass arguments to `get_iam_policy` via a request object, either of type
|
773
|
+
# {::Google::Iam::V1::GetIamPolicyRequest} or an equivalent Hash.
|
774
|
+
#
|
775
|
+
# @param request [::Google::Iam::V1::GetIamPolicyRequest, ::Hash]
|
776
|
+
# A request object representing the call parameters. Required. To specify no
|
777
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
778
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
779
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
780
|
+
#
|
781
|
+
# @overload get_iam_policy(resource: nil, options: nil)
|
782
|
+
# Pass arguments to `get_iam_policy` via keyword arguments. Note that at
|
783
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
784
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
785
|
+
#
|
786
|
+
# @param resource [::String]
|
787
|
+
# REQUIRED: The resource for which the policy is being requested.
|
788
|
+
# See the operation documentation for the appropriate value for this field.
|
789
|
+
# @param options [::Google::Iam::V1::GetPolicyOptions, ::Hash]
|
790
|
+
# OPTIONAL: A `GetPolicyOptions` object for specifying options to
|
791
|
+
# `GetIamPolicy`.
|
792
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
793
|
+
# @yieldparam result [::Google::Iam::V1::Policy]
|
794
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
795
|
+
#
|
796
|
+
# @return [::Google::Iam::V1::Policy]
|
797
|
+
#
|
798
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
799
|
+
def get_iam_policy request, options = nil
|
800
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
801
|
+
|
802
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Iam::V1::GetIamPolicyRequest
|
803
|
+
|
804
|
+
# Converts hash and nil to an options object
|
805
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
806
|
+
|
807
|
+
# Customize the options with defaults
|
808
|
+
call_metadata = @config.rpcs.get_iam_policy.metadata.to_h
|
809
|
+
|
810
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
811
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
812
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
813
|
+
gapic_version: ::Google::Cloud::Spanner::Admin::Database::V1::VERSION,
|
814
|
+
transports_version_send: [:rest]
|
815
|
+
|
816
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
817
|
+
|
818
|
+
options.apply_defaults timeout: @config.rpcs.get_iam_policy.timeout,
|
819
|
+
metadata: call_metadata,
|
820
|
+
retry_policy: @config.rpcs.get_iam_policy.retry_policy
|
821
|
+
|
822
|
+
options.apply_defaults timeout: @config.timeout,
|
823
|
+
metadata: @config.metadata,
|
824
|
+
retry_policy: @config.retry_policy
|
825
|
+
|
826
|
+
@database_admin_stub.get_iam_policy request, options do |result, operation|
|
827
|
+
yield result, operation if block_given?
|
828
|
+
return result
|
829
|
+
end
|
830
|
+
rescue ::Gapic::Rest::Error => e
|
831
|
+
raise ::Google::Cloud::Error.from_error(e)
|
832
|
+
end
|
833
|
+
|
834
|
+
##
|
835
|
+
# Returns permissions that the caller has on the specified database or backup
|
836
|
+
# resource.
|
837
|
+
#
|
838
|
+
# Attempting this RPC on a non-existent Cloud Spanner database will
|
839
|
+
# result in a NOT_FOUND error if the user has
|
840
|
+
# `spanner.databases.list` permission on the containing Cloud
|
841
|
+
# Spanner instance. Otherwise returns an empty set of permissions.
|
842
|
+
# Calling this method on a backup that does not exist will
|
843
|
+
# result in a NOT_FOUND error if the user has
|
844
|
+
# `spanner.backups.list` permission on the containing instance.
|
845
|
+
#
|
846
|
+
# @overload test_iam_permissions(request, options = nil)
|
847
|
+
# Pass arguments to `test_iam_permissions` via a request object, either of type
|
848
|
+
# {::Google::Iam::V1::TestIamPermissionsRequest} or an equivalent Hash.
|
849
|
+
#
|
850
|
+
# @param request [::Google::Iam::V1::TestIamPermissionsRequest, ::Hash]
|
851
|
+
# A request object representing the call parameters. Required. To specify no
|
852
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
853
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
854
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
855
|
+
#
|
856
|
+
# @overload test_iam_permissions(resource: nil, permissions: nil)
|
857
|
+
# Pass arguments to `test_iam_permissions` via keyword arguments. Note that at
|
858
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
859
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
860
|
+
#
|
861
|
+
# @param resource [::String]
|
862
|
+
# REQUIRED: The resource for which the policy detail is being requested.
|
863
|
+
# See the operation documentation for the appropriate value for this field.
|
864
|
+
# @param permissions [::Array<::String>]
|
865
|
+
# The set of permissions to check for the `resource`. Permissions with
|
866
|
+
# wildcards (such as '*' or 'storage.*') are not allowed. For more
|
867
|
+
# information see
|
868
|
+
# [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions).
|
869
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
870
|
+
# @yieldparam result [::Google::Iam::V1::TestIamPermissionsResponse]
|
871
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
872
|
+
#
|
873
|
+
# @return [::Google::Iam::V1::TestIamPermissionsResponse]
|
874
|
+
#
|
875
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
876
|
+
def test_iam_permissions request, options = nil
|
877
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
878
|
+
|
879
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Iam::V1::TestIamPermissionsRequest
|
880
|
+
|
881
|
+
# Converts hash and nil to an options object
|
882
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
883
|
+
|
884
|
+
# Customize the options with defaults
|
885
|
+
call_metadata = @config.rpcs.test_iam_permissions.metadata.to_h
|
886
|
+
|
887
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
888
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
889
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
890
|
+
gapic_version: ::Google::Cloud::Spanner::Admin::Database::V1::VERSION,
|
891
|
+
transports_version_send: [:rest]
|
892
|
+
|
893
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
894
|
+
|
895
|
+
options.apply_defaults timeout: @config.rpcs.test_iam_permissions.timeout,
|
896
|
+
metadata: call_metadata,
|
897
|
+
retry_policy: @config.rpcs.test_iam_permissions.retry_policy
|
898
|
+
|
899
|
+
options.apply_defaults timeout: @config.timeout,
|
900
|
+
metadata: @config.metadata,
|
901
|
+
retry_policy: @config.retry_policy
|
902
|
+
|
903
|
+
@database_admin_stub.test_iam_permissions request, options do |result, operation|
|
904
|
+
yield result, operation if block_given?
|
905
|
+
return result
|
906
|
+
end
|
907
|
+
rescue ::Gapic::Rest::Error => e
|
908
|
+
raise ::Google::Cloud::Error.from_error(e)
|
909
|
+
end
|
910
|
+
|
911
|
+
##
|
912
|
+
# Starts creating a new Cloud Spanner Backup.
|
913
|
+
# The returned backup {::Google::Longrunning::Operation long-running operation}
|
914
|
+
# will have a name of the format
|
915
|
+
# `projects/<project>/instances/<instance>/backups/<backup>/operations/<operation_id>`
|
916
|
+
# and can be used to track creation of the backup. The
|
917
|
+
# {::Google::Longrunning::Operation#metadata metadata} field type is
|
918
|
+
# {::Google::Cloud::Spanner::Admin::Database::V1::CreateBackupMetadata CreateBackupMetadata}. The
|
919
|
+
# {::Google::Longrunning::Operation#response response} field type is
|
920
|
+
# {::Google::Cloud::Spanner::Admin::Database::V1::Backup Backup}, if successful. Cancelling the returned operation will stop the
|
921
|
+
# creation and delete the backup.
|
922
|
+
# There can be only one pending backup creation per database. Backup creation
|
923
|
+
# of different databases can run concurrently.
|
924
|
+
#
|
925
|
+
# @overload create_backup(request, options = nil)
|
926
|
+
# Pass arguments to `create_backup` via a request object, either of type
|
927
|
+
# {::Google::Cloud::Spanner::Admin::Database::V1::CreateBackupRequest} or an equivalent Hash.
|
928
|
+
#
|
929
|
+
# @param request [::Google::Cloud::Spanner::Admin::Database::V1::CreateBackupRequest, ::Hash]
|
930
|
+
# A request object representing the call parameters. Required. To specify no
|
931
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
932
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
933
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
934
|
+
#
|
935
|
+
# @overload create_backup(parent: nil, backup_id: nil, backup: nil, encryption_config: nil)
|
936
|
+
# Pass arguments to `create_backup` via keyword arguments. Note that at
|
937
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
938
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
939
|
+
#
|
940
|
+
# @param parent [::String]
|
941
|
+
# Required. The name of the instance in which the backup will be
|
942
|
+
# created. This must be the same instance that contains the database the
|
943
|
+
# backup will be created from. The backup will be stored in the
|
944
|
+
# location(s) specified in the instance configuration of this
|
945
|
+
# instance. Values are of the form
|
946
|
+
# `projects/<project>/instances/<instance>`.
|
947
|
+
# @param backup_id [::String]
|
948
|
+
# Required. The id of the backup to be created. The `backup_id` appended to
|
949
|
+
# `parent` forms the full backup name of the form
|
950
|
+
# `projects/<project>/instances/<instance>/backups/<backup_id>`.
|
951
|
+
# @param backup [::Google::Cloud::Spanner::Admin::Database::V1::Backup, ::Hash]
|
952
|
+
# Required. The backup to create.
|
953
|
+
# @param encryption_config [::Google::Cloud::Spanner::Admin::Database::V1::CreateBackupEncryptionConfig, ::Hash]
|
954
|
+
# Optional. The encryption configuration used to encrypt the backup. If this field is
|
955
|
+
# not specified, the backup will use the same
|
956
|
+
# encryption configuration as the database by default, namely
|
957
|
+
# {::Google::Cloud::Spanner::Admin::Database::V1::CreateBackupEncryptionConfig#encryption_type encryption_type} =
|
958
|
+
# `USE_DATABASE_ENCRYPTION`.
|
959
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
960
|
+
# @yieldparam result [::Gapic::Operation]
|
961
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
962
|
+
#
|
963
|
+
# @return [::Gapic::Operation]
|
964
|
+
#
|
965
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
966
|
+
def create_backup request, options = nil
|
967
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
968
|
+
|
969
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Spanner::Admin::Database::V1::CreateBackupRequest
|
970
|
+
|
971
|
+
# Converts hash and nil to an options object
|
972
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
973
|
+
|
974
|
+
# Customize the options with defaults
|
975
|
+
call_metadata = @config.rpcs.create_backup.metadata.to_h
|
976
|
+
|
977
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
978
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
979
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
980
|
+
gapic_version: ::Google::Cloud::Spanner::Admin::Database::V1::VERSION,
|
981
|
+
transports_version_send: [:rest]
|
982
|
+
|
983
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
984
|
+
|
985
|
+
options.apply_defaults timeout: @config.rpcs.create_backup.timeout,
|
986
|
+
metadata: call_metadata,
|
987
|
+
retry_policy: @config.rpcs.create_backup.retry_policy
|
988
|
+
|
989
|
+
options.apply_defaults timeout: @config.timeout,
|
990
|
+
metadata: @config.metadata,
|
991
|
+
retry_policy: @config.retry_policy
|
992
|
+
|
993
|
+
@database_admin_stub.create_backup request, options do |result, operation|
|
994
|
+
result = ::Gapic::Operation.new result, @operations_client, options: options
|
995
|
+
yield result, operation if block_given?
|
996
|
+
return result
|
997
|
+
end
|
998
|
+
rescue ::Gapic::Rest::Error => e
|
999
|
+
raise ::Google::Cloud::Error.from_error(e)
|
1000
|
+
end
|
1001
|
+
|
1002
|
+
##
|
1003
|
+
# Starts copying a Cloud Spanner Backup.
|
1004
|
+
# The returned backup {::Google::Longrunning::Operation long-running operation}
|
1005
|
+
# will have a name of the format
|
1006
|
+
# `projects/<project>/instances/<instance>/backups/<backup>/operations/<operation_id>`
|
1007
|
+
# and can be used to track copying of the backup. The operation is associated
|
1008
|
+
# with the destination backup.
|
1009
|
+
# The {::Google::Longrunning::Operation#metadata metadata} field type is
|
1010
|
+
# {::Google::Cloud::Spanner::Admin::Database::V1::CopyBackupMetadata CopyBackupMetadata}.
|
1011
|
+
# The {::Google::Longrunning::Operation#response response} field type is
|
1012
|
+
# {::Google::Cloud::Spanner::Admin::Database::V1::Backup Backup}, if successful. Cancelling the returned operation will stop the
|
1013
|
+
# copying and delete the backup.
|
1014
|
+
# Concurrent CopyBackup requests can run on the same source backup.
|
1015
|
+
#
|
1016
|
+
# @overload copy_backup(request, options = nil)
|
1017
|
+
# Pass arguments to `copy_backup` via a request object, either of type
|
1018
|
+
# {::Google::Cloud::Spanner::Admin::Database::V1::CopyBackupRequest} or an equivalent Hash.
|
1019
|
+
#
|
1020
|
+
# @param request [::Google::Cloud::Spanner::Admin::Database::V1::CopyBackupRequest, ::Hash]
|
1021
|
+
# A request object representing the call parameters. Required. To specify no
|
1022
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
1023
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
1024
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
1025
|
+
#
|
1026
|
+
# @overload copy_backup(parent: nil, backup_id: nil, source_backup: nil, expire_time: nil, encryption_config: nil)
|
1027
|
+
# Pass arguments to `copy_backup` via keyword arguments. Note that at
|
1028
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
1029
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
1030
|
+
#
|
1031
|
+
# @param parent [::String]
|
1032
|
+
# Required. The name of the destination instance that will contain the backup copy.
|
1033
|
+
# Values are of the form: `projects/<project>/instances/<instance>`.
|
1034
|
+
# @param backup_id [::String]
|
1035
|
+
# Required. The id of the backup copy.
|
1036
|
+
# The `backup_id` appended to `parent` forms the full backup_uri of the form
|
1037
|
+
# `projects/<project>/instances/<instance>/backups/<backup>`.
|
1038
|
+
# @param source_backup [::String]
|
1039
|
+
# Required. The source backup to be copied.
|
1040
|
+
# The source backup needs to be in READY state for it to be copied.
|
1041
|
+
# Once CopyBackup is in progress, the source backup cannot be deleted or
|
1042
|
+
# cleaned up on expiration until CopyBackup is finished.
|
1043
|
+
# Values are of the form:
|
1044
|
+
# `projects/<project>/instances/<instance>/backups/<backup>`.
|
1045
|
+
# @param expire_time [::Google::Protobuf::Timestamp, ::Hash]
|
1046
|
+
# Required. The expiration time of the backup in microsecond granularity.
|
1047
|
+
# The expiration time must be at least 6 hours and at most 366 days
|
1048
|
+
# from the `create_time` of the source backup. Once the `expire_time` has
|
1049
|
+
# passed, the backup is eligible to be automatically deleted by Cloud Spanner
|
1050
|
+
# to free the resources used by the backup.
|
1051
|
+
# @param encryption_config [::Google::Cloud::Spanner::Admin::Database::V1::CopyBackupEncryptionConfig, ::Hash]
|
1052
|
+
# Optional. The encryption configuration used to encrypt the backup. If this field is
|
1053
|
+
# not specified, the backup will use the same
|
1054
|
+
# encryption configuration as the source backup by default, namely
|
1055
|
+
# {::Google::Cloud::Spanner::Admin::Database::V1::CopyBackupEncryptionConfig#encryption_type encryption_type} =
|
1056
|
+
# `USE_CONFIG_DEFAULT_OR_BACKUP_ENCRYPTION`.
|
1057
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
1058
|
+
# @yieldparam result [::Gapic::Operation]
|
1059
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
1060
|
+
#
|
1061
|
+
# @return [::Gapic::Operation]
|
1062
|
+
#
|
1063
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
1064
|
+
def copy_backup request, options = nil
|
1065
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
1066
|
+
|
1067
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Spanner::Admin::Database::V1::CopyBackupRequest
|
1068
|
+
|
1069
|
+
# Converts hash and nil to an options object
|
1070
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
1071
|
+
|
1072
|
+
# Customize the options with defaults
|
1073
|
+
call_metadata = @config.rpcs.copy_backup.metadata.to_h
|
1074
|
+
|
1075
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
1076
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
1077
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
1078
|
+
gapic_version: ::Google::Cloud::Spanner::Admin::Database::V1::VERSION,
|
1079
|
+
transports_version_send: [:rest]
|
1080
|
+
|
1081
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
1082
|
+
|
1083
|
+
options.apply_defaults timeout: @config.rpcs.copy_backup.timeout,
|
1084
|
+
metadata: call_metadata,
|
1085
|
+
retry_policy: @config.rpcs.copy_backup.retry_policy
|
1086
|
+
|
1087
|
+
options.apply_defaults timeout: @config.timeout,
|
1088
|
+
metadata: @config.metadata,
|
1089
|
+
retry_policy: @config.retry_policy
|
1090
|
+
|
1091
|
+
@database_admin_stub.copy_backup request, options do |result, operation|
|
1092
|
+
result = ::Gapic::Operation.new result, @operations_client, options: options
|
1093
|
+
yield result, operation if block_given?
|
1094
|
+
return result
|
1095
|
+
end
|
1096
|
+
rescue ::Gapic::Rest::Error => e
|
1097
|
+
raise ::Google::Cloud::Error.from_error(e)
|
1098
|
+
end
|
1099
|
+
|
1100
|
+
##
|
1101
|
+
# Gets metadata on a pending or completed {::Google::Cloud::Spanner::Admin::Database::V1::Backup Backup}.
|
1102
|
+
#
|
1103
|
+
# @overload get_backup(request, options = nil)
|
1104
|
+
# Pass arguments to `get_backup` via a request object, either of type
|
1105
|
+
# {::Google::Cloud::Spanner::Admin::Database::V1::GetBackupRequest} or an equivalent Hash.
|
1106
|
+
#
|
1107
|
+
# @param request [::Google::Cloud::Spanner::Admin::Database::V1::GetBackupRequest, ::Hash]
|
1108
|
+
# A request object representing the call parameters. Required. To specify no
|
1109
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
1110
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
1111
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
1112
|
+
#
|
1113
|
+
# @overload get_backup(name: nil)
|
1114
|
+
# Pass arguments to `get_backup` via keyword arguments. Note that at
|
1115
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
1116
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
1117
|
+
#
|
1118
|
+
# @param name [::String]
|
1119
|
+
# Required. Name of the backup.
|
1120
|
+
# Values are of the form
|
1121
|
+
# `projects/<project>/instances/<instance>/backups/<backup>`.
|
1122
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
1123
|
+
# @yieldparam result [::Google::Cloud::Spanner::Admin::Database::V1::Backup]
|
1124
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
1125
|
+
#
|
1126
|
+
# @return [::Google::Cloud::Spanner::Admin::Database::V1::Backup]
|
1127
|
+
#
|
1128
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
1129
|
+
def get_backup request, options = nil
|
1130
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
1131
|
+
|
1132
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Spanner::Admin::Database::V1::GetBackupRequest
|
1133
|
+
|
1134
|
+
# Converts hash and nil to an options object
|
1135
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
1136
|
+
|
1137
|
+
# Customize the options with defaults
|
1138
|
+
call_metadata = @config.rpcs.get_backup.metadata.to_h
|
1139
|
+
|
1140
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
1141
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
1142
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
1143
|
+
gapic_version: ::Google::Cloud::Spanner::Admin::Database::V1::VERSION,
|
1144
|
+
transports_version_send: [:rest]
|
1145
|
+
|
1146
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
1147
|
+
|
1148
|
+
options.apply_defaults timeout: @config.rpcs.get_backup.timeout,
|
1149
|
+
metadata: call_metadata,
|
1150
|
+
retry_policy: @config.rpcs.get_backup.retry_policy
|
1151
|
+
|
1152
|
+
options.apply_defaults timeout: @config.timeout,
|
1153
|
+
metadata: @config.metadata,
|
1154
|
+
retry_policy: @config.retry_policy
|
1155
|
+
|
1156
|
+
@database_admin_stub.get_backup request, options do |result, operation|
|
1157
|
+
yield result, operation if block_given?
|
1158
|
+
return result
|
1159
|
+
end
|
1160
|
+
rescue ::Gapic::Rest::Error => e
|
1161
|
+
raise ::Google::Cloud::Error.from_error(e)
|
1162
|
+
end
|
1163
|
+
|
1164
|
+
##
|
1165
|
+
# Updates a pending or completed {::Google::Cloud::Spanner::Admin::Database::V1::Backup Backup}.
|
1166
|
+
#
|
1167
|
+
# @overload update_backup(request, options = nil)
|
1168
|
+
# Pass arguments to `update_backup` via a request object, either of type
|
1169
|
+
# {::Google::Cloud::Spanner::Admin::Database::V1::UpdateBackupRequest} or an equivalent Hash.
|
1170
|
+
#
|
1171
|
+
# @param request [::Google::Cloud::Spanner::Admin::Database::V1::UpdateBackupRequest, ::Hash]
|
1172
|
+
# A request object representing the call parameters. Required. To specify no
|
1173
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
1174
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
1175
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
1176
|
+
#
|
1177
|
+
# @overload update_backup(backup: nil, update_mask: nil)
|
1178
|
+
# Pass arguments to `update_backup` via keyword arguments. Note that at
|
1179
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
1180
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
1181
|
+
#
|
1182
|
+
# @param backup [::Google::Cloud::Spanner::Admin::Database::V1::Backup, ::Hash]
|
1183
|
+
# Required. The backup to update. `backup.name`, and the fields to be updated
|
1184
|
+
# as specified by `update_mask` are required. Other fields are ignored.
|
1185
|
+
# Update is only supported for the following fields:
|
1186
|
+
# * `backup.expire_time`.
|
1187
|
+
# @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
|
1188
|
+
# Required. A mask specifying which fields (e.g. `expire_time`) in the
|
1189
|
+
# Backup resource should be updated. This mask is relative to the Backup
|
1190
|
+
# resource, not to the request message. The field mask must always be
|
1191
|
+
# specified; this prevents any future fields from being erased accidentally
|
1192
|
+
# by clients that do not know about them.
|
1193
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
1194
|
+
# @yieldparam result [::Google::Cloud::Spanner::Admin::Database::V1::Backup]
|
1195
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
1196
|
+
#
|
1197
|
+
# @return [::Google::Cloud::Spanner::Admin::Database::V1::Backup]
|
1198
|
+
#
|
1199
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
1200
|
+
def update_backup request, options = nil
|
1201
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
1202
|
+
|
1203
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Spanner::Admin::Database::V1::UpdateBackupRequest
|
1204
|
+
|
1205
|
+
# Converts hash and nil to an options object
|
1206
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
1207
|
+
|
1208
|
+
# Customize the options with defaults
|
1209
|
+
call_metadata = @config.rpcs.update_backup.metadata.to_h
|
1210
|
+
|
1211
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
1212
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
1213
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
1214
|
+
gapic_version: ::Google::Cloud::Spanner::Admin::Database::V1::VERSION,
|
1215
|
+
transports_version_send: [:rest]
|
1216
|
+
|
1217
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
1218
|
+
|
1219
|
+
options.apply_defaults timeout: @config.rpcs.update_backup.timeout,
|
1220
|
+
metadata: call_metadata,
|
1221
|
+
retry_policy: @config.rpcs.update_backup.retry_policy
|
1222
|
+
|
1223
|
+
options.apply_defaults timeout: @config.timeout,
|
1224
|
+
metadata: @config.metadata,
|
1225
|
+
retry_policy: @config.retry_policy
|
1226
|
+
|
1227
|
+
@database_admin_stub.update_backup request, options do |result, operation|
|
1228
|
+
yield result, operation if block_given?
|
1229
|
+
return result
|
1230
|
+
end
|
1231
|
+
rescue ::Gapic::Rest::Error => e
|
1232
|
+
raise ::Google::Cloud::Error.from_error(e)
|
1233
|
+
end
|
1234
|
+
|
1235
|
+
##
|
1236
|
+
# Deletes a pending or completed {::Google::Cloud::Spanner::Admin::Database::V1::Backup Backup}.
|
1237
|
+
#
|
1238
|
+
# @overload delete_backup(request, options = nil)
|
1239
|
+
# Pass arguments to `delete_backup` via a request object, either of type
|
1240
|
+
# {::Google::Cloud::Spanner::Admin::Database::V1::DeleteBackupRequest} or an equivalent Hash.
|
1241
|
+
#
|
1242
|
+
# @param request [::Google::Cloud::Spanner::Admin::Database::V1::DeleteBackupRequest, ::Hash]
|
1243
|
+
# A request object representing the call parameters. Required. To specify no
|
1244
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
1245
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
1246
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
1247
|
+
#
|
1248
|
+
# @overload delete_backup(name: nil)
|
1249
|
+
# Pass arguments to `delete_backup` via keyword arguments. Note that at
|
1250
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
1251
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
1252
|
+
#
|
1253
|
+
# @param name [::String]
|
1254
|
+
# Required. Name of the backup to delete.
|
1255
|
+
# Values are of the form
|
1256
|
+
# `projects/<project>/instances/<instance>/backups/<backup>`.
|
1257
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
1258
|
+
# @yieldparam result [::Google::Protobuf::Empty]
|
1259
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
1260
|
+
#
|
1261
|
+
# @return [::Google::Protobuf::Empty]
|
1262
|
+
#
|
1263
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
1264
|
+
def delete_backup request, options = nil
|
1265
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
1266
|
+
|
1267
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Spanner::Admin::Database::V1::DeleteBackupRequest
|
1268
|
+
|
1269
|
+
# Converts hash and nil to an options object
|
1270
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
1271
|
+
|
1272
|
+
# Customize the options with defaults
|
1273
|
+
call_metadata = @config.rpcs.delete_backup.metadata.to_h
|
1274
|
+
|
1275
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
1276
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
1277
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
1278
|
+
gapic_version: ::Google::Cloud::Spanner::Admin::Database::V1::VERSION,
|
1279
|
+
transports_version_send: [:rest]
|
1280
|
+
|
1281
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
1282
|
+
|
1283
|
+
options.apply_defaults timeout: @config.rpcs.delete_backup.timeout,
|
1284
|
+
metadata: call_metadata,
|
1285
|
+
retry_policy: @config.rpcs.delete_backup.retry_policy
|
1286
|
+
|
1287
|
+
options.apply_defaults timeout: @config.timeout,
|
1288
|
+
metadata: @config.metadata,
|
1289
|
+
retry_policy: @config.retry_policy
|
1290
|
+
|
1291
|
+
@database_admin_stub.delete_backup request, options do |result, operation|
|
1292
|
+
yield result, operation if block_given?
|
1293
|
+
return result
|
1294
|
+
end
|
1295
|
+
rescue ::Gapic::Rest::Error => e
|
1296
|
+
raise ::Google::Cloud::Error.from_error(e)
|
1297
|
+
end
|
1298
|
+
|
1299
|
+
##
|
1300
|
+
# Lists completed and pending backups.
|
1301
|
+
# Backups returned are ordered by `create_time` in descending order,
|
1302
|
+
# starting from the most recent `create_time`.
|
1303
|
+
#
|
1304
|
+
# @overload list_backups(request, options = nil)
|
1305
|
+
# Pass arguments to `list_backups` via a request object, either of type
|
1306
|
+
# {::Google::Cloud::Spanner::Admin::Database::V1::ListBackupsRequest} or an equivalent Hash.
|
1307
|
+
#
|
1308
|
+
# @param request [::Google::Cloud::Spanner::Admin::Database::V1::ListBackupsRequest, ::Hash]
|
1309
|
+
# A request object representing the call parameters. Required. To specify no
|
1310
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
1311
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
1312
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
1313
|
+
#
|
1314
|
+
# @overload list_backups(parent: nil, filter: nil, page_size: nil, page_token: nil)
|
1315
|
+
# Pass arguments to `list_backups` via keyword arguments. Note that at
|
1316
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
1317
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
1318
|
+
#
|
1319
|
+
# @param parent [::String]
|
1320
|
+
# Required. The instance to list backups from. Values are of the
|
1321
|
+
# form `projects/<project>/instances/<instance>`.
|
1322
|
+
# @param filter [::String]
|
1323
|
+
# An expression that filters the list of returned backups.
|
1324
|
+
#
|
1325
|
+
# A filter expression consists of a field name, a comparison operator, and a
|
1326
|
+
# value for filtering.
|
1327
|
+
# The value must be a string, a number, or a boolean. The comparison operator
|
1328
|
+
# must be one of: `<`, `>`, `<=`, `>=`, `!=`, `=`, or `:`.
|
1329
|
+
# Colon `:` is the contains operator. Filter rules are not case sensitive.
|
1330
|
+
#
|
1331
|
+
# The following fields in the {::Google::Cloud::Spanner::Admin::Database::V1::Backup Backup} are eligible for filtering:
|
1332
|
+
#
|
1333
|
+
# * `name`
|
1334
|
+
# * `database`
|
1335
|
+
# * `state`
|
1336
|
+
# * `create_time` (and values are of the format YYYY-MM-DDTHH:MM:SSZ)
|
1337
|
+
# * `expire_time` (and values are of the format YYYY-MM-DDTHH:MM:SSZ)
|
1338
|
+
# * `version_time` (and values are of the format YYYY-MM-DDTHH:MM:SSZ)
|
1339
|
+
# * `size_bytes`
|
1340
|
+
#
|
1341
|
+
# You can combine multiple expressions by enclosing each expression in
|
1342
|
+
# parentheses. By default, expressions are combined with AND logic, but
|
1343
|
+
# you can specify AND, OR, and NOT logic explicitly.
|
1344
|
+
#
|
1345
|
+
# Here are a few examples:
|
1346
|
+
#
|
1347
|
+
# * `name:Howl` - The backup's name contains the string "howl".
|
1348
|
+
# * `database:prod`
|
1349
|
+
# - The database's name contains the string "prod".
|
1350
|
+
# * `state:CREATING` - The backup is pending creation.
|
1351
|
+
# * `state:READY` - The backup is fully created and ready for use.
|
1352
|
+
# * `(name:howl) AND (create_time < \"2018-03-28T14:50:00Z\")`
|
1353
|
+
# - The backup name contains the string "howl" and `create_time`
|
1354
|
+
# of the backup is before 2018-03-28T14:50:00Z.
|
1355
|
+
# * `expire_time < \"2018-03-28T14:50:00Z\"`
|
1356
|
+
# - The backup `expire_time` is before 2018-03-28T14:50:00Z.
|
1357
|
+
# * `size_bytes > 10000000000` - The backup's size is greater than 10GB
|
1358
|
+
# @param page_size [::Integer]
|
1359
|
+
# Number of backups to be returned in the response. If 0 or
|
1360
|
+
# less, defaults to the server's maximum allowed page size.
|
1361
|
+
# @param page_token [::String]
|
1362
|
+
# If non-empty, `page_token` should contain a
|
1363
|
+
# {::Google::Cloud::Spanner::Admin::Database::V1::ListBackupsResponse#next_page_token next_page_token} from a
|
1364
|
+
# previous {::Google::Cloud::Spanner::Admin::Database::V1::ListBackupsResponse ListBackupsResponse} to the same `parent` and with the same
|
1365
|
+
# `filter`.
|
1366
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
1367
|
+
# @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Spanner::Admin::Database::V1::Backup>]
|
1368
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
1369
|
+
#
|
1370
|
+
# @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Spanner::Admin::Database::V1::Backup>]
|
1371
|
+
#
|
1372
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
1373
|
+
def list_backups request, options = nil
|
1374
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
1375
|
+
|
1376
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Spanner::Admin::Database::V1::ListBackupsRequest
|
1377
|
+
|
1378
|
+
# Converts hash and nil to an options object
|
1379
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
1380
|
+
|
1381
|
+
# Customize the options with defaults
|
1382
|
+
call_metadata = @config.rpcs.list_backups.metadata.to_h
|
1383
|
+
|
1384
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
1385
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
1386
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
1387
|
+
gapic_version: ::Google::Cloud::Spanner::Admin::Database::V1::VERSION,
|
1388
|
+
transports_version_send: [:rest]
|
1389
|
+
|
1390
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
1391
|
+
|
1392
|
+
options.apply_defaults timeout: @config.rpcs.list_backups.timeout,
|
1393
|
+
metadata: call_metadata,
|
1394
|
+
retry_policy: @config.rpcs.list_backups.retry_policy
|
1395
|
+
|
1396
|
+
options.apply_defaults timeout: @config.timeout,
|
1397
|
+
metadata: @config.metadata,
|
1398
|
+
retry_policy: @config.retry_policy
|
1399
|
+
|
1400
|
+
@database_admin_stub.list_backups request, options do |result, operation|
|
1401
|
+
result = ::Gapic::Rest::PagedEnumerable.new @database_admin_stub, :list_backups, "backups", request, result, options
|
1402
|
+
yield result, operation if block_given?
|
1403
|
+
return result
|
1404
|
+
end
|
1405
|
+
rescue ::Gapic::Rest::Error => e
|
1406
|
+
raise ::Google::Cloud::Error.from_error(e)
|
1407
|
+
end
|
1408
|
+
|
1409
|
+
##
|
1410
|
+
# Create a new database by restoring from a completed backup. The new
|
1411
|
+
# database must be in the same project and in an instance with the same
|
1412
|
+
# instance configuration as the instance containing
|
1413
|
+
# the backup. The returned database [long-running
|
1414
|
+
# operation][google.longrunning.Operation] has a name of the format
|
1415
|
+
# `projects/<project>/instances/<instance>/databases/<database>/operations/<operation_id>`,
|
1416
|
+
# and can be used to track the progress of the operation, and to cancel it.
|
1417
|
+
# The {::Google::Longrunning::Operation#metadata metadata} field type is
|
1418
|
+
# {::Google::Cloud::Spanner::Admin::Database::V1::RestoreDatabaseMetadata RestoreDatabaseMetadata}.
|
1419
|
+
# The {::Google::Longrunning::Operation#response response} type
|
1420
|
+
# is {::Google::Cloud::Spanner::Admin::Database::V1::Database Database}, if
|
1421
|
+
# successful. Cancelling the returned operation will stop the restore and
|
1422
|
+
# delete the database.
|
1423
|
+
# There can be only one database being restored into an instance at a time.
|
1424
|
+
# Once the restore operation completes, a new restore operation can be
|
1425
|
+
# initiated, without waiting for the optimize operation associated with the
|
1426
|
+
# first restore to complete.
|
1427
|
+
#
|
1428
|
+
# @overload restore_database(request, options = nil)
|
1429
|
+
# Pass arguments to `restore_database` via a request object, either of type
|
1430
|
+
# {::Google::Cloud::Spanner::Admin::Database::V1::RestoreDatabaseRequest} or an equivalent Hash.
|
1431
|
+
#
|
1432
|
+
# @param request [::Google::Cloud::Spanner::Admin::Database::V1::RestoreDatabaseRequest, ::Hash]
|
1433
|
+
# A request object representing the call parameters. Required. To specify no
|
1434
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
1435
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
1436
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
1437
|
+
#
|
1438
|
+
# @overload restore_database(parent: nil, database_id: nil, backup: nil, encryption_config: nil)
|
1439
|
+
# Pass arguments to `restore_database` via keyword arguments. Note that at
|
1440
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
1441
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
1442
|
+
#
|
1443
|
+
# @param parent [::String]
|
1444
|
+
# Required. The name of the instance in which to create the
|
1445
|
+
# restored database. This instance must be in the same project and
|
1446
|
+
# have the same instance configuration as the instance containing
|
1447
|
+
# the source backup. Values are of the form
|
1448
|
+
# `projects/<project>/instances/<instance>`.
|
1449
|
+
# @param database_id [::String]
|
1450
|
+
# Required. The id of the database to create and restore to. This
|
1451
|
+
# database must not already exist. The `database_id` appended to
|
1452
|
+
# `parent` forms the full database name of the form
|
1453
|
+
# `projects/<project>/instances/<instance>/databases/<database_id>`.
|
1454
|
+
# @param backup [::String]
|
1455
|
+
# Name of the backup from which to restore. Values are of the form
|
1456
|
+
# `projects/<project>/instances/<instance>/backups/<backup>`.
|
1457
|
+
# @param encryption_config [::Google::Cloud::Spanner::Admin::Database::V1::RestoreDatabaseEncryptionConfig, ::Hash]
|
1458
|
+
# Optional. An encryption configuration describing the encryption type and key
|
1459
|
+
# resources in Cloud KMS used to encrypt/decrypt the database to restore to.
|
1460
|
+
# If this field is not specified, the restored database will use
|
1461
|
+
# the same encryption configuration as the backup by default, namely
|
1462
|
+
# {::Google::Cloud::Spanner::Admin::Database::V1::RestoreDatabaseEncryptionConfig#encryption_type encryption_type} =
|
1463
|
+
# `USE_CONFIG_DEFAULT_OR_BACKUP_ENCRYPTION`.
|
1464
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
1465
|
+
# @yieldparam result [::Gapic::Operation]
|
1466
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
1467
|
+
#
|
1468
|
+
# @return [::Gapic::Operation]
|
1469
|
+
#
|
1470
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
1471
|
+
def restore_database request, options = nil
|
1472
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
1473
|
+
|
1474
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Spanner::Admin::Database::V1::RestoreDatabaseRequest
|
1475
|
+
|
1476
|
+
# Converts hash and nil to an options object
|
1477
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
1478
|
+
|
1479
|
+
# Customize the options with defaults
|
1480
|
+
call_metadata = @config.rpcs.restore_database.metadata.to_h
|
1481
|
+
|
1482
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
1483
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
1484
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
1485
|
+
gapic_version: ::Google::Cloud::Spanner::Admin::Database::V1::VERSION,
|
1486
|
+
transports_version_send: [:rest]
|
1487
|
+
|
1488
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
1489
|
+
|
1490
|
+
options.apply_defaults timeout: @config.rpcs.restore_database.timeout,
|
1491
|
+
metadata: call_metadata,
|
1492
|
+
retry_policy: @config.rpcs.restore_database.retry_policy
|
1493
|
+
|
1494
|
+
options.apply_defaults timeout: @config.timeout,
|
1495
|
+
metadata: @config.metadata,
|
1496
|
+
retry_policy: @config.retry_policy
|
1497
|
+
|
1498
|
+
@database_admin_stub.restore_database request, options do |result, operation|
|
1499
|
+
result = ::Gapic::Operation.new result, @operations_client, options: options
|
1500
|
+
yield result, operation if block_given?
|
1501
|
+
return result
|
1502
|
+
end
|
1503
|
+
rescue ::Gapic::Rest::Error => e
|
1504
|
+
raise ::Google::Cloud::Error.from_error(e)
|
1505
|
+
end
|
1506
|
+
|
1507
|
+
##
|
1508
|
+
# Lists database {::Google::Longrunning::Operation longrunning-operations}.
|
1509
|
+
# A database operation has a name of the form
|
1510
|
+
# `projects/<project>/instances/<instance>/databases/<database>/operations/<operation>`.
|
1511
|
+
# The long-running operation
|
1512
|
+
# {::Google::Longrunning::Operation#metadata metadata} field type
|
1513
|
+
# `metadata.type_url` describes the type of the metadata. Operations returned
|
1514
|
+
# include those that have completed/failed/canceled within the last 7 days,
|
1515
|
+
# and pending operations.
|
1516
|
+
#
|
1517
|
+
# @overload list_database_operations(request, options = nil)
|
1518
|
+
# Pass arguments to `list_database_operations` via a request object, either of type
|
1519
|
+
# {::Google::Cloud::Spanner::Admin::Database::V1::ListDatabaseOperationsRequest} or an equivalent Hash.
|
1520
|
+
#
|
1521
|
+
# @param request [::Google::Cloud::Spanner::Admin::Database::V1::ListDatabaseOperationsRequest, ::Hash]
|
1522
|
+
# A request object representing the call parameters. Required. To specify no
|
1523
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
1524
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
1525
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
1526
|
+
#
|
1527
|
+
# @overload list_database_operations(parent: nil, filter: nil, page_size: nil, page_token: nil)
|
1528
|
+
# Pass arguments to `list_database_operations` via keyword arguments. Note that at
|
1529
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
1530
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
1531
|
+
#
|
1532
|
+
# @param parent [::String]
|
1533
|
+
# Required. The instance of the database operations.
|
1534
|
+
# Values are of the form `projects/<project>/instances/<instance>`.
|
1535
|
+
# @param filter [::String]
|
1536
|
+
# An expression that filters the list of returned operations.
|
1537
|
+
#
|
1538
|
+
# A filter expression consists of a field name, a
|
1539
|
+
# comparison operator, and a value for filtering.
|
1540
|
+
# The value must be a string, a number, or a boolean. The comparison operator
|
1541
|
+
# must be one of: `<`, `>`, `<=`, `>=`, `!=`, `=`, or `:`.
|
1542
|
+
# Colon `:` is the contains operator. Filter rules are not case sensitive.
|
1543
|
+
#
|
1544
|
+
# The following fields in the {::Google::Longrunning::Operation Operation}
|
1545
|
+
# are eligible for filtering:
|
1546
|
+
#
|
1547
|
+
# * `name` - The name of the long-running operation
|
1548
|
+
# * `done` - False if the operation is in progress, else true.
|
1549
|
+
# * `metadata.@type` - the type of metadata. For example, the type string
|
1550
|
+
# for {::Google::Cloud::Spanner::Admin::Database::V1::RestoreDatabaseMetadata RestoreDatabaseMetadata} is
|
1551
|
+
# `type.googleapis.com/google.spanner.admin.database.v1.RestoreDatabaseMetadata`.
|
1552
|
+
# * `metadata.<field_name>` - any field in metadata.value.
|
1553
|
+
# `metadata.@type` must be specified first, if filtering on metadata
|
1554
|
+
# fields.
|
1555
|
+
# * `error` - Error associated with the long-running operation.
|
1556
|
+
# * `response.@type` - the type of response.
|
1557
|
+
# * `response.<field_name>` - any field in response.value.
|
1558
|
+
#
|
1559
|
+
# You can combine multiple expressions by enclosing each expression in
|
1560
|
+
# parentheses. By default, expressions are combined with AND logic. However,
|
1561
|
+
# you can specify AND, OR, and NOT logic explicitly.
|
1562
|
+
#
|
1563
|
+
# Here are a few examples:
|
1564
|
+
#
|
1565
|
+
# * `done:true` - The operation is complete.
|
1566
|
+
# * `(metadata.@type=type.googleapis.com/google.spanner.admin.database.v1.RestoreDatabaseMetadata) AND` \
|
1567
|
+
# `(metadata.source_type:BACKUP) AND` \
|
1568
|
+
# `(metadata.backup_info.backup:backup_howl) AND` \
|
1569
|
+
# `(metadata.name:restored_howl) AND` \
|
1570
|
+
# `(metadata.progress.start_time < \"2018-03-28T14:50:00Z\") AND` \
|
1571
|
+
# `(error:*)` - Return operations where:
|
1572
|
+
# * The operation's metadata type is {::Google::Cloud::Spanner::Admin::Database::V1::RestoreDatabaseMetadata RestoreDatabaseMetadata}.
|
1573
|
+
# * The database is restored from a backup.
|
1574
|
+
# * The backup name contains "backup_howl".
|
1575
|
+
# * The restored database's name contains "restored_howl".
|
1576
|
+
# * The operation started before 2018-03-28T14:50:00Z.
|
1577
|
+
# * The operation resulted in an error.
|
1578
|
+
# @param page_size [::Integer]
|
1579
|
+
# Number of operations to be returned in the response. If 0 or
|
1580
|
+
# less, defaults to the server's maximum allowed page size.
|
1581
|
+
# @param page_token [::String]
|
1582
|
+
# If non-empty, `page_token` should contain a
|
1583
|
+
# {::Google::Cloud::Spanner::Admin::Database::V1::ListDatabaseOperationsResponse#next_page_token next_page_token}
|
1584
|
+
# from a previous {::Google::Cloud::Spanner::Admin::Database::V1::ListDatabaseOperationsResponse ListDatabaseOperationsResponse} to the
|
1585
|
+
# same `parent` and with the same `filter`.
|
1586
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
1587
|
+
# @yieldparam result [::Gapic::Operation]
|
1588
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
1589
|
+
#
|
1590
|
+
# @return [::Gapic::Operation]
|
1591
|
+
#
|
1592
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
1593
|
+
def list_database_operations request, options = nil
|
1594
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
1595
|
+
|
1596
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Spanner::Admin::Database::V1::ListDatabaseOperationsRequest
|
1597
|
+
|
1598
|
+
# Converts hash and nil to an options object
|
1599
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
1600
|
+
|
1601
|
+
# Customize the options with defaults
|
1602
|
+
call_metadata = @config.rpcs.list_database_operations.metadata.to_h
|
1603
|
+
|
1604
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
1605
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
1606
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
1607
|
+
gapic_version: ::Google::Cloud::Spanner::Admin::Database::V1::VERSION,
|
1608
|
+
transports_version_send: [:rest]
|
1609
|
+
|
1610
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
1611
|
+
|
1612
|
+
options.apply_defaults timeout: @config.rpcs.list_database_operations.timeout,
|
1613
|
+
metadata: call_metadata,
|
1614
|
+
retry_policy: @config.rpcs.list_database_operations.retry_policy
|
1615
|
+
|
1616
|
+
options.apply_defaults timeout: @config.timeout,
|
1617
|
+
metadata: @config.metadata,
|
1618
|
+
retry_policy: @config.retry_policy
|
1619
|
+
|
1620
|
+
@database_admin_stub.list_database_operations request, options do |result, operation|
|
1621
|
+
result = ::Gapic::Rest::PagedEnumerable.new @database_admin_stub, :list_database_operations, "operations", request, result, options
|
1622
|
+
yield result, operation if block_given?
|
1623
|
+
return result
|
1624
|
+
end
|
1625
|
+
rescue ::Gapic::Rest::Error => e
|
1626
|
+
raise ::Google::Cloud::Error.from_error(e)
|
1627
|
+
end
|
1628
|
+
|
1629
|
+
##
|
1630
|
+
# Lists the backup {::Google::Longrunning::Operation long-running operations} in
|
1631
|
+
# the given instance. A backup operation has a name of the form
|
1632
|
+
# `projects/<project>/instances/<instance>/backups/<backup>/operations/<operation>`.
|
1633
|
+
# The long-running operation
|
1634
|
+
# {::Google::Longrunning::Operation#metadata metadata} field type
|
1635
|
+
# `metadata.type_url` describes the type of the metadata. Operations returned
|
1636
|
+
# include those that have completed/failed/canceled within the last 7 days,
|
1637
|
+
# and pending operations. Operations returned are ordered by
|
1638
|
+
# `operation.metadata.value.progress.start_time` in descending order starting
|
1639
|
+
# from the most recently started operation.
|
1640
|
+
#
|
1641
|
+
# @overload list_backup_operations(request, options = nil)
|
1642
|
+
# Pass arguments to `list_backup_operations` via a request object, either of type
|
1643
|
+
# {::Google::Cloud::Spanner::Admin::Database::V1::ListBackupOperationsRequest} or an equivalent Hash.
|
1644
|
+
#
|
1645
|
+
# @param request [::Google::Cloud::Spanner::Admin::Database::V1::ListBackupOperationsRequest, ::Hash]
|
1646
|
+
# A request object representing the call parameters. Required. To specify no
|
1647
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
1648
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
1649
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
1650
|
+
#
|
1651
|
+
# @overload list_backup_operations(parent: nil, filter: nil, page_size: nil, page_token: nil)
|
1652
|
+
# Pass arguments to `list_backup_operations` via keyword arguments. Note that at
|
1653
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
1654
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
1655
|
+
#
|
1656
|
+
# @param parent [::String]
|
1657
|
+
# Required. The instance of the backup operations. Values are of
|
1658
|
+
# the form `projects/<project>/instances/<instance>`.
|
1659
|
+
# @param filter [::String]
|
1660
|
+
# An expression that filters the list of returned backup operations.
|
1661
|
+
#
|
1662
|
+
# A filter expression consists of a field name, a
|
1663
|
+
# comparison operator, and a value for filtering.
|
1664
|
+
# The value must be a string, a number, or a boolean. The comparison operator
|
1665
|
+
# must be one of: `<`, `>`, `<=`, `>=`, `!=`, `=`, or `:`.
|
1666
|
+
# Colon `:` is the contains operator. Filter rules are not case sensitive.
|
1667
|
+
#
|
1668
|
+
# The following fields in the {::Google::Longrunning::Operation operation}
|
1669
|
+
# are eligible for filtering:
|
1670
|
+
#
|
1671
|
+
# * `name` - The name of the long-running operation
|
1672
|
+
# * `done` - False if the operation is in progress, else true.
|
1673
|
+
# * `metadata.@type` - the type of metadata. For example, the type string
|
1674
|
+
# for {::Google::Cloud::Spanner::Admin::Database::V1::CreateBackupMetadata CreateBackupMetadata} is
|
1675
|
+
# `type.googleapis.com/google.spanner.admin.database.v1.CreateBackupMetadata`.
|
1676
|
+
# * `metadata.<field_name>` - any field in metadata.value.
|
1677
|
+
# `metadata.@type` must be specified first if filtering on metadata
|
1678
|
+
# fields.
|
1679
|
+
# * `error` - Error associated with the long-running operation.
|
1680
|
+
# * `response.@type` - the type of response.
|
1681
|
+
# * `response.<field_name>` - any field in response.value.
|
1682
|
+
#
|
1683
|
+
# You can combine multiple expressions by enclosing each expression in
|
1684
|
+
# parentheses. By default, expressions are combined with AND logic, but
|
1685
|
+
# you can specify AND, OR, and NOT logic explicitly.
|
1686
|
+
#
|
1687
|
+
# Here are a few examples:
|
1688
|
+
#
|
1689
|
+
# * `done:true` - The operation is complete.
|
1690
|
+
# * `(metadata.@type=type.googleapis.com/google.spanner.admin.database.v1.CreateBackupMetadata) AND` \
|
1691
|
+
# `metadata.database:prod` - Returns operations where:
|
1692
|
+
# * The operation's metadata type is {::Google::Cloud::Spanner::Admin::Database::V1::CreateBackupMetadata CreateBackupMetadata}.
|
1693
|
+
# * The database the backup was taken from has a name containing the
|
1694
|
+
# string "prod".
|
1695
|
+
# * `(metadata.@type=type.googleapis.com/google.spanner.admin.database.v1.CreateBackupMetadata) AND` \
|
1696
|
+
# `(metadata.name:howl) AND` \
|
1697
|
+
# `(metadata.progress.start_time < \"2018-03-28T14:50:00Z\") AND` \
|
1698
|
+
# `(error:*)` - Returns operations where:
|
1699
|
+
# * The operation's metadata type is {::Google::Cloud::Spanner::Admin::Database::V1::CreateBackupMetadata CreateBackupMetadata}.
|
1700
|
+
# * The backup name contains the string "howl".
|
1701
|
+
# * The operation started before 2018-03-28T14:50:00Z.
|
1702
|
+
# * The operation resulted in an error.
|
1703
|
+
# * `(metadata.@type=type.googleapis.com/google.spanner.admin.database.v1.CopyBackupMetadata) AND` \
|
1704
|
+
# `(metadata.source_backup:test) AND` \
|
1705
|
+
# `(metadata.progress.start_time < \"2022-01-18T14:50:00Z\") AND` \
|
1706
|
+
# `(error:*)` - Returns operations where:
|
1707
|
+
# * The operation's metadata type is {::Google::Cloud::Spanner::Admin::Database::V1::CopyBackupMetadata CopyBackupMetadata}.
|
1708
|
+
# * The source backup of the copied backup name contains the string
|
1709
|
+
# "test".
|
1710
|
+
# * The operation started before 2022-01-18T14:50:00Z.
|
1711
|
+
# * The operation resulted in an error.
|
1712
|
+
# * `((metadata.@type=type.googleapis.com/google.spanner.admin.database.v1.CreateBackupMetadata) AND` \
|
1713
|
+
# `(metadata.database:test_db)) OR` \
|
1714
|
+
# `((metadata.@type=type.googleapis.com/google.spanner.admin.database.v1.CopyBackupMetadata)
|
1715
|
+
# AND` \
|
1716
|
+
# `(metadata.source_backup:test_bkp)) AND` \
|
1717
|
+
# `(error:*)` - Returns operations where:
|
1718
|
+
# * The operation's metadata matches either of criteria:
|
1719
|
+
# * The operation's metadata type is {::Google::Cloud::Spanner::Admin::Database::V1::CreateBackupMetadata CreateBackupMetadata} AND the
|
1720
|
+
# database the backup was taken from has name containing string
|
1721
|
+
# "test_db"
|
1722
|
+
# * The operation's metadata type is {::Google::Cloud::Spanner::Admin::Database::V1::CopyBackupMetadata CopyBackupMetadata} AND the
|
1723
|
+
# backup the backup was copied from has name containing string
|
1724
|
+
# "test_bkp"
|
1725
|
+
# * The operation resulted in an error.
|
1726
|
+
# @param page_size [::Integer]
|
1727
|
+
# Number of operations to be returned in the response. If 0 or
|
1728
|
+
# less, defaults to the server's maximum allowed page size.
|
1729
|
+
# @param page_token [::String]
|
1730
|
+
# If non-empty, `page_token` should contain a
|
1731
|
+
# {::Google::Cloud::Spanner::Admin::Database::V1::ListBackupOperationsResponse#next_page_token next_page_token}
|
1732
|
+
# from a previous {::Google::Cloud::Spanner::Admin::Database::V1::ListBackupOperationsResponse ListBackupOperationsResponse} to the
|
1733
|
+
# same `parent` and with the same `filter`.
|
1734
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
1735
|
+
# @yieldparam result [::Gapic::Operation]
|
1736
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
1737
|
+
#
|
1738
|
+
# @return [::Gapic::Operation]
|
1739
|
+
#
|
1740
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
1741
|
+
def list_backup_operations request, options = nil
|
1742
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
1743
|
+
|
1744
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Spanner::Admin::Database::V1::ListBackupOperationsRequest
|
1745
|
+
|
1746
|
+
# Converts hash and nil to an options object
|
1747
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
1748
|
+
|
1749
|
+
# Customize the options with defaults
|
1750
|
+
call_metadata = @config.rpcs.list_backup_operations.metadata.to_h
|
1751
|
+
|
1752
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
1753
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
1754
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
1755
|
+
gapic_version: ::Google::Cloud::Spanner::Admin::Database::V1::VERSION,
|
1756
|
+
transports_version_send: [:rest]
|
1757
|
+
|
1758
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
1759
|
+
|
1760
|
+
options.apply_defaults timeout: @config.rpcs.list_backup_operations.timeout,
|
1761
|
+
metadata: call_metadata,
|
1762
|
+
retry_policy: @config.rpcs.list_backup_operations.retry_policy
|
1763
|
+
|
1764
|
+
options.apply_defaults timeout: @config.timeout,
|
1765
|
+
metadata: @config.metadata,
|
1766
|
+
retry_policy: @config.retry_policy
|
1767
|
+
|
1768
|
+
@database_admin_stub.list_backup_operations request, options do |result, operation|
|
1769
|
+
result = ::Gapic::Rest::PagedEnumerable.new @database_admin_stub, :list_backup_operations, "operations", request, result, options
|
1770
|
+
yield result, operation if block_given?
|
1771
|
+
return result
|
1772
|
+
end
|
1773
|
+
rescue ::Gapic::Rest::Error => e
|
1774
|
+
raise ::Google::Cloud::Error.from_error(e)
|
1775
|
+
end
|
1776
|
+
|
1777
|
+
##
|
1778
|
+
# Lists Cloud Spanner database roles.
|
1779
|
+
#
|
1780
|
+
# @overload list_database_roles(request, options = nil)
|
1781
|
+
# Pass arguments to `list_database_roles` via a request object, either of type
|
1782
|
+
# {::Google::Cloud::Spanner::Admin::Database::V1::ListDatabaseRolesRequest} or an equivalent Hash.
|
1783
|
+
#
|
1784
|
+
# @param request [::Google::Cloud::Spanner::Admin::Database::V1::ListDatabaseRolesRequest, ::Hash]
|
1785
|
+
# A request object representing the call parameters. Required. To specify no
|
1786
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
1787
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
1788
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
1789
|
+
#
|
1790
|
+
# @overload list_database_roles(parent: nil, page_size: nil, page_token: nil)
|
1791
|
+
# Pass arguments to `list_database_roles` via keyword arguments. Note that at
|
1792
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
1793
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
1794
|
+
#
|
1795
|
+
# @param parent [::String]
|
1796
|
+
# Required. The database whose roles should be listed.
|
1797
|
+
# Values are of the form
|
1798
|
+
# `projects/<project>/instances/<instance>/databases/<database>/databaseRoles`.
|
1799
|
+
# @param page_size [::Integer]
|
1800
|
+
# Number of database roles to be returned in the response. If 0 or less,
|
1801
|
+
# defaults to the server's maximum allowed page size.
|
1802
|
+
# @param page_token [::String]
|
1803
|
+
# If non-empty, `page_token` should contain a
|
1804
|
+
# {::Google::Cloud::Spanner::Admin::Database::V1::ListDatabaseRolesResponse#next_page_token next_page_token} from a
|
1805
|
+
# previous {::Google::Cloud::Spanner::Admin::Database::V1::ListDatabaseRolesResponse ListDatabaseRolesResponse}.
|
1806
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
1807
|
+
# @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Spanner::Admin::Database::V1::DatabaseRole>]
|
1808
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
1809
|
+
#
|
1810
|
+
# @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Spanner::Admin::Database::V1::DatabaseRole>]
|
1811
|
+
#
|
1812
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
1813
|
+
def list_database_roles request, options = nil
|
1814
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
1815
|
+
|
1816
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Spanner::Admin::Database::V1::ListDatabaseRolesRequest
|
1817
|
+
|
1818
|
+
# Converts hash and nil to an options object
|
1819
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
1820
|
+
|
1821
|
+
# Customize the options with defaults
|
1822
|
+
call_metadata = @config.rpcs.list_database_roles.metadata.to_h
|
1823
|
+
|
1824
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
1825
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
1826
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
1827
|
+
gapic_version: ::Google::Cloud::Spanner::Admin::Database::V1::VERSION,
|
1828
|
+
transports_version_send: [:rest]
|
1829
|
+
|
1830
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
1831
|
+
|
1832
|
+
options.apply_defaults timeout: @config.rpcs.list_database_roles.timeout,
|
1833
|
+
metadata: call_metadata,
|
1834
|
+
retry_policy: @config.rpcs.list_database_roles.retry_policy
|
1835
|
+
|
1836
|
+
options.apply_defaults timeout: @config.timeout,
|
1837
|
+
metadata: @config.metadata,
|
1838
|
+
retry_policy: @config.retry_policy
|
1839
|
+
|
1840
|
+
@database_admin_stub.list_database_roles request, options do |result, operation|
|
1841
|
+
result = ::Gapic::Rest::PagedEnumerable.new @database_admin_stub, :list_database_roles, "database_roles", request, result, options
|
1842
|
+
yield result, operation if block_given?
|
1843
|
+
return result
|
1844
|
+
end
|
1845
|
+
rescue ::Gapic::Rest::Error => e
|
1846
|
+
raise ::Google::Cloud::Error.from_error(e)
|
1847
|
+
end
|
1848
|
+
|
1849
|
+
##
|
1850
|
+
# Configuration class for the DatabaseAdmin REST API.
|
1851
|
+
#
|
1852
|
+
# This class represents the configuration for DatabaseAdmin REST,
|
1853
|
+
# providing control over timeouts, retry behavior, logging, transport
|
1854
|
+
# parameters, and other low-level controls. Certain parameters can also be
|
1855
|
+
# applied individually to specific RPCs. See
|
1856
|
+
# {::Google::Cloud::Spanner::Admin::Database::V1::DatabaseAdmin::Rest::Client::Configuration::Rpcs}
|
1857
|
+
# for a list of RPCs that can be configured independently.
|
1858
|
+
#
|
1859
|
+
# Configuration can be applied globally to all clients, or to a single client
|
1860
|
+
# on construction.
|
1861
|
+
#
|
1862
|
+
# @example
|
1863
|
+
#
|
1864
|
+
# # Modify the global config, setting the timeout for
|
1865
|
+
# # list_databases to 20 seconds,
|
1866
|
+
# # and all remaining timeouts to 10 seconds.
|
1867
|
+
# ::Google::Cloud::Spanner::Admin::Database::V1::DatabaseAdmin::Rest::Client.configure do |config|
|
1868
|
+
# config.timeout = 10.0
|
1869
|
+
# config.rpcs.list_databases.timeout = 20.0
|
1870
|
+
# end
|
1871
|
+
#
|
1872
|
+
# # Apply the above configuration only to a new client.
|
1873
|
+
# client = ::Google::Cloud::Spanner::Admin::Database::V1::DatabaseAdmin::Rest::Client.new do |config|
|
1874
|
+
# config.timeout = 10.0
|
1875
|
+
# config.rpcs.list_databases.timeout = 20.0
|
1876
|
+
# end
|
1877
|
+
#
|
1878
|
+
# @!attribute [rw] endpoint
|
1879
|
+
# The hostname or hostname:port of the service endpoint.
|
1880
|
+
# Defaults to `"spanner.googleapis.com"`.
|
1881
|
+
# @return [::String]
|
1882
|
+
# @!attribute [rw] credentials
|
1883
|
+
# Credentials to send with calls. You may provide any of the following types:
|
1884
|
+
# * (`String`) The path to a service account key file in JSON format
|
1885
|
+
# * (`Hash`) A service account key as a Hash
|
1886
|
+
# * (`Google::Auth::Credentials`) A googleauth credentials object
|
1887
|
+
# (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
|
1888
|
+
# * (`Signet::OAuth2::Client`) A signet oauth2 client object
|
1889
|
+
# (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
|
1890
|
+
# * (`nil`) indicating no credentials
|
1891
|
+
# @return [::Object]
|
1892
|
+
# @!attribute [rw] scope
|
1893
|
+
# The OAuth scopes
|
1894
|
+
# @return [::Array<::String>]
|
1895
|
+
# @!attribute [rw] lib_name
|
1896
|
+
# The library name as recorded in instrumentation and logging
|
1897
|
+
# @return [::String]
|
1898
|
+
# @!attribute [rw] lib_version
|
1899
|
+
# The library version as recorded in instrumentation and logging
|
1900
|
+
# @return [::String]
|
1901
|
+
# @!attribute [rw] timeout
|
1902
|
+
# The call timeout in seconds.
|
1903
|
+
# @return [::Numeric]
|
1904
|
+
# @!attribute [rw] metadata
|
1905
|
+
# Additional headers to be sent with the call.
|
1906
|
+
# @return [::Hash{::Symbol=>::String}]
|
1907
|
+
# @!attribute [rw] retry_policy
|
1908
|
+
# The retry policy. The value is a hash with the following keys:
|
1909
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
1910
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
1911
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
1912
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
1913
|
+
# trigger a retry.
|
1914
|
+
# @return [::Hash]
|
1915
|
+
# @!attribute [rw] quota_project
|
1916
|
+
# A separate project against which to charge quota.
|
1917
|
+
# @return [::String]
|
1918
|
+
#
|
1919
|
+
class Configuration
|
1920
|
+
extend ::Gapic::Config
|
1921
|
+
|
1922
|
+
config_attr :endpoint, "spanner.googleapis.com", ::String
|
1923
|
+
config_attr :credentials, nil do |value|
|
1924
|
+
allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
|
1925
|
+
allowed.any? { |klass| klass === value }
|
1926
|
+
end
|
1927
|
+
config_attr :scope, nil, ::String, ::Array, nil
|
1928
|
+
config_attr :lib_name, nil, ::String, nil
|
1929
|
+
config_attr :lib_version, nil, ::String, nil
|
1930
|
+
config_attr :timeout, nil, ::Numeric, nil
|
1931
|
+
config_attr :metadata, nil, ::Hash, nil
|
1932
|
+
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
|
1933
|
+
config_attr :quota_project, nil, ::String, nil
|
1934
|
+
|
1935
|
+
# @private
|
1936
|
+
def initialize parent_config = nil
|
1937
|
+
@parent_config = parent_config unless parent_config.nil?
|
1938
|
+
|
1939
|
+
yield self if block_given?
|
1940
|
+
end
|
1941
|
+
|
1942
|
+
##
|
1943
|
+
# Configurations for individual RPCs
|
1944
|
+
# @return [Rpcs]
|
1945
|
+
#
|
1946
|
+
def rpcs
|
1947
|
+
@rpcs ||= begin
|
1948
|
+
parent_rpcs = nil
|
1949
|
+
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
|
1950
|
+
Rpcs.new parent_rpcs
|
1951
|
+
end
|
1952
|
+
end
|
1953
|
+
|
1954
|
+
##
|
1955
|
+
# Configuration RPC class for the DatabaseAdmin API.
|
1956
|
+
#
|
1957
|
+
# Includes fields providing the configuration for each RPC in this service.
|
1958
|
+
# Each configuration object is of type `Gapic::Config::Method` and includes
|
1959
|
+
# the following configuration fields:
|
1960
|
+
#
|
1961
|
+
# * `timeout` (*type:* `Numeric`) - The call timeout in seconds
|
1962
|
+
# * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
|
1963
|
+
# * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
|
1964
|
+
# include the following keys:
|
1965
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
1966
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
1967
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
1968
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
1969
|
+
# trigger a retry.
|
1970
|
+
#
|
1971
|
+
class Rpcs
|
1972
|
+
##
|
1973
|
+
# RPC-specific configuration for `list_databases`
|
1974
|
+
# @return [::Gapic::Config::Method]
|
1975
|
+
#
|
1976
|
+
attr_reader :list_databases
|
1977
|
+
##
|
1978
|
+
# RPC-specific configuration for `create_database`
|
1979
|
+
# @return [::Gapic::Config::Method]
|
1980
|
+
#
|
1981
|
+
attr_reader :create_database
|
1982
|
+
##
|
1983
|
+
# RPC-specific configuration for `get_database`
|
1984
|
+
# @return [::Gapic::Config::Method]
|
1985
|
+
#
|
1986
|
+
attr_reader :get_database
|
1987
|
+
##
|
1988
|
+
# RPC-specific configuration for `update_database_ddl`
|
1989
|
+
# @return [::Gapic::Config::Method]
|
1990
|
+
#
|
1991
|
+
attr_reader :update_database_ddl
|
1992
|
+
##
|
1993
|
+
# RPC-specific configuration for `drop_database`
|
1994
|
+
# @return [::Gapic::Config::Method]
|
1995
|
+
#
|
1996
|
+
attr_reader :drop_database
|
1997
|
+
##
|
1998
|
+
# RPC-specific configuration for `get_database_ddl`
|
1999
|
+
# @return [::Gapic::Config::Method]
|
2000
|
+
#
|
2001
|
+
attr_reader :get_database_ddl
|
2002
|
+
##
|
2003
|
+
# RPC-specific configuration for `set_iam_policy`
|
2004
|
+
# @return [::Gapic::Config::Method]
|
2005
|
+
#
|
2006
|
+
attr_reader :set_iam_policy
|
2007
|
+
##
|
2008
|
+
# RPC-specific configuration for `get_iam_policy`
|
2009
|
+
# @return [::Gapic::Config::Method]
|
2010
|
+
#
|
2011
|
+
attr_reader :get_iam_policy
|
2012
|
+
##
|
2013
|
+
# RPC-specific configuration for `test_iam_permissions`
|
2014
|
+
# @return [::Gapic::Config::Method]
|
2015
|
+
#
|
2016
|
+
attr_reader :test_iam_permissions
|
2017
|
+
##
|
2018
|
+
# RPC-specific configuration for `create_backup`
|
2019
|
+
# @return [::Gapic::Config::Method]
|
2020
|
+
#
|
2021
|
+
attr_reader :create_backup
|
2022
|
+
##
|
2023
|
+
# RPC-specific configuration for `copy_backup`
|
2024
|
+
# @return [::Gapic::Config::Method]
|
2025
|
+
#
|
2026
|
+
attr_reader :copy_backup
|
2027
|
+
##
|
2028
|
+
# RPC-specific configuration for `get_backup`
|
2029
|
+
# @return [::Gapic::Config::Method]
|
2030
|
+
#
|
2031
|
+
attr_reader :get_backup
|
2032
|
+
##
|
2033
|
+
# RPC-specific configuration for `update_backup`
|
2034
|
+
# @return [::Gapic::Config::Method]
|
2035
|
+
#
|
2036
|
+
attr_reader :update_backup
|
2037
|
+
##
|
2038
|
+
# RPC-specific configuration for `delete_backup`
|
2039
|
+
# @return [::Gapic::Config::Method]
|
2040
|
+
#
|
2041
|
+
attr_reader :delete_backup
|
2042
|
+
##
|
2043
|
+
# RPC-specific configuration for `list_backups`
|
2044
|
+
# @return [::Gapic::Config::Method]
|
2045
|
+
#
|
2046
|
+
attr_reader :list_backups
|
2047
|
+
##
|
2048
|
+
# RPC-specific configuration for `restore_database`
|
2049
|
+
# @return [::Gapic::Config::Method]
|
2050
|
+
#
|
2051
|
+
attr_reader :restore_database
|
2052
|
+
##
|
2053
|
+
# RPC-specific configuration for `list_database_operations`
|
2054
|
+
# @return [::Gapic::Config::Method]
|
2055
|
+
#
|
2056
|
+
attr_reader :list_database_operations
|
2057
|
+
##
|
2058
|
+
# RPC-specific configuration for `list_backup_operations`
|
2059
|
+
# @return [::Gapic::Config::Method]
|
2060
|
+
#
|
2061
|
+
attr_reader :list_backup_operations
|
2062
|
+
##
|
2063
|
+
# RPC-specific configuration for `list_database_roles`
|
2064
|
+
# @return [::Gapic::Config::Method]
|
2065
|
+
#
|
2066
|
+
attr_reader :list_database_roles
|
2067
|
+
|
2068
|
+
# @private
|
2069
|
+
def initialize parent_rpcs = nil
|
2070
|
+
list_databases_config = parent_rpcs.list_databases if parent_rpcs.respond_to? :list_databases
|
2071
|
+
@list_databases = ::Gapic::Config::Method.new list_databases_config
|
2072
|
+
create_database_config = parent_rpcs.create_database if parent_rpcs.respond_to? :create_database
|
2073
|
+
@create_database = ::Gapic::Config::Method.new create_database_config
|
2074
|
+
get_database_config = parent_rpcs.get_database if parent_rpcs.respond_to? :get_database
|
2075
|
+
@get_database = ::Gapic::Config::Method.new get_database_config
|
2076
|
+
update_database_ddl_config = parent_rpcs.update_database_ddl if parent_rpcs.respond_to? :update_database_ddl
|
2077
|
+
@update_database_ddl = ::Gapic::Config::Method.new update_database_ddl_config
|
2078
|
+
drop_database_config = parent_rpcs.drop_database if parent_rpcs.respond_to? :drop_database
|
2079
|
+
@drop_database = ::Gapic::Config::Method.new drop_database_config
|
2080
|
+
get_database_ddl_config = parent_rpcs.get_database_ddl if parent_rpcs.respond_to? :get_database_ddl
|
2081
|
+
@get_database_ddl = ::Gapic::Config::Method.new get_database_ddl_config
|
2082
|
+
set_iam_policy_config = parent_rpcs.set_iam_policy if parent_rpcs.respond_to? :set_iam_policy
|
2083
|
+
@set_iam_policy = ::Gapic::Config::Method.new set_iam_policy_config
|
2084
|
+
get_iam_policy_config = parent_rpcs.get_iam_policy if parent_rpcs.respond_to? :get_iam_policy
|
2085
|
+
@get_iam_policy = ::Gapic::Config::Method.new get_iam_policy_config
|
2086
|
+
test_iam_permissions_config = parent_rpcs.test_iam_permissions if parent_rpcs.respond_to? :test_iam_permissions
|
2087
|
+
@test_iam_permissions = ::Gapic::Config::Method.new test_iam_permissions_config
|
2088
|
+
create_backup_config = parent_rpcs.create_backup if parent_rpcs.respond_to? :create_backup
|
2089
|
+
@create_backup = ::Gapic::Config::Method.new create_backup_config
|
2090
|
+
copy_backup_config = parent_rpcs.copy_backup if parent_rpcs.respond_to? :copy_backup
|
2091
|
+
@copy_backup = ::Gapic::Config::Method.new copy_backup_config
|
2092
|
+
get_backup_config = parent_rpcs.get_backup if parent_rpcs.respond_to? :get_backup
|
2093
|
+
@get_backup = ::Gapic::Config::Method.new get_backup_config
|
2094
|
+
update_backup_config = parent_rpcs.update_backup if parent_rpcs.respond_to? :update_backup
|
2095
|
+
@update_backup = ::Gapic::Config::Method.new update_backup_config
|
2096
|
+
delete_backup_config = parent_rpcs.delete_backup if parent_rpcs.respond_to? :delete_backup
|
2097
|
+
@delete_backup = ::Gapic::Config::Method.new delete_backup_config
|
2098
|
+
list_backups_config = parent_rpcs.list_backups if parent_rpcs.respond_to? :list_backups
|
2099
|
+
@list_backups = ::Gapic::Config::Method.new list_backups_config
|
2100
|
+
restore_database_config = parent_rpcs.restore_database if parent_rpcs.respond_to? :restore_database
|
2101
|
+
@restore_database = ::Gapic::Config::Method.new restore_database_config
|
2102
|
+
list_database_operations_config = parent_rpcs.list_database_operations if parent_rpcs.respond_to? :list_database_operations
|
2103
|
+
@list_database_operations = ::Gapic::Config::Method.new list_database_operations_config
|
2104
|
+
list_backup_operations_config = parent_rpcs.list_backup_operations if parent_rpcs.respond_to? :list_backup_operations
|
2105
|
+
@list_backup_operations = ::Gapic::Config::Method.new list_backup_operations_config
|
2106
|
+
list_database_roles_config = parent_rpcs.list_database_roles if parent_rpcs.respond_to? :list_database_roles
|
2107
|
+
@list_database_roles = ::Gapic::Config::Method.new list_database_roles_config
|
2108
|
+
|
2109
|
+
yield self if block_given?
|
2110
|
+
end
|
2111
|
+
end
|
2112
|
+
end
|
2113
|
+
end
|
2114
|
+
end
|
2115
|
+
end
|
2116
|
+
end
|
2117
|
+
end
|
2118
|
+
end
|
2119
|
+
end
|
2120
|
+
end
|
2121
|
+
end
|