@google-cloud/spanner 8.10.0 → 8.12.0

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