google-cloud-spanner-admin-database-v1 0.11.0 → 0.13.0

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