@google-cloud/spanner 7.18.0 → 7.19.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (84) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/README.md +1 -0
  3. package/build/protos/google/spanner/admin/database/v1/backup.proto +773 -0
  4. package/build/protos/google/spanner/admin/database/v1/backup_schedule.proto +230 -0
  5. package/build/protos/google/spanner/admin/database/v1/common.proto +132 -0
  6. package/build/protos/google/spanner/admin/database/v1/spanner_database_admin.proto +1279 -0
  7. package/build/protos/google/spanner/admin/instance/v1/common.proto +64 -0
  8. package/build/protos/google/spanner/admin/instance/v1/spanner_instance_admin.proto +2110 -0
  9. package/build/protos/google/spanner/executor/v1/cloud_executor.proto +1520 -0
  10. package/build/protos/google/spanner/v1/commit_response.proto +59 -0
  11. package/build/protos/google/spanner/v1/keys.proto +163 -0
  12. package/build/protos/google/spanner/v1/mutation.proto +107 -0
  13. package/build/protos/google/spanner/v1/query_plan.proto +128 -0
  14. package/build/protos/google/spanner/v1/result_set.proto +237 -0
  15. package/build/protos/google/spanner/v1/spanner.proto +1389 -0
  16. package/build/protos/google/spanner/v1/transaction.proto +622 -0
  17. package/build/protos/google/spanner/v1/type.proto +214 -0
  18. package/build/protos/protos.d.ts +39869 -0
  19. package/build/protos/protos.js +101659 -0
  20. package/build/protos/protos.json +10391 -0
  21. package/build/src/backup.d.ts +349 -0
  22. package/build/src/backup.js +246 -0
  23. package/build/src/batch-transaction.d.ts +247 -0
  24. package/build/src/batch-transaction.js +384 -0
  25. package/build/src/codec.d.ts +362 -0
  26. package/build/src/codec.js +791 -0
  27. package/build/src/common-grpc/service-object.d.ts +80 -0
  28. package/build/src/common-grpc/service-object.js +101 -0
  29. package/build/src/common-grpc/service.d.ts +445 -0
  30. package/build/src/common-grpc/service.js +826 -0
  31. package/build/src/common.d.ts +66 -0
  32. package/build/src/common.js +54 -0
  33. package/build/src/database.d.ts +2103 -0
  34. package/build/src/database.js +1660 -0
  35. package/build/src/extra_proto_list.json +1 -0
  36. package/build/src/helper.d.ts +45 -0
  37. package/build/src/helper.js +71 -0
  38. package/build/src/index.d.ts +1195 -0
  39. package/build/src/index.js +1059 -0
  40. package/build/src/instance-config.d.ts +294 -0
  41. package/build/src/instance-config.js +216 -0
  42. package/build/src/instance.d.ts +832 -0
  43. package/build/src/instance.js +781 -0
  44. package/build/src/instrument.d.ts +85 -0
  45. package/build/src/instrument.js +215 -0
  46. package/build/src/multiplexed-session.d.ts +135 -0
  47. package/build/src/multiplexed-session.js +194 -0
  48. package/build/src/partial-result-stream.d.ts +253 -0
  49. package/build/src/partial-result-stream.js +400 -0
  50. package/build/src/request_id_header.d.ts +41 -0
  51. package/build/src/request_id_header.js +138 -0
  52. package/build/src/session-factory.d.ts +115 -0
  53. package/build/src/session-factory.js +106 -0
  54. package/build/src/session-pool.d.ts +471 -0
  55. package/build/src/session-pool.js +765 -0
  56. package/build/src/session.d.ts +258 -0
  57. package/build/src/session.js +348 -0
  58. package/build/src/spanner_grpc_config.json +92 -0
  59. package/build/src/table.d.ts +831 -0
  60. package/build/src/table.js +277 -0
  61. package/build/src/transaction-runner.d.ts +185 -0
  62. package/build/src/transaction-runner.js +282 -0
  63. package/build/src/transaction.d.ts +1691 -0
  64. package/build/src/transaction.js +2003 -0
  65. package/build/src/v1/database_admin_client.d.ts +2332 -0
  66. package/build/src/v1/database_admin_client.js +2364 -0
  67. package/build/src/v1/database_admin_client_config.json +165 -0
  68. package/build/src/v1/database_admin_proto_list.json +6 -0
  69. package/build/src/v1/gapic_metadata.json +27 -0
  70. package/build/src/v1/index.d.ts +4 -0
  71. package/build/src/v1/index.js +29 -0
  72. package/build/src/v1/instance_admin_client.d.ts +1985 -0
  73. package/build/src/v1/instance_admin_client.js +1768 -0
  74. package/build/src/v1/instance_admin_client_config.json +129 -0
  75. package/build/src/v1/instance_admin_proto_list.json +4 -0
  76. package/build/src/v1/spanner_client.d.ts +1250 -0
  77. package/build/src/v1/spanner_client.js +1086 -0
  78. package/build/src/v1/spanner_client_config.json +119 -0
  79. package/build/src/v1/spanner_executor_proxy_client.d.ts +418 -0
  80. package/build/src/v1/spanner_executor_proxy_client.js +706 -0
  81. package/build/src/v1/spanner_executor_proxy_client_config.json +30 -0
  82. package/build/src/v1/spanner_executor_proxy_proto_list.json +14 -0
  83. package/build/src/v1/spanner_proto_list.json +10 -0
  84. package/package.json +1 -1
@@ -0,0 +1,2364 @@
1
+ "use strict";
2
+ // Copyright 2025 Google LLC
3
+ //
4
+ // Licensed under the Apache License, Version 2.0 (the "License");
5
+ // you may not use this file except in compliance with the License.
6
+ // You may obtain a copy of the License at
7
+ //
8
+ // https://www.apache.org/licenses/LICENSE-2.0
9
+ //
10
+ // Unless required by applicable law or agreed to in writing, software
11
+ // distributed under the License is distributed on an "AS IS" BASIS,
12
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ // See the License for the specific language governing permissions and
14
+ // limitations under the License.
15
+ //
16
+ // ** This file is automatically generated by gapic-generator-typescript. **
17
+ // ** https://github.com/googleapis/gapic-generator-typescript **
18
+ // ** All changes to this file may be overwritten. **
19
+ Object.defineProperty(exports, "__esModule", { value: true });
20
+ exports.DatabaseAdminClient = void 0;
21
+ const jsonProtos = require("../../protos/protos.json");
22
+ /**
23
+ * Client JSON configuration object, loaded from
24
+ * `src/v1/database_admin_client_config.json`.
25
+ * This file defines retry strategy and timeouts for all API methods in this library.
26
+ */
27
+ const gapicConfig = require("./database_admin_client_config.json");
28
+ const version = require('../../../package.json').version;
29
+ /**
30
+ * Cloud Spanner Database Admin API
31
+ *
32
+ * The Cloud Spanner Database Admin API can be used to:
33
+ * * create, drop, and list databases
34
+ * * update the schema of pre-existing databases
35
+ * * create, delete, copy and list backups for a database
36
+ * * restore a database from an existing backup
37
+ * @class
38
+ * @memberof v1
39
+ */
40
+ class DatabaseAdminClient {
41
+ /**
42
+ * Construct an instance of DatabaseAdminClient.
43
+ *
44
+ * @param {object} [options] - The configuration object.
45
+ * The options accepted by the constructor are described in detail
46
+ * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance).
47
+ * The common options are:
48
+ * @param {object} [options.credentials] - Credentials object.
49
+ * @param {string} [options.credentials.client_email]
50
+ * @param {string} [options.credentials.private_key]
51
+ * @param {string} [options.email] - Account email address. Required when
52
+ * using a .pem or .p12 keyFilename.
53
+ * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or
54
+ * .p12 key downloaded from the Google Developers Console. If you provide
55
+ * a path to a JSON file, the projectId option below is not necessary.
56
+ * NOTE: .pem and .p12 require you to specify options.email as well.
57
+ * @param {number} [options.port] - The port on which to connect to
58
+ * the remote host.
59
+ * @param {string} [options.projectId] - The project ID from the Google
60
+ * Developer's Console, e.g. 'grape-spaceship-123'. We will also check
61
+ * the environment variable GCLOUD_PROJECT for your project ID. If your
62
+ * app is running in an environment which supports
63
+ * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials},
64
+ * your project ID will be detected automatically.
65
+ * @param {string} [options.apiEndpoint] - The domain name of the
66
+ * API remote host.
67
+ * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override.
68
+ * Follows the structure of {@link gapicConfig}.
69
+ * @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode.
70
+ * For more information, please check the
71
+ * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}.
72
+ * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you
73
+ * need to avoid loading the default gRPC version and want to use the fallback
74
+ * HTTP implementation. Load only fallback version and pass it to the constructor:
75
+ * ```
76
+ * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC
77
+ * const client = new DatabaseAdminClient({fallback: true}, gax);
78
+ * ```
79
+ */
80
+ constructor(opts, gaxInstance) {
81
+ var _a, _b, _c, _d, _e;
82
+ this._terminated = false;
83
+ this.descriptors = {
84
+ page: {},
85
+ stream: {},
86
+ longrunning: {},
87
+ batching: {},
88
+ };
89
+ // Ensure that options include all the required fields.
90
+ const staticMembers = this.constructor;
91
+ if ((opts === null || opts === void 0 ? void 0 : opts.universe_domain) &&
92
+ (opts === null || opts === void 0 ? void 0 : opts.universeDomain) &&
93
+ (opts === null || opts === void 0 ? void 0 : opts.universe_domain) !== (opts === null || opts === void 0 ? void 0 : opts.universeDomain)) {
94
+ throw new Error('Please set either universe_domain or universeDomain, but not both.');
95
+ }
96
+ const universeDomainEnvVar = typeof process === 'object' && typeof process.env === 'object'
97
+ ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']
98
+ : undefined;
99
+ this._universeDomain =
100
+ (_c = (_b = (_a = opts === null || opts === void 0 ? void 0 : opts.universeDomain) !== null && _a !== void 0 ? _a : opts === null || opts === void 0 ? void 0 : opts.universe_domain) !== null && _b !== void 0 ? _b : universeDomainEnvVar) !== null && _c !== void 0 ? _c : 'googleapis.com';
101
+ this._servicePath = 'spanner.' + this._universeDomain;
102
+ const servicePath = (opts === null || opts === void 0 ? void 0 : opts.servicePath) || (opts === null || opts === void 0 ? void 0 : opts.apiEndpoint) || this._servicePath;
103
+ this._providedCustomServicePath = !!((opts === null || opts === void 0 ? void 0 : opts.servicePath) || (opts === null || opts === void 0 ? void 0 : opts.apiEndpoint));
104
+ const port = (opts === null || opts === void 0 ? void 0 : opts.port) || staticMembers.port;
105
+ const clientConfig = (_d = opts === null || opts === void 0 ? void 0 : opts.clientConfig) !== null && _d !== void 0 ? _d : {};
106
+ const fallback = (_e = opts === null || opts === void 0 ? void 0 : opts.fallback) !== null && _e !== void 0 ? _e : (typeof window !== 'undefined' && typeof (window === null || window === void 0 ? void 0 : window.fetch) === 'function');
107
+ opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts);
108
+ // Request numeric enum values if REST transport is used.
109
+ opts.numericEnums = true;
110
+ // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case.
111
+ if (servicePath !== this._servicePath && !('scopes' in opts)) {
112
+ opts['scopes'] = staticMembers.scopes;
113
+ }
114
+ // Load google-gax module synchronously if needed
115
+ if (!gaxInstance) {
116
+ gaxInstance = require('google-gax');
117
+ }
118
+ // Choose either gRPC or proto-over-HTTP implementation of google-gax.
119
+ this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance;
120
+ // Create a `gaxGrpc` object, with any grpc-specific options sent to the client.
121
+ this._gaxGrpc = new this._gaxModule.GrpcClient(opts);
122
+ // Save options to use in initialize() method.
123
+ this._opts = opts;
124
+ // Save the auth object to the client, for use by other methods.
125
+ this.auth = this._gaxGrpc.auth;
126
+ // Set useJWTAccessWithScope on the auth object.
127
+ this.auth.useJWTAccessWithScope = true;
128
+ // Set defaultServicePath on the auth object.
129
+ this.auth.defaultServicePath = this._servicePath;
130
+ // Set the default scopes in auth client if needed.
131
+ if (servicePath === this._servicePath) {
132
+ this.auth.defaultScopes = staticMembers.scopes;
133
+ }
134
+ // Determine the client header string.
135
+ const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`];
136
+ if (typeof process === 'object' && 'versions' in process) {
137
+ clientHeader.push(`gl-node/${process.versions.node}`);
138
+ }
139
+ else {
140
+ clientHeader.push(`gl-web/${this._gaxModule.version}`);
141
+ }
142
+ if (!opts.fallback) {
143
+ clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`);
144
+ }
145
+ else {
146
+ clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`);
147
+ }
148
+ if (opts.libName && opts.libVersion) {
149
+ clientHeader.push(`${opts.libName}/${opts.libVersion}`);
150
+ }
151
+ // Load the applicable protos.
152
+ this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos);
153
+ // This API contains "path templates"; forward-slash-separated
154
+ // identifiers to uniquely identify resources within the API.
155
+ // Create useful helper objects for these.
156
+ this.pathTemplates = {
157
+ backupPathTemplate: new this._gaxModule.PathTemplate('projects/{project}/instances/{instance}/backups/{backup}'),
158
+ backupSchedulePathTemplate: new this._gaxModule.PathTemplate('projects/{project}/instances/{instance}/databases/{database}/backupSchedules/{schedule}'),
159
+ cryptoKeyPathTemplate: new this._gaxModule.PathTemplate('projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}'),
160
+ databasePathTemplate: new this._gaxModule.PathTemplate('projects/{project}/instances/{instance}/databases/{database}'),
161
+ databaseRolePathTemplate: new this._gaxModule.PathTemplate('projects/{project}/instances/{instance}/databases/{database}/databaseRoles/{role}'),
162
+ instancePathTemplate: new this._gaxModule.PathTemplate('projects/{project}/instances/{instance}'),
163
+ };
164
+ // Some of the methods on this service return "paged" results,
165
+ // (e.g. 50 results at a time, with tokens to get subsequent
166
+ // pages). Denote the keys used for pagination and results.
167
+ this.descriptors.page = {
168
+ listDatabases: new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'databases'),
169
+ listBackups: new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'backups'),
170
+ listDatabaseOperations: new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'operations'),
171
+ listBackupOperations: new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'operations'),
172
+ listDatabaseRoles: new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'databaseRoles'),
173
+ listBackupSchedules: new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'backupSchedules'),
174
+ };
175
+ const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
176
+ // This API contains "long-running operations", which return a
177
+ // an Operation object that allows for tracking of the operation,
178
+ // rather than holding a request open.
179
+ const lroOptions = {
180
+ auth: this.auth,
181
+ grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined,
182
+ };
183
+ if (opts.fallback) {
184
+ lroOptions.protoJson = protoFilesRoot;
185
+ lroOptions.httpRules = [
186
+ {
187
+ selector: 'google.longrunning.Operations.CancelOperation',
188
+ post: '/v1/{name=projects/*/instances/*/databases/*/operations/*}:cancel',
189
+ additional_bindings: [
190
+ { post: '/v1/{name=projects/*/instances/*/operations/*}:cancel' },
191
+ {
192
+ post: '/v1/{name=projects/*/instances/*/backups/*/operations/*}:cancel',
193
+ },
194
+ {
195
+ post: '/v1/{name=projects/*/instanceConfigs/*/operations/*}:cancel',
196
+ },
197
+ ],
198
+ },
199
+ {
200
+ selector: 'google.longrunning.Operations.DeleteOperation',
201
+ delete: '/v1/{name=projects/*/instances/*/databases/*/operations/*}',
202
+ additional_bindings: [
203
+ { delete: '/v1/{name=projects/*/instances/*/operations/*}' },
204
+ {
205
+ delete: '/v1/{name=projects/*/instances/*/backups/*/operations/*}',
206
+ },
207
+ { delete: '/v1/{name=projects/*/instanceConfigs/*/operations/*}' },
208
+ ],
209
+ },
210
+ {
211
+ selector: 'google.longrunning.Operations.GetOperation',
212
+ get: '/v1/{name=projects/*/instances/*/databases/*/operations/*}',
213
+ additional_bindings: [
214
+ { get: '/v1/{name=projects/*/instances/*/operations/*}' },
215
+ { get: '/v1/{name=projects/*/instances/*/backups/*/operations/*}' },
216
+ { get: '/v1/{name=projects/*/instanceConfigs/*/operations/*}' },
217
+ ],
218
+ },
219
+ {
220
+ selector: 'google.longrunning.Operations.ListOperations',
221
+ get: '/v1/{name=projects/*/instances/*/databases/*/operations}',
222
+ additional_bindings: [
223
+ { get: '/v1/{name=projects/*/instances/*/operations}' },
224
+ { get: '/v1/{name=projects/*/instances/*/backups/*/operations}' },
225
+ { get: '/v1/{name=projects/*/instanceConfigs/*/operations}' },
226
+ ],
227
+ },
228
+ ];
229
+ }
230
+ this.operationsClient = this._gaxModule
231
+ .lro(lroOptions)
232
+ .operationsClient(opts);
233
+ const createDatabaseResponse = protoFilesRoot.lookup('.google.spanner.admin.database.v1.Database');
234
+ const createDatabaseMetadata = protoFilesRoot.lookup('.google.spanner.admin.database.v1.CreateDatabaseMetadata');
235
+ const updateDatabaseResponse = protoFilesRoot.lookup('.google.spanner.admin.database.v1.Database');
236
+ const updateDatabaseMetadata = protoFilesRoot.lookup('.google.spanner.admin.database.v1.UpdateDatabaseMetadata');
237
+ const updateDatabaseDdlResponse = protoFilesRoot.lookup('.google.protobuf.Empty');
238
+ const updateDatabaseDdlMetadata = protoFilesRoot.lookup('.google.spanner.admin.database.v1.UpdateDatabaseDdlMetadata');
239
+ const createBackupResponse = protoFilesRoot.lookup('.google.spanner.admin.database.v1.Backup');
240
+ const createBackupMetadata = protoFilesRoot.lookup('.google.spanner.admin.database.v1.CreateBackupMetadata');
241
+ const copyBackupResponse = protoFilesRoot.lookup('.google.spanner.admin.database.v1.Backup');
242
+ const copyBackupMetadata = protoFilesRoot.lookup('.google.spanner.admin.database.v1.CopyBackupMetadata');
243
+ const restoreDatabaseResponse = protoFilesRoot.lookup('.google.spanner.admin.database.v1.Database');
244
+ const restoreDatabaseMetadata = protoFilesRoot.lookup('.google.spanner.admin.database.v1.RestoreDatabaseMetadata');
245
+ this.descriptors.longrunning = {
246
+ createDatabase: new this._gaxModule.LongrunningDescriptor(this.operationsClient, createDatabaseResponse.decode.bind(createDatabaseResponse), createDatabaseMetadata.decode.bind(createDatabaseMetadata)),
247
+ updateDatabase: new this._gaxModule.LongrunningDescriptor(this.operationsClient, updateDatabaseResponse.decode.bind(updateDatabaseResponse), updateDatabaseMetadata.decode.bind(updateDatabaseMetadata)),
248
+ updateDatabaseDdl: new this._gaxModule.LongrunningDescriptor(this.operationsClient, updateDatabaseDdlResponse.decode.bind(updateDatabaseDdlResponse), updateDatabaseDdlMetadata.decode.bind(updateDatabaseDdlMetadata)),
249
+ createBackup: new this._gaxModule.LongrunningDescriptor(this.operationsClient, createBackupResponse.decode.bind(createBackupResponse), createBackupMetadata.decode.bind(createBackupMetadata)),
250
+ copyBackup: new this._gaxModule.LongrunningDescriptor(this.operationsClient, copyBackupResponse.decode.bind(copyBackupResponse), copyBackupMetadata.decode.bind(copyBackupMetadata)),
251
+ restoreDatabase: new this._gaxModule.LongrunningDescriptor(this.operationsClient, restoreDatabaseResponse.decode.bind(restoreDatabaseResponse), restoreDatabaseMetadata.decode.bind(restoreDatabaseMetadata)),
252
+ };
253
+ // Put together the default options sent with requests.
254
+ this._defaults = this._gaxGrpc.constructSettings('google.spanner.admin.database.v1.DatabaseAdmin', gapicConfig, opts.clientConfig || {}, { 'x-goog-api-client': clientHeader.join(' ') });
255
+ // Set up a dictionary of "inner API calls"; the core implementation
256
+ // of calling the API is handled in `google-gax`, with this code
257
+ // merely providing the destination and request information.
258
+ this.innerApiCalls = {};
259
+ // Add a warn function to the client constructor so it can be easily tested.
260
+ this.warn = this._gaxModule.warn;
261
+ }
262
+ /**
263
+ * Initialize the client.
264
+ * Performs asynchronous operations (such as authentication) and prepares the client.
265
+ * This function will be called automatically when any class method is called for the
266
+ * first time, but if you need to initialize it before calling an actual method,
267
+ * feel free to call initialize() directly.
268
+ *
269
+ * You can await on this method if you want to make sure the client is initialized.
270
+ *
271
+ * @returns {Promise} A promise that resolves to an authenticated service stub.
272
+ */
273
+ initialize() {
274
+ // If the client stub promise is already initialized, return immediately.
275
+ if (this.databaseAdminStub) {
276
+ return this.databaseAdminStub;
277
+ }
278
+ // Put together the "service stub" for
279
+ // google.spanner.admin.database.v1.DatabaseAdmin.
280
+ this.databaseAdminStub = this._gaxGrpc.createStub(this._opts.fallback
281
+ ? this._protos.lookupService('google.spanner.admin.database.v1.DatabaseAdmin')
282
+ : // eslint-disable-next-line @typescript-eslint/no-explicit-any
283
+ this._protos.google.spanner.admin.database.v1.DatabaseAdmin, this._opts, this._providedCustomServicePath);
284
+ // Iterate over each of the methods that the service provides
285
+ // and create an API call method for each.
286
+ const databaseAdminStubMethods = [
287
+ 'listDatabases',
288
+ 'createDatabase',
289
+ 'getDatabase',
290
+ 'updateDatabase',
291
+ 'updateDatabaseDdl',
292
+ 'dropDatabase',
293
+ 'getDatabaseDdl',
294
+ 'setIamPolicy',
295
+ 'getIamPolicy',
296
+ 'testIamPermissions',
297
+ 'createBackup',
298
+ 'copyBackup',
299
+ 'getBackup',
300
+ 'updateBackup',
301
+ 'deleteBackup',
302
+ 'listBackups',
303
+ 'restoreDatabase',
304
+ 'listDatabaseOperations',
305
+ 'listBackupOperations',
306
+ 'listDatabaseRoles',
307
+ 'addSplitPoints',
308
+ 'createBackupSchedule',
309
+ 'getBackupSchedule',
310
+ 'updateBackupSchedule',
311
+ 'deleteBackupSchedule',
312
+ 'listBackupSchedules',
313
+ ];
314
+ for (const methodName of databaseAdminStubMethods) {
315
+ const callPromise = this.databaseAdminStub.then(stub => (...args) => {
316
+ if (this._terminated) {
317
+ return Promise.reject('The client has already been closed.');
318
+ }
319
+ const func = stub[methodName];
320
+ return func.apply(stub, args);
321
+ }, (err) => () => {
322
+ throw err;
323
+ });
324
+ const descriptor = this.descriptors.page[methodName] ||
325
+ this.descriptors.longrunning[methodName] ||
326
+ undefined;
327
+ const apiCall = this._gaxModule.createApiCall(callPromise, this._defaults[methodName], descriptor, this._opts.fallback);
328
+ this.innerApiCalls[methodName] = apiCall;
329
+ }
330
+ return this.databaseAdminStub;
331
+ }
332
+ /**
333
+ * The DNS address for this API service.
334
+ * @deprecated Use the apiEndpoint method of the client instance.
335
+ * @returns {string} The DNS address for this service.
336
+ */
337
+ static get servicePath() {
338
+ if (typeof process === 'object' &&
339
+ typeof process.emitWarning === 'function') {
340
+ process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning');
341
+ }
342
+ return 'spanner.googleapis.com';
343
+ }
344
+ /**
345
+ * The DNS address for this API service - same as servicePath.
346
+ * @deprecated Use the apiEndpoint method of the client instance.
347
+ * @returns {string} The DNS address for this service.
348
+ */
349
+ static get apiEndpoint() {
350
+ if (typeof process === 'object' &&
351
+ typeof process.emitWarning === 'function') {
352
+ process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning');
353
+ }
354
+ return 'spanner.googleapis.com';
355
+ }
356
+ /**
357
+ * The DNS address for this API service.
358
+ * @returns {string} The DNS address for this service.
359
+ */
360
+ get apiEndpoint() {
361
+ return this._servicePath;
362
+ }
363
+ get universeDomain() {
364
+ return this._universeDomain;
365
+ }
366
+ /**
367
+ * The port for this API service.
368
+ * @returns {number} The default port for this service.
369
+ */
370
+ static get port() {
371
+ return 443;
372
+ }
373
+ /**
374
+ * The scopes needed to make gRPC calls for every method defined
375
+ * in this service.
376
+ * @returns {string[]} List of default scopes.
377
+ */
378
+ static get scopes() {
379
+ return [
380
+ 'https://www.googleapis.com/auth/cloud-platform',
381
+ 'https://www.googleapis.com/auth/spanner.admin',
382
+ ];
383
+ }
384
+ /**
385
+ * Return the project ID used by this class.
386
+ * @returns {Promise} A promise that resolves to string containing the project ID.
387
+ */
388
+ getProjectId(callback) {
389
+ if (callback) {
390
+ this.auth.getProjectId(callback);
391
+ return;
392
+ }
393
+ return this.auth.getProjectId();
394
+ }
395
+ getDatabase(request, optionsOrCallback, callback) {
396
+ var _a;
397
+ request = request || {};
398
+ let options;
399
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
400
+ callback = optionsOrCallback;
401
+ options = {};
402
+ }
403
+ else {
404
+ options = optionsOrCallback;
405
+ }
406
+ options = options || {};
407
+ options.otherArgs = options.otherArgs || {};
408
+ options.otherArgs.headers = options.otherArgs.headers || {};
409
+ options.otherArgs.headers['x-goog-request-params'] =
410
+ this._gaxModule.routingHeader.fromParams({
411
+ name: (_a = request.name) !== null && _a !== void 0 ? _a : '',
412
+ });
413
+ this.initialize();
414
+ return this.innerApiCalls.getDatabase(request, options, callback);
415
+ }
416
+ dropDatabase(request, optionsOrCallback, callback) {
417
+ var _a;
418
+ request = request || {};
419
+ let options;
420
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
421
+ callback = optionsOrCallback;
422
+ options = {};
423
+ }
424
+ else {
425
+ options = optionsOrCallback;
426
+ }
427
+ options = options || {};
428
+ options.otherArgs = options.otherArgs || {};
429
+ options.otherArgs.headers = options.otherArgs.headers || {};
430
+ options.otherArgs.headers['x-goog-request-params'] =
431
+ this._gaxModule.routingHeader.fromParams({
432
+ database: (_a = request.database) !== null && _a !== void 0 ? _a : '',
433
+ });
434
+ this.initialize();
435
+ return this.innerApiCalls.dropDatabase(request, options, callback);
436
+ }
437
+ getDatabaseDdl(request, optionsOrCallback, callback) {
438
+ var _a;
439
+ request = request || {};
440
+ let options;
441
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
442
+ callback = optionsOrCallback;
443
+ options = {};
444
+ }
445
+ else {
446
+ options = optionsOrCallback;
447
+ }
448
+ options = options || {};
449
+ options.otherArgs = options.otherArgs || {};
450
+ options.otherArgs.headers = options.otherArgs.headers || {};
451
+ options.otherArgs.headers['x-goog-request-params'] =
452
+ this._gaxModule.routingHeader.fromParams({
453
+ database: (_a = request.database) !== null && _a !== void 0 ? _a : '',
454
+ });
455
+ this.initialize();
456
+ return this.innerApiCalls.getDatabaseDdl(request, options, callback);
457
+ }
458
+ setIamPolicy(request, optionsOrCallback, callback) {
459
+ var _a;
460
+ request = request || {};
461
+ let options;
462
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
463
+ callback = optionsOrCallback;
464
+ options = {};
465
+ }
466
+ else {
467
+ options = optionsOrCallback;
468
+ }
469
+ options = options || {};
470
+ options.otherArgs = options.otherArgs || {};
471
+ options.otherArgs.headers = options.otherArgs.headers || {};
472
+ options.otherArgs.headers['x-goog-request-params'] =
473
+ this._gaxModule.routingHeader.fromParams({
474
+ resource: (_a = request.resource) !== null && _a !== void 0 ? _a : '',
475
+ });
476
+ this.initialize();
477
+ return this.innerApiCalls.setIamPolicy(request, options, callback);
478
+ }
479
+ getIamPolicy(request, optionsOrCallback, callback) {
480
+ var _a;
481
+ request = request || {};
482
+ let options;
483
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
484
+ callback = optionsOrCallback;
485
+ options = {};
486
+ }
487
+ else {
488
+ options = optionsOrCallback;
489
+ }
490
+ options = options || {};
491
+ options.otherArgs = options.otherArgs || {};
492
+ options.otherArgs.headers = options.otherArgs.headers || {};
493
+ options.otherArgs.headers['x-goog-request-params'] =
494
+ this._gaxModule.routingHeader.fromParams({
495
+ resource: (_a = request.resource) !== null && _a !== void 0 ? _a : '',
496
+ });
497
+ this.initialize();
498
+ return this.innerApiCalls.getIamPolicy(request, options, callback);
499
+ }
500
+ testIamPermissions(request, optionsOrCallback, callback) {
501
+ var _a;
502
+ request = request || {};
503
+ let options;
504
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
505
+ callback = optionsOrCallback;
506
+ options = {};
507
+ }
508
+ else {
509
+ options = optionsOrCallback;
510
+ }
511
+ options = options || {};
512
+ options.otherArgs = options.otherArgs || {};
513
+ options.otherArgs.headers = options.otherArgs.headers || {};
514
+ options.otherArgs.headers['x-goog-request-params'] =
515
+ this._gaxModule.routingHeader.fromParams({
516
+ resource: (_a = request.resource) !== null && _a !== void 0 ? _a : '',
517
+ });
518
+ this.initialize();
519
+ return this.innerApiCalls.testIamPermissions(request, options, callback);
520
+ }
521
+ getBackup(request, optionsOrCallback, callback) {
522
+ var _a;
523
+ request = request || {};
524
+ let options;
525
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
526
+ callback = optionsOrCallback;
527
+ options = {};
528
+ }
529
+ else {
530
+ options = optionsOrCallback;
531
+ }
532
+ options = options || {};
533
+ options.otherArgs = options.otherArgs || {};
534
+ options.otherArgs.headers = options.otherArgs.headers || {};
535
+ options.otherArgs.headers['x-goog-request-params'] =
536
+ this._gaxModule.routingHeader.fromParams({
537
+ name: (_a = request.name) !== null && _a !== void 0 ? _a : '',
538
+ });
539
+ this.initialize();
540
+ return this.innerApiCalls.getBackup(request, options, callback);
541
+ }
542
+ updateBackup(request, optionsOrCallback, callback) {
543
+ var _a;
544
+ request = request || {};
545
+ let options;
546
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
547
+ callback = optionsOrCallback;
548
+ options = {};
549
+ }
550
+ else {
551
+ options = optionsOrCallback;
552
+ }
553
+ options = options || {};
554
+ options.otherArgs = options.otherArgs || {};
555
+ options.otherArgs.headers = options.otherArgs.headers || {};
556
+ options.otherArgs.headers['x-goog-request-params'] =
557
+ this._gaxModule.routingHeader.fromParams({
558
+ 'backup.name': (_a = request.backup.name) !== null && _a !== void 0 ? _a : '',
559
+ });
560
+ this.initialize();
561
+ return this.innerApiCalls.updateBackup(request, options, callback);
562
+ }
563
+ deleteBackup(request, optionsOrCallback, callback) {
564
+ var _a;
565
+ request = request || {};
566
+ let options;
567
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
568
+ callback = optionsOrCallback;
569
+ options = {};
570
+ }
571
+ else {
572
+ options = optionsOrCallback;
573
+ }
574
+ options = options || {};
575
+ options.otherArgs = options.otherArgs || {};
576
+ options.otherArgs.headers = options.otherArgs.headers || {};
577
+ options.otherArgs.headers['x-goog-request-params'] =
578
+ this._gaxModule.routingHeader.fromParams({
579
+ name: (_a = request.name) !== null && _a !== void 0 ? _a : '',
580
+ });
581
+ this.initialize();
582
+ return this.innerApiCalls.deleteBackup(request, options, callback);
583
+ }
584
+ addSplitPoints(request, optionsOrCallback, callback) {
585
+ var _a;
586
+ request = request || {};
587
+ let options;
588
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
589
+ callback = optionsOrCallback;
590
+ options = {};
591
+ }
592
+ else {
593
+ options = optionsOrCallback;
594
+ }
595
+ options = options || {};
596
+ options.otherArgs = options.otherArgs || {};
597
+ options.otherArgs.headers = options.otherArgs.headers || {};
598
+ options.otherArgs.headers['x-goog-request-params'] =
599
+ this._gaxModule.routingHeader.fromParams({
600
+ database: (_a = request.database) !== null && _a !== void 0 ? _a : '',
601
+ });
602
+ this.initialize();
603
+ return this.innerApiCalls.addSplitPoints(request, options, callback);
604
+ }
605
+ createBackupSchedule(request, optionsOrCallback, callback) {
606
+ var _a;
607
+ request = request || {};
608
+ let options;
609
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
610
+ callback = optionsOrCallback;
611
+ options = {};
612
+ }
613
+ else {
614
+ options = optionsOrCallback;
615
+ }
616
+ options = options || {};
617
+ options.otherArgs = options.otherArgs || {};
618
+ options.otherArgs.headers = options.otherArgs.headers || {};
619
+ options.otherArgs.headers['x-goog-request-params'] =
620
+ this._gaxModule.routingHeader.fromParams({
621
+ parent: (_a = request.parent) !== null && _a !== void 0 ? _a : '',
622
+ });
623
+ this.initialize();
624
+ return this.innerApiCalls.createBackupSchedule(request, options, callback);
625
+ }
626
+ getBackupSchedule(request, optionsOrCallback, callback) {
627
+ var _a;
628
+ request = request || {};
629
+ let options;
630
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
631
+ callback = optionsOrCallback;
632
+ options = {};
633
+ }
634
+ else {
635
+ options = optionsOrCallback;
636
+ }
637
+ options = options || {};
638
+ options.otherArgs = options.otherArgs || {};
639
+ options.otherArgs.headers = options.otherArgs.headers || {};
640
+ options.otherArgs.headers['x-goog-request-params'] =
641
+ this._gaxModule.routingHeader.fromParams({
642
+ name: (_a = request.name) !== null && _a !== void 0 ? _a : '',
643
+ });
644
+ this.initialize();
645
+ return this.innerApiCalls.getBackupSchedule(request, options, callback);
646
+ }
647
+ updateBackupSchedule(request, optionsOrCallback, callback) {
648
+ var _a;
649
+ request = request || {};
650
+ let options;
651
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
652
+ callback = optionsOrCallback;
653
+ options = {};
654
+ }
655
+ else {
656
+ options = optionsOrCallback;
657
+ }
658
+ options = options || {};
659
+ options.otherArgs = options.otherArgs || {};
660
+ options.otherArgs.headers = options.otherArgs.headers || {};
661
+ options.otherArgs.headers['x-goog-request-params'] =
662
+ this._gaxModule.routingHeader.fromParams({
663
+ 'backup_schedule.name': (_a = request.backupSchedule.name) !== null && _a !== void 0 ? _a : '',
664
+ });
665
+ this.initialize();
666
+ return this.innerApiCalls.updateBackupSchedule(request, options, callback);
667
+ }
668
+ deleteBackupSchedule(request, optionsOrCallback, callback) {
669
+ var _a;
670
+ request = request || {};
671
+ let options;
672
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
673
+ callback = optionsOrCallback;
674
+ options = {};
675
+ }
676
+ else {
677
+ options = optionsOrCallback;
678
+ }
679
+ options = options || {};
680
+ options.otherArgs = options.otherArgs || {};
681
+ options.otherArgs.headers = options.otherArgs.headers || {};
682
+ options.otherArgs.headers['x-goog-request-params'] =
683
+ this._gaxModule.routingHeader.fromParams({
684
+ name: (_a = request.name) !== null && _a !== void 0 ? _a : '',
685
+ });
686
+ this.initialize();
687
+ return this.innerApiCalls.deleteBackupSchedule(request, options, callback);
688
+ }
689
+ createDatabase(request, optionsOrCallback, callback) {
690
+ var _a;
691
+ request = request || {};
692
+ let options;
693
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
694
+ callback = optionsOrCallback;
695
+ options = {};
696
+ }
697
+ else {
698
+ options = optionsOrCallback;
699
+ }
700
+ options = options || {};
701
+ options.otherArgs = options.otherArgs || {};
702
+ options.otherArgs.headers = options.otherArgs.headers || {};
703
+ options.otherArgs.headers['x-goog-request-params'] =
704
+ this._gaxModule.routingHeader.fromParams({
705
+ parent: (_a = request.parent) !== null && _a !== void 0 ? _a : '',
706
+ });
707
+ this.initialize();
708
+ return this.innerApiCalls.createDatabase(request, options, callback);
709
+ }
710
+ /**
711
+ * Check the status of the long running operation returned by `createDatabase()`.
712
+ * @param {String} name
713
+ * The operation name that will be passed.
714
+ * @returns {Promise} - The promise which resolves to an object.
715
+ * The decoded operation object has result and metadata field to get information from.
716
+ * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation }
717
+ * for more details and examples.
718
+ */
719
+ async checkCreateDatabaseProgress(name) {
720
+ const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({ name });
721
+ const [operation] = await this.operationsClient.getOperation(request);
722
+ const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createDatabase, this._gaxModule.createDefaultBackoffSettings());
723
+ return decodeOperation;
724
+ }
725
+ updateDatabase(request, optionsOrCallback, callback) {
726
+ var _a;
727
+ request = request || {};
728
+ let options;
729
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
730
+ callback = optionsOrCallback;
731
+ options = {};
732
+ }
733
+ else {
734
+ options = optionsOrCallback;
735
+ }
736
+ options = options || {};
737
+ options.otherArgs = options.otherArgs || {};
738
+ options.otherArgs.headers = options.otherArgs.headers || {};
739
+ options.otherArgs.headers['x-goog-request-params'] =
740
+ this._gaxModule.routingHeader.fromParams({
741
+ 'database.name': (_a = request.database.name) !== null && _a !== void 0 ? _a : '',
742
+ });
743
+ this.initialize();
744
+ return this.innerApiCalls.updateDatabase(request, options, callback);
745
+ }
746
+ /**
747
+ * Check the status of the long running operation returned by `updateDatabase()`.
748
+ * @param {String} name
749
+ * The operation name that will be passed.
750
+ * @returns {Promise} - The promise which resolves to an object.
751
+ * The decoded operation object has result and metadata field to get information from.
752
+ * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation }
753
+ * for more details and examples.
754
+ */
755
+ async checkUpdateDatabaseProgress(name) {
756
+ const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({ name });
757
+ const [operation] = await this.operationsClient.getOperation(request);
758
+ const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateDatabase, this._gaxModule.createDefaultBackoffSettings());
759
+ return decodeOperation;
760
+ }
761
+ updateDatabaseDdl(request, optionsOrCallback, callback) {
762
+ var _a;
763
+ request = request || {};
764
+ let options;
765
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
766
+ callback = optionsOrCallback;
767
+ options = {};
768
+ }
769
+ else {
770
+ options = optionsOrCallback;
771
+ }
772
+ options = options || {};
773
+ options.otherArgs = options.otherArgs || {};
774
+ options.otherArgs.headers = options.otherArgs.headers || {};
775
+ options.otherArgs.headers['x-goog-request-params'] =
776
+ this._gaxModule.routingHeader.fromParams({
777
+ database: (_a = request.database) !== null && _a !== void 0 ? _a : '',
778
+ });
779
+ this.initialize();
780
+ return this.innerApiCalls.updateDatabaseDdl(request, options, callback);
781
+ }
782
+ /**
783
+ * Check the status of the long running operation returned by `updateDatabaseDdl()`.
784
+ * @param {String} name
785
+ * The operation name that will be passed.
786
+ * @returns {Promise} - The promise which resolves to an object.
787
+ * The decoded operation object has result and metadata field to get information from.
788
+ * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation }
789
+ * for more details and examples.
790
+ */
791
+ async checkUpdateDatabaseDdlProgress(name) {
792
+ const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({ name });
793
+ const [operation] = await this.operationsClient.getOperation(request);
794
+ const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateDatabaseDdl, this._gaxModule.createDefaultBackoffSettings());
795
+ return decodeOperation;
796
+ }
797
+ createBackup(request, optionsOrCallback, callback) {
798
+ var _a;
799
+ request = request || {};
800
+ let options;
801
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
802
+ callback = optionsOrCallback;
803
+ options = {};
804
+ }
805
+ else {
806
+ options = optionsOrCallback;
807
+ }
808
+ options = options || {};
809
+ options.otherArgs = options.otherArgs || {};
810
+ options.otherArgs.headers = options.otherArgs.headers || {};
811
+ options.otherArgs.headers['x-goog-request-params'] =
812
+ this._gaxModule.routingHeader.fromParams({
813
+ parent: (_a = request.parent) !== null && _a !== void 0 ? _a : '',
814
+ });
815
+ this.initialize();
816
+ return this.innerApiCalls.createBackup(request, options, callback);
817
+ }
818
+ /**
819
+ * Check the status of the long running operation returned by `createBackup()`.
820
+ * @param {String} name
821
+ * The operation name that will be passed.
822
+ * @returns {Promise} - The promise which resolves to an object.
823
+ * The decoded operation object has result and metadata field to get information from.
824
+ * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation }
825
+ * for more details and examples.
826
+ */
827
+ async checkCreateBackupProgress(name) {
828
+ const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({ name });
829
+ const [operation] = await this.operationsClient.getOperation(request);
830
+ const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createBackup, this._gaxModule.createDefaultBackoffSettings());
831
+ return decodeOperation;
832
+ }
833
+ copyBackup(request, optionsOrCallback, callback) {
834
+ var _a;
835
+ request = request || {};
836
+ let options;
837
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
838
+ callback = optionsOrCallback;
839
+ options = {};
840
+ }
841
+ else {
842
+ options = optionsOrCallback;
843
+ }
844
+ options = options || {};
845
+ options.otherArgs = options.otherArgs || {};
846
+ options.otherArgs.headers = options.otherArgs.headers || {};
847
+ options.otherArgs.headers['x-goog-request-params'] =
848
+ this._gaxModule.routingHeader.fromParams({
849
+ parent: (_a = request.parent) !== null && _a !== void 0 ? _a : '',
850
+ });
851
+ this.initialize();
852
+ return this.innerApiCalls.copyBackup(request, options, callback);
853
+ }
854
+ /**
855
+ * Check the status of the long running operation returned by `copyBackup()`.
856
+ * @param {String} name
857
+ * The operation name that will be passed.
858
+ * @returns {Promise} - The promise which resolves to an object.
859
+ * The decoded operation object has result and metadata field to get information from.
860
+ * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation }
861
+ * for more details and examples.
862
+ */
863
+ async checkCopyBackupProgress(name) {
864
+ const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({ name });
865
+ const [operation] = await this.operationsClient.getOperation(request);
866
+ const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.copyBackup, this._gaxModule.createDefaultBackoffSettings());
867
+ return decodeOperation;
868
+ }
869
+ restoreDatabase(request, optionsOrCallback, callback) {
870
+ var _a;
871
+ request = request || {};
872
+ let options;
873
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
874
+ callback = optionsOrCallback;
875
+ options = {};
876
+ }
877
+ else {
878
+ options = optionsOrCallback;
879
+ }
880
+ options = options || {};
881
+ options.otherArgs = options.otherArgs || {};
882
+ options.otherArgs.headers = options.otherArgs.headers || {};
883
+ options.otherArgs.headers['x-goog-request-params'] =
884
+ this._gaxModule.routingHeader.fromParams({
885
+ parent: (_a = request.parent) !== null && _a !== void 0 ? _a : '',
886
+ });
887
+ this.initialize();
888
+ return this.innerApiCalls.restoreDatabase(request, options, callback);
889
+ }
890
+ /**
891
+ * Check the status of the long running operation returned by `restoreDatabase()`.
892
+ * @param {String} name
893
+ * The operation name that will be passed.
894
+ * @returns {Promise} - The promise which resolves to an object.
895
+ * The decoded operation object has result and metadata field to get information from.
896
+ * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation }
897
+ * for more details and examples.
898
+ */
899
+ async checkRestoreDatabaseProgress(name) {
900
+ const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({ name });
901
+ const [operation] = await this.operationsClient.getOperation(request);
902
+ const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.restoreDatabase, this._gaxModule.createDefaultBackoffSettings());
903
+ return decodeOperation;
904
+ }
905
+ listDatabases(request, optionsOrCallback, callback) {
906
+ var _a;
907
+ request = request || {};
908
+ let options;
909
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
910
+ callback = optionsOrCallback;
911
+ options = {};
912
+ }
913
+ else {
914
+ options = optionsOrCallback;
915
+ }
916
+ options = options || {};
917
+ options.otherArgs = options.otherArgs || {};
918
+ options.otherArgs.headers = options.otherArgs.headers || {};
919
+ options.otherArgs.headers['x-goog-request-params'] =
920
+ this._gaxModule.routingHeader.fromParams({
921
+ parent: (_a = request.parent) !== null && _a !== void 0 ? _a : '',
922
+ });
923
+ this.initialize();
924
+ return this.innerApiCalls.listDatabases(request, options, callback);
925
+ }
926
+ /**
927
+ * Equivalent to `listDatabases`, but returns a NodeJS Stream object.
928
+ * @param {Object} request
929
+ * The request object that will be sent.
930
+ * @param {string} request.parent
931
+ * Required. The instance whose databases should be listed.
932
+ * Values are of the form `projects/<project>/instances/<instance>`.
933
+ * @param {number} request.pageSize
934
+ * Number of databases to be returned in the response. If 0 or less,
935
+ * defaults to the server's maximum allowed page size.
936
+ * @param {string} request.pageToken
937
+ * If non-empty, `page_token` should contain a
938
+ * {@link protos.google.spanner.admin.database.v1.ListDatabasesResponse.next_page_token|next_page_token}
939
+ * from a previous
940
+ * {@link protos.google.spanner.admin.database.v1.ListDatabasesResponse|ListDatabasesResponse}.
941
+ * @param {object} [options]
942
+ * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
943
+ * @returns {Stream}
944
+ * An object stream which emits an object representing {@link protos.google.spanner.admin.database.v1.Database|Database} on 'data' event.
945
+ * The client library will perform auto-pagination by default: it will call the API as many
946
+ * times as needed. Note that it can affect your quota.
947
+ * We recommend using `listDatabasesAsync()`
948
+ * method described below for async iteration which you can stop as needed.
949
+ * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation }
950
+ * for more details and examples.
951
+ */
952
+ listDatabasesStream(request, options) {
953
+ var _a;
954
+ request = request || {};
955
+ options = options || {};
956
+ options.otherArgs = options.otherArgs || {};
957
+ options.otherArgs.headers = options.otherArgs.headers || {};
958
+ options.otherArgs.headers['x-goog-request-params'] =
959
+ this._gaxModule.routingHeader.fromParams({
960
+ parent: (_a = request.parent) !== null && _a !== void 0 ? _a : '',
961
+ });
962
+ const defaultCallSettings = this._defaults['listDatabases'];
963
+ const callSettings = defaultCallSettings.merge(options);
964
+ this.initialize();
965
+ return this.descriptors.page.listDatabases.createStream(this.innerApiCalls.listDatabases, request, callSettings);
966
+ }
967
+ /**
968
+ * Equivalent to `listDatabases`, but returns an iterable object.
969
+ *
970
+ * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand.
971
+ * @param {Object} request
972
+ * The request object that will be sent.
973
+ * @param {string} request.parent
974
+ * Required. The instance whose databases should be listed.
975
+ * Values are of the form `projects/<project>/instances/<instance>`.
976
+ * @param {number} request.pageSize
977
+ * Number of databases to be returned in the response. If 0 or less,
978
+ * defaults to the server's maximum allowed page size.
979
+ * @param {string} request.pageToken
980
+ * If non-empty, `page_token` should contain a
981
+ * {@link protos.google.spanner.admin.database.v1.ListDatabasesResponse.next_page_token|next_page_token}
982
+ * from a previous
983
+ * {@link protos.google.spanner.admin.database.v1.ListDatabasesResponse|ListDatabasesResponse}.
984
+ * @param {object} [options]
985
+ * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
986
+ * @returns {Object}
987
+ * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }.
988
+ * When you iterate the returned iterable, each element will be an object representing
989
+ * {@link protos.google.spanner.admin.database.v1.Database|Database}. The API will be called under the hood as needed, once per the page,
990
+ * so you can stop the iteration when you don't need more results.
991
+ * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation }
992
+ * for more details and examples.
993
+ */
994
+ listDatabasesAsync(request, options) {
995
+ var _a;
996
+ request = request || {};
997
+ options = options || {};
998
+ options.otherArgs = options.otherArgs || {};
999
+ options.otherArgs.headers = options.otherArgs.headers || {};
1000
+ options.otherArgs.headers['x-goog-request-params'] =
1001
+ this._gaxModule.routingHeader.fromParams({
1002
+ parent: (_a = request.parent) !== null && _a !== void 0 ? _a : '',
1003
+ });
1004
+ const defaultCallSettings = this._defaults['listDatabases'];
1005
+ const callSettings = defaultCallSettings.merge(options);
1006
+ this.initialize();
1007
+ return this.descriptors.page.listDatabases.asyncIterate(this.innerApiCalls['listDatabases'], request, callSettings);
1008
+ }
1009
+ listBackups(request, optionsOrCallback, callback) {
1010
+ var _a;
1011
+ request = request || {};
1012
+ let options;
1013
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
1014
+ callback = optionsOrCallback;
1015
+ options = {};
1016
+ }
1017
+ else {
1018
+ options = optionsOrCallback;
1019
+ }
1020
+ options = options || {};
1021
+ options.otherArgs = options.otherArgs || {};
1022
+ options.otherArgs.headers = options.otherArgs.headers || {};
1023
+ options.otherArgs.headers['x-goog-request-params'] =
1024
+ this._gaxModule.routingHeader.fromParams({
1025
+ parent: (_a = request.parent) !== null && _a !== void 0 ? _a : '',
1026
+ });
1027
+ this.initialize();
1028
+ return this.innerApiCalls.listBackups(request, options, callback);
1029
+ }
1030
+ /**
1031
+ * Equivalent to `listBackups`, but returns a NodeJS Stream object.
1032
+ * @param {Object} request
1033
+ * The request object that will be sent.
1034
+ * @param {string} request.parent
1035
+ * Required. The instance to list backups from. Values are of the
1036
+ * form `projects/<project>/instances/<instance>`.
1037
+ * @param {string} request.filter
1038
+ * An expression that filters the list of returned backups.
1039
+ *
1040
+ * A filter expression consists of a field name, a comparison operator, and a
1041
+ * value for filtering.
1042
+ * The value must be a string, a number, or a boolean. The comparison operator
1043
+ * must be one of: `<`, `>`, `<=`, `>=`, `!=`, `=`, or `:`.
1044
+ * Colon `:` is the contains operator. Filter rules are not case sensitive.
1045
+ *
1046
+ * The following fields in the
1047
+ * {@link protos.google.spanner.admin.database.v1.Backup|Backup} are eligible for
1048
+ * filtering:
1049
+ *
1050
+ * * `name`
1051
+ * * `database`
1052
+ * * `state`
1053
+ * * `create_time` (and values are of the format YYYY-MM-DDTHH:MM:SSZ)
1054
+ * * `expire_time` (and values are of the format YYYY-MM-DDTHH:MM:SSZ)
1055
+ * * `version_time` (and values are of the format YYYY-MM-DDTHH:MM:SSZ)
1056
+ * * `size_bytes`
1057
+ * * `backup_schedules`
1058
+ *
1059
+ * You can combine multiple expressions by enclosing each expression in
1060
+ * parentheses. By default, expressions are combined with AND logic, but
1061
+ * you can specify AND, OR, and NOT logic explicitly.
1062
+ *
1063
+ * Here are a few examples:
1064
+ *
1065
+ * * `name:Howl` - The backup's name contains the string "howl".
1066
+ * * `database:prod`
1067
+ * - The database's name contains the string "prod".
1068
+ * * `state:CREATING` - The backup is pending creation.
1069
+ * * `state:READY` - The backup is fully created and ready for use.
1070
+ * * `(name:howl) AND (create_time < \"2018-03-28T14:50:00Z\")`
1071
+ * - The backup name contains the string "howl" and `create_time`
1072
+ * of the backup is before 2018-03-28T14:50:00Z.
1073
+ * * `expire_time < \"2018-03-28T14:50:00Z\"`
1074
+ * - The backup `expire_time` is before 2018-03-28T14:50:00Z.
1075
+ * * `size_bytes > 10000000000` - The backup's size is greater than 10GB
1076
+ * * `backup_schedules:daily`
1077
+ * - The backup is created from a schedule with "daily" in its name.
1078
+ * @param {number} request.pageSize
1079
+ * Number of backups to be returned in the response. If 0 or
1080
+ * less, defaults to the server's maximum allowed page size.
1081
+ * @param {string} request.pageToken
1082
+ * If non-empty, `page_token` should contain a
1083
+ * {@link protos.google.spanner.admin.database.v1.ListBackupsResponse.next_page_token|next_page_token}
1084
+ * from a previous
1085
+ * {@link protos.google.spanner.admin.database.v1.ListBackupsResponse|ListBackupsResponse}
1086
+ * to the same `parent` and with the same `filter`.
1087
+ * @param {object} [options]
1088
+ * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
1089
+ * @returns {Stream}
1090
+ * An object stream which emits an object representing {@link protos.google.spanner.admin.database.v1.Backup|Backup} on 'data' event.
1091
+ * The client library will perform auto-pagination by default: it will call the API as many
1092
+ * times as needed. Note that it can affect your quota.
1093
+ * We recommend using `listBackupsAsync()`
1094
+ * method described below for async iteration which you can stop as needed.
1095
+ * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation }
1096
+ * for more details and examples.
1097
+ */
1098
+ listBackupsStream(request, options) {
1099
+ var _a;
1100
+ request = request || {};
1101
+ options = options || {};
1102
+ options.otherArgs = options.otherArgs || {};
1103
+ options.otherArgs.headers = options.otherArgs.headers || {};
1104
+ options.otherArgs.headers['x-goog-request-params'] =
1105
+ this._gaxModule.routingHeader.fromParams({
1106
+ parent: (_a = request.parent) !== null && _a !== void 0 ? _a : '',
1107
+ });
1108
+ const defaultCallSettings = this._defaults['listBackups'];
1109
+ const callSettings = defaultCallSettings.merge(options);
1110
+ this.initialize();
1111
+ return this.descriptors.page.listBackups.createStream(this.innerApiCalls.listBackups, request, callSettings);
1112
+ }
1113
+ /**
1114
+ * Equivalent to `listBackups`, but returns an iterable object.
1115
+ *
1116
+ * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand.
1117
+ * @param {Object} request
1118
+ * The request object that will be sent.
1119
+ * @param {string} request.parent
1120
+ * Required. The instance to list backups from. Values are of the
1121
+ * form `projects/<project>/instances/<instance>`.
1122
+ * @param {string} request.filter
1123
+ * An expression that filters the list of returned backups.
1124
+ *
1125
+ * A filter expression consists of a field name, a comparison operator, and a
1126
+ * value for filtering.
1127
+ * The value must be a string, a number, or a boolean. The comparison operator
1128
+ * must be one of: `<`, `>`, `<=`, `>=`, `!=`, `=`, or `:`.
1129
+ * Colon `:` is the contains operator. Filter rules are not case sensitive.
1130
+ *
1131
+ * The following fields in the
1132
+ * {@link protos.google.spanner.admin.database.v1.Backup|Backup} are eligible for
1133
+ * filtering:
1134
+ *
1135
+ * * `name`
1136
+ * * `database`
1137
+ * * `state`
1138
+ * * `create_time` (and values are of the format YYYY-MM-DDTHH:MM:SSZ)
1139
+ * * `expire_time` (and values are of the format YYYY-MM-DDTHH:MM:SSZ)
1140
+ * * `version_time` (and values are of the format YYYY-MM-DDTHH:MM:SSZ)
1141
+ * * `size_bytes`
1142
+ * * `backup_schedules`
1143
+ *
1144
+ * You can combine multiple expressions by enclosing each expression in
1145
+ * parentheses. By default, expressions are combined with AND logic, but
1146
+ * you can specify AND, OR, and NOT logic explicitly.
1147
+ *
1148
+ * Here are a few examples:
1149
+ *
1150
+ * * `name:Howl` - The backup's name contains the string "howl".
1151
+ * * `database:prod`
1152
+ * - The database's name contains the string "prod".
1153
+ * * `state:CREATING` - The backup is pending creation.
1154
+ * * `state:READY` - The backup is fully created and ready for use.
1155
+ * * `(name:howl) AND (create_time < \"2018-03-28T14:50:00Z\")`
1156
+ * - The backup name contains the string "howl" and `create_time`
1157
+ * of the backup is before 2018-03-28T14:50:00Z.
1158
+ * * `expire_time < \"2018-03-28T14:50:00Z\"`
1159
+ * - The backup `expire_time` is before 2018-03-28T14:50:00Z.
1160
+ * * `size_bytes > 10000000000` - The backup's size is greater than 10GB
1161
+ * * `backup_schedules:daily`
1162
+ * - The backup is created from a schedule with "daily" in its name.
1163
+ * @param {number} request.pageSize
1164
+ * Number of backups to be returned in the response. If 0 or
1165
+ * less, defaults to the server's maximum allowed page size.
1166
+ * @param {string} request.pageToken
1167
+ * If non-empty, `page_token` should contain a
1168
+ * {@link protos.google.spanner.admin.database.v1.ListBackupsResponse.next_page_token|next_page_token}
1169
+ * from a previous
1170
+ * {@link protos.google.spanner.admin.database.v1.ListBackupsResponse|ListBackupsResponse}
1171
+ * to the same `parent` and with the same `filter`.
1172
+ * @param {object} [options]
1173
+ * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
1174
+ * @returns {Object}
1175
+ * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }.
1176
+ * When you iterate the returned iterable, each element will be an object representing
1177
+ * {@link protos.google.spanner.admin.database.v1.Backup|Backup}. The API will be called under the hood as needed, once per the page,
1178
+ * so you can stop the iteration when you don't need more results.
1179
+ * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation }
1180
+ * for more details and examples.
1181
+ */
1182
+ listBackupsAsync(request, options) {
1183
+ var _a;
1184
+ request = request || {};
1185
+ options = options || {};
1186
+ options.otherArgs = options.otherArgs || {};
1187
+ options.otherArgs.headers = options.otherArgs.headers || {};
1188
+ options.otherArgs.headers['x-goog-request-params'] =
1189
+ this._gaxModule.routingHeader.fromParams({
1190
+ parent: (_a = request.parent) !== null && _a !== void 0 ? _a : '',
1191
+ });
1192
+ const defaultCallSettings = this._defaults['listBackups'];
1193
+ const callSettings = defaultCallSettings.merge(options);
1194
+ this.initialize();
1195
+ return this.descriptors.page.listBackups.asyncIterate(this.innerApiCalls['listBackups'], request, callSettings);
1196
+ }
1197
+ listDatabaseOperations(request, optionsOrCallback, callback) {
1198
+ var _a;
1199
+ request = request || {};
1200
+ let options;
1201
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
1202
+ callback = optionsOrCallback;
1203
+ options = {};
1204
+ }
1205
+ else {
1206
+ options = optionsOrCallback;
1207
+ }
1208
+ options = options || {};
1209
+ options.otherArgs = options.otherArgs || {};
1210
+ options.otherArgs.headers = options.otherArgs.headers || {};
1211
+ options.otherArgs.headers['x-goog-request-params'] =
1212
+ this._gaxModule.routingHeader.fromParams({
1213
+ parent: (_a = request.parent) !== null && _a !== void 0 ? _a : '',
1214
+ });
1215
+ this.initialize();
1216
+ return this.innerApiCalls.listDatabaseOperations(request, options, callback);
1217
+ }
1218
+ /**
1219
+ * Equivalent to `listDatabaseOperations`, but returns a NodeJS Stream object.
1220
+ * @param {Object} request
1221
+ * The request object that will be sent.
1222
+ * @param {string} request.parent
1223
+ * Required. The instance of the database operations.
1224
+ * Values are of the form `projects/<project>/instances/<instance>`.
1225
+ * @param {string} request.filter
1226
+ * An expression that filters the list of returned operations.
1227
+ *
1228
+ * A filter expression consists of a field name, a
1229
+ * comparison operator, and a value for filtering.
1230
+ * The value must be a string, a number, or a boolean. The comparison operator
1231
+ * must be one of: `<`, `>`, `<=`, `>=`, `!=`, `=`, or `:`.
1232
+ * Colon `:` is the contains operator. Filter rules are not case sensitive.
1233
+ *
1234
+ * The following fields in the {@link protos.google.longrunning.Operation|Operation}
1235
+ * are eligible for filtering:
1236
+ *
1237
+ * * `name` - The name of the long-running operation
1238
+ * * `done` - False if the operation is in progress, else true.
1239
+ * * `metadata.@type` - the type of metadata. For example, the type string
1240
+ * for
1241
+ * {@link protos.google.spanner.admin.database.v1.RestoreDatabaseMetadata|RestoreDatabaseMetadata}
1242
+ * is
1243
+ * `type.googleapis.com/google.spanner.admin.database.v1.RestoreDatabaseMetadata`.
1244
+ * * `metadata.<field_name>` - any field in metadata.value.
1245
+ * `metadata.@type` must be specified first, if filtering on metadata
1246
+ * fields.
1247
+ * * `error` - Error associated with the long-running operation.
1248
+ * * `response.@type` - the type of response.
1249
+ * * `response.<field_name>` - any field in response.value.
1250
+ *
1251
+ * You can combine multiple expressions by enclosing each expression in
1252
+ * parentheses. By default, expressions are combined with AND logic. However,
1253
+ * you can specify AND, OR, and NOT logic explicitly.
1254
+ *
1255
+ * Here are a few examples:
1256
+ *
1257
+ * * `done:true` - The operation is complete.
1258
+ * * `(metadata.@type=type.googleapis.com/google.spanner.admin.database.v1.RestoreDatabaseMetadata) AND` \
1259
+ * `(metadata.source_type:BACKUP) AND` \
1260
+ * `(metadata.backup_info.backup:backup_howl) AND` \
1261
+ * `(metadata.name:restored_howl) AND` \
1262
+ * `(metadata.progress.start_time < \"2018-03-28T14:50:00Z\") AND` \
1263
+ * `(error:*)` - Return operations where:
1264
+ * * The operation's metadata type is
1265
+ * {@link protos.google.spanner.admin.database.v1.RestoreDatabaseMetadata|RestoreDatabaseMetadata}.
1266
+ * * The database is restored from a backup.
1267
+ * * The backup name contains "backup_howl".
1268
+ * * The restored database's name contains "restored_howl".
1269
+ * * The operation started before 2018-03-28T14:50:00Z.
1270
+ * * The operation resulted in an error.
1271
+ * @param {number} request.pageSize
1272
+ * Number of operations to be returned in the response. If 0 or
1273
+ * less, defaults to the server's maximum allowed page size.
1274
+ * @param {string} request.pageToken
1275
+ * If non-empty, `page_token` should contain a
1276
+ * {@link protos.google.spanner.admin.database.v1.ListDatabaseOperationsResponse.next_page_token|next_page_token}
1277
+ * from a previous
1278
+ * {@link protos.google.spanner.admin.database.v1.ListDatabaseOperationsResponse|ListDatabaseOperationsResponse}
1279
+ * to the same `parent` and with the same `filter`.
1280
+ * @param {object} [options]
1281
+ * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
1282
+ * @returns {Stream}
1283
+ * An object stream which emits an object representing {@link protos.google.longrunning.Operation|Operation} on 'data' event.
1284
+ * The client library will perform auto-pagination by default: it will call the API as many
1285
+ * times as needed. Note that it can affect your quota.
1286
+ * We recommend using `listDatabaseOperationsAsync()`
1287
+ * method described below for async iteration which you can stop as needed.
1288
+ * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation }
1289
+ * for more details and examples.
1290
+ */
1291
+ listDatabaseOperationsStream(request, options) {
1292
+ var _a;
1293
+ request = request || {};
1294
+ options = options || {};
1295
+ options.otherArgs = options.otherArgs || {};
1296
+ options.otherArgs.headers = options.otherArgs.headers || {};
1297
+ options.otherArgs.headers['x-goog-request-params'] =
1298
+ this._gaxModule.routingHeader.fromParams({
1299
+ parent: (_a = request.parent) !== null && _a !== void 0 ? _a : '',
1300
+ });
1301
+ const defaultCallSettings = this._defaults['listDatabaseOperations'];
1302
+ const callSettings = defaultCallSettings.merge(options);
1303
+ this.initialize();
1304
+ return this.descriptors.page.listDatabaseOperations.createStream(this.innerApiCalls.listDatabaseOperations, request, callSettings);
1305
+ }
1306
+ /**
1307
+ * Equivalent to `listDatabaseOperations`, but returns an iterable object.
1308
+ *
1309
+ * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand.
1310
+ * @param {Object} request
1311
+ * The request object that will be sent.
1312
+ * @param {string} request.parent
1313
+ * Required. The instance of the database operations.
1314
+ * Values are of the form `projects/<project>/instances/<instance>`.
1315
+ * @param {string} request.filter
1316
+ * An expression that filters the list of returned operations.
1317
+ *
1318
+ * A filter expression consists of a field name, a
1319
+ * comparison operator, and a value for filtering.
1320
+ * The value must be a string, a number, or a boolean. The comparison operator
1321
+ * must be one of: `<`, `>`, `<=`, `>=`, `!=`, `=`, or `:`.
1322
+ * Colon `:` is the contains operator. Filter rules are not case sensitive.
1323
+ *
1324
+ * The following fields in the {@link protos.google.longrunning.Operation|Operation}
1325
+ * are eligible for filtering:
1326
+ *
1327
+ * * `name` - The name of the long-running operation
1328
+ * * `done` - False if the operation is in progress, else true.
1329
+ * * `metadata.@type` - the type of metadata. For example, the type string
1330
+ * for
1331
+ * {@link protos.google.spanner.admin.database.v1.RestoreDatabaseMetadata|RestoreDatabaseMetadata}
1332
+ * is
1333
+ * `type.googleapis.com/google.spanner.admin.database.v1.RestoreDatabaseMetadata`.
1334
+ * * `metadata.<field_name>` - any field in metadata.value.
1335
+ * `metadata.@type` must be specified first, if filtering on metadata
1336
+ * fields.
1337
+ * * `error` - Error associated with the long-running operation.
1338
+ * * `response.@type` - the type of response.
1339
+ * * `response.<field_name>` - any field in response.value.
1340
+ *
1341
+ * You can combine multiple expressions by enclosing each expression in
1342
+ * parentheses. By default, expressions are combined with AND logic. However,
1343
+ * you can specify AND, OR, and NOT logic explicitly.
1344
+ *
1345
+ * Here are a few examples:
1346
+ *
1347
+ * * `done:true` - The operation is complete.
1348
+ * * `(metadata.@type=type.googleapis.com/google.spanner.admin.database.v1.RestoreDatabaseMetadata) AND` \
1349
+ * `(metadata.source_type:BACKUP) AND` \
1350
+ * `(metadata.backup_info.backup:backup_howl) AND` \
1351
+ * `(metadata.name:restored_howl) AND` \
1352
+ * `(metadata.progress.start_time < \"2018-03-28T14:50:00Z\") AND` \
1353
+ * `(error:*)` - Return operations where:
1354
+ * * The operation's metadata type is
1355
+ * {@link protos.google.spanner.admin.database.v1.RestoreDatabaseMetadata|RestoreDatabaseMetadata}.
1356
+ * * The database is restored from a backup.
1357
+ * * The backup name contains "backup_howl".
1358
+ * * The restored database's name contains "restored_howl".
1359
+ * * The operation started before 2018-03-28T14:50:00Z.
1360
+ * * The operation resulted in an error.
1361
+ * @param {number} request.pageSize
1362
+ * Number of operations to be returned in the response. If 0 or
1363
+ * less, defaults to the server's maximum allowed page size.
1364
+ * @param {string} request.pageToken
1365
+ * If non-empty, `page_token` should contain a
1366
+ * {@link protos.google.spanner.admin.database.v1.ListDatabaseOperationsResponse.next_page_token|next_page_token}
1367
+ * from a previous
1368
+ * {@link protos.google.spanner.admin.database.v1.ListDatabaseOperationsResponse|ListDatabaseOperationsResponse}
1369
+ * to the same `parent` and with the same `filter`.
1370
+ * @param {object} [options]
1371
+ * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
1372
+ * @returns {Object}
1373
+ * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }.
1374
+ * When you iterate the returned iterable, each element will be an object representing
1375
+ * {@link protos.google.longrunning.Operation|Operation}. The API will be called under the hood as needed, once per the page,
1376
+ * so you can stop the iteration when you don't need more results.
1377
+ * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation }
1378
+ * for more details and examples.
1379
+ */
1380
+ listDatabaseOperationsAsync(request, options) {
1381
+ var _a;
1382
+ request = request || {};
1383
+ options = options || {};
1384
+ options.otherArgs = options.otherArgs || {};
1385
+ options.otherArgs.headers = options.otherArgs.headers || {};
1386
+ options.otherArgs.headers['x-goog-request-params'] =
1387
+ this._gaxModule.routingHeader.fromParams({
1388
+ parent: (_a = request.parent) !== null && _a !== void 0 ? _a : '',
1389
+ });
1390
+ const defaultCallSettings = this._defaults['listDatabaseOperations'];
1391
+ const callSettings = defaultCallSettings.merge(options);
1392
+ this.initialize();
1393
+ return this.descriptors.page.listDatabaseOperations.asyncIterate(this.innerApiCalls['listDatabaseOperations'], request, callSettings);
1394
+ }
1395
+ listBackupOperations(request, optionsOrCallback, callback) {
1396
+ var _a;
1397
+ request = request || {};
1398
+ let options;
1399
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
1400
+ callback = optionsOrCallback;
1401
+ options = {};
1402
+ }
1403
+ else {
1404
+ options = optionsOrCallback;
1405
+ }
1406
+ options = options || {};
1407
+ options.otherArgs = options.otherArgs || {};
1408
+ options.otherArgs.headers = options.otherArgs.headers || {};
1409
+ options.otherArgs.headers['x-goog-request-params'] =
1410
+ this._gaxModule.routingHeader.fromParams({
1411
+ parent: (_a = request.parent) !== null && _a !== void 0 ? _a : '',
1412
+ });
1413
+ this.initialize();
1414
+ return this.innerApiCalls.listBackupOperations(request, options, callback);
1415
+ }
1416
+ /**
1417
+ * Equivalent to `listBackupOperations`, but returns a NodeJS Stream object.
1418
+ * @param {Object} request
1419
+ * The request object that will be sent.
1420
+ * @param {string} request.parent
1421
+ * Required. The instance of the backup operations. Values are of
1422
+ * the form `projects/<project>/instances/<instance>`.
1423
+ * @param {string} request.filter
1424
+ * An expression that filters the list of returned backup operations.
1425
+ *
1426
+ * A filter expression consists of a field name, a
1427
+ * comparison operator, and a value for filtering.
1428
+ * The value must be a string, a number, or a boolean. The comparison operator
1429
+ * must be one of: `<`, `>`, `<=`, `>=`, `!=`, `=`, or `:`.
1430
+ * Colon `:` is the contains operator. Filter rules are not case sensitive.
1431
+ *
1432
+ * The following fields in the {@link protos.google.longrunning.Operation|operation}
1433
+ * are eligible for filtering:
1434
+ *
1435
+ * * `name` - The name of the long-running operation
1436
+ * * `done` - False if the operation is in progress, else true.
1437
+ * * `metadata.@type` - the type of metadata. For example, the type string
1438
+ * for
1439
+ * {@link protos.google.spanner.admin.database.v1.CreateBackupMetadata|CreateBackupMetadata}
1440
+ * is
1441
+ * `type.googleapis.com/google.spanner.admin.database.v1.CreateBackupMetadata`.
1442
+ * * `metadata.<field_name>` - any field in metadata.value.
1443
+ * `metadata.@type` must be specified first if filtering on metadata
1444
+ * fields.
1445
+ * * `error` - Error associated with the long-running operation.
1446
+ * * `response.@type` - the type of response.
1447
+ * * `response.<field_name>` - any field in response.value.
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
+ * * `done:true` - The operation is complete.
1456
+ * * `(metadata.@type=type.googleapis.com/google.spanner.admin.database.v1.CreateBackupMetadata) AND` \
1457
+ * `metadata.database:prod` - Returns operations where:
1458
+ * * The operation's metadata type is
1459
+ * {@link protos.google.spanner.admin.database.v1.CreateBackupMetadata|CreateBackupMetadata}.
1460
+ * * The source database name of backup contains the string "prod".
1461
+ * * `(metadata.@type=type.googleapis.com/google.spanner.admin.database.v1.CreateBackupMetadata) AND` \
1462
+ * `(metadata.name:howl) AND` \
1463
+ * `(metadata.progress.start_time < \"2018-03-28T14:50:00Z\") AND` \
1464
+ * `(error:*)` - Returns operations where:
1465
+ * * The operation's metadata type is
1466
+ * {@link protos.google.spanner.admin.database.v1.CreateBackupMetadata|CreateBackupMetadata}.
1467
+ * * The backup name contains the string "howl".
1468
+ * * The operation started before 2018-03-28T14:50:00Z.
1469
+ * * The operation resulted in an error.
1470
+ * * `(metadata.@type=type.googleapis.com/google.spanner.admin.database.v1.CopyBackupMetadata) AND` \
1471
+ * `(metadata.source_backup:test) AND` \
1472
+ * `(metadata.progress.start_time < \"2022-01-18T14:50:00Z\") AND` \
1473
+ * `(error:*)` - Returns operations where:
1474
+ * * The operation's metadata type is
1475
+ * {@link protos.google.spanner.admin.database.v1.CopyBackupMetadata|CopyBackupMetadata}.
1476
+ * * The source backup name contains the string "test".
1477
+ * * The operation started before 2022-01-18T14:50:00Z.
1478
+ * * The operation resulted in an error.
1479
+ * * `((metadata.@type=type.googleapis.com/google.spanner.admin.database.v1.CreateBackupMetadata) AND` \
1480
+ * `(metadata.database:test_db)) OR` \
1481
+ * `((metadata.@type=type.googleapis.com/google.spanner.admin.database.v1.CopyBackupMetadata)
1482
+ * AND` \
1483
+ * `(metadata.source_backup:test_bkp)) AND` \
1484
+ * `(error:*)` - Returns operations where:
1485
+ * * The operation's metadata matches either of criteria:
1486
+ * * The operation's metadata type is
1487
+ * {@link protos.google.spanner.admin.database.v1.CreateBackupMetadata|CreateBackupMetadata}
1488
+ * AND the source database name of the backup contains the string
1489
+ * "test_db"
1490
+ * * The operation's metadata type is
1491
+ * {@link protos.google.spanner.admin.database.v1.CopyBackupMetadata|CopyBackupMetadata}
1492
+ * AND the source backup name contains the string "test_bkp"
1493
+ * * The operation resulted in an error.
1494
+ * @param {number} request.pageSize
1495
+ * Number of operations to be returned in the response. If 0 or
1496
+ * less, defaults to the server's maximum allowed page size.
1497
+ * @param {string} request.pageToken
1498
+ * If non-empty, `page_token` should contain a
1499
+ * {@link protos.google.spanner.admin.database.v1.ListBackupOperationsResponse.next_page_token|next_page_token}
1500
+ * from a previous
1501
+ * {@link protos.google.spanner.admin.database.v1.ListBackupOperationsResponse|ListBackupOperationsResponse}
1502
+ * to the same `parent` and with the same `filter`.
1503
+ * @param {object} [options]
1504
+ * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
1505
+ * @returns {Stream}
1506
+ * An object stream which emits an object representing {@link protos.google.longrunning.Operation|Operation} on 'data' event.
1507
+ * The client library will perform auto-pagination by default: it will call the API as many
1508
+ * times as needed. Note that it can affect your quota.
1509
+ * We recommend using `listBackupOperationsAsync()`
1510
+ * method described below for async iteration which you can stop as needed.
1511
+ * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation }
1512
+ * for more details and examples.
1513
+ */
1514
+ listBackupOperationsStream(request, options) {
1515
+ var _a;
1516
+ request = request || {};
1517
+ options = options || {};
1518
+ options.otherArgs = options.otherArgs || {};
1519
+ options.otherArgs.headers = options.otherArgs.headers || {};
1520
+ options.otherArgs.headers['x-goog-request-params'] =
1521
+ this._gaxModule.routingHeader.fromParams({
1522
+ parent: (_a = request.parent) !== null && _a !== void 0 ? _a : '',
1523
+ });
1524
+ const defaultCallSettings = this._defaults['listBackupOperations'];
1525
+ const callSettings = defaultCallSettings.merge(options);
1526
+ this.initialize();
1527
+ return this.descriptors.page.listBackupOperations.createStream(this.innerApiCalls.listBackupOperations, request, callSettings);
1528
+ }
1529
+ /**
1530
+ * Equivalent to `listBackupOperations`, but returns an iterable object.
1531
+ *
1532
+ * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand.
1533
+ * @param {Object} request
1534
+ * The request object that will be sent.
1535
+ * @param {string} request.parent
1536
+ * Required. The instance of the backup operations. Values are of
1537
+ * the form `projects/<project>/instances/<instance>`.
1538
+ * @param {string} request.filter
1539
+ * An expression that filters the list of returned backup operations.
1540
+ *
1541
+ * A filter expression consists of a field name, a
1542
+ * comparison operator, and a value for filtering.
1543
+ * The value must be a string, a number, or a boolean. The comparison operator
1544
+ * must be one of: `<`, `>`, `<=`, `>=`, `!=`, `=`, or `:`.
1545
+ * Colon `:` is the contains operator. Filter rules are not case sensitive.
1546
+ *
1547
+ * The following fields in the {@link protos.google.longrunning.Operation|operation}
1548
+ * are eligible for filtering:
1549
+ *
1550
+ * * `name` - The name of the long-running operation
1551
+ * * `done` - False if the operation is in progress, else true.
1552
+ * * `metadata.@type` - the type of metadata. For example, the type string
1553
+ * for
1554
+ * {@link protos.google.spanner.admin.database.v1.CreateBackupMetadata|CreateBackupMetadata}
1555
+ * is
1556
+ * `type.googleapis.com/google.spanner.admin.database.v1.CreateBackupMetadata`.
1557
+ * * `metadata.<field_name>` - any field in metadata.value.
1558
+ * `metadata.@type` must be specified first if filtering on metadata
1559
+ * fields.
1560
+ * * `error` - Error associated with the long-running operation.
1561
+ * * `response.@type` - the type of response.
1562
+ * * `response.<field_name>` - any field in response.value.
1563
+ *
1564
+ * You can combine multiple expressions by enclosing each expression in
1565
+ * parentheses. By default, expressions are combined with AND logic, but
1566
+ * you can specify AND, OR, and NOT logic explicitly.
1567
+ *
1568
+ * Here are a few examples:
1569
+ *
1570
+ * * `done:true` - The operation is complete.
1571
+ * * `(metadata.@type=type.googleapis.com/google.spanner.admin.database.v1.CreateBackupMetadata) AND` \
1572
+ * `metadata.database:prod` - Returns operations where:
1573
+ * * The operation's metadata type is
1574
+ * {@link protos.google.spanner.admin.database.v1.CreateBackupMetadata|CreateBackupMetadata}.
1575
+ * * The source database name of backup contains the string "prod".
1576
+ * * `(metadata.@type=type.googleapis.com/google.spanner.admin.database.v1.CreateBackupMetadata) AND` \
1577
+ * `(metadata.name:howl) AND` \
1578
+ * `(metadata.progress.start_time < \"2018-03-28T14:50:00Z\") AND` \
1579
+ * `(error:*)` - Returns operations where:
1580
+ * * The operation's metadata type is
1581
+ * {@link protos.google.spanner.admin.database.v1.CreateBackupMetadata|CreateBackupMetadata}.
1582
+ * * The backup name contains the string "howl".
1583
+ * * The operation started before 2018-03-28T14:50:00Z.
1584
+ * * The operation resulted in an error.
1585
+ * * `(metadata.@type=type.googleapis.com/google.spanner.admin.database.v1.CopyBackupMetadata) AND` \
1586
+ * `(metadata.source_backup:test) AND` \
1587
+ * `(metadata.progress.start_time < \"2022-01-18T14:50:00Z\") AND` \
1588
+ * `(error:*)` - Returns operations where:
1589
+ * * The operation's metadata type is
1590
+ * {@link protos.google.spanner.admin.database.v1.CopyBackupMetadata|CopyBackupMetadata}.
1591
+ * * The source backup name contains the string "test".
1592
+ * * The operation started before 2022-01-18T14:50:00Z.
1593
+ * * The operation resulted in an error.
1594
+ * * `((metadata.@type=type.googleapis.com/google.spanner.admin.database.v1.CreateBackupMetadata) AND` \
1595
+ * `(metadata.database:test_db)) OR` \
1596
+ * `((metadata.@type=type.googleapis.com/google.spanner.admin.database.v1.CopyBackupMetadata)
1597
+ * AND` \
1598
+ * `(metadata.source_backup:test_bkp)) AND` \
1599
+ * `(error:*)` - Returns operations where:
1600
+ * * The operation's metadata matches either of criteria:
1601
+ * * The operation's metadata type is
1602
+ * {@link protos.google.spanner.admin.database.v1.CreateBackupMetadata|CreateBackupMetadata}
1603
+ * AND the source database name of the backup contains the string
1604
+ * "test_db"
1605
+ * * The operation's metadata type is
1606
+ * {@link protos.google.spanner.admin.database.v1.CopyBackupMetadata|CopyBackupMetadata}
1607
+ * AND the source backup name contains the string "test_bkp"
1608
+ * * The operation resulted in an error.
1609
+ * @param {number} request.pageSize
1610
+ * Number of operations to be returned in the response. If 0 or
1611
+ * less, defaults to the server's maximum allowed page size.
1612
+ * @param {string} request.pageToken
1613
+ * If non-empty, `page_token` should contain a
1614
+ * {@link protos.google.spanner.admin.database.v1.ListBackupOperationsResponse.next_page_token|next_page_token}
1615
+ * from a previous
1616
+ * {@link protos.google.spanner.admin.database.v1.ListBackupOperationsResponse|ListBackupOperationsResponse}
1617
+ * to the same `parent` and with the same `filter`.
1618
+ * @param {object} [options]
1619
+ * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
1620
+ * @returns {Object}
1621
+ * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }.
1622
+ * When you iterate the returned iterable, each element will be an object representing
1623
+ * {@link protos.google.longrunning.Operation|Operation}. The API will be called under the hood as needed, once per the page,
1624
+ * so you can stop the iteration when you don't need more results.
1625
+ * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation }
1626
+ * for more details and examples.
1627
+ */
1628
+ listBackupOperationsAsync(request, options) {
1629
+ var _a;
1630
+ request = request || {};
1631
+ options = options || {};
1632
+ options.otherArgs = options.otherArgs || {};
1633
+ options.otherArgs.headers = options.otherArgs.headers || {};
1634
+ options.otherArgs.headers['x-goog-request-params'] =
1635
+ this._gaxModule.routingHeader.fromParams({
1636
+ parent: (_a = request.parent) !== null && _a !== void 0 ? _a : '',
1637
+ });
1638
+ const defaultCallSettings = this._defaults['listBackupOperations'];
1639
+ const callSettings = defaultCallSettings.merge(options);
1640
+ this.initialize();
1641
+ return this.descriptors.page.listBackupOperations.asyncIterate(this.innerApiCalls['listBackupOperations'], request, callSettings);
1642
+ }
1643
+ listDatabaseRoles(request, optionsOrCallback, callback) {
1644
+ var _a;
1645
+ request = request || {};
1646
+ let options;
1647
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
1648
+ callback = optionsOrCallback;
1649
+ options = {};
1650
+ }
1651
+ else {
1652
+ options = optionsOrCallback;
1653
+ }
1654
+ options = options || {};
1655
+ options.otherArgs = options.otherArgs || {};
1656
+ options.otherArgs.headers = options.otherArgs.headers || {};
1657
+ options.otherArgs.headers['x-goog-request-params'] =
1658
+ this._gaxModule.routingHeader.fromParams({
1659
+ parent: (_a = request.parent) !== null && _a !== void 0 ? _a : '',
1660
+ });
1661
+ this.initialize();
1662
+ return this.innerApiCalls.listDatabaseRoles(request, options, callback);
1663
+ }
1664
+ /**
1665
+ * Equivalent to `listDatabaseRoles`, but returns a NodeJS Stream object.
1666
+ * @param {Object} request
1667
+ * The request object that will be sent.
1668
+ * @param {string} request.parent
1669
+ * Required. The database whose roles should be listed.
1670
+ * Values are of the form
1671
+ * `projects/<project>/instances/<instance>/databases/<database>`.
1672
+ * @param {number} request.pageSize
1673
+ * Number of database roles to be returned in the response. If 0 or less,
1674
+ * defaults to the server's maximum allowed page size.
1675
+ * @param {string} request.pageToken
1676
+ * If non-empty, `page_token` should contain a
1677
+ * {@link protos.google.spanner.admin.database.v1.ListDatabaseRolesResponse.next_page_token|next_page_token}
1678
+ * from a previous
1679
+ * {@link protos.google.spanner.admin.database.v1.ListDatabaseRolesResponse|ListDatabaseRolesResponse}.
1680
+ * @param {object} [options]
1681
+ * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
1682
+ * @returns {Stream}
1683
+ * An object stream which emits an object representing {@link protos.google.spanner.admin.database.v1.DatabaseRole|DatabaseRole} on 'data' event.
1684
+ * The client library will perform auto-pagination by default: it will call the API as many
1685
+ * times as needed. Note that it can affect your quota.
1686
+ * We recommend using `listDatabaseRolesAsync()`
1687
+ * method described below for async iteration which you can stop as needed.
1688
+ * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation }
1689
+ * for more details and examples.
1690
+ */
1691
+ listDatabaseRolesStream(request, options) {
1692
+ var _a;
1693
+ request = request || {};
1694
+ options = options || {};
1695
+ options.otherArgs = options.otherArgs || {};
1696
+ options.otherArgs.headers = options.otherArgs.headers || {};
1697
+ options.otherArgs.headers['x-goog-request-params'] =
1698
+ this._gaxModule.routingHeader.fromParams({
1699
+ parent: (_a = request.parent) !== null && _a !== void 0 ? _a : '',
1700
+ });
1701
+ const defaultCallSettings = this._defaults['listDatabaseRoles'];
1702
+ const callSettings = defaultCallSettings.merge(options);
1703
+ this.initialize();
1704
+ return this.descriptors.page.listDatabaseRoles.createStream(this.innerApiCalls.listDatabaseRoles, request, callSettings);
1705
+ }
1706
+ /**
1707
+ * Equivalent to `listDatabaseRoles`, but returns an iterable object.
1708
+ *
1709
+ * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand.
1710
+ * @param {Object} request
1711
+ * The request object that will be sent.
1712
+ * @param {string} request.parent
1713
+ * Required. The database whose roles should be listed.
1714
+ * Values are of the form
1715
+ * `projects/<project>/instances/<instance>/databases/<database>`.
1716
+ * @param {number} request.pageSize
1717
+ * Number of database roles to be returned in the response. If 0 or less,
1718
+ * defaults to the server's maximum allowed page size.
1719
+ * @param {string} request.pageToken
1720
+ * If non-empty, `page_token` should contain a
1721
+ * {@link protos.google.spanner.admin.database.v1.ListDatabaseRolesResponse.next_page_token|next_page_token}
1722
+ * from a previous
1723
+ * {@link protos.google.spanner.admin.database.v1.ListDatabaseRolesResponse|ListDatabaseRolesResponse}.
1724
+ * @param {object} [options]
1725
+ * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
1726
+ * @returns {Object}
1727
+ * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }.
1728
+ * When you iterate the returned iterable, each element will be an object representing
1729
+ * {@link protos.google.spanner.admin.database.v1.DatabaseRole|DatabaseRole}. The API will be called under the hood as needed, once per the page,
1730
+ * so you can stop the iteration when you don't need more results.
1731
+ * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation }
1732
+ * for more details and examples.
1733
+ */
1734
+ listDatabaseRolesAsync(request, options) {
1735
+ var _a;
1736
+ request = request || {};
1737
+ options = options || {};
1738
+ options.otherArgs = options.otherArgs || {};
1739
+ options.otherArgs.headers = options.otherArgs.headers || {};
1740
+ options.otherArgs.headers['x-goog-request-params'] =
1741
+ this._gaxModule.routingHeader.fromParams({
1742
+ parent: (_a = request.parent) !== null && _a !== void 0 ? _a : '',
1743
+ });
1744
+ const defaultCallSettings = this._defaults['listDatabaseRoles'];
1745
+ const callSettings = defaultCallSettings.merge(options);
1746
+ this.initialize();
1747
+ return this.descriptors.page.listDatabaseRoles.asyncIterate(this.innerApiCalls['listDatabaseRoles'], request, callSettings);
1748
+ }
1749
+ listBackupSchedules(request, optionsOrCallback, callback) {
1750
+ var _a;
1751
+ request = request || {};
1752
+ let options;
1753
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
1754
+ callback = optionsOrCallback;
1755
+ options = {};
1756
+ }
1757
+ else {
1758
+ options = optionsOrCallback;
1759
+ }
1760
+ options = options || {};
1761
+ options.otherArgs = options.otherArgs || {};
1762
+ options.otherArgs.headers = options.otherArgs.headers || {};
1763
+ options.otherArgs.headers['x-goog-request-params'] =
1764
+ this._gaxModule.routingHeader.fromParams({
1765
+ parent: (_a = request.parent) !== null && _a !== void 0 ? _a : '',
1766
+ });
1767
+ this.initialize();
1768
+ return this.innerApiCalls.listBackupSchedules(request, options, callback);
1769
+ }
1770
+ /**
1771
+ * Equivalent to `listBackupSchedules`, but returns a NodeJS Stream object.
1772
+ * @param {Object} request
1773
+ * The request object that will be sent.
1774
+ * @param {string} request.parent
1775
+ * Required. Database is the parent resource whose backup schedules should be
1776
+ * listed. Values are of the form
1777
+ * projects/<project>/instances/<instance>/databases/<database>
1778
+ * @param {number} [request.pageSize]
1779
+ * Optional. Number of backup schedules to be returned in the response. If 0
1780
+ * or less, defaults to the server's maximum allowed page size.
1781
+ * @param {string} [request.pageToken]
1782
+ * Optional. If non-empty, `page_token` should contain a
1783
+ * {@link protos.google.spanner.admin.database.v1.ListBackupSchedulesResponse.next_page_token|next_page_token}
1784
+ * from a previous
1785
+ * {@link protos.google.spanner.admin.database.v1.ListBackupSchedulesResponse|ListBackupSchedulesResponse}
1786
+ * to the same `parent`.
1787
+ * @param {object} [options]
1788
+ * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
1789
+ * @returns {Stream}
1790
+ * An object stream which emits an object representing {@link protos.google.spanner.admin.database.v1.BackupSchedule|BackupSchedule} on 'data' event.
1791
+ * The client library will perform auto-pagination by default: it will call the API as many
1792
+ * times as needed. Note that it can affect your quota.
1793
+ * We recommend using `listBackupSchedulesAsync()`
1794
+ * method described below for async iteration which you can stop as needed.
1795
+ * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation }
1796
+ * for more details and examples.
1797
+ */
1798
+ listBackupSchedulesStream(request, options) {
1799
+ var _a;
1800
+ request = request || {};
1801
+ options = options || {};
1802
+ options.otherArgs = options.otherArgs || {};
1803
+ options.otherArgs.headers = options.otherArgs.headers || {};
1804
+ options.otherArgs.headers['x-goog-request-params'] =
1805
+ this._gaxModule.routingHeader.fromParams({
1806
+ parent: (_a = request.parent) !== null && _a !== void 0 ? _a : '',
1807
+ });
1808
+ const defaultCallSettings = this._defaults['listBackupSchedules'];
1809
+ const callSettings = defaultCallSettings.merge(options);
1810
+ this.initialize();
1811
+ return this.descriptors.page.listBackupSchedules.createStream(this.innerApiCalls.listBackupSchedules, request, callSettings);
1812
+ }
1813
+ /**
1814
+ * Equivalent to `listBackupSchedules`, but returns an iterable object.
1815
+ *
1816
+ * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand.
1817
+ * @param {Object} request
1818
+ * The request object that will be sent.
1819
+ * @param {string} request.parent
1820
+ * Required. Database is the parent resource whose backup schedules should be
1821
+ * listed. Values are of the form
1822
+ * projects/<project>/instances/<instance>/databases/<database>
1823
+ * @param {number} [request.pageSize]
1824
+ * Optional. Number of backup schedules to be returned in the response. If 0
1825
+ * or less, defaults to the server's maximum allowed page size.
1826
+ * @param {string} [request.pageToken]
1827
+ * Optional. If non-empty, `page_token` should contain a
1828
+ * {@link protos.google.spanner.admin.database.v1.ListBackupSchedulesResponse.next_page_token|next_page_token}
1829
+ * from a previous
1830
+ * {@link protos.google.spanner.admin.database.v1.ListBackupSchedulesResponse|ListBackupSchedulesResponse}
1831
+ * to the same `parent`.
1832
+ * @param {object} [options]
1833
+ * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
1834
+ * @returns {Object}
1835
+ * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }.
1836
+ * When you iterate the returned iterable, each element will be an object representing
1837
+ * {@link protos.google.spanner.admin.database.v1.BackupSchedule|BackupSchedule}. The API will be called under the hood as needed, once per the page,
1838
+ * so you can stop the iteration when you don't need more results.
1839
+ * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation }
1840
+ * for more details and examples.
1841
+ */
1842
+ listBackupSchedulesAsync(request, options) {
1843
+ var _a;
1844
+ request = request || {};
1845
+ options = options || {};
1846
+ options.otherArgs = options.otherArgs || {};
1847
+ options.otherArgs.headers = options.otherArgs.headers || {};
1848
+ options.otherArgs.headers['x-goog-request-params'] =
1849
+ this._gaxModule.routingHeader.fromParams({
1850
+ parent: (_a = request.parent) !== null && _a !== void 0 ? _a : '',
1851
+ });
1852
+ const defaultCallSettings = this._defaults['listBackupSchedules'];
1853
+ const callSettings = defaultCallSettings.merge(options);
1854
+ this.initialize();
1855
+ return this.descriptors.page.listBackupSchedules.asyncIterate(this.innerApiCalls['listBackupSchedules'], request, callSettings);
1856
+ }
1857
+ /**
1858
+ * Gets the latest state of a long-running operation. Clients can use this
1859
+ * method to poll the operation result at intervals as recommended by the API
1860
+ * service.
1861
+ *
1862
+ * @param {Object} request - The request object that will be sent.
1863
+ * @param {string} request.name - The name of the operation resource.
1864
+ * @param {Object=} options
1865
+ * Optional parameters. You can override the default settings for this call,
1866
+ * e.g, timeout, retries, paginations, etc. See {@link
1867
+ * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions}
1868
+ * for the details.
1869
+ * @param {function(?Error, ?Object)=} callback
1870
+ * The function which will be called with the result of the API call.
1871
+ *
1872
+ * The second parameter to the callback is an object representing
1873
+ * {@link google.longrunning.Operation | google.longrunning.Operation}.
1874
+ * @return {Promise} - The promise which resolves to an array.
1875
+ * The first element of the array is an object representing
1876
+ * {@link google.longrunning.Operation | google.longrunning.Operation}.
1877
+ * The promise has a method named "cancel" which cancels the ongoing API call.
1878
+ *
1879
+ * @example
1880
+ * ```
1881
+ * const client = longrunning.operationsClient();
1882
+ * const name = '';
1883
+ * const [response] = await client.getOperation({name});
1884
+ * // doThingsWith(response)
1885
+ * ```
1886
+ */
1887
+ getOperation(request, optionsOrCallback, callback) {
1888
+ var _a;
1889
+ let options;
1890
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
1891
+ callback = optionsOrCallback;
1892
+ options = {};
1893
+ }
1894
+ else {
1895
+ options = optionsOrCallback;
1896
+ }
1897
+ options = options || {};
1898
+ options.otherArgs = options.otherArgs || {};
1899
+ options.otherArgs.headers = options.otherArgs.headers || {};
1900
+ options.otherArgs.headers['x-goog-request-params'] =
1901
+ this._gaxModule.routingHeader.fromParams({
1902
+ name: (_a = request.name) !== null && _a !== void 0 ? _a : '',
1903
+ });
1904
+ return this.operationsClient.getOperation(request, options, callback);
1905
+ }
1906
+ /**
1907
+ * Lists operations that match the specified filter in the request. If the
1908
+ * server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object.
1909
+ *
1910
+ * For-await-of syntax is used with the iterable to recursively get response element on-demand.
1911
+ *
1912
+ * @param {Object} request - The request object that will be sent.
1913
+ * @param {string} request.name - The name of the operation collection.
1914
+ * @param {string} request.filter - The standard list filter.
1915
+ * @param {number=} request.pageSize -
1916
+ * The maximum number of resources contained in the underlying API
1917
+ * response. If page streaming is performed per-resource, this
1918
+ * parameter does not affect the return value. If page streaming is
1919
+ * performed per-page, this determines the maximum number of
1920
+ * resources in a page.
1921
+ * @param {Object=} options
1922
+ * Optional parameters. You can override the default settings for this call,
1923
+ * e.g, timeout, retries, paginations, etc. See {@link
1924
+ * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} for the
1925
+ * details.
1926
+ * @returns {Object}
1927
+ * An iterable Object that conforms to {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | iteration protocols}.
1928
+ *
1929
+ * @example
1930
+ * ```
1931
+ * const client = longrunning.operationsClient();
1932
+ * for await (const response of client.listOperationsAsync(request));
1933
+ * // doThingsWith(response)
1934
+ * ```
1935
+ */
1936
+ listOperationsAsync(request, options) {
1937
+ var _a;
1938
+ options = options || {};
1939
+ options.otherArgs = options.otherArgs || {};
1940
+ options.otherArgs.headers = options.otherArgs.headers || {};
1941
+ options.otherArgs.headers['x-goog-request-params'] =
1942
+ this._gaxModule.routingHeader.fromParams({
1943
+ name: (_a = request.name) !== null && _a !== void 0 ? _a : '',
1944
+ });
1945
+ return this.operationsClient.listOperationsAsync(request, options);
1946
+ }
1947
+ /**
1948
+ * Starts asynchronous cancellation on a long-running operation. The server
1949
+ * makes a best effort to cancel the operation, but success is not
1950
+ * guaranteed. If the server doesn't support this method, it returns
1951
+ * `google.rpc.Code.UNIMPLEMENTED`. Clients can use
1952
+ * {@link Operations.GetOperation} or
1953
+ * other methods to check whether the cancellation succeeded or whether the
1954
+ * operation completed despite cancellation. On successful cancellation,
1955
+ * the operation is not deleted; instead, it becomes an operation with
1956
+ * an {@link Operation.error} value with a {@link google.rpc.Status.code} of
1957
+ * 1, corresponding to `Code.CANCELLED`.
1958
+ *
1959
+ * @param {Object} request - The request object that will be sent.
1960
+ * @param {string} request.name - The name of the operation resource to be cancelled.
1961
+ * @param {Object=} options
1962
+ * Optional parameters. You can override the default settings for this call,
1963
+ * e.g, timeout, retries, paginations, etc. See {@link
1964
+ * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} for the
1965
+ * details.
1966
+ * @param {function(?Error)=} callback
1967
+ * The function which will be called with the result of the API call.
1968
+ * @return {Promise} - The promise which resolves when API call finishes.
1969
+ * The promise has a method named "cancel" which cancels the ongoing API
1970
+ * call.
1971
+ *
1972
+ * @example
1973
+ * ```
1974
+ * const client = longrunning.operationsClient();
1975
+ * await client.cancelOperation({name: ''});
1976
+ * ```
1977
+ */
1978
+ cancelOperation(request, optionsOrCallback, callback) {
1979
+ var _a;
1980
+ let options;
1981
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
1982
+ callback = optionsOrCallback;
1983
+ options = {};
1984
+ }
1985
+ else {
1986
+ options = optionsOrCallback;
1987
+ }
1988
+ options = options || {};
1989
+ options.otherArgs = options.otherArgs || {};
1990
+ options.otherArgs.headers = options.otherArgs.headers || {};
1991
+ options.otherArgs.headers['x-goog-request-params'] =
1992
+ this._gaxModule.routingHeader.fromParams({
1993
+ name: (_a = request.name) !== null && _a !== void 0 ? _a : '',
1994
+ });
1995
+ return this.operationsClient.cancelOperation(request, options, callback);
1996
+ }
1997
+ /**
1998
+ * Deletes a long-running operation. This method indicates that the client is
1999
+ * no longer interested in the operation result. It does not cancel the
2000
+ * operation. If the server doesn't support this method, it returns
2001
+ * `google.rpc.Code.UNIMPLEMENTED`.
2002
+ *
2003
+ * @param {Object} request - The request object that will be sent.
2004
+ * @param {string} request.name - The name of the operation resource to be deleted.
2005
+ * @param {Object=} options
2006
+ * Optional parameters. You can override the default settings for this call,
2007
+ * e.g, timeout, retries, paginations, etc. See {@link
2008
+ * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions}
2009
+ * for the details.
2010
+ * @param {function(?Error)=} callback
2011
+ * The function which will be called with the result of the API call.
2012
+ * @return {Promise} - The promise which resolves when API call finishes.
2013
+ * The promise has a method named "cancel" which cancels the ongoing API
2014
+ * call.
2015
+ *
2016
+ * @example
2017
+ * ```
2018
+ * const client = longrunning.operationsClient();
2019
+ * await client.deleteOperation({name: ''});
2020
+ * ```
2021
+ */
2022
+ deleteOperation(request, optionsOrCallback, callback) {
2023
+ var _a;
2024
+ let options;
2025
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
2026
+ callback = optionsOrCallback;
2027
+ options = {};
2028
+ }
2029
+ else {
2030
+ options = optionsOrCallback;
2031
+ }
2032
+ options = options || {};
2033
+ options.otherArgs = options.otherArgs || {};
2034
+ options.otherArgs.headers = options.otherArgs.headers || {};
2035
+ options.otherArgs.headers['x-goog-request-params'] =
2036
+ this._gaxModule.routingHeader.fromParams({
2037
+ name: (_a = request.name) !== null && _a !== void 0 ? _a : '',
2038
+ });
2039
+ return this.operationsClient.deleteOperation(request, options, callback);
2040
+ }
2041
+ // --------------------
2042
+ // -- Path templates --
2043
+ // --------------------
2044
+ /**
2045
+ * Return a fully-qualified backup resource name string.
2046
+ *
2047
+ * @param {string} project
2048
+ * @param {string} instance
2049
+ * @param {string} backup
2050
+ * @returns {string} Resource name string.
2051
+ */
2052
+ backupPath(project, instance, backup) {
2053
+ return this.pathTemplates.backupPathTemplate.render({
2054
+ project: project,
2055
+ instance: instance,
2056
+ backup: backup,
2057
+ });
2058
+ }
2059
+ /**
2060
+ * Parse the project from Backup resource.
2061
+ *
2062
+ * @param {string} backupName
2063
+ * A fully-qualified path representing Backup resource.
2064
+ * @returns {string} A string representing the project.
2065
+ */
2066
+ matchProjectFromBackupName(backupName) {
2067
+ return this.pathTemplates.backupPathTemplate.match(backupName).project;
2068
+ }
2069
+ /**
2070
+ * Parse the instance from Backup resource.
2071
+ *
2072
+ * @param {string} backupName
2073
+ * A fully-qualified path representing Backup resource.
2074
+ * @returns {string} A string representing the instance.
2075
+ */
2076
+ matchInstanceFromBackupName(backupName) {
2077
+ return this.pathTemplates.backupPathTemplate.match(backupName).instance;
2078
+ }
2079
+ /**
2080
+ * Parse the backup from Backup resource.
2081
+ *
2082
+ * @param {string} backupName
2083
+ * A fully-qualified path representing Backup resource.
2084
+ * @returns {string} A string representing the backup.
2085
+ */
2086
+ matchBackupFromBackupName(backupName) {
2087
+ return this.pathTemplates.backupPathTemplate.match(backupName).backup;
2088
+ }
2089
+ /**
2090
+ * Return a fully-qualified backupSchedule resource name string.
2091
+ *
2092
+ * @param {string} project
2093
+ * @param {string} instance
2094
+ * @param {string} database
2095
+ * @param {string} schedule
2096
+ * @returns {string} Resource name string.
2097
+ */
2098
+ backupSchedulePath(project, instance, database, schedule) {
2099
+ return this.pathTemplates.backupSchedulePathTemplate.render({
2100
+ project: project,
2101
+ instance: instance,
2102
+ database: database,
2103
+ schedule: schedule,
2104
+ });
2105
+ }
2106
+ /**
2107
+ * Parse the project from BackupSchedule resource.
2108
+ *
2109
+ * @param {string} backupScheduleName
2110
+ * A fully-qualified path representing BackupSchedule resource.
2111
+ * @returns {string} A string representing the project.
2112
+ */
2113
+ matchProjectFromBackupScheduleName(backupScheduleName) {
2114
+ return this.pathTemplates.backupSchedulePathTemplate.match(backupScheduleName).project;
2115
+ }
2116
+ /**
2117
+ * Parse the instance from BackupSchedule resource.
2118
+ *
2119
+ * @param {string} backupScheduleName
2120
+ * A fully-qualified path representing BackupSchedule resource.
2121
+ * @returns {string} A string representing the instance.
2122
+ */
2123
+ matchInstanceFromBackupScheduleName(backupScheduleName) {
2124
+ return this.pathTemplates.backupSchedulePathTemplate.match(backupScheduleName).instance;
2125
+ }
2126
+ /**
2127
+ * Parse the database from BackupSchedule resource.
2128
+ *
2129
+ * @param {string} backupScheduleName
2130
+ * A fully-qualified path representing BackupSchedule resource.
2131
+ * @returns {string} A string representing the database.
2132
+ */
2133
+ matchDatabaseFromBackupScheduleName(backupScheduleName) {
2134
+ return this.pathTemplates.backupSchedulePathTemplate.match(backupScheduleName).database;
2135
+ }
2136
+ /**
2137
+ * Parse the schedule from BackupSchedule resource.
2138
+ *
2139
+ * @param {string} backupScheduleName
2140
+ * A fully-qualified path representing BackupSchedule resource.
2141
+ * @returns {string} A string representing the schedule.
2142
+ */
2143
+ matchScheduleFromBackupScheduleName(backupScheduleName) {
2144
+ return this.pathTemplates.backupSchedulePathTemplate.match(backupScheduleName).schedule;
2145
+ }
2146
+ /**
2147
+ * Return a fully-qualified cryptoKey resource name string.
2148
+ *
2149
+ * @param {string} project
2150
+ * @param {string} location
2151
+ * @param {string} key_ring
2152
+ * @param {string} crypto_key
2153
+ * @returns {string} Resource name string.
2154
+ */
2155
+ cryptoKeyPath(project, location, keyRing, cryptoKey) {
2156
+ return this.pathTemplates.cryptoKeyPathTemplate.render({
2157
+ project: project,
2158
+ location: location,
2159
+ key_ring: keyRing,
2160
+ crypto_key: cryptoKey,
2161
+ });
2162
+ }
2163
+ /**
2164
+ * Parse the project from CryptoKey resource.
2165
+ *
2166
+ * @param {string} cryptoKeyName
2167
+ * A fully-qualified path representing CryptoKey resource.
2168
+ * @returns {string} A string representing the project.
2169
+ */
2170
+ matchProjectFromCryptoKeyName(cryptoKeyName) {
2171
+ return this.pathTemplates.cryptoKeyPathTemplate.match(cryptoKeyName)
2172
+ .project;
2173
+ }
2174
+ /**
2175
+ * Parse the location from CryptoKey resource.
2176
+ *
2177
+ * @param {string} cryptoKeyName
2178
+ * A fully-qualified path representing CryptoKey resource.
2179
+ * @returns {string} A string representing the location.
2180
+ */
2181
+ matchLocationFromCryptoKeyName(cryptoKeyName) {
2182
+ return this.pathTemplates.cryptoKeyPathTemplate.match(cryptoKeyName)
2183
+ .location;
2184
+ }
2185
+ /**
2186
+ * Parse the key_ring from CryptoKey resource.
2187
+ *
2188
+ * @param {string} cryptoKeyName
2189
+ * A fully-qualified path representing CryptoKey resource.
2190
+ * @returns {string} A string representing the key_ring.
2191
+ */
2192
+ matchKeyRingFromCryptoKeyName(cryptoKeyName) {
2193
+ return this.pathTemplates.cryptoKeyPathTemplate.match(cryptoKeyName)
2194
+ .key_ring;
2195
+ }
2196
+ /**
2197
+ * Parse the crypto_key from CryptoKey resource.
2198
+ *
2199
+ * @param {string} cryptoKeyName
2200
+ * A fully-qualified path representing CryptoKey resource.
2201
+ * @returns {string} A string representing the crypto_key.
2202
+ */
2203
+ matchCryptoKeyFromCryptoKeyName(cryptoKeyName) {
2204
+ return this.pathTemplates.cryptoKeyPathTemplate.match(cryptoKeyName)
2205
+ .crypto_key;
2206
+ }
2207
+ /**
2208
+ * Return a fully-qualified database resource name string.
2209
+ *
2210
+ * @param {string} project
2211
+ * @param {string} instance
2212
+ * @param {string} database
2213
+ * @returns {string} Resource name string.
2214
+ */
2215
+ databasePath(project, instance, database) {
2216
+ return this.pathTemplates.databasePathTemplate.render({
2217
+ project: project,
2218
+ instance: instance,
2219
+ database: database,
2220
+ });
2221
+ }
2222
+ /**
2223
+ * Parse the project from Database resource.
2224
+ *
2225
+ * @param {string} databaseName
2226
+ * A fully-qualified path representing Database resource.
2227
+ * @returns {string} A string representing the project.
2228
+ */
2229
+ matchProjectFromDatabaseName(databaseName) {
2230
+ return this.pathTemplates.databasePathTemplate.match(databaseName).project;
2231
+ }
2232
+ /**
2233
+ * Parse the instance from Database resource.
2234
+ *
2235
+ * @param {string} databaseName
2236
+ * A fully-qualified path representing Database resource.
2237
+ * @returns {string} A string representing the instance.
2238
+ */
2239
+ matchInstanceFromDatabaseName(databaseName) {
2240
+ return this.pathTemplates.databasePathTemplate.match(databaseName).instance;
2241
+ }
2242
+ /**
2243
+ * Parse the database from Database resource.
2244
+ *
2245
+ * @param {string} databaseName
2246
+ * A fully-qualified path representing Database resource.
2247
+ * @returns {string} A string representing the database.
2248
+ */
2249
+ matchDatabaseFromDatabaseName(databaseName) {
2250
+ return this.pathTemplates.databasePathTemplate.match(databaseName).database;
2251
+ }
2252
+ /**
2253
+ * Return a fully-qualified databaseRole resource name string.
2254
+ *
2255
+ * @param {string} project
2256
+ * @param {string} instance
2257
+ * @param {string} database
2258
+ * @param {string} role
2259
+ * @returns {string} Resource name string.
2260
+ */
2261
+ databaseRolePath(project, instance, database, role) {
2262
+ return this.pathTemplates.databaseRolePathTemplate.render({
2263
+ project: project,
2264
+ instance: instance,
2265
+ database: database,
2266
+ role: role,
2267
+ });
2268
+ }
2269
+ /**
2270
+ * Parse the project from DatabaseRole resource.
2271
+ *
2272
+ * @param {string} databaseRoleName
2273
+ * A fully-qualified path representing DatabaseRole resource.
2274
+ * @returns {string} A string representing the project.
2275
+ */
2276
+ matchProjectFromDatabaseRoleName(databaseRoleName) {
2277
+ return this.pathTemplates.databaseRolePathTemplate.match(databaseRoleName)
2278
+ .project;
2279
+ }
2280
+ /**
2281
+ * Parse the instance from DatabaseRole resource.
2282
+ *
2283
+ * @param {string} databaseRoleName
2284
+ * A fully-qualified path representing DatabaseRole resource.
2285
+ * @returns {string} A string representing the instance.
2286
+ */
2287
+ matchInstanceFromDatabaseRoleName(databaseRoleName) {
2288
+ return this.pathTemplates.databaseRolePathTemplate.match(databaseRoleName)
2289
+ .instance;
2290
+ }
2291
+ /**
2292
+ * Parse the database from DatabaseRole resource.
2293
+ *
2294
+ * @param {string} databaseRoleName
2295
+ * A fully-qualified path representing DatabaseRole resource.
2296
+ * @returns {string} A string representing the database.
2297
+ */
2298
+ matchDatabaseFromDatabaseRoleName(databaseRoleName) {
2299
+ return this.pathTemplates.databaseRolePathTemplate.match(databaseRoleName)
2300
+ .database;
2301
+ }
2302
+ /**
2303
+ * Parse the role from DatabaseRole resource.
2304
+ *
2305
+ * @param {string} databaseRoleName
2306
+ * A fully-qualified path representing DatabaseRole resource.
2307
+ * @returns {string} A string representing the role.
2308
+ */
2309
+ matchRoleFromDatabaseRoleName(databaseRoleName) {
2310
+ return this.pathTemplates.databaseRolePathTemplate.match(databaseRoleName)
2311
+ .role;
2312
+ }
2313
+ /**
2314
+ * Return a fully-qualified instance resource name string.
2315
+ *
2316
+ * @param {string} project
2317
+ * @param {string} instance
2318
+ * @returns {string} Resource name string.
2319
+ */
2320
+ instancePath(project, instance) {
2321
+ return this.pathTemplates.instancePathTemplate.render({
2322
+ project: project,
2323
+ instance: instance,
2324
+ });
2325
+ }
2326
+ /**
2327
+ * Parse the project from Instance resource.
2328
+ *
2329
+ * @param {string} instanceName
2330
+ * A fully-qualified path representing Instance resource.
2331
+ * @returns {string} A string representing the project.
2332
+ */
2333
+ matchProjectFromInstanceName(instanceName) {
2334
+ return this.pathTemplates.instancePathTemplate.match(instanceName).project;
2335
+ }
2336
+ /**
2337
+ * Parse the instance from Instance resource.
2338
+ *
2339
+ * @param {string} instanceName
2340
+ * A fully-qualified path representing Instance resource.
2341
+ * @returns {string} A string representing the instance.
2342
+ */
2343
+ matchInstanceFromInstanceName(instanceName) {
2344
+ return this.pathTemplates.instancePathTemplate.match(instanceName).instance;
2345
+ }
2346
+ /**
2347
+ * Terminate the gRPC channel and close the client.
2348
+ *
2349
+ * The client will no longer be usable and all future behavior is undefined.
2350
+ * @returns {Promise} A promise that resolves when the client is closed.
2351
+ */
2352
+ close() {
2353
+ if (this.databaseAdminStub && !this._terminated) {
2354
+ return this.databaseAdminStub.then(stub => {
2355
+ this._terminated = true;
2356
+ stub.close();
2357
+ this.operationsClient.close();
2358
+ });
2359
+ }
2360
+ return Promise.resolve();
2361
+ }
2362
+ }
2363
+ exports.DatabaseAdminClient = DatabaseAdminClient;
2364
+ //# sourceMappingURL=database_admin_client.js.map