@google-cloud/spanner-api 0.1.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.
- package/README.md +111 -0
- package/build/protos/google/spanner/admin/database/v1/backup.proto +773 -0
- package/build/protos/google/spanner/admin/database/v1/backup_schedule.proto +230 -0
- package/build/protos/google/spanner/admin/database/v1/common.proto +132 -0
- package/build/protos/google/spanner/admin/database/v1/spanner_database_admin.proto +1314 -0
- package/build/protos/google/spanner/admin/instance/v1/common.proto +64 -0
- package/build/protos/google/spanner/admin/instance/v1/spanner_instance_admin.proto +2184 -0
- package/build/protos/google/spanner/executor/v1/cloud_executor.proto +1610 -0
- package/build/protos/google/spanner/v1/change_stream.proto +451 -0
- package/build/protos/google/spanner/v1/commit_response.proto +80 -0
- package/build/protos/google/spanner/v1/keys.proto +163 -0
- package/build/protos/google/spanner/v1/location.proto +388 -0
- package/build/protos/google/spanner/v1/mutation.proto +156 -0
- package/build/protos/google/spanner/v1/query_plan.proto +156 -0
- package/build/protos/google/spanner/v1/result_set.proto +260 -0
- package/build/protos/google/spanner/v1/spanner.proto +1472 -0
- package/build/protos/google/spanner/v1/transaction.proto +329 -0
- package/build/protos/google/spanner/v1/type.proto +214 -0
- package/build/protos/protos.d.ts +42547 -0
- package/build/protos/protos.js +1 -0
- package/build/protos/protos.json +1 -0
- package/build/src/index.d.ts +20 -0
- package/build/src/index.js +34 -0
- package/build/src/index.js.map +1 -0
- package/build/src/v1/database_admin_client.d.ts +2433 -0
- package/build/src/v1/database_admin_client.js +2938 -0
- package/build/src/v1/database_admin_client.js.map +1 -0
- package/build/src/v1/database_admin_client_config.json +169 -0
- package/build/src/v1/database_admin_proto_list.json +6 -0
- package/build/src/v1/gapic_metadata.json +253 -0
- package/build/src/v1/index.d.ts +4 -0
- package/build/src/v1/index.js +29 -0
- package/build/src/v1/index.js.map +1 -0
- package/build/src/v1/instance_admin_client.d.ts +2162 -0
- package/build/src/v1/instance_admin_client.js +2411 -0
- package/build/src/v1/instance_admin_client.js.map +1 -0
- package/build/src/v1/instance_admin_client_config.json +129 -0
- package/build/src/v1/instance_admin_proto_list.json +4 -0
- package/build/src/v1/spanner_client.d.ts +1353 -0
- package/build/src/v1/spanner_client.js +1456 -0
- package/build/src/v1/spanner_client.js.map +1 -0
- package/build/src/v1/spanner_client_config.json +123 -0
- package/build/src/v1/spanner_executor_proxy_client.d.ts +419 -0
- package/build/src/v1/spanner_executor_proxy_client.js +730 -0
- package/build/src/v1/spanner_executor_proxy_client.js.map +1 -0
- package/build/src/v1/spanner_executor_proxy_client_config.json +30 -0
- package/build/src/v1/spanner_executor_proxy_proto_list.json +15 -0
- package/build/src/v1/spanner_proto_list.json +12 -0
- package/package.json +65 -0
|
@@ -0,0 +1,2938 @@
|
|
|
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-api');
|
|
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
|
+
* @example <caption>include:samples/generated/v1/database_admin.create_database.js</caption>
|
|
1099
|
+
* region_tag:spanner_v1_generated_DatabaseAdmin_CreateDatabase_async
|
|
1100
|
+
*/
|
|
1101
|
+
async checkCreateDatabaseProgress(name) {
|
|
1102
|
+
this._log.info('createDatabase long-running');
|
|
1103
|
+
const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({ name });
|
|
1104
|
+
const [operation] = await this.operationsClient.getOperation(request);
|
|
1105
|
+
const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createDatabase, this._gaxModule.createDefaultBackoffSettings());
|
|
1106
|
+
return decodeOperation;
|
|
1107
|
+
}
|
|
1108
|
+
updateDatabase(request, optionsOrCallback, callback) {
|
|
1109
|
+
request = request || {};
|
|
1110
|
+
let options;
|
|
1111
|
+
if (typeof optionsOrCallback === 'function' && callback === undefined) {
|
|
1112
|
+
callback = optionsOrCallback;
|
|
1113
|
+
options = {};
|
|
1114
|
+
}
|
|
1115
|
+
else {
|
|
1116
|
+
options = optionsOrCallback;
|
|
1117
|
+
}
|
|
1118
|
+
options = options || {};
|
|
1119
|
+
options.otherArgs = options.otherArgs || {};
|
|
1120
|
+
options.otherArgs.headers = options.otherArgs.headers || {};
|
|
1121
|
+
options.otherArgs.headers['x-goog-request-params'] =
|
|
1122
|
+
this._gaxModule.routingHeader.fromParams({
|
|
1123
|
+
'database.name': request.database.name ?? '',
|
|
1124
|
+
});
|
|
1125
|
+
this.initialize().catch((err) => {
|
|
1126
|
+
throw err;
|
|
1127
|
+
});
|
|
1128
|
+
const wrappedCallback = callback
|
|
1129
|
+
? (error, response, rawResponse, _) => {
|
|
1130
|
+
this._log.info('updateDatabase response %j', rawResponse);
|
|
1131
|
+
callback(error, response, rawResponse, _); // We verified callback above.
|
|
1132
|
+
}
|
|
1133
|
+
: undefined;
|
|
1134
|
+
this._log.info('updateDatabase request %j', request);
|
|
1135
|
+
return this.innerApiCalls
|
|
1136
|
+
.updateDatabase(request, options, wrappedCallback)
|
|
1137
|
+
?.then(([response, rawResponse, _]) => {
|
|
1138
|
+
this._log.info('updateDatabase response %j', rawResponse);
|
|
1139
|
+
return [response, rawResponse, _];
|
|
1140
|
+
});
|
|
1141
|
+
}
|
|
1142
|
+
/**
|
|
1143
|
+
* Check the status of the long running operation returned by `updateDatabase()`.
|
|
1144
|
+
* @param {String} name
|
|
1145
|
+
* The operation name that will be passed.
|
|
1146
|
+
* @returns {Promise} - The promise which resolves to an object.
|
|
1147
|
+
* The decoded operation object has result and metadata field to get information from.
|
|
1148
|
+
* Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation }
|
|
1149
|
+
* for more details and examples.
|
|
1150
|
+
* @example <caption>include:samples/generated/v1/database_admin.update_database.js</caption>
|
|
1151
|
+
* region_tag:spanner_v1_generated_DatabaseAdmin_UpdateDatabase_async
|
|
1152
|
+
*/
|
|
1153
|
+
async checkUpdateDatabaseProgress(name) {
|
|
1154
|
+
this._log.info('updateDatabase long-running');
|
|
1155
|
+
const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({ name });
|
|
1156
|
+
const [operation] = await this.operationsClient.getOperation(request);
|
|
1157
|
+
const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateDatabase, this._gaxModule.createDefaultBackoffSettings());
|
|
1158
|
+
return decodeOperation;
|
|
1159
|
+
}
|
|
1160
|
+
updateDatabaseDdl(request, optionsOrCallback, callback) {
|
|
1161
|
+
request = request || {};
|
|
1162
|
+
let options;
|
|
1163
|
+
if (typeof optionsOrCallback === 'function' && callback === undefined) {
|
|
1164
|
+
callback = optionsOrCallback;
|
|
1165
|
+
options = {};
|
|
1166
|
+
}
|
|
1167
|
+
else {
|
|
1168
|
+
options = optionsOrCallback;
|
|
1169
|
+
}
|
|
1170
|
+
options = options || {};
|
|
1171
|
+
options.otherArgs = options.otherArgs || {};
|
|
1172
|
+
options.otherArgs.headers = options.otherArgs.headers || {};
|
|
1173
|
+
options.otherArgs.headers['x-goog-request-params'] =
|
|
1174
|
+
this._gaxModule.routingHeader.fromParams({
|
|
1175
|
+
database: request.database ?? '',
|
|
1176
|
+
});
|
|
1177
|
+
this.initialize().catch((err) => {
|
|
1178
|
+
throw err;
|
|
1179
|
+
});
|
|
1180
|
+
const wrappedCallback = callback
|
|
1181
|
+
? (error, response, rawResponse, _) => {
|
|
1182
|
+
this._log.info('updateDatabaseDdl response %j', rawResponse);
|
|
1183
|
+
callback(error, response, rawResponse, _); // We verified callback above.
|
|
1184
|
+
}
|
|
1185
|
+
: undefined;
|
|
1186
|
+
this._log.info('updateDatabaseDdl request %j', request);
|
|
1187
|
+
return this.innerApiCalls
|
|
1188
|
+
.updateDatabaseDdl(request, options, wrappedCallback)
|
|
1189
|
+
?.then(([response, rawResponse, _]) => {
|
|
1190
|
+
this._log.info('updateDatabaseDdl response %j', rawResponse);
|
|
1191
|
+
return [response, rawResponse, _];
|
|
1192
|
+
});
|
|
1193
|
+
}
|
|
1194
|
+
/**
|
|
1195
|
+
* Check the status of the long running operation returned by `updateDatabaseDdl()`.
|
|
1196
|
+
* @param {String} name
|
|
1197
|
+
* The operation name that will be passed.
|
|
1198
|
+
* @returns {Promise} - The promise which resolves to an object.
|
|
1199
|
+
* The decoded operation object has result and metadata field to get information from.
|
|
1200
|
+
* Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation }
|
|
1201
|
+
* for more details and examples.
|
|
1202
|
+
* @example <caption>include:samples/generated/v1/database_admin.update_database_ddl.js</caption>
|
|
1203
|
+
* region_tag:spanner_v1_generated_DatabaseAdmin_UpdateDatabaseDdl_async
|
|
1204
|
+
*/
|
|
1205
|
+
async checkUpdateDatabaseDdlProgress(name) {
|
|
1206
|
+
this._log.info('updateDatabaseDdl long-running');
|
|
1207
|
+
const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({ name });
|
|
1208
|
+
const [operation] = await this.operationsClient.getOperation(request);
|
|
1209
|
+
const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateDatabaseDdl, this._gaxModule.createDefaultBackoffSettings());
|
|
1210
|
+
return decodeOperation;
|
|
1211
|
+
}
|
|
1212
|
+
createBackup(request, optionsOrCallback, callback) {
|
|
1213
|
+
request = request || {};
|
|
1214
|
+
let options;
|
|
1215
|
+
if (typeof optionsOrCallback === 'function' && callback === undefined) {
|
|
1216
|
+
callback = optionsOrCallback;
|
|
1217
|
+
options = {};
|
|
1218
|
+
}
|
|
1219
|
+
else {
|
|
1220
|
+
options = optionsOrCallback;
|
|
1221
|
+
}
|
|
1222
|
+
options = options || {};
|
|
1223
|
+
options.otherArgs = options.otherArgs || {};
|
|
1224
|
+
options.otherArgs.headers = options.otherArgs.headers || {};
|
|
1225
|
+
options.otherArgs.headers['x-goog-request-params'] =
|
|
1226
|
+
this._gaxModule.routingHeader.fromParams({
|
|
1227
|
+
parent: request.parent ?? '',
|
|
1228
|
+
});
|
|
1229
|
+
this.initialize().catch((err) => {
|
|
1230
|
+
throw err;
|
|
1231
|
+
});
|
|
1232
|
+
const wrappedCallback = callback
|
|
1233
|
+
? (error, response, rawResponse, _) => {
|
|
1234
|
+
this._log.info('createBackup response %j', rawResponse);
|
|
1235
|
+
callback(error, response, rawResponse, _); // We verified callback above.
|
|
1236
|
+
}
|
|
1237
|
+
: undefined;
|
|
1238
|
+
this._log.info('createBackup request %j', request);
|
|
1239
|
+
return this.innerApiCalls
|
|
1240
|
+
.createBackup(request, options, wrappedCallback)
|
|
1241
|
+
?.then(([response, rawResponse, _]) => {
|
|
1242
|
+
this._log.info('createBackup response %j', rawResponse);
|
|
1243
|
+
return [response, rawResponse, _];
|
|
1244
|
+
});
|
|
1245
|
+
}
|
|
1246
|
+
/**
|
|
1247
|
+
* Check the status of the long running operation returned by `createBackup()`.
|
|
1248
|
+
* @param {String} name
|
|
1249
|
+
* The operation name that will be passed.
|
|
1250
|
+
* @returns {Promise} - The promise which resolves to an object.
|
|
1251
|
+
* The decoded operation object has result and metadata field to get information from.
|
|
1252
|
+
* Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation }
|
|
1253
|
+
* for more details and examples.
|
|
1254
|
+
* @example <caption>include:samples/generated/v1/database_admin.create_backup.js</caption>
|
|
1255
|
+
* region_tag:spanner_v1_generated_DatabaseAdmin_CreateBackup_async
|
|
1256
|
+
*/
|
|
1257
|
+
async checkCreateBackupProgress(name) {
|
|
1258
|
+
this._log.info('createBackup long-running');
|
|
1259
|
+
const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({ name });
|
|
1260
|
+
const [operation] = await this.operationsClient.getOperation(request);
|
|
1261
|
+
const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createBackup, this._gaxModule.createDefaultBackoffSettings());
|
|
1262
|
+
return decodeOperation;
|
|
1263
|
+
}
|
|
1264
|
+
copyBackup(request, optionsOrCallback, callback) {
|
|
1265
|
+
request = request || {};
|
|
1266
|
+
let options;
|
|
1267
|
+
if (typeof optionsOrCallback === 'function' && callback === undefined) {
|
|
1268
|
+
callback = optionsOrCallback;
|
|
1269
|
+
options = {};
|
|
1270
|
+
}
|
|
1271
|
+
else {
|
|
1272
|
+
options = optionsOrCallback;
|
|
1273
|
+
}
|
|
1274
|
+
options = options || {};
|
|
1275
|
+
options.otherArgs = options.otherArgs || {};
|
|
1276
|
+
options.otherArgs.headers = options.otherArgs.headers || {};
|
|
1277
|
+
options.otherArgs.headers['x-goog-request-params'] =
|
|
1278
|
+
this._gaxModule.routingHeader.fromParams({
|
|
1279
|
+
parent: request.parent ?? '',
|
|
1280
|
+
});
|
|
1281
|
+
this.initialize().catch((err) => {
|
|
1282
|
+
throw err;
|
|
1283
|
+
});
|
|
1284
|
+
const wrappedCallback = callback
|
|
1285
|
+
? (error, response, rawResponse, _) => {
|
|
1286
|
+
this._log.info('copyBackup response %j', rawResponse);
|
|
1287
|
+
callback(error, response, rawResponse, _); // We verified callback above.
|
|
1288
|
+
}
|
|
1289
|
+
: undefined;
|
|
1290
|
+
this._log.info('copyBackup request %j', request);
|
|
1291
|
+
return this.innerApiCalls
|
|
1292
|
+
.copyBackup(request, options, wrappedCallback)
|
|
1293
|
+
?.then(([response, rawResponse, _]) => {
|
|
1294
|
+
this._log.info('copyBackup response %j', rawResponse);
|
|
1295
|
+
return [response, rawResponse, _];
|
|
1296
|
+
});
|
|
1297
|
+
}
|
|
1298
|
+
/**
|
|
1299
|
+
* Check the status of the long running operation returned by `copyBackup()`.
|
|
1300
|
+
* @param {String} name
|
|
1301
|
+
* The operation name that will be passed.
|
|
1302
|
+
* @returns {Promise} - The promise which resolves to an object.
|
|
1303
|
+
* The decoded operation object has result and metadata field to get information from.
|
|
1304
|
+
* Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation }
|
|
1305
|
+
* for more details and examples.
|
|
1306
|
+
* @example <caption>include:samples/generated/v1/database_admin.copy_backup.js</caption>
|
|
1307
|
+
* region_tag:spanner_v1_generated_DatabaseAdmin_CopyBackup_async
|
|
1308
|
+
*/
|
|
1309
|
+
async checkCopyBackupProgress(name) {
|
|
1310
|
+
this._log.info('copyBackup long-running');
|
|
1311
|
+
const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({ name });
|
|
1312
|
+
const [operation] = await this.operationsClient.getOperation(request);
|
|
1313
|
+
const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.copyBackup, this._gaxModule.createDefaultBackoffSettings());
|
|
1314
|
+
return decodeOperation;
|
|
1315
|
+
}
|
|
1316
|
+
restoreDatabase(request, optionsOrCallback, callback) {
|
|
1317
|
+
request = request || {};
|
|
1318
|
+
let options;
|
|
1319
|
+
if (typeof optionsOrCallback === 'function' && callback === undefined) {
|
|
1320
|
+
callback = optionsOrCallback;
|
|
1321
|
+
options = {};
|
|
1322
|
+
}
|
|
1323
|
+
else {
|
|
1324
|
+
options = optionsOrCallback;
|
|
1325
|
+
}
|
|
1326
|
+
options = options || {};
|
|
1327
|
+
options.otherArgs = options.otherArgs || {};
|
|
1328
|
+
options.otherArgs.headers = options.otherArgs.headers || {};
|
|
1329
|
+
options.otherArgs.headers['x-goog-request-params'] =
|
|
1330
|
+
this._gaxModule.routingHeader.fromParams({
|
|
1331
|
+
parent: request.parent ?? '',
|
|
1332
|
+
});
|
|
1333
|
+
this.initialize().catch((err) => {
|
|
1334
|
+
throw err;
|
|
1335
|
+
});
|
|
1336
|
+
const wrappedCallback = callback
|
|
1337
|
+
? (error, response, rawResponse, _) => {
|
|
1338
|
+
this._log.info('restoreDatabase response %j', rawResponse);
|
|
1339
|
+
callback(error, response, rawResponse, _); // We verified callback above.
|
|
1340
|
+
}
|
|
1341
|
+
: undefined;
|
|
1342
|
+
this._log.info('restoreDatabase request %j', request);
|
|
1343
|
+
return this.innerApiCalls
|
|
1344
|
+
.restoreDatabase(request, options, wrappedCallback)
|
|
1345
|
+
?.then(([response, rawResponse, _]) => {
|
|
1346
|
+
this._log.info('restoreDatabase response %j', rawResponse);
|
|
1347
|
+
return [response, rawResponse, _];
|
|
1348
|
+
});
|
|
1349
|
+
}
|
|
1350
|
+
/**
|
|
1351
|
+
* Check the status of the long running operation returned by `restoreDatabase()`.
|
|
1352
|
+
* @param {String} name
|
|
1353
|
+
* The operation name that will be passed.
|
|
1354
|
+
* @returns {Promise} - The promise which resolves to an object.
|
|
1355
|
+
* The decoded operation object has result and metadata field to get information from.
|
|
1356
|
+
* Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation }
|
|
1357
|
+
* for more details and examples.
|
|
1358
|
+
* @example <caption>include:samples/generated/v1/database_admin.restore_database.js</caption>
|
|
1359
|
+
* region_tag:spanner_v1_generated_DatabaseAdmin_RestoreDatabase_async
|
|
1360
|
+
*/
|
|
1361
|
+
async checkRestoreDatabaseProgress(name) {
|
|
1362
|
+
this._log.info('restoreDatabase long-running');
|
|
1363
|
+
const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({ name });
|
|
1364
|
+
const [operation] = await this.operationsClient.getOperation(request);
|
|
1365
|
+
const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.restoreDatabase, this._gaxModule.createDefaultBackoffSettings());
|
|
1366
|
+
return decodeOperation;
|
|
1367
|
+
}
|
|
1368
|
+
listDatabases(request, optionsOrCallback, callback) {
|
|
1369
|
+
request = request || {};
|
|
1370
|
+
let options;
|
|
1371
|
+
if (typeof optionsOrCallback === 'function' && callback === undefined) {
|
|
1372
|
+
callback = optionsOrCallback;
|
|
1373
|
+
options = {};
|
|
1374
|
+
}
|
|
1375
|
+
else {
|
|
1376
|
+
options = optionsOrCallback;
|
|
1377
|
+
}
|
|
1378
|
+
options = options || {};
|
|
1379
|
+
options.otherArgs = options.otherArgs || {};
|
|
1380
|
+
options.otherArgs.headers = options.otherArgs.headers || {};
|
|
1381
|
+
options.otherArgs.headers['x-goog-request-params'] =
|
|
1382
|
+
this._gaxModule.routingHeader.fromParams({
|
|
1383
|
+
parent: request.parent ?? '',
|
|
1384
|
+
});
|
|
1385
|
+
this.initialize().catch((err) => {
|
|
1386
|
+
throw err;
|
|
1387
|
+
});
|
|
1388
|
+
const wrappedCallback = callback
|
|
1389
|
+
? (error, values, nextPageRequest, rawResponse) => {
|
|
1390
|
+
this._log.info('listDatabases values %j', values);
|
|
1391
|
+
callback(error, values, nextPageRequest, rawResponse); // We verified callback above.
|
|
1392
|
+
}
|
|
1393
|
+
: undefined;
|
|
1394
|
+
this._log.info('listDatabases request %j', request);
|
|
1395
|
+
return this.innerApiCalls
|
|
1396
|
+
.listDatabases(request, options, wrappedCallback)
|
|
1397
|
+
?.then(([response, input, output]) => {
|
|
1398
|
+
this._log.info('listDatabases values %j', response);
|
|
1399
|
+
return [response, input, output];
|
|
1400
|
+
});
|
|
1401
|
+
}
|
|
1402
|
+
/**
|
|
1403
|
+
* Equivalent to `listDatabases`, but returns a NodeJS Stream object.
|
|
1404
|
+
* @param {Object} request
|
|
1405
|
+
* The request object that will be sent.
|
|
1406
|
+
* @param {string} request.parent
|
|
1407
|
+
* Required. The instance whose databases should be listed.
|
|
1408
|
+
* Values are of the form `projects/<project>/instances/<instance>`.
|
|
1409
|
+
* @param {number} request.pageSize
|
|
1410
|
+
* Number of databases to be returned in the response. If 0 or less,
|
|
1411
|
+
* defaults to the server's maximum allowed page size.
|
|
1412
|
+
* @param {string} request.pageToken
|
|
1413
|
+
* If non-empty, `page_token` should contain a
|
|
1414
|
+
* {@link protos.google.spanner.admin.database.v1.ListDatabasesResponse.next_page_token|next_page_token}
|
|
1415
|
+
* from a previous
|
|
1416
|
+
* {@link protos.google.spanner.admin.database.v1.ListDatabasesResponse|ListDatabasesResponse}.
|
|
1417
|
+
* @param {object} [options]
|
|
1418
|
+
* Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
|
|
1419
|
+
* @returns {Stream}
|
|
1420
|
+
* An object stream which emits an object representing {@link protos.google.spanner.admin.database.v1.Database|Database} on 'data' event.
|
|
1421
|
+
* The client library will perform auto-pagination by default: it will call the API as many
|
|
1422
|
+
* times as needed. Note that it can affect your quota.
|
|
1423
|
+
* We recommend using `listDatabasesAsync()`
|
|
1424
|
+
* method described below for async iteration which you can stop as needed.
|
|
1425
|
+
* Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation }
|
|
1426
|
+
* for more details and examples.
|
|
1427
|
+
*/
|
|
1428
|
+
listDatabasesStream(request, options) {
|
|
1429
|
+
request = request || {};
|
|
1430
|
+
options = options || {};
|
|
1431
|
+
options.otherArgs = options.otherArgs || {};
|
|
1432
|
+
options.otherArgs.headers = options.otherArgs.headers || {};
|
|
1433
|
+
options.otherArgs.headers['x-goog-request-params'] =
|
|
1434
|
+
this._gaxModule.routingHeader.fromParams({
|
|
1435
|
+
parent: request.parent ?? '',
|
|
1436
|
+
});
|
|
1437
|
+
const defaultCallSettings = this._defaults['listDatabases'];
|
|
1438
|
+
const callSettings = defaultCallSettings.merge(options);
|
|
1439
|
+
this.initialize().catch((err) => {
|
|
1440
|
+
throw err;
|
|
1441
|
+
});
|
|
1442
|
+
this._log.info('listDatabases stream %j', request);
|
|
1443
|
+
return this.descriptors.page.listDatabases.createStream(this.innerApiCalls.listDatabases, request, callSettings);
|
|
1444
|
+
}
|
|
1445
|
+
/**
|
|
1446
|
+
* Equivalent to `listDatabases`, but returns an iterable object.
|
|
1447
|
+
*
|
|
1448
|
+
* `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand.
|
|
1449
|
+
* @param {Object} request
|
|
1450
|
+
* The request object that will be sent.
|
|
1451
|
+
* @param {string} request.parent
|
|
1452
|
+
* Required. The instance whose databases should be listed.
|
|
1453
|
+
* Values are of the form `projects/<project>/instances/<instance>`.
|
|
1454
|
+
* @param {number} request.pageSize
|
|
1455
|
+
* Number of databases to be returned in the response. If 0 or less,
|
|
1456
|
+
* defaults to the server's maximum allowed page size.
|
|
1457
|
+
* @param {string} request.pageToken
|
|
1458
|
+
* If non-empty, `page_token` should contain a
|
|
1459
|
+
* {@link protos.google.spanner.admin.database.v1.ListDatabasesResponse.next_page_token|next_page_token}
|
|
1460
|
+
* from a previous
|
|
1461
|
+
* {@link protos.google.spanner.admin.database.v1.ListDatabasesResponse|ListDatabasesResponse}.
|
|
1462
|
+
* @param {object} [options]
|
|
1463
|
+
* Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
|
|
1464
|
+
* @returns {Object}
|
|
1465
|
+
* An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }.
|
|
1466
|
+
* When you iterate the returned iterable, each element will be an object representing
|
|
1467
|
+
* {@link protos.google.spanner.admin.database.v1.Database|Database}. The API will be called under the hood as needed, once per the page,
|
|
1468
|
+
* so you can stop the iteration when you don't need more results.
|
|
1469
|
+
* Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation }
|
|
1470
|
+
* for more details and examples.
|
|
1471
|
+
* @example <caption>include:samples/generated/v1/database_admin.list_databases.js</caption>
|
|
1472
|
+
* region_tag:spanner_v1_generated_DatabaseAdmin_ListDatabases_async
|
|
1473
|
+
*/
|
|
1474
|
+
listDatabasesAsync(request, options) {
|
|
1475
|
+
request = request || {};
|
|
1476
|
+
options = options || {};
|
|
1477
|
+
options.otherArgs = options.otherArgs || {};
|
|
1478
|
+
options.otherArgs.headers = options.otherArgs.headers || {};
|
|
1479
|
+
options.otherArgs.headers['x-goog-request-params'] =
|
|
1480
|
+
this._gaxModule.routingHeader.fromParams({
|
|
1481
|
+
parent: request.parent ?? '',
|
|
1482
|
+
});
|
|
1483
|
+
const defaultCallSettings = this._defaults['listDatabases'];
|
|
1484
|
+
const callSettings = defaultCallSettings.merge(options);
|
|
1485
|
+
this.initialize().catch((err) => {
|
|
1486
|
+
throw err;
|
|
1487
|
+
});
|
|
1488
|
+
this._log.info('listDatabases iterate %j', request);
|
|
1489
|
+
return this.descriptors.page.listDatabases.asyncIterate(this.innerApiCalls['listDatabases'], request, callSettings);
|
|
1490
|
+
}
|
|
1491
|
+
listBackups(request, optionsOrCallback, callback) {
|
|
1492
|
+
request = request || {};
|
|
1493
|
+
let options;
|
|
1494
|
+
if (typeof optionsOrCallback === 'function' && callback === undefined) {
|
|
1495
|
+
callback = optionsOrCallback;
|
|
1496
|
+
options = {};
|
|
1497
|
+
}
|
|
1498
|
+
else {
|
|
1499
|
+
options = optionsOrCallback;
|
|
1500
|
+
}
|
|
1501
|
+
options = options || {};
|
|
1502
|
+
options.otherArgs = options.otherArgs || {};
|
|
1503
|
+
options.otherArgs.headers = options.otherArgs.headers || {};
|
|
1504
|
+
options.otherArgs.headers['x-goog-request-params'] =
|
|
1505
|
+
this._gaxModule.routingHeader.fromParams({
|
|
1506
|
+
parent: request.parent ?? '',
|
|
1507
|
+
});
|
|
1508
|
+
this.initialize().catch((err) => {
|
|
1509
|
+
throw err;
|
|
1510
|
+
});
|
|
1511
|
+
const wrappedCallback = callback
|
|
1512
|
+
? (error, values, nextPageRequest, rawResponse) => {
|
|
1513
|
+
this._log.info('listBackups values %j', values);
|
|
1514
|
+
callback(error, values, nextPageRequest, rawResponse); // We verified callback above.
|
|
1515
|
+
}
|
|
1516
|
+
: undefined;
|
|
1517
|
+
this._log.info('listBackups request %j', request);
|
|
1518
|
+
return this.innerApiCalls
|
|
1519
|
+
.listBackups(request, options, wrappedCallback)
|
|
1520
|
+
?.then(([response, input, output]) => {
|
|
1521
|
+
this._log.info('listBackups values %j', response);
|
|
1522
|
+
return [response, input, output];
|
|
1523
|
+
});
|
|
1524
|
+
}
|
|
1525
|
+
/**
|
|
1526
|
+
* Equivalent to `listBackups`, but returns a NodeJS Stream object.
|
|
1527
|
+
* @param {Object} request
|
|
1528
|
+
* The request object that will be sent.
|
|
1529
|
+
* @param {string} request.parent
|
|
1530
|
+
* Required. The instance to list backups from. Values are of the
|
|
1531
|
+
* form `projects/<project>/instances/<instance>`.
|
|
1532
|
+
* @param {string} request.filter
|
|
1533
|
+
* An expression that filters the list of returned backups.
|
|
1534
|
+
*
|
|
1535
|
+
* A filter expression consists of a field name, a comparison operator, and a
|
|
1536
|
+
* value for filtering.
|
|
1537
|
+
* The value must be a string, a number, or a boolean. The comparison operator
|
|
1538
|
+
* must be one of: `<`, `>`, `<=`, `>=`, `!=`, `=`, or `:`.
|
|
1539
|
+
* Colon `:` is the contains operator. Filter rules are not case sensitive.
|
|
1540
|
+
*
|
|
1541
|
+
* The following fields in the
|
|
1542
|
+
* {@link protos.google.spanner.admin.database.v1.Backup|Backup} are eligible for
|
|
1543
|
+
* filtering:
|
|
1544
|
+
*
|
|
1545
|
+
* * `name`
|
|
1546
|
+
* * `database`
|
|
1547
|
+
* * `state`
|
|
1548
|
+
* * `create_time` (and values are of the format YYYY-MM-DDTHH:MM:SSZ)
|
|
1549
|
+
* * `expire_time` (and values are of the format YYYY-MM-DDTHH:MM:SSZ)
|
|
1550
|
+
* * `version_time` (and values are of the format YYYY-MM-DDTHH:MM:SSZ)
|
|
1551
|
+
* * `size_bytes`
|
|
1552
|
+
* * `backup_schedules`
|
|
1553
|
+
*
|
|
1554
|
+
* You can combine multiple expressions by enclosing each expression in
|
|
1555
|
+
* parentheses. By default, expressions are combined with AND logic, but
|
|
1556
|
+
* you can specify AND, OR, and NOT logic explicitly.
|
|
1557
|
+
*
|
|
1558
|
+
* Here are a few examples:
|
|
1559
|
+
*
|
|
1560
|
+
* * `name:Howl` - The backup's name contains the string "howl".
|
|
1561
|
+
* * `database:prod`
|
|
1562
|
+
* - The database's name contains the string "prod".
|
|
1563
|
+
* * `state:CREATING` - The backup is pending creation.
|
|
1564
|
+
* * `state:READY` - The backup is fully created and ready for use.
|
|
1565
|
+
* * `(name:howl) AND (create_time < \"2018-03-28T14:50:00Z\")`
|
|
1566
|
+
* - The backup name contains the string "howl" and `create_time`
|
|
1567
|
+
* of the backup is before 2018-03-28T14:50:00Z.
|
|
1568
|
+
* * `expire_time < \"2018-03-28T14:50:00Z\"`
|
|
1569
|
+
* - The backup `expire_time` is before 2018-03-28T14:50:00Z.
|
|
1570
|
+
* * `size_bytes > 10000000000` - The backup's size is greater than 10GB
|
|
1571
|
+
* * `backup_schedules:daily`
|
|
1572
|
+
* - The backup is created from a schedule with "daily" in its name.
|
|
1573
|
+
* @param {number} request.pageSize
|
|
1574
|
+
* Number of backups to be returned in the response. If 0 or
|
|
1575
|
+
* less, defaults to the server's maximum allowed page size.
|
|
1576
|
+
* @param {string} request.pageToken
|
|
1577
|
+
* If non-empty, `page_token` should contain a
|
|
1578
|
+
* {@link protos.google.spanner.admin.database.v1.ListBackupsResponse.next_page_token|next_page_token}
|
|
1579
|
+
* from a previous
|
|
1580
|
+
* {@link protos.google.spanner.admin.database.v1.ListBackupsResponse|ListBackupsResponse}
|
|
1581
|
+
* to the same `parent` and with the same `filter`.
|
|
1582
|
+
* @param {object} [options]
|
|
1583
|
+
* Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
|
|
1584
|
+
* @returns {Stream}
|
|
1585
|
+
* An object stream which emits an object representing {@link protos.google.spanner.admin.database.v1.Backup|Backup} on 'data' event.
|
|
1586
|
+
* The client library will perform auto-pagination by default: it will call the API as many
|
|
1587
|
+
* times as needed. Note that it can affect your quota.
|
|
1588
|
+
* We recommend using `listBackupsAsync()`
|
|
1589
|
+
* method described below for async iteration which you can stop as needed.
|
|
1590
|
+
* Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation }
|
|
1591
|
+
* for more details and examples.
|
|
1592
|
+
*/
|
|
1593
|
+
listBackupsStream(request, options) {
|
|
1594
|
+
request = request || {};
|
|
1595
|
+
options = options || {};
|
|
1596
|
+
options.otherArgs = options.otherArgs || {};
|
|
1597
|
+
options.otherArgs.headers = options.otherArgs.headers || {};
|
|
1598
|
+
options.otherArgs.headers['x-goog-request-params'] =
|
|
1599
|
+
this._gaxModule.routingHeader.fromParams({
|
|
1600
|
+
parent: request.parent ?? '',
|
|
1601
|
+
});
|
|
1602
|
+
const defaultCallSettings = this._defaults['listBackups'];
|
|
1603
|
+
const callSettings = defaultCallSettings.merge(options);
|
|
1604
|
+
this.initialize().catch((err) => {
|
|
1605
|
+
throw err;
|
|
1606
|
+
});
|
|
1607
|
+
this._log.info('listBackups stream %j', request);
|
|
1608
|
+
return this.descriptors.page.listBackups.createStream(this.innerApiCalls.listBackups, request, callSettings);
|
|
1609
|
+
}
|
|
1610
|
+
/**
|
|
1611
|
+
* Equivalent to `listBackups`, but returns an iterable object.
|
|
1612
|
+
*
|
|
1613
|
+
* `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand.
|
|
1614
|
+
* @param {Object} request
|
|
1615
|
+
* The request object that will be sent.
|
|
1616
|
+
* @param {string} request.parent
|
|
1617
|
+
* Required. The instance to list backups from. Values are of the
|
|
1618
|
+
* form `projects/<project>/instances/<instance>`.
|
|
1619
|
+
* @param {string} request.filter
|
|
1620
|
+
* An expression that filters the list of returned backups.
|
|
1621
|
+
*
|
|
1622
|
+
* A filter expression consists of a field name, a comparison operator, and a
|
|
1623
|
+
* value for filtering.
|
|
1624
|
+
* The value must be a string, a number, or a boolean. The comparison operator
|
|
1625
|
+
* must be one of: `<`, `>`, `<=`, `>=`, `!=`, `=`, or `:`.
|
|
1626
|
+
* Colon `:` is the contains operator. Filter rules are not case sensitive.
|
|
1627
|
+
*
|
|
1628
|
+
* The following fields in the
|
|
1629
|
+
* {@link protos.google.spanner.admin.database.v1.Backup|Backup} are eligible for
|
|
1630
|
+
* filtering:
|
|
1631
|
+
*
|
|
1632
|
+
* * `name`
|
|
1633
|
+
* * `database`
|
|
1634
|
+
* * `state`
|
|
1635
|
+
* * `create_time` (and values are of the format YYYY-MM-DDTHH:MM:SSZ)
|
|
1636
|
+
* * `expire_time` (and values are of the format YYYY-MM-DDTHH:MM:SSZ)
|
|
1637
|
+
* * `version_time` (and values are of the format YYYY-MM-DDTHH:MM:SSZ)
|
|
1638
|
+
* * `size_bytes`
|
|
1639
|
+
* * `backup_schedules`
|
|
1640
|
+
*
|
|
1641
|
+
* You can combine multiple expressions by enclosing each expression in
|
|
1642
|
+
* parentheses. By default, expressions are combined with AND logic, but
|
|
1643
|
+
* you can specify AND, OR, and NOT logic explicitly.
|
|
1644
|
+
*
|
|
1645
|
+
* Here are a few examples:
|
|
1646
|
+
*
|
|
1647
|
+
* * `name:Howl` - The backup's name contains the string "howl".
|
|
1648
|
+
* * `database:prod`
|
|
1649
|
+
* - The database's name contains the string "prod".
|
|
1650
|
+
* * `state:CREATING` - The backup is pending creation.
|
|
1651
|
+
* * `state:READY` - The backup is fully created and ready for use.
|
|
1652
|
+
* * `(name:howl) AND (create_time < \"2018-03-28T14:50:00Z\")`
|
|
1653
|
+
* - The backup name contains the string "howl" and `create_time`
|
|
1654
|
+
* of the backup is before 2018-03-28T14:50:00Z.
|
|
1655
|
+
* * `expire_time < \"2018-03-28T14:50:00Z\"`
|
|
1656
|
+
* - The backup `expire_time` is before 2018-03-28T14:50:00Z.
|
|
1657
|
+
* * `size_bytes > 10000000000` - The backup's size is greater than 10GB
|
|
1658
|
+
* * `backup_schedules:daily`
|
|
1659
|
+
* - The backup is created from a schedule with "daily" in its name.
|
|
1660
|
+
* @param {number} request.pageSize
|
|
1661
|
+
* Number of backups to be returned in the response. If 0 or
|
|
1662
|
+
* less, defaults to the server's maximum allowed page size.
|
|
1663
|
+
* @param {string} request.pageToken
|
|
1664
|
+
* If non-empty, `page_token` should contain a
|
|
1665
|
+
* {@link protos.google.spanner.admin.database.v1.ListBackupsResponse.next_page_token|next_page_token}
|
|
1666
|
+
* from a previous
|
|
1667
|
+
* {@link protos.google.spanner.admin.database.v1.ListBackupsResponse|ListBackupsResponse}
|
|
1668
|
+
* to the same `parent` and with the same `filter`.
|
|
1669
|
+
* @param {object} [options]
|
|
1670
|
+
* Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
|
|
1671
|
+
* @returns {Object}
|
|
1672
|
+
* An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }.
|
|
1673
|
+
* When you iterate the returned iterable, each element will be an object representing
|
|
1674
|
+
* {@link protos.google.spanner.admin.database.v1.Backup|Backup}. The API will be called under the hood as needed, once per the page,
|
|
1675
|
+
* so you can stop the iteration when you don't need more results.
|
|
1676
|
+
* Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation }
|
|
1677
|
+
* for more details and examples.
|
|
1678
|
+
* @example <caption>include:samples/generated/v1/database_admin.list_backups.js</caption>
|
|
1679
|
+
* region_tag:spanner_v1_generated_DatabaseAdmin_ListBackups_async
|
|
1680
|
+
*/
|
|
1681
|
+
listBackupsAsync(request, options) {
|
|
1682
|
+
request = request || {};
|
|
1683
|
+
options = options || {};
|
|
1684
|
+
options.otherArgs = options.otherArgs || {};
|
|
1685
|
+
options.otherArgs.headers = options.otherArgs.headers || {};
|
|
1686
|
+
options.otherArgs.headers['x-goog-request-params'] =
|
|
1687
|
+
this._gaxModule.routingHeader.fromParams({
|
|
1688
|
+
parent: request.parent ?? '',
|
|
1689
|
+
});
|
|
1690
|
+
const defaultCallSettings = this._defaults['listBackups'];
|
|
1691
|
+
const callSettings = defaultCallSettings.merge(options);
|
|
1692
|
+
this.initialize().catch((err) => {
|
|
1693
|
+
throw err;
|
|
1694
|
+
});
|
|
1695
|
+
this._log.info('listBackups iterate %j', request);
|
|
1696
|
+
return this.descriptors.page.listBackups.asyncIterate(this.innerApiCalls['listBackups'], request, callSettings);
|
|
1697
|
+
}
|
|
1698
|
+
listDatabaseOperations(request, optionsOrCallback, callback) {
|
|
1699
|
+
request = request || {};
|
|
1700
|
+
let options;
|
|
1701
|
+
if (typeof optionsOrCallback === 'function' && callback === undefined) {
|
|
1702
|
+
callback = optionsOrCallback;
|
|
1703
|
+
options = {};
|
|
1704
|
+
}
|
|
1705
|
+
else {
|
|
1706
|
+
options = optionsOrCallback;
|
|
1707
|
+
}
|
|
1708
|
+
options = options || {};
|
|
1709
|
+
options.otherArgs = options.otherArgs || {};
|
|
1710
|
+
options.otherArgs.headers = options.otherArgs.headers || {};
|
|
1711
|
+
options.otherArgs.headers['x-goog-request-params'] =
|
|
1712
|
+
this._gaxModule.routingHeader.fromParams({
|
|
1713
|
+
parent: request.parent ?? '',
|
|
1714
|
+
});
|
|
1715
|
+
this.initialize().catch((err) => {
|
|
1716
|
+
throw err;
|
|
1717
|
+
});
|
|
1718
|
+
const wrappedCallback = callback
|
|
1719
|
+
? (error, values, nextPageRequest, rawResponse) => {
|
|
1720
|
+
this._log.info('listDatabaseOperations values %j', values);
|
|
1721
|
+
callback(error, values, nextPageRequest, rawResponse); // We verified callback above.
|
|
1722
|
+
}
|
|
1723
|
+
: undefined;
|
|
1724
|
+
this._log.info('listDatabaseOperations request %j', request);
|
|
1725
|
+
return this.innerApiCalls
|
|
1726
|
+
.listDatabaseOperations(request, options, wrappedCallback)
|
|
1727
|
+
?.then(([response, input, output]) => {
|
|
1728
|
+
this._log.info('listDatabaseOperations values %j', response);
|
|
1729
|
+
return [response, input, output];
|
|
1730
|
+
});
|
|
1731
|
+
}
|
|
1732
|
+
/**
|
|
1733
|
+
* Equivalent to `listDatabaseOperations`, but returns a NodeJS Stream object.
|
|
1734
|
+
* @param {Object} request
|
|
1735
|
+
* The request object that will be sent.
|
|
1736
|
+
* @param {string} request.parent
|
|
1737
|
+
* Required. The instance of the database operations.
|
|
1738
|
+
* Values are of the form `projects/<project>/instances/<instance>`.
|
|
1739
|
+
* @param {string} request.filter
|
|
1740
|
+
* An expression that filters the list of returned operations.
|
|
1741
|
+
*
|
|
1742
|
+
* A filter expression consists of a field name, a
|
|
1743
|
+
* comparison operator, and a value for filtering.
|
|
1744
|
+
* The value must be a string, a number, or a boolean. The comparison operator
|
|
1745
|
+
* must be one of: `<`, `>`, `<=`, `>=`, `!=`, `=`, or `:`.
|
|
1746
|
+
* Colon `:` is the contains operator. Filter rules are not case sensitive.
|
|
1747
|
+
*
|
|
1748
|
+
* The following fields in the {@link protos.google.longrunning.Operation|Operation}
|
|
1749
|
+
* are eligible for filtering:
|
|
1750
|
+
*
|
|
1751
|
+
* * `name` - The name of the long-running operation
|
|
1752
|
+
* * `done` - False if the operation is in progress, else true.
|
|
1753
|
+
* * `metadata.@type` - the type of metadata. For example, the type string
|
|
1754
|
+
* for
|
|
1755
|
+
* {@link protos.google.spanner.admin.database.v1.RestoreDatabaseMetadata|RestoreDatabaseMetadata}
|
|
1756
|
+
* is
|
|
1757
|
+
* `type.googleapis.com/google.spanner.admin.database.v1.RestoreDatabaseMetadata`.
|
|
1758
|
+
* * `metadata.<field_name>` - any field in metadata.value.
|
|
1759
|
+
* `metadata.@type` must be specified first, if filtering on metadata
|
|
1760
|
+
* fields.
|
|
1761
|
+
* * `error` - Error associated with the long-running operation.
|
|
1762
|
+
* * `response.@type` - the type of response.
|
|
1763
|
+
* * `response.<field_name>` - any field in response.value.
|
|
1764
|
+
*
|
|
1765
|
+
* You can combine multiple expressions by enclosing each expression in
|
|
1766
|
+
* parentheses. By default, expressions are combined with AND logic. However,
|
|
1767
|
+
* you can specify AND, OR, and NOT logic explicitly.
|
|
1768
|
+
*
|
|
1769
|
+
* Here are a few examples:
|
|
1770
|
+
*
|
|
1771
|
+
* * `done:true` - The operation is complete.
|
|
1772
|
+
* * `(metadata.@type=type.googleapis.com/google.spanner.admin.database.v1.RestoreDatabaseMetadata) AND` \
|
|
1773
|
+
* `(metadata.source_type:BACKUP) AND` \
|
|
1774
|
+
* `(metadata.backup_info.backup:backup_howl) AND` \
|
|
1775
|
+
* `(metadata.name:restored_howl) AND` \
|
|
1776
|
+
* `(metadata.progress.start_time < \"2018-03-28T14:50:00Z\") AND` \
|
|
1777
|
+
* `(error:*)` - Return operations where:
|
|
1778
|
+
* * The operation's metadata type is
|
|
1779
|
+
* {@link protos.google.spanner.admin.database.v1.RestoreDatabaseMetadata|RestoreDatabaseMetadata}.
|
|
1780
|
+
* * The database is restored from a backup.
|
|
1781
|
+
* * The backup name contains "backup_howl".
|
|
1782
|
+
* * The restored database's name contains "restored_howl".
|
|
1783
|
+
* * The operation started before 2018-03-28T14:50:00Z.
|
|
1784
|
+
* * The operation resulted in an error.
|
|
1785
|
+
* @param {number} request.pageSize
|
|
1786
|
+
* Number of operations to be returned in the response. If 0 or
|
|
1787
|
+
* less, defaults to the server's maximum allowed page size.
|
|
1788
|
+
* @param {string} request.pageToken
|
|
1789
|
+
* If non-empty, `page_token` should contain a
|
|
1790
|
+
* {@link protos.google.spanner.admin.database.v1.ListDatabaseOperationsResponse.next_page_token|next_page_token}
|
|
1791
|
+
* from a previous
|
|
1792
|
+
* {@link protos.google.spanner.admin.database.v1.ListDatabaseOperationsResponse|ListDatabaseOperationsResponse}
|
|
1793
|
+
* to the same `parent` and with the same `filter`.
|
|
1794
|
+
* @param {object} [options]
|
|
1795
|
+
* Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
|
|
1796
|
+
* @returns {Stream}
|
|
1797
|
+
* An object stream which emits an object representing {@link protos.google.longrunning.Operation|Operation} on 'data' event.
|
|
1798
|
+
* The client library will perform auto-pagination by default: it will call the API as many
|
|
1799
|
+
* times as needed. Note that it can affect your quota.
|
|
1800
|
+
* We recommend using `listDatabaseOperationsAsync()`
|
|
1801
|
+
* method described below for async iteration which you can stop as needed.
|
|
1802
|
+
* Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation }
|
|
1803
|
+
* for more details and examples.
|
|
1804
|
+
*/
|
|
1805
|
+
listDatabaseOperationsStream(request, options) {
|
|
1806
|
+
request = request || {};
|
|
1807
|
+
options = options || {};
|
|
1808
|
+
options.otherArgs = options.otherArgs || {};
|
|
1809
|
+
options.otherArgs.headers = options.otherArgs.headers || {};
|
|
1810
|
+
options.otherArgs.headers['x-goog-request-params'] =
|
|
1811
|
+
this._gaxModule.routingHeader.fromParams({
|
|
1812
|
+
parent: request.parent ?? '',
|
|
1813
|
+
});
|
|
1814
|
+
const defaultCallSettings = this._defaults['listDatabaseOperations'];
|
|
1815
|
+
const callSettings = defaultCallSettings.merge(options);
|
|
1816
|
+
this.initialize().catch((err) => {
|
|
1817
|
+
throw err;
|
|
1818
|
+
});
|
|
1819
|
+
this._log.info('listDatabaseOperations stream %j', request);
|
|
1820
|
+
return this.descriptors.page.listDatabaseOperations.createStream(this.innerApiCalls.listDatabaseOperations, request, callSettings);
|
|
1821
|
+
}
|
|
1822
|
+
/**
|
|
1823
|
+
* Equivalent to `listDatabaseOperations`, but returns an iterable object.
|
|
1824
|
+
*
|
|
1825
|
+
* `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand.
|
|
1826
|
+
* @param {Object} request
|
|
1827
|
+
* The request object that will be sent.
|
|
1828
|
+
* @param {string} request.parent
|
|
1829
|
+
* Required. The instance of the database operations.
|
|
1830
|
+
* Values are of the form `projects/<project>/instances/<instance>`.
|
|
1831
|
+
* @param {string} request.filter
|
|
1832
|
+
* An expression that filters the list of returned operations.
|
|
1833
|
+
*
|
|
1834
|
+
* A filter expression consists of a field name, a
|
|
1835
|
+
* comparison operator, and a value for filtering.
|
|
1836
|
+
* The value must be a string, a number, or a boolean. The comparison operator
|
|
1837
|
+
* must be one of: `<`, `>`, `<=`, `>=`, `!=`, `=`, or `:`.
|
|
1838
|
+
* Colon `:` is the contains operator. Filter rules are not case sensitive.
|
|
1839
|
+
*
|
|
1840
|
+
* The following fields in the {@link protos.google.longrunning.Operation|Operation}
|
|
1841
|
+
* are eligible for filtering:
|
|
1842
|
+
*
|
|
1843
|
+
* * `name` - The name of the long-running operation
|
|
1844
|
+
* * `done` - False if the operation is in progress, else true.
|
|
1845
|
+
* * `metadata.@type` - the type of metadata. For example, the type string
|
|
1846
|
+
* for
|
|
1847
|
+
* {@link protos.google.spanner.admin.database.v1.RestoreDatabaseMetadata|RestoreDatabaseMetadata}
|
|
1848
|
+
* is
|
|
1849
|
+
* `type.googleapis.com/google.spanner.admin.database.v1.RestoreDatabaseMetadata`.
|
|
1850
|
+
* * `metadata.<field_name>` - any field in metadata.value.
|
|
1851
|
+
* `metadata.@type` must be specified first, if filtering on metadata
|
|
1852
|
+
* fields.
|
|
1853
|
+
* * `error` - Error associated with the long-running operation.
|
|
1854
|
+
* * `response.@type` - the type of response.
|
|
1855
|
+
* * `response.<field_name>` - any field in response.value.
|
|
1856
|
+
*
|
|
1857
|
+
* You can combine multiple expressions by enclosing each expression in
|
|
1858
|
+
* parentheses. By default, expressions are combined with AND logic. However,
|
|
1859
|
+
* you can specify AND, OR, and NOT logic explicitly.
|
|
1860
|
+
*
|
|
1861
|
+
* Here are a few examples:
|
|
1862
|
+
*
|
|
1863
|
+
* * `done:true` - The operation is complete.
|
|
1864
|
+
* * `(metadata.@type=type.googleapis.com/google.spanner.admin.database.v1.RestoreDatabaseMetadata) AND` \
|
|
1865
|
+
* `(metadata.source_type:BACKUP) AND` \
|
|
1866
|
+
* `(metadata.backup_info.backup:backup_howl) AND` \
|
|
1867
|
+
* `(metadata.name:restored_howl) AND` \
|
|
1868
|
+
* `(metadata.progress.start_time < \"2018-03-28T14:50:00Z\") AND` \
|
|
1869
|
+
* `(error:*)` - Return operations where:
|
|
1870
|
+
* * The operation's metadata type is
|
|
1871
|
+
* {@link protos.google.spanner.admin.database.v1.RestoreDatabaseMetadata|RestoreDatabaseMetadata}.
|
|
1872
|
+
* * The database is restored from a backup.
|
|
1873
|
+
* * The backup name contains "backup_howl".
|
|
1874
|
+
* * The restored database's name contains "restored_howl".
|
|
1875
|
+
* * The operation started before 2018-03-28T14:50:00Z.
|
|
1876
|
+
* * The operation resulted in an error.
|
|
1877
|
+
* @param {number} request.pageSize
|
|
1878
|
+
* Number of operations to be returned in the response. If 0 or
|
|
1879
|
+
* less, defaults to the server's maximum allowed page size.
|
|
1880
|
+
* @param {string} request.pageToken
|
|
1881
|
+
* If non-empty, `page_token` should contain a
|
|
1882
|
+
* {@link protos.google.spanner.admin.database.v1.ListDatabaseOperationsResponse.next_page_token|next_page_token}
|
|
1883
|
+
* from a previous
|
|
1884
|
+
* {@link protos.google.spanner.admin.database.v1.ListDatabaseOperationsResponse|ListDatabaseOperationsResponse}
|
|
1885
|
+
* to the same `parent` and with the same `filter`.
|
|
1886
|
+
* @param {object} [options]
|
|
1887
|
+
* Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
|
|
1888
|
+
* @returns {Object}
|
|
1889
|
+
* An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }.
|
|
1890
|
+
* When you iterate the returned iterable, each element will be an object representing
|
|
1891
|
+
* {@link protos.google.longrunning.Operation|Operation}. The API will be called under the hood as needed, once per the page,
|
|
1892
|
+
* so you can stop the iteration when you don't need more results.
|
|
1893
|
+
* Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation }
|
|
1894
|
+
* for more details and examples.
|
|
1895
|
+
* @example <caption>include:samples/generated/v1/database_admin.list_database_operations.js</caption>
|
|
1896
|
+
* region_tag:spanner_v1_generated_DatabaseAdmin_ListDatabaseOperations_async
|
|
1897
|
+
*/
|
|
1898
|
+
listDatabaseOperationsAsync(request, options) {
|
|
1899
|
+
request = request || {};
|
|
1900
|
+
options = options || {};
|
|
1901
|
+
options.otherArgs = options.otherArgs || {};
|
|
1902
|
+
options.otherArgs.headers = options.otherArgs.headers || {};
|
|
1903
|
+
options.otherArgs.headers['x-goog-request-params'] =
|
|
1904
|
+
this._gaxModule.routingHeader.fromParams({
|
|
1905
|
+
parent: request.parent ?? '',
|
|
1906
|
+
});
|
|
1907
|
+
const defaultCallSettings = this._defaults['listDatabaseOperations'];
|
|
1908
|
+
const callSettings = defaultCallSettings.merge(options);
|
|
1909
|
+
this.initialize().catch((err) => {
|
|
1910
|
+
throw err;
|
|
1911
|
+
});
|
|
1912
|
+
this._log.info('listDatabaseOperations iterate %j', request);
|
|
1913
|
+
return this.descriptors.page.listDatabaseOperations.asyncIterate(this.innerApiCalls['listDatabaseOperations'], request, callSettings);
|
|
1914
|
+
}
|
|
1915
|
+
listBackupOperations(request, optionsOrCallback, callback) {
|
|
1916
|
+
request = request || {};
|
|
1917
|
+
let options;
|
|
1918
|
+
if (typeof optionsOrCallback === 'function' && callback === undefined) {
|
|
1919
|
+
callback = optionsOrCallback;
|
|
1920
|
+
options = {};
|
|
1921
|
+
}
|
|
1922
|
+
else {
|
|
1923
|
+
options = optionsOrCallback;
|
|
1924
|
+
}
|
|
1925
|
+
options = options || {};
|
|
1926
|
+
options.otherArgs = options.otherArgs || {};
|
|
1927
|
+
options.otherArgs.headers = options.otherArgs.headers || {};
|
|
1928
|
+
options.otherArgs.headers['x-goog-request-params'] =
|
|
1929
|
+
this._gaxModule.routingHeader.fromParams({
|
|
1930
|
+
parent: request.parent ?? '',
|
|
1931
|
+
});
|
|
1932
|
+
this.initialize().catch((err) => {
|
|
1933
|
+
throw err;
|
|
1934
|
+
});
|
|
1935
|
+
const wrappedCallback = callback
|
|
1936
|
+
? (error, values, nextPageRequest, rawResponse) => {
|
|
1937
|
+
this._log.info('listBackupOperations values %j', values);
|
|
1938
|
+
callback(error, values, nextPageRequest, rawResponse); // We verified callback above.
|
|
1939
|
+
}
|
|
1940
|
+
: undefined;
|
|
1941
|
+
this._log.info('listBackupOperations request %j', request);
|
|
1942
|
+
return this.innerApiCalls
|
|
1943
|
+
.listBackupOperations(request, options, wrappedCallback)
|
|
1944
|
+
?.then(([response, input, output]) => {
|
|
1945
|
+
this._log.info('listBackupOperations values %j', response);
|
|
1946
|
+
return [response, input, output];
|
|
1947
|
+
});
|
|
1948
|
+
}
|
|
1949
|
+
/**
|
|
1950
|
+
* Equivalent to `listBackupOperations`, but returns a NodeJS Stream object.
|
|
1951
|
+
* @param {Object} request
|
|
1952
|
+
* The request object that will be sent.
|
|
1953
|
+
* @param {string} request.parent
|
|
1954
|
+
* Required. The instance of the backup operations. Values are of
|
|
1955
|
+
* the form `projects/<project>/instances/<instance>`.
|
|
1956
|
+
* @param {string} request.filter
|
|
1957
|
+
* An expression that filters the list of returned backup operations.
|
|
1958
|
+
*
|
|
1959
|
+
* A filter expression consists of a field name, a
|
|
1960
|
+
* comparison operator, and a value for filtering.
|
|
1961
|
+
* The value must be a string, a number, or a boolean. The comparison operator
|
|
1962
|
+
* must be one of: `<`, `>`, `<=`, `>=`, `!=`, `=`, or `:`.
|
|
1963
|
+
* Colon `:` is the contains operator. Filter rules are not case sensitive.
|
|
1964
|
+
*
|
|
1965
|
+
* The following fields in the {@link protos.google.longrunning.Operation|operation}
|
|
1966
|
+
* are eligible for filtering:
|
|
1967
|
+
*
|
|
1968
|
+
* * `name` - The name of the long-running operation
|
|
1969
|
+
* * `done` - False if the operation is in progress, else true.
|
|
1970
|
+
* * `metadata.@type` - the type of metadata. For example, the type string
|
|
1971
|
+
* for
|
|
1972
|
+
* {@link protos.google.spanner.admin.database.v1.CreateBackupMetadata|CreateBackupMetadata}
|
|
1973
|
+
* is
|
|
1974
|
+
* `type.googleapis.com/google.spanner.admin.database.v1.CreateBackupMetadata`.
|
|
1975
|
+
* * `metadata.<field_name>` - any field in metadata.value.
|
|
1976
|
+
* `metadata.@type` must be specified first if filtering on metadata
|
|
1977
|
+
* fields.
|
|
1978
|
+
* * `error` - Error associated with the long-running operation.
|
|
1979
|
+
* * `response.@type` - the type of response.
|
|
1980
|
+
* * `response.<field_name>` - any field in response.value.
|
|
1981
|
+
*
|
|
1982
|
+
* You can combine multiple expressions by enclosing each expression in
|
|
1983
|
+
* parentheses. By default, expressions are combined with AND logic, but
|
|
1984
|
+
* you can specify AND, OR, and NOT logic explicitly.
|
|
1985
|
+
*
|
|
1986
|
+
* Here are a few examples:
|
|
1987
|
+
*
|
|
1988
|
+
* * `done:true` - The operation is complete.
|
|
1989
|
+
* * `(metadata.@type=type.googleapis.com/google.spanner.admin.database.v1.CreateBackupMetadata) AND` \
|
|
1990
|
+
* `metadata.database:prod` - Returns operations where:
|
|
1991
|
+
* * The operation's metadata type is
|
|
1992
|
+
* {@link protos.google.spanner.admin.database.v1.CreateBackupMetadata|CreateBackupMetadata}.
|
|
1993
|
+
* * The source database name of backup contains the string "prod".
|
|
1994
|
+
* * `(metadata.@type=type.googleapis.com/google.spanner.admin.database.v1.CreateBackupMetadata) AND` \
|
|
1995
|
+
* `(metadata.name:howl) AND` \
|
|
1996
|
+
* `(metadata.progress.start_time < \"2018-03-28T14:50:00Z\") AND` \
|
|
1997
|
+
* `(error:*)` - Returns operations where:
|
|
1998
|
+
* * The operation's metadata type is
|
|
1999
|
+
* {@link protos.google.spanner.admin.database.v1.CreateBackupMetadata|CreateBackupMetadata}.
|
|
2000
|
+
* * The backup name contains the string "howl".
|
|
2001
|
+
* * The operation started before 2018-03-28T14:50:00Z.
|
|
2002
|
+
* * The operation resulted in an error.
|
|
2003
|
+
* * `(metadata.@type=type.googleapis.com/google.spanner.admin.database.v1.CopyBackupMetadata) AND` \
|
|
2004
|
+
* `(metadata.source_backup:test) AND` \
|
|
2005
|
+
* `(metadata.progress.start_time < \"2022-01-18T14:50:00Z\") AND` \
|
|
2006
|
+
* `(error:*)` - Returns operations where:
|
|
2007
|
+
* * The operation's metadata type is
|
|
2008
|
+
* {@link protos.google.spanner.admin.database.v1.CopyBackupMetadata|CopyBackupMetadata}.
|
|
2009
|
+
* * The source backup name contains the string "test".
|
|
2010
|
+
* * The operation started before 2022-01-18T14:50:00Z.
|
|
2011
|
+
* * The operation resulted in an error.
|
|
2012
|
+
* * `((metadata.@type=type.googleapis.com/google.spanner.admin.database.v1.CreateBackupMetadata) AND` \
|
|
2013
|
+
* `(metadata.database:test_db)) OR` \
|
|
2014
|
+
* `((metadata.@type=type.googleapis.com/google.spanner.admin.database.v1.CopyBackupMetadata)
|
|
2015
|
+
* AND` \
|
|
2016
|
+
* `(metadata.source_backup:test_bkp)) AND` \
|
|
2017
|
+
* `(error:*)` - Returns operations where:
|
|
2018
|
+
* * The operation's metadata matches either of criteria:
|
|
2019
|
+
* * The operation's metadata type is
|
|
2020
|
+
* {@link protos.google.spanner.admin.database.v1.CreateBackupMetadata|CreateBackupMetadata}
|
|
2021
|
+
* AND the source database name of the backup contains the string
|
|
2022
|
+
* "test_db"
|
|
2023
|
+
* * The operation's metadata type is
|
|
2024
|
+
* {@link protos.google.spanner.admin.database.v1.CopyBackupMetadata|CopyBackupMetadata}
|
|
2025
|
+
* AND the source backup name contains the string "test_bkp"
|
|
2026
|
+
* * The operation resulted in an error.
|
|
2027
|
+
* @param {number} request.pageSize
|
|
2028
|
+
* Number of operations to be returned in the response. If 0 or
|
|
2029
|
+
* less, defaults to the server's maximum allowed page size.
|
|
2030
|
+
* @param {string} request.pageToken
|
|
2031
|
+
* If non-empty, `page_token` should contain a
|
|
2032
|
+
* {@link protos.google.spanner.admin.database.v1.ListBackupOperationsResponse.next_page_token|next_page_token}
|
|
2033
|
+
* from a previous
|
|
2034
|
+
* {@link protos.google.spanner.admin.database.v1.ListBackupOperationsResponse|ListBackupOperationsResponse}
|
|
2035
|
+
* to the same `parent` and with the same `filter`.
|
|
2036
|
+
* @param {object} [options]
|
|
2037
|
+
* Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
|
|
2038
|
+
* @returns {Stream}
|
|
2039
|
+
* An object stream which emits an object representing {@link protos.google.longrunning.Operation|Operation} on 'data' event.
|
|
2040
|
+
* The client library will perform auto-pagination by default: it will call the API as many
|
|
2041
|
+
* times as needed. Note that it can affect your quota.
|
|
2042
|
+
* We recommend using `listBackupOperationsAsync()`
|
|
2043
|
+
* method described below for async iteration which you can stop as needed.
|
|
2044
|
+
* Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation }
|
|
2045
|
+
* for more details and examples.
|
|
2046
|
+
*/
|
|
2047
|
+
listBackupOperationsStream(request, options) {
|
|
2048
|
+
request = request || {};
|
|
2049
|
+
options = options || {};
|
|
2050
|
+
options.otherArgs = options.otherArgs || {};
|
|
2051
|
+
options.otherArgs.headers = options.otherArgs.headers || {};
|
|
2052
|
+
options.otherArgs.headers['x-goog-request-params'] =
|
|
2053
|
+
this._gaxModule.routingHeader.fromParams({
|
|
2054
|
+
parent: request.parent ?? '',
|
|
2055
|
+
});
|
|
2056
|
+
const defaultCallSettings = this._defaults['listBackupOperations'];
|
|
2057
|
+
const callSettings = defaultCallSettings.merge(options);
|
|
2058
|
+
this.initialize().catch((err) => {
|
|
2059
|
+
throw err;
|
|
2060
|
+
});
|
|
2061
|
+
this._log.info('listBackupOperations stream %j', request);
|
|
2062
|
+
return this.descriptors.page.listBackupOperations.createStream(this.innerApiCalls.listBackupOperations, request, callSettings);
|
|
2063
|
+
}
|
|
2064
|
+
/**
|
|
2065
|
+
* Equivalent to `listBackupOperations`, but returns an iterable object.
|
|
2066
|
+
*
|
|
2067
|
+
* `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand.
|
|
2068
|
+
* @param {Object} request
|
|
2069
|
+
* The request object that will be sent.
|
|
2070
|
+
* @param {string} request.parent
|
|
2071
|
+
* Required. The instance of the backup operations. Values are of
|
|
2072
|
+
* the form `projects/<project>/instances/<instance>`.
|
|
2073
|
+
* @param {string} request.filter
|
|
2074
|
+
* An expression that filters the list of returned backup operations.
|
|
2075
|
+
*
|
|
2076
|
+
* A filter expression consists of a field name, a
|
|
2077
|
+
* comparison operator, and a value for filtering.
|
|
2078
|
+
* The value must be a string, a number, or a boolean. The comparison operator
|
|
2079
|
+
* must be one of: `<`, `>`, `<=`, `>=`, `!=`, `=`, or `:`.
|
|
2080
|
+
* Colon `:` is the contains operator. Filter rules are not case sensitive.
|
|
2081
|
+
*
|
|
2082
|
+
* The following fields in the {@link protos.google.longrunning.Operation|operation}
|
|
2083
|
+
* are eligible for filtering:
|
|
2084
|
+
*
|
|
2085
|
+
* * `name` - The name of the long-running operation
|
|
2086
|
+
* * `done` - False if the operation is in progress, else true.
|
|
2087
|
+
* * `metadata.@type` - the type of metadata. For example, the type string
|
|
2088
|
+
* for
|
|
2089
|
+
* {@link protos.google.spanner.admin.database.v1.CreateBackupMetadata|CreateBackupMetadata}
|
|
2090
|
+
* is
|
|
2091
|
+
* `type.googleapis.com/google.spanner.admin.database.v1.CreateBackupMetadata`.
|
|
2092
|
+
* * `metadata.<field_name>` - any field in metadata.value.
|
|
2093
|
+
* `metadata.@type` must be specified first if filtering on metadata
|
|
2094
|
+
* fields.
|
|
2095
|
+
* * `error` - Error associated with the long-running operation.
|
|
2096
|
+
* * `response.@type` - the type of response.
|
|
2097
|
+
* * `response.<field_name>` - any field in response.value.
|
|
2098
|
+
*
|
|
2099
|
+
* You can combine multiple expressions by enclosing each expression in
|
|
2100
|
+
* parentheses. By default, expressions are combined with AND logic, but
|
|
2101
|
+
* you can specify AND, OR, and NOT logic explicitly.
|
|
2102
|
+
*
|
|
2103
|
+
* Here are a few examples:
|
|
2104
|
+
*
|
|
2105
|
+
* * `done:true` - The operation is complete.
|
|
2106
|
+
* * `(metadata.@type=type.googleapis.com/google.spanner.admin.database.v1.CreateBackupMetadata) AND` \
|
|
2107
|
+
* `metadata.database:prod` - Returns operations where:
|
|
2108
|
+
* * The operation's metadata type is
|
|
2109
|
+
* {@link protos.google.spanner.admin.database.v1.CreateBackupMetadata|CreateBackupMetadata}.
|
|
2110
|
+
* * The source database name of backup contains the string "prod".
|
|
2111
|
+
* * `(metadata.@type=type.googleapis.com/google.spanner.admin.database.v1.CreateBackupMetadata) AND` \
|
|
2112
|
+
* `(metadata.name:howl) AND` \
|
|
2113
|
+
* `(metadata.progress.start_time < \"2018-03-28T14:50:00Z\") AND` \
|
|
2114
|
+
* `(error:*)` - Returns operations where:
|
|
2115
|
+
* * The operation's metadata type is
|
|
2116
|
+
* {@link protos.google.spanner.admin.database.v1.CreateBackupMetadata|CreateBackupMetadata}.
|
|
2117
|
+
* * The backup name contains the string "howl".
|
|
2118
|
+
* * The operation started before 2018-03-28T14:50:00Z.
|
|
2119
|
+
* * The operation resulted in an error.
|
|
2120
|
+
* * `(metadata.@type=type.googleapis.com/google.spanner.admin.database.v1.CopyBackupMetadata) AND` \
|
|
2121
|
+
* `(metadata.source_backup:test) AND` \
|
|
2122
|
+
* `(metadata.progress.start_time < \"2022-01-18T14:50:00Z\") AND` \
|
|
2123
|
+
* `(error:*)` - Returns operations where:
|
|
2124
|
+
* * The operation's metadata type is
|
|
2125
|
+
* {@link protos.google.spanner.admin.database.v1.CopyBackupMetadata|CopyBackupMetadata}.
|
|
2126
|
+
* * The source backup name contains the string "test".
|
|
2127
|
+
* * The operation started before 2022-01-18T14:50:00Z.
|
|
2128
|
+
* * The operation resulted in an error.
|
|
2129
|
+
* * `((metadata.@type=type.googleapis.com/google.spanner.admin.database.v1.CreateBackupMetadata) AND` \
|
|
2130
|
+
* `(metadata.database:test_db)) OR` \
|
|
2131
|
+
* `((metadata.@type=type.googleapis.com/google.spanner.admin.database.v1.CopyBackupMetadata)
|
|
2132
|
+
* AND` \
|
|
2133
|
+
* `(metadata.source_backup:test_bkp)) AND` \
|
|
2134
|
+
* `(error:*)` - Returns operations where:
|
|
2135
|
+
* * The operation's metadata matches either of criteria:
|
|
2136
|
+
* * The operation's metadata type is
|
|
2137
|
+
* {@link protos.google.spanner.admin.database.v1.CreateBackupMetadata|CreateBackupMetadata}
|
|
2138
|
+
* AND the source database name of the backup contains the string
|
|
2139
|
+
* "test_db"
|
|
2140
|
+
* * The operation's metadata type is
|
|
2141
|
+
* {@link protos.google.spanner.admin.database.v1.CopyBackupMetadata|CopyBackupMetadata}
|
|
2142
|
+
* AND the source backup name contains the string "test_bkp"
|
|
2143
|
+
* * The operation resulted in an error.
|
|
2144
|
+
* @param {number} request.pageSize
|
|
2145
|
+
* Number of operations to be returned in the response. If 0 or
|
|
2146
|
+
* less, defaults to the server's maximum allowed page size.
|
|
2147
|
+
* @param {string} request.pageToken
|
|
2148
|
+
* If non-empty, `page_token` should contain a
|
|
2149
|
+
* {@link protos.google.spanner.admin.database.v1.ListBackupOperationsResponse.next_page_token|next_page_token}
|
|
2150
|
+
* from a previous
|
|
2151
|
+
* {@link protos.google.spanner.admin.database.v1.ListBackupOperationsResponse|ListBackupOperationsResponse}
|
|
2152
|
+
* to the same `parent` and with the same `filter`.
|
|
2153
|
+
* @param {object} [options]
|
|
2154
|
+
* Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
|
|
2155
|
+
* @returns {Object}
|
|
2156
|
+
* An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }.
|
|
2157
|
+
* When you iterate the returned iterable, each element will be an object representing
|
|
2158
|
+
* {@link protos.google.longrunning.Operation|Operation}. The API will be called under the hood as needed, once per the page,
|
|
2159
|
+
* so you can stop the iteration when you don't need more results.
|
|
2160
|
+
* Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation }
|
|
2161
|
+
* for more details and examples.
|
|
2162
|
+
* @example <caption>include:samples/generated/v1/database_admin.list_backup_operations.js</caption>
|
|
2163
|
+
* region_tag:spanner_v1_generated_DatabaseAdmin_ListBackupOperations_async
|
|
2164
|
+
*/
|
|
2165
|
+
listBackupOperationsAsync(request, options) {
|
|
2166
|
+
request = request || {};
|
|
2167
|
+
options = options || {};
|
|
2168
|
+
options.otherArgs = options.otherArgs || {};
|
|
2169
|
+
options.otherArgs.headers = options.otherArgs.headers || {};
|
|
2170
|
+
options.otherArgs.headers['x-goog-request-params'] =
|
|
2171
|
+
this._gaxModule.routingHeader.fromParams({
|
|
2172
|
+
parent: request.parent ?? '',
|
|
2173
|
+
});
|
|
2174
|
+
const defaultCallSettings = this._defaults['listBackupOperations'];
|
|
2175
|
+
const callSettings = defaultCallSettings.merge(options);
|
|
2176
|
+
this.initialize().catch((err) => {
|
|
2177
|
+
throw err;
|
|
2178
|
+
});
|
|
2179
|
+
this._log.info('listBackupOperations iterate %j', request);
|
|
2180
|
+
return this.descriptors.page.listBackupOperations.asyncIterate(this.innerApiCalls['listBackupOperations'], request, callSettings);
|
|
2181
|
+
}
|
|
2182
|
+
listDatabaseRoles(request, optionsOrCallback, callback) {
|
|
2183
|
+
request = request || {};
|
|
2184
|
+
let options;
|
|
2185
|
+
if (typeof optionsOrCallback === 'function' && callback === undefined) {
|
|
2186
|
+
callback = optionsOrCallback;
|
|
2187
|
+
options = {};
|
|
2188
|
+
}
|
|
2189
|
+
else {
|
|
2190
|
+
options = optionsOrCallback;
|
|
2191
|
+
}
|
|
2192
|
+
options = options || {};
|
|
2193
|
+
options.otherArgs = options.otherArgs || {};
|
|
2194
|
+
options.otherArgs.headers = options.otherArgs.headers || {};
|
|
2195
|
+
options.otherArgs.headers['x-goog-request-params'] =
|
|
2196
|
+
this._gaxModule.routingHeader.fromParams({
|
|
2197
|
+
parent: request.parent ?? '',
|
|
2198
|
+
});
|
|
2199
|
+
this.initialize().catch((err) => {
|
|
2200
|
+
throw err;
|
|
2201
|
+
});
|
|
2202
|
+
const wrappedCallback = callback
|
|
2203
|
+
? (error, values, nextPageRequest, rawResponse) => {
|
|
2204
|
+
this._log.info('listDatabaseRoles values %j', values);
|
|
2205
|
+
callback(error, values, nextPageRequest, rawResponse); // We verified callback above.
|
|
2206
|
+
}
|
|
2207
|
+
: undefined;
|
|
2208
|
+
this._log.info('listDatabaseRoles request %j', request);
|
|
2209
|
+
return this.innerApiCalls
|
|
2210
|
+
.listDatabaseRoles(request, options, wrappedCallback)
|
|
2211
|
+
?.then(([response, input, output]) => {
|
|
2212
|
+
this._log.info('listDatabaseRoles values %j', response);
|
|
2213
|
+
return [response, input, output];
|
|
2214
|
+
});
|
|
2215
|
+
}
|
|
2216
|
+
/**
|
|
2217
|
+
* Equivalent to `listDatabaseRoles`, but returns a NodeJS Stream object.
|
|
2218
|
+
* @param {Object} request
|
|
2219
|
+
* The request object that will be sent.
|
|
2220
|
+
* @param {string} request.parent
|
|
2221
|
+
* Required. The database whose roles should be listed.
|
|
2222
|
+
* Values are of the form
|
|
2223
|
+
* `projects/<project>/instances/<instance>/databases/<database>`.
|
|
2224
|
+
* @param {number} request.pageSize
|
|
2225
|
+
* Number of database roles to be returned in the response. If 0 or less,
|
|
2226
|
+
* defaults to the server's maximum allowed page size.
|
|
2227
|
+
* @param {string} request.pageToken
|
|
2228
|
+
* If non-empty, `page_token` should contain a
|
|
2229
|
+
* {@link protos.google.spanner.admin.database.v1.ListDatabaseRolesResponse.next_page_token|next_page_token}
|
|
2230
|
+
* from a previous
|
|
2231
|
+
* {@link protos.google.spanner.admin.database.v1.ListDatabaseRolesResponse|ListDatabaseRolesResponse}.
|
|
2232
|
+
* @param {object} [options]
|
|
2233
|
+
* Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
|
|
2234
|
+
* @returns {Stream}
|
|
2235
|
+
* An object stream which emits an object representing {@link protos.google.spanner.admin.database.v1.DatabaseRole|DatabaseRole} on 'data' event.
|
|
2236
|
+
* The client library will perform auto-pagination by default: it will call the API as many
|
|
2237
|
+
* times as needed. Note that it can affect your quota.
|
|
2238
|
+
* We recommend using `listDatabaseRolesAsync()`
|
|
2239
|
+
* method described below for async iteration which you can stop as needed.
|
|
2240
|
+
* Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation }
|
|
2241
|
+
* for more details and examples.
|
|
2242
|
+
*/
|
|
2243
|
+
listDatabaseRolesStream(request, options) {
|
|
2244
|
+
request = request || {};
|
|
2245
|
+
options = options || {};
|
|
2246
|
+
options.otherArgs = options.otherArgs || {};
|
|
2247
|
+
options.otherArgs.headers = options.otherArgs.headers || {};
|
|
2248
|
+
options.otherArgs.headers['x-goog-request-params'] =
|
|
2249
|
+
this._gaxModule.routingHeader.fromParams({
|
|
2250
|
+
parent: request.parent ?? '',
|
|
2251
|
+
});
|
|
2252
|
+
const defaultCallSettings = this._defaults['listDatabaseRoles'];
|
|
2253
|
+
const callSettings = defaultCallSettings.merge(options);
|
|
2254
|
+
this.initialize().catch((err) => {
|
|
2255
|
+
throw err;
|
|
2256
|
+
});
|
|
2257
|
+
this._log.info('listDatabaseRoles stream %j', request);
|
|
2258
|
+
return this.descriptors.page.listDatabaseRoles.createStream(this.innerApiCalls.listDatabaseRoles, request, callSettings);
|
|
2259
|
+
}
|
|
2260
|
+
/**
|
|
2261
|
+
* Equivalent to `listDatabaseRoles`, but returns an iterable object.
|
|
2262
|
+
*
|
|
2263
|
+
* `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand.
|
|
2264
|
+
* @param {Object} request
|
|
2265
|
+
* The request object that will be sent.
|
|
2266
|
+
* @param {string} request.parent
|
|
2267
|
+
* Required. The database whose roles should be listed.
|
|
2268
|
+
* Values are of the form
|
|
2269
|
+
* `projects/<project>/instances/<instance>/databases/<database>`.
|
|
2270
|
+
* @param {number} request.pageSize
|
|
2271
|
+
* Number of database roles to be returned in the response. If 0 or less,
|
|
2272
|
+
* defaults to the server's maximum allowed page size.
|
|
2273
|
+
* @param {string} request.pageToken
|
|
2274
|
+
* If non-empty, `page_token` should contain a
|
|
2275
|
+
* {@link protos.google.spanner.admin.database.v1.ListDatabaseRolesResponse.next_page_token|next_page_token}
|
|
2276
|
+
* from a previous
|
|
2277
|
+
* {@link protos.google.spanner.admin.database.v1.ListDatabaseRolesResponse|ListDatabaseRolesResponse}.
|
|
2278
|
+
* @param {object} [options]
|
|
2279
|
+
* Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
|
|
2280
|
+
* @returns {Object}
|
|
2281
|
+
* An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }.
|
|
2282
|
+
* When you iterate the returned iterable, each element will be an object representing
|
|
2283
|
+
* {@link protos.google.spanner.admin.database.v1.DatabaseRole|DatabaseRole}. The API will be called under the hood as needed, once per the page,
|
|
2284
|
+
* so you can stop the iteration when you don't need more results.
|
|
2285
|
+
* Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation }
|
|
2286
|
+
* for more details and examples.
|
|
2287
|
+
* @example <caption>include:samples/generated/v1/database_admin.list_database_roles.js</caption>
|
|
2288
|
+
* region_tag:spanner_v1_generated_DatabaseAdmin_ListDatabaseRoles_async
|
|
2289
|
+
*/
|
|
2290
|
+
listDatabaseRolesAsync(request, options) {
|
|
2291
|
+
request = request || {};
|
|
2292
|
+
options = options || {};
|
|
2293
|
+
options.otherArgs = options.otherArgs || {};
|
|
2294
|
+
options.otherArgs.headers = options.otherArgs.headers || {};
|
|
2295
|
+
options.otherArgs.headers['x-goog-request-params'] =
|
|
2296
|
+
this._gaxModule.routingHeader.fromParams({
|
|
2297
|
+
parent: request.parent ?? '',
|
|
2298
|
+
});
|
|
2299
|
+
const defaultCallSettings = this._defaults['listDatabaseRoles'];
|
|
2300
|
+
const callSettings = defaultCallSettings.merge(options);
|
|
2301
|
+
this.initialize().catch((err) => {
|
|
2302
|
+
throw err;
|
|
2303
|
+
});
|
|
2304
|
+
this._log.info('listDatabaseRoles iterate %j', request);
|
|
2305
|
+
return this.descriptors.page.listDatabaseRoles.asyncIterate(this.innerApiCalls['listDatabaseRoles'], request, callSettings);
|
|
2306
|
+
}
|
|
2307
|
+
listBackupSchedules(request, optionsOrCallback, callback) {
|
|
2308
|
+
request = request || {};
|
|
2309
|
+
let options;
|
|
2310
|
+
if (typeof optionsOrCallback === 'function' && callback === undefined) {
|
|
2311
|
+
callback = optionsOrCallback;
|
|
2312
|
+
options = {};
|
|
2313
|
+
}
|
|
2314
|
+
else {
|
|
2315
|
+
options = optionsOrCallback;
|
|
2316
|
+
}
|
|
2317
|
+
options = options || {};
|
|
2318
|
+
options.otherArgs = options.otherArgs || {};
|
|
2319
|
+
options.otherArgs.headers = options.otherArgs.headers || {};
|
|
2320
|
+
options.otherArgs.headers['x-goog-request-params'] =
|
|
2321
|
+
this._gaxModule.routingHeader.fromParams({
|
|
2322
|
+
parent: request.parent ?? '',
|
|
2323
|
+
});
|
|
2324
|
+
this.initialize().catch((err) => {
|
|
2325
|
+
throw err;
|
|
2326
|
+
});
|
|
2327
|
+
const wrappedCallback = callback
|
|
2328
|
+
? (error, values, nextPageRequest, rawResponse) => {
|
|
2329
|
+
this._log.info('listBackupSchedules values %j', values);
|
|
2330
|
+
callback(error, values, nextPageRequest, rawResponse); // We verified callback above.
|
|
2331
|
+
}
|
|
2332
|
+
: undefined;
|
|
2333
|
+
this._log.info('listBackupSchedules request %j', request);
|
|
2334
|
+
return this.innerApiCalls
|
|
2335
|
+
.listBackupSchedules(request, options, wrappedCallback)
|
|
2336
|
+
?.then(([response, input, output]) => {
|
|
2337
|
+
this._log.info('listBackupSchedules values %j', response);
|
|
2338
|
+
return [response, input, output];
|
|
2339
|
+
});
|
|
2340
|
+
}
|
|
2341
|
+
/**
|
|
2342
|
+
* Equivalent to `listBackupSchedules`, but returns a NodeJS Stream object.
|
|
2343
|
+
* @param {Object} request
|
|
2344
|
+
* The request object that will be sent.
|
|
2345
|
+
* @param {string} request.parent
|
|
2346
|
+
* Required. Database is the parent resource whose backup schedules should be
|
|
2347
|
+
* listed. Values are of the form
|
|
2348
|
+
* projects/<project>/instances/<instance>/databases/<database>
|
|
2349
|
+
* @param {number} [request.pageSize]
|
|
2350
|
+
* Optional. Number of backup schedules to be returned in the response. If 0
|
|
2351
|
+
* or less, defaults to the server's maximum allowed page size.
|
|
2352
|
+
* @param {string} [request.pageToken]
|
|
2353
|
+
* Optional. If non-empty, `page_token` should contain a
|
|
2354
|
+
* {@link protos.google.spanner.admin.database.v1.ListBackupSchedulesResponse.next_page_token|next_page_token}
|
|
2355
|
+
* from a previous
|
|
2356
|
+
* {@link protos.google.spanner.admin.database.v1.ListBackupSchedulesResponse|ListBackupSchedulesResponse}
|
|
2357
|
+
* to the same `parent`.
|
|
2358
|
+
* @param {object} [options]
|
|
2359
|
+
* Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
|
|
2360
|
+
* @returns {Stream}
|
|
2361
|
+
* An object stream which emits an object representing {@link protos.google.spanner.admin.database.v1.BackupSchedule|BackupSchedule} on 'data' event.
|
|
2362
|
+
* The client library will perform auto-pagination by default: it will call the API as many
|
|
2363
|
+
* times as needed. Note that it can affect your quota.
|
|
2364
|
+
* We recommend using `listBackupSchedulesAsync()`
|
|
2365
|
+
* method described below for async iteration which you can stop as needed.
|
|
2366
|
+
* Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation }
|
|
2367
|
+
* for more details and examples.
|
|
2368
|
+
*/
|
|
2369
|
+
listBackupSchedulesStream(request, options) {
|
|
2370
|
+
request = request || {};
|
|
2371
|
+
options = options || {};
|
|
2372
|
+
options.otherArgs = options.otherArgs || {};
|
|
2373
|
+
options.otherArgs.headers = options.otherArgs.headers || {};
|
|
2374
|
+
options.otherArgs.headers['x-goog-request-params'] =
|
|
2375
|
+
this._gaxModule.routingHeader.fromParams({
|
|
2376
|
+
parent: request.parent ?? '',
|
|
2377
|
+
});
|
|
2378
|
+
const defaultCallSettings = this._defaults['listBackupSchedules'];
|
|
2379
|
+
const callSettings = defaultCallSettings.merge(options);
|
|
2380
|
+
this.initialize().catch((err) => {
|
|
2381
|
+
throw err;
|
|
2382
|
+
});
|
|
2383
|
+
this._log.info('listBackupSchedules stream %j', request);
|
|
2384
|
+
return this.descriptors.page.listBackupSchedules.createStream(this.innerApiCalls.listBackupSchedules, request, callSettings);
|
|
2385
|
+
}
|
|
2386
|
+
/**
|
|
2387
|
+
* Equivalent to `listBackupSchedules`, but returns an iterable object.
|
|
2388
|
+
*
|
|
2389
|
+
* `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand.
|
|
2390
|
+
* @param {Object} request
|
|
2391
|
+
* The request object that will be sent.
|
|
2392
|
+
* @param {string} request.parent
|
|
2393
|
+
* Required. Database is the parent resource whose backup schedules should be
|
|
2394
|
+
* listed. Values are of the form
|
|
2395
|
+
* projects/<project>/instances/<instance>/databases/<database>
|
|
2396
|
+
* @param {number} [request.pageSize]
|
|
2397
|
+
* Optional. Number of backup schedules to be returned in the response. If 0
|
|
2398
|
+
* or less, defaults to the server's maximum allowed page size.
|
|
2399
|
+
* @param {string} [request.pageToken]
|
|
2400
|
+
* Optional. If non-empty, `page_token` should contain a
|
|
2401
|
+
* {@link protos.google.spanner.admin.database.v1.ListBackupSchedulesResponse.next_page_token|next_page_token}
|
|
2402
|
+
* from a previous
|
|
2403
|
+
* {@link protos.google.spanner.admin.database.v1.ListBackupSchedulesResponse|ListBackupSchedulesResponse}
|
|
2404
|
+
* to the same `parent`.
|
|
2405
|
+
* @param {object} [options]
|
|
2406
|
+
* Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
|
|
2407
|
+
* @returns {Object}
|
|
2408
|
+
* An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }.
|
|
2409
|
+
* When you iterate the returned iterable, each element will be an object representing
|
|
2410
|
+
* {@link protos.google.spanner.admin.database.v1.BackupSchedule|BackupSchedule}. The API will be called under the hood as needed, once per the page,
|
|
2411
|
+
* so you can stop the iteration when you don't need more results.
|
|
2412
|
+
* Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation }
|
|
2413
|
+
* for more details and examples.
|
|
2414
|
+
* @example <caption>include:samples/generated/v1/database_admin.list_backup_schedules.js</caption>
|
|
2415
|
+
* region_tag:spanner_v1_generated_DatabaseAdmin_ListBackupSchedules_async
|
|
2416
|
+
*/
|
|
2417
|
+
listBackupSchedulesAsync(request, options) {
|
|
2418
|
+
request = request || {};
|
|
2419
|
+
options = options || {};
|
|
2420
|
+
options.otherArgs = options.otherArgs || {};
|
|
2421
|
+
options.otherArgs.headers = options.otherArgs.headers || {};
|
|
2422
|
+
options.otherArgs.headers['x-goog-request-params'] =
|
|
2423
|
+
this._gaxModule.routingHeader.fromParams({
|
|
2424
|
+
parent: request.parent ?? '',
|
|
2425
|
+
});
|
|
2426
|
+
const defaultCallSettings = this._defaults['listBackupSchedules'];
|
|
2427
|
+
const callSettings = defaultCallSettings.merge(options);
|
|
2428
|
+
this.initialize().catch((err) => {
|
|
2429
|
+
throw err;
|
|
2430
|
+
});
|
|
2431
|
+
this._log.info('listBackupSchedules iterate %j', request);
|
|
2432
|
+
return this.descriptors.page.listBackupSchedules.asyncIterate(this.innerApiCalls['listBackupSchedules'], request, callSettings);
|
|
2433
|
+
}
|
|
2434
|
+
/**
|
|
2435
|
+
* Gets the latest state of a long-running operation. Clients can use this
|
|
2436
|
+
* method to poll the operation result at intervals as recommended by the API
|
|
2437
|
+
* service.
|
|
2438
|
+
*
|
|
2439
|
+
* @param {Object} request - The request object that will be sent.
|
|
2440
|
+
* @param {string} request.name - The name of the operation resource.
|
|
2441
|
+
* @param {Object=} options
|
|
2442
|
+
* Optional parameters. You can override the default settings for this call,
|
|
2443
|
+
* e.g, timeout, retries, paginations, etc. See {@link
|
|
2444
|
+
* https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions}
|
|
2445
|
+
* for the details.
|
|
2446
|
+
* @param {function(?Error, ?Object)=} callback
|
|
2447
|
+
* The function which will be called with the result of the API call.
|
|
2448
|
+
*
|
|
2449
|
+
* The second parameter to the callback is an object representing
|
|
2450
|
+
* {@link google.longrunning.Operation | google.longrunning.Operation}.
|
|
2451
|
+
* @return {Promise} - The promise which resolves to an array.
|
|
2452
|
+
* The first element of the array is an object representing
|
|
2453
|
+
* {@link google.longrunning.Operation | google.longrunning.Operation}.
|
|
2454
|
+
* The promise has a method named "cancel" which cancels the ongoing API call.
|
|
2455
|
+
*
|
|
2456
|
+
* @example
|
|
2457
|
+
* ```
|
|
2458
|
+
* const client = longrunning.operationsClient();
|
|
2459
|
+
* const name = '';
|
|
2460
|
+
* const [response] = await client.getOperation({name});
|
|
2461
|
+
* // doThingsWith(response)
|
|
2462
|
+
* ```
|
|
2463
|
+
*/
|
|
2464
|
+
getOperation(request, optionsOrCallback, callback) {
|
|
2465
|
+
let options;
|
|
2466
|
+
if (typeof optionsOrCallback === 'function' && callback === undefined) {
|
|
2467
|
+
callback = optionsOrCallback;
|
|
2468
|
+
options = {};
|
|
2469
|
+
}
|
|
2470
|
+
else {
|
|
2471
|
+
options = optionsOrCallback;
|
|
2472
|
+
}
|
|
2473
|
+
options = options || {};
|
|
2474
|
+
options.otherArgs = options.otherArgs || {};
|
|
2475
|
+
options.otherArgs.headers = options.otherArgs.headers || {};
|
|
2476
|
+
options.otherArgs.headers['x-goog-request-params'] =
|
|
2477
|
+
this._gaxModule.routingHeader.fromParams({
|
|
2478
|
+
name: request.name ?? '',
|
|
2479
|
+
});
|
|
2480
|
+
return this.operationsClient.getOperation(request, options, callback);
|
|
2481
|
+
}
|
|
2482
|
+
/**
|
|
2483
|
+
* Lists operations that match the specified filter in the request. If the
|
|
2484
|
+
* server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object.
|
|
2485
|
+
*
|
|
2486
|
+
* For-await-of syntax is used with the iterable to recursively get response element on-demand.
|
|
2487
|
+
*
|
|
2488
|
+
* @param {Object} request - The request object that will be sent.
|
|
2489
|
+
* @param {string} request.name - The name of the operation collection.
|
|
2490
|
+
* @param {string} request.filter - The standard list filter.
|
|
2491
|
+
* @param {number=} request.pageSize -
|
|
2492
|
+
* The maximum number of resources contained in the underlying API
|
|
2493
|
+
* response. If page streaming is performed per-resource, this
|
|
2494
|
+
* parameter does not affect the return value. If page streaming is
|
|
2495
|
+
* performed per-page, this determines the maximum number of
|
|
2496
|
+
* resources in a page.
|
|
2497
|
+
* @param {Object=} options
|
|
2498
|
+
* Optional parameters. You can override the default settings for this call,
|
|
2499
|
+
* e.g, timeout, retries, paginations, etc. See {@link
|
|
2500
|
+
* https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} for the
|
|
2501
|
+
* details.
|
|
2502
|
+
* @returns {Object}
|
|
2503
|
+
* An iterable Object that conforms to {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | iteration protocols}.
|
|
2504
|
+
*
|
|
2505
|
+
* @example
|
|
2506
|
+
* ```
|
|
2507
|
+
* const client = longrunning.operationsClient();
|
|
2508
|
+
* for await (const response of client.listOperationsAsync(request));
|
|
2509
|
+
* // doThingsWith(response)
|
|
2510
|
+
* ```
|
|
2511
|
+
*/
|
|
2512
|
+
listOperationsAsync(request, options) {
|
|
2513
|
+
options = options || {};
|
|
2514
|
+
options.otherArgs = options.otherArgs || {};
|
|
2515
|
+
options.otherArgs.headers = options.otherArgs.headers || {};
|
|
2516
|
+
options.otherArgs.headers['x-goog-request-params'] =
|
|
2517
|
+
this._gaxModule.routingHeader.fromParams({
|
|
2518
|
+
name: request.name ?? '',
|
|
2519
|
+
});
|
|
2520
|
+
return this.operationsClient.listOperationsAsync(request, options);
|
|
2521
|
+
}
|
|
2522
|
+
/**
|
|
2523
|
+
* Starts asynchronous cancellation on a long-running operation. The server
|
|
2524
|
+
* makes a best effort to cancel the operation, but success is not
|
|
2525
|
+
* guaranteed. If the server doesn't support this method, it returns
|
|
2526
|
+
* `google.rpc.Code.UNIMPLEMENTED`. Clients can use
|
|
2527
|
+
* {@link Operations.GetOperation} or
|
|
2528
|
+
* other methods to check whether the cancellation succeeded or whether the
|
|
2529
|
+
* operation completed despite cancellation. On successful cancellation,
|
|
2530
|
+
* the operation is not deleted; instead, it becomes an operation with
|
|
2531
|
+
* an {@link Operation.error} value with a {@link google.rpc.Status.code} of
|
|
2532
|
+
* 1, corresponding to `Code.CANCELLED`.
|
|
2533
|
+
*
|
|
2534
|
+
* @param {Object} request - The request object that will be sent.
|
|
2535
|
+
* @param {string} request.name - The name of the operation resource to be cancelled.
|
|
2536
|
+
* @param {Object=} options
|
|
2537
|
+
* Optional parameters. You can override the default settings for this call,
|
|
2538
|
+
* e.g, timeout, retries, paginations, etc. See {@link
|
|
2539
|
+
* https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} for the
|
|
2540
|
+
* details.
|
|
2541
|
+
* @param {function(?Error)=} callback
|
|
2542
|
+
* The function which will be called with the result of the API call.
|
|
2543
|
+
* @return {Promise} - The promise which resolves when API call finishes.
|
|
2544
|
+
* The promise has a method named "cancel" which cancels the ongoing API
|
|
2545
|
+
* call.
|
|
2546
|
+
*
|
|
2547
|
+
* @example
|
|
2548
|
+
* ```
|
|
2549
|
+
* const client = longrunning.operationsClient();
|
|
2550
|
+
* await client.cancelOperation({name: ''});
|
|
2551
|
+
* ```
|
|
2552
|
+
*/
|
|
2553
|
+
cancelOperation(request, optionsOrCallback, callback) {
|
|
2554
|
+
let options;
|
|
2555
|
+
if (typeof optionsOrCallback === 'function' && callback === undefined) {
|
|
2556
|
+
callback = optionsOrCallback;
|
|
2557
|
+
options = {};
|
|
2558
|
+
}
|
|
2559
|
+
else {
|
|
2560
|
+
options = optionsOrCallback;
|
|
2561
|
+
}
|
|
2562
|
+
options = options || {};
|
|
2563
|
+
options.otherArgs = options.otherArgs || {};
|
|
2564
|
+
options.otherArgs.headers = options.otherArgs.headers || {};
|
|
2565
|
+
options.otherArgs.headers['x-goog-request-params'] =
|
|
2566
|
+
this._gaxModule.routingHeader.fromParams({
|
|
2567
|
+
name: request.name ?? '',
|
|
2568
|
+
});
|
|
2569
|
+
return this.operationsClient.cancelOperation(request, options, callback);
|
|
2570
|
+
}
|
|
2571
|
+
/**
|
|
2572
|
+
* Deletes a long-running operation. This method indicates that the client is
|
|
2573
|
+
* no longer interested in the operation result. It does not cancel the
|
|
2574
|
+
* operation. If the server doesn't support this method, it returns
|
|
2575
|
+
* `google.rpc.Code.UNIMPLEMENTED`.
|
|
2576
|
+
*
|
|
2577
|
+
* @param {Object} request - The request object that will be sent.
|
|
2578
|
+
* @param {string} request.name - The name of the operation resource to be deleted.
|
|
2579
|
+
* @param {Object=} options
|
|
2580
|
+
* Optional parameters. You can override the default settings for this call,
|
|
2581
|
+
* e.g, timeout, retries, paginations, etc. See {@link
|
|
2582
|
+
* https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions}
|
|
2583
|
+
* for the details.
|
|
2584
|
+
* @param {function(?Error)=} callback
|
|
2585
|
+
* The function which will be called with the result of the API call.
|
|
2586
|
+
* @return {Promise} - The promise which resolves when API call finishes.
|
|
2587
|
+
* The promise has a method named "cancel" which cancels the ongoing API
|
|
2588
|
+
* call.
|
|
2589
|
+
*
|
|
2590
|
+
* @example
|
|
2591
|
+
* ```
|
|
2592
|
+
* const client = longrunning.operationsClient();
|
|
2593
|
+
* await client.deleteOperation({name: ''});
|
|
2594
|
+
* ```
|
|
2595
|
+
*/
|
|
2596
|
+
deleteOperation(request, optionsOrCallback, callback) {
|
|
2597
|
+
let options;
|
|
2598
|
+
if (typeof optionsOrCallback === 'function' && callback === undefined) {
|
|
2599
|
+
callback = optionsOrCallback;
|
|
2600
|
+
options = {};
|
|
2601
|
+
}
|
|
2602
|
+
else {
|
|
2603
|
+
options = optionsOrCallback;
|
|
2604
|
+
}
|
|
2605
|
+
options = options || {};
|
|
2606
|
+
options.otherArgs = options.otherArgs || {};
|
|
2607
|
+
options.otherArgs.headers = options.otherArgs.headers || {};
|
|
2608
|
+
options.otherArgs.headers['x-goog-request-params'] =
|
|
2609
|
+
this._gaxModule.routingHeader.fromParams({
|
|
2610
|
+
name: request.name ?? '',
|
|
2611
|
+
});
|
|
2612
|
+
return this.operationsClient.deleteOperation(request, options, callback);
|
|
2613
|
+
}
|
|
2614
|
+
// --------------------
|
|
2615
|
+
// -- Path templates --
|
|
2616
|
+
// --------------------
|
|
2617
|
+
/**
|
|
2618
|
+
* Return a fully-qualified backup resource name string.
|
|
2619
|
+
*
|
|
2620
|
+
* @param {string} project
|
|
2621
|
+
* @param {string} instance
|
|
2622
|
+
* @param {string} backup
|
|
2623
|
+
* @returns {string} Resource name string.
|
|
2624
|
+
*/
|
|
2625
|
+
backupPath(project, instance, backup) {
|
|
2626
|
+
return this.pathTemplates.backupPathTemplate.render({
|
|
2627
|
+
project: project,
|
|
2628
|
+
instance: instance,
|
|
2629
|
+
backup: backup,
|
|
2630
|
+
});
|
|
2631
|
+
}
|
|
2632
|
+
/**
|
|
2633
|
+
* Parse the project from Backup resource.
|
|
2634
|
+
*
|
|
2635
|
+
* @param {string} backupName
|
|
2636
|
+
* A fully-qualified path representing Backup resource.
|
|
2637
|
+
* @returns {string} A string representing the project.
|
|
2638
|
+
*/
|
|
2639
|
+
matchProjectFromBackupName(backupName) {
|
|
2640
|
+
return this.pathTemplates.backupPathTemplate.match(backupName).project;
|
|
2641
|
+
}
|
|
2642
|
+
/**
|
|
2643
|
+
* Parse the instance from Backup resource.
|
|
2644
|
+
*
|
|
2645
|
+
* @param {string} backupName
|
|
2646
|
+
* A fully-qualified path representing Backup resource.
|
|
2647
|
+
* @returns {string} A string representing the instance.
|
|
2648
|
+
*/
|
|
2649
|
+
matchInstanceFromBackupName(backupName) {
|
|
2650
|
+
return this.pathTemplates.backupPathTemplate.match(backupName).instance;
|
|
2651
|
+
}
|
|
2652
|
+
/**
|
|
2653
|
+
* Parse the backup from Backup resource.
|
|
2654
|
+
*
|
|
2655
|
+
* @param {string} backupName
|
|
2656
|
+
* A fully-qualified path representing Backup resource.
|
|
2657
|
+
* @returns {string} A string representing the backup.
|
|
2658
|
+
*/
|
|
2659
|
+
matchBackupFromBackupName(backupName) {
|
|
2660
|
+
return this.pathTemplates.backupPathTemplate.match(backupName).backup;
|
|
2661
|
+
}
|
|
2662
|
+
/**
|
|
2663
|
+
* Return a fully-qualified backupSchedule resource name string.
|
|
2664
|
+
*
|
|
2665
|
+
* @param {string} project
|
|
2666
|
+
* @param {string} instance
|
|
2667
|
+
* @param {string} database
|
|
2668
|
+
* @param {string} schedule
|
|
2669
|
+
* @returns {string} Resource name string.
|
|
2670
|
+
*/
|
|
2671
|
+
backupSchedulePath(project, instance, database, schedule) {
|
|
2672
|
+
return this.pathTemplates.backupSchedulePathTemplate.render({
|
|
2673
|
+
project: project,
|
|
2674
|
+
instance: instance,
|
|
2675
|
+
database: database,
|
|
2676
|
+
schedule: schedule,
|
|
2677
|
+
});
|
|
2678
|
+
}
|
|
2679
|
+
/**
|
|
2680
|
+
* Parse the project from BackupSchedule resource.
|
|
2681
|
+
*
|
|
2682
|
+
* @param {string} backupScheduleName
|
|
2683
|
+
* A fully-qualified path representing BackupSchedule resource.
|
|
2684
|
+
* @returns {string} A string representing the project.
|
|
2685
|
+
*/
|
|
2686
|
+
matchProjectFromBackupScheduleName(backupScheduleName) {
|
|
2687
|
+
return this.pathTemplates.backupSchedulePathTemplate.match(backupScheduleName).project;
|
|
2688
|
+
}
|
|
2689
|
+
/**
|
|
2690
|
+
* Parse the instance from BackupSchedule resource.
|
|
2691
|
+
*
|
|
2692
|
+
* @param {string} backupScheduleName
|
|
2693
|
+
* A fully-qualified path representing BackupSchedule resource.
|
|
2694
|
+
* @returns {string} A string representing the instance.
|
|
2695
|
+
*/
|
|
2696
|
+
matchInstanceFromBackupScheduleName(backupScheduleName) {
|
|
2697
|
+
return this.pathTemplates.backupSchedulePathTemplate.match(backupScheduleName).instance;
|
|
2698
|
+
}
|
|
2699
|
+
/**
|
|
2700
|
+
* Parse the database from BackupSchedule resource.
|
|
2701
|
+
*
|
|
2702
|
+
* @param {string} backupScheduleName
|
|
2703
|
+
* A fully-qualified path representing BackupSchedule resource.
|
|
2704
|
+
* @returns {string} A string representing the database.
|
|
2705
|
+
*/
|
|
2706
|
+
matchDatabaseFromBackupScheduleName(backupScheduleName) {
|
|
2707
|
+
return this.pathTemplates.backupSchedulePathTemplate.match(backupScheduleName).database;
|
|
2708
|
+
}
|
|
2709
|
+
/**
|
|
2710
|
+
* Parse the schedule from BackupSchedule resource.
|
|
2711
|
+
*
|
|
2712
|
+
* @param {string} backupScheduleName
|
|
2713
|
+
* A fully-qualified path representing BackupSchedule resource.
|
|
2714
|
+
* @returns {string} A string representing the schedule.
|
|
2715
|
+
*/
|
|
2716
|
+
matchScheduleFromBackupScheduleName(backupScheduleName) {
|
|
2717
|
+
return this.pathTemplates.backupSchedulePathTemplate.match(backupScheduleName).schedule;
|
|
2718
|
+
}
|
|
2719
|
+
/**
|
|
2720
|
+
* Return a fully-qualified cryptoKey resource name string.
|
|
2721
|
+
*
|
|
2722
|
+
* @param {string} project
|
|
2723
|
+
* @param {string} location
|
|
2724
|
+
* @param {string} key_ring
|
|
2725
|
+
* @param {string} crypto_key
|
|
2726
|
+
* @returns {string} Resource name string.
|
|
2727
|
+
*/
|
|
2728
|
+
cryptoKeyPath(project, location, keyRing, cryptoKey) {
|
|
2729
|
+
return this.pathTemplates.cryptoKeyPathTemplate.render({
|
|
2730
|
+
project: project,
|
|
2731
|
+
location: location,
|
|
2732
|
+
key_ring: keyRing,
|
|
2733
|
+
crypto_key: cryptoKey,
|
|
2734
|
+
});
|
|
2735
|
+
}
|
|
2736
|
+
/**
|
|
2737
|
+
* Parse the project from CryptoKey resource.
|
|
2738
|
+
*
|
|
2739
|
+
* @param {string} cryptoKeyName
|
|
2740
|
+
* A fully-qualified path representing CryptoKey resource.
|
|
2741
|
+
* @returns {string} A string representing the project.
|
|
2742
|
+
*/
|
|
2743
|
+
matchProjectFromCryptoKeyName(cryptoKeyName) {
|
|
2744
|
+
return this.pathTemplates.cryptoKeyPathTemplate.match(cryptoKeyName)
|
|
2745
|
+
.project;
|
|
2746
|
+
}
|
|
2747
|
+
/**
|
|
2748
|
+
* Parse the location from CryptoKey resource.
|
|
2749
|
+
*
|
|
2750
|
+
* @param {string} cryptoKeyName
|
|
2751
|
+
* A fully-qualified path representing CryptoKey resource.
|
|
2752
|
+
* @returns {string} A string representing the location.
|
|
2753
|
+
*/
|
|
2754
|
+
matchLocationFromCryptoKeyName(cryptoKeyName) {
|
|
2755
|
+
return this.pathTemplates.cryptoKeyPathTemplate.match(cryptoKeyName)
|
|
2756
|
+
.location;
|
|
2757
|
+
}
|
|
2758
|
+
/**
|
|
2759
|
+
* Parse the key_ring from CryptoKey resource.
|
|
2760
|
+
*
|
|
2761
|
+
* @param {string} cryptoKeyName
|
|
2762
|
+
* A fully-qualified path representing CryptoKey resource.
|
|
2763
|
+
* @returns {string} A string representing the key_ring.
|
|
2764
|
+
*/
|
|
2765
|
+
matchKeyRingFromCryptoKeyName(cryptoKeyName) {
|
|
2766
|
+
return this.pathTemplates.cryptoKeyPathTemplate.match(cryptoKeyName)
|
|
2767
|
+
.key_ring;
|
|
2768
|
+
}
|
|
2769
|
+
/**
|
|
2770
|
+
* Parse the crypto_key from CryptoKey resource.
|
|
2771
|
+
*
|
|
2772
|
+
* @param {string} cryptoKeyName
|
|
2773
|
+
* A fully-qualified path representing CryptoKey resource.
|
|
2774
|
+
* @returns {string} A string representing the crypto_key.
|
|
2775
|
+
*/
|
|
2776
|
+
matchCryptoKeyFromCryptoKeyName(cryptoKeyName) {
|
|
2777
|
+
return this.pathTemplates.cryptoKeyPathTemplate.match(cryptoKeyName)
|
|
2778
|
+
.crypto_key;
|
|
2779
|
+
}
|
|
2780
|
+
/**
|
|
2781
|
+
* Return a fully-qualified database resource name string.
|
|
2782
|
+
*
|
|
2783
|
+
* @param {string} project
|
|
2784
|
+
* @param {string} instance
|
|
2785
|
+
* @param {string} database
|
|
2786
|
+
* @returns {string} Resource name string.
|
|
2787
|
+
*/
|
|
2788
|
+
databasePath(project, instance, database) {
|
|
2789
|
+
return this.pathTemplates.databasePathTemplate.render({
|
|
2790
|
+
project: project,
|
|
2791
|
+
instance: instance,
|
|
2792
|
+
database: database,
|
|
2793
|
+
});
|
|
2794
|
+
}
|
|
2795
|
+
/**
|
|
2796
|
+
* Parse the project from Database resource.
|
|
2797
|
+
*
|
|
2798
|
+
* @param {string} databaseName
|
|
2799
|
+
* A fully-qualified path representing Database resource.
|
|
2800
|
+
* @returns {string} A string representing the project.
|
|
2801
|
+
*/
|
|
2802
|
+
matchProjectFromDatabaseName(databaseName) {
|
|
2803
|
+
return this.pathTemplates.databasePathTemplate.match(databaseName).project;
|
|
2804
|
+
}
|
|
2805
|
+
/**
|
|
2806
|
+
* Parse the instance from Database resource.
|
|
2807
|
+
*
|
|
2808
|
+
* @param {string} databaseName
|
|
2809
|
+
* A fully-qualified path representing Database resource.
|
|
2810
|
+
* @returns {string} A string representing the instance.
|
|
2811
|
+
*/
|
|
2812
|
+
matchInstanceFromDatabaseName(databaseName) {
|
|
2813
|
+
return this.pathTemplates.databasePathTemplate.match(databaseName).instance;
|
|
2814
|
+
}
|
|
2815
|
+
/**
|
|
2816
|
+
* Parse the database from Database resource.
|
|
2817
|
+
*
|
|
2818
|
+
* @param {string} databaseName
|
|
2819
|
+
* A fully-qualified path representing Database resource.
|
|
2820
|
+
* @returns {string} A string representing the database.
|
|
2821
|
+
*/
|
|
2822
|
+
matchDatabaseFromDatabaseName(databaseName) {
|
|
2823
|
+
return this.pathTemplates.databasePathTemplate.match(databaseName).database;
|
|
2824
|
+
}
|
|
2825
|
+
/**
|
|
2826
|
+
* Return a fully-qualified databaseRole resource name string.
|
|
2827
|
+
*
|
|
2828
|
+
* @param {string} project
|
|
2829
|
+
* @param {string} instance
|
|
2830
|
+
* @param {string} database
|
|
2831
|
+
* @param {string} role
|
|
2832
|
+
* @returns {string} Resource name string.
|
|
2833
|
+
*/
|
|
2834
|
+
databaseRolePath(project, instance, database, role) {
|
|
2835
|
+
return this.pathTemplates.databaseRolePathTemplate.render({
|
|
2836
|
+
project: project,
|
|
2837
|
+
instance: instance,
|
|
2838
|
+
database: database,
|
|
2839
|
+
role: role,
|
|
2840
|
+
});
|
|
2841
|
+
}
|
|
2842
|
+
/**
|
|
2843
|
+
* Parse the project from DatabaseRole resource.
|
|
2844
|
+
*
|
|
2845
|
+
* @param {string} databaseRoleName
|
|
2846
|
+
* A fully-qualified path representing DatabaseRole resource.
|
|
2847
|
+
* @returns {string} A string representing the project.
|
|
2848
|
+
*/
|
|
2849
|
+
matchProjectFromDatabaseRoleName(databaseRoleName) {
|
|
2850
|
+
return this.pathTemplates.databaseRolePathTemplate.match(databaseRoleName)
|
|
2851
|
+
.project;
|
|
2852
|
+
}
|
|
2853
|
+
/**
|
|
2854
|
+
* Parse the instance from DatabaseRole resource.
|
|
2855
|
+
*
|
|
2856
|
+
* @param {string} databaseRoleName
|
|
2857
|
+
* A fully-qualified path representing DatabaseRole resource.
|
|
2858
|
+
* @returns {string} A string representing the instance.
|
|
2859
|
+
*/
|
|
2860
|
+
matchInstanceFromDatabaseRoleName(databaseRoleName) {
|
|
2861
|
+
return this.pathTemplates.databaseRolePathTemplate.match(databaseRoleName)
|
|
2862
|
+
.instance;
|
|
2863
|
+
}
|
|
2864
|
+
/**
|
|
2865
|
+
* Parse the database from DatabaseRole resource.
|
|
2866
|
+
*
|
|
2867
|
+
* @param {string} databaseRoleName
|
|
2868
|
+
* A fully-qualified path representing DatabaseRole resource.
|
|
2869
|
+
* @returns {string} A string representing the database.
|
|
2870
|
+
*/
|
|
2871
|
+
matchDatabaseFromDatabaseRoleName(databaseRoleName) {
|
|
2872
|
+
return this.pathTemplates.databaseRolePathTemplate.match(databaseRoleName)
|
|
2873
|
+
.database;
|
|
2874
|
+
}
|
|
2875
|
+
/**
|
|
2876
|
+
* Parse the role from DatabaseRole resource.
|
|
2877
|
+
*
|
|
2878
|
+
* @param {string} databaseRoleName
|
|
2879
|
+
* A fully-qualified path representing DatabaseRole resource.
|
|
2880
|
+
* @returns {string} A string representing the role.
|
|
2881
|
+
*/
|
|
2882
|
+
matchRoleFromDatabaseRoleName(databaseRoleName) {
|
|
2883
|
+
return this.pathTemplates.databaseRolePathTemplate.match(databaseRoleName)
|
|
2884
|
+
.role;
|
|
2885
|
+
}
|
|
2886
|
+
/**
|
|
2887
|
+
* Return a fully-qualified instance resource name string.
|
|
2888
|
+
*
|
|
2889
|
+
* @param {string} project
|
|
2890
|
+
* @param {string} instance
|
|
2891
|
+
* @returns {string} Resource name string.
|
|
2892
|
+
*/
|
|
2893
|
+
instancePath(project, instance) {
|
|
2894
|
+
return this.pathTemplates.instancePathTemplate.render({
|
|
2895
|
+
project: project,
|
|
2896
|
+
instance: instance,
|
|
2897
|
+
});
|
|
2898
|
+
}
|
|
2899
|
+
/**
|
|
2900
|
+
* Parse the project from Instance resource.
|
|
2901
|
+
*
|
|
2902
|
+
* @param {string} instanceName
|
|
2903
|
+
* A fully-qualified path representing Instance resource.
|
|
2904
|
+
* @returns {string} A string representing the project.
|
|
2905
|
+
*/
|
|
2906
|
+
matchProjectFromInstanceName(instanceName) {
|
|
2907
|
+
return this.pathTemplates.instancePathTemplate.match(instanceName).project;
|
|
2908
|
+
}
|
|
2909
|
+
/**
|
|
2910
|
+
* Parse the instance from Instance resource.
|
|
2911
|
+
*
|
|
2912
|
+
* @param {string} instanceName
|
|
2913
|
+
* A fully-qualified path representing Instance resource.
|
|
2914
|
+
* @returns {string} A string representing the instance.
|
|
2915
|
+
*/
|
|
2916
|
+
matchInstanceFromInstanceName(instanceName) {
|
|
2917
|
+
return this.pathTemplates.instancePathTemplate.match(instanceName).instance;
|
|
2918
|
+
}
|
|
2919
|
+
/**
|
|
2920
|
+
* Terminate the gRPC channel and close the client.
|
|
2921
|
+
*
|
|
2922
|
+
* The client will no longer be usable and all future behavior is undefined.
|
|
2923
|
+
* @returns {Promise} A promise that resolves when the client is closed.
|
|
2924
|
+
*/
|
|
2925
|
+
close() {
|
|
2926
|
+
if (this.databaseAdminStub && !this._terminated) {
|
|
2927
|
+
return this.databaseAdminStub.then((stub) => {
|
|
2928
|
+
this._log.info('ending gRPC channel');
|
|
2929
|
+
this._terminated = true;
|
|
2930
|
+
stub.close();
|
|
2931
|
+
void this.operationsClient.close();
|
|
2932
|
+
});
|
|
2933
|
+
}
|
|
2934
|
+
return Promise.resolve();
|
|
2935
|
+
}
|
|
2936
|
+
}
|
|
2937
|
+
exports.DatabaseAdminClient = DatabaseAdminClient;
|
|
2938
|
+
//# sourceMappingURL=database_admin_client.js.map
|