@google-cloud/spanner 6.9.0 → 6.10.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/CHANGELOG.md +13 -0
- package/README.md +1 -0
- package/build/protos/google/spanner/admin/database/v1/spanner_database_admin.proto +90 -1
- package/build/protos/protos.d.ts +245 -0
- package/build/protos/protos.js +581 -0
- package/build/protos/protos.json +73 -0
- package/build/src/common-grpc/service.js +4 -0
- package/build/src/database.d.ts +66 -0
- package/build/src/database.js +21 -0
- package/build/src/index.d.ts +2 -2
- package/build/src/session-pool.d.ts +3 -3
- package/build/src/v1/database_admin_client.d.ts +79 -0
- package/build/src/v1/database_admin_client.js +43 -0
- package/build/src/v1/database_admin_client_config.json +5 -0
- package/package.json +1 -1
package/build/protos/protos.json
CHANGED
|
@@ -1883,6 +1883,34 @@
|
|
|
1883
1883
|
}
|
|
1884
1884
|
]
|
|
1885
1885
|
},
|
|
1886
|
+
"UpdateDatabase": {
|
|
1887
|
+
"requestType": "UpdateDatabaseRequest",
|
|
1888
|
+
"responseType": "google.longrunning.Operation",
|
|
1889
|
+
"options": {
|
|
1890
|
+
"(google.api.http).patch": "/v1/{database.name=projects/*/instances/*/databases/*}",
|
|
1891
|
+
"(google.api.http).body": "database",
|
|
1892
|
+
"(google.api.method_signature)": "database,update_mask",
|
|
1893
|
+
"(google.longrunning.operation_info).response_type": "Database",
|
|
1894
|
+
"(google.longrunning.operation_info).metadata_type": "UpdateDatabaseMetadata"
|
|
1895
|
+
},
|
|
1896
|
+
"parsedOptions": [
|
|
1897
|
+
{
|
|
1898
|
+
"(google.api.http)": {
|
|
1899
|
+
"patch": "/v1/{database.name=projects/*/instances/*/databases/*}",
|
|
1900
|
+
"body": "database"
|
|
1901
|
+
}
|
|
1902
|
+
},
|
|
1903
|
+
{
|
|
1904
|
+
"(google.api.method_signature)": "database,update_mask"
|
|
1905
|
+
},
|
|
1906
|
+
{
|
|
1907
|
+
"(google.longrunning.operation_info)": {
|
|
1908
|
+
"response_type": "Database",
|
|
1909
|
+
"metadata_type": "UpdateDatabaseMetadata"
|
|
1910
|
+
}
|
|
1911
|
+
}
|
|
1912
|
+
]
|
|
1913
|
+
},
|
|
1886
1914
|
"UpdateDatabaseDdl": {
|
|
1887
1915
|
"requestType": "UpdateDatabaseDdlRequest",
|
|
1888
1916
|
"responseType": "google.longrunning.Operation",
|
|
@@ -2340,6 +2368,17 @@
|
|
|
2340
2368
|
"options": {
|
|
2341
2369
|
"(google.api.field_behavior)": "OUTPUT_ONLY"
|
|
2342
2370
|
}
|
|
2371
|
+
},
|
|
2372
|
+
"enableDropProtection": {
|
|
2373
|
+
"type": "bool",
|
|
2374
|
+
"id": 11
|
|
2375
|
+
},
|
|
2376
|
+
"reconciling": {
|
|
2377
|
+
"type": "bool",
|
|
2378
|
+
"id": 12,
|
|
2379
|
+
"options": {
|
|
2380
|
+
"(google.api.field_behavior)": "OUTPUT_ONLY"
|
|
2381
|
+
}
|
|
2343
2382
|
}
|
|
2344
2383
|
},
|
|
2345
2384
|
"nested": {
|
|
@@ -2450,6 +2489,40 @@
|
|
|
2450
2489
|
}
|
|
2451
2490
|
}
|
|
2452
2491
|
},
|
|
2492
|
+
"UpdateDatabaseRequest": {
|
|
2493
|
+
"fields": {
|
|
2494
|
+
"database": {
|
|
2495
|
+
"type": "Database",
|
|
2496
|
+
"id": 1,
|
|
2497
|
+
"options": {
|
|
2498
|
+
"(google.api.field_behavior)": "REQUIRED"
|
|
2499
|
+
}
|
|
2500
|
+
},
|
|
2501
|
+
"updateMask": {
|
|
2502
|
+
"type": "google.protobuf.FieldMask",
|
|
2503
|
+
"id": 2,
|
|
2504
|
+
"options": {
|
|
2505
|
+
"(google.api.field_behavior)": "REQUIRED"
|
|
2506
|
+
}
|
|
2507
|
+
}
|
|
2508
|
+
}
|
|
2509
|
+
},
|
|
2510
|
+
"UpdateDatabaseMetadata": {
|
|
2511
|
+
"fields": {
|
|
2512
|
+
"request": {
|
|
2513
|
+
"type": "UpdateDatabaseRequest",
|
|
2514
|
+
"id": 1
|
|
2515
|
+
},
|
|
2516
|
+
"progress": {
|
|
2517
|
+
"type": "OperationProgress",
|
|
2518
|
+
"id": 2
|
|
2519
|
+
},
|
|
2520
|
+
"cancelTime": {
|
|
2521
|
+
"type": "google.protobuf.Timestamp",
|
|
2522
|
+
"id": 3
|
|
2523
|
+
}
|
|
2524
|
+
}
|
|
2525
|
+
},
|
|
2453
2526
|
"UpdateDatabaseDdlRequest": {
|
|
2454
2527
|
"fields": {
|
|
2455
2528
|
"database": {
|
|
@@ -307,6 +307,10 @@ class GrpcService extends common_1.Service {
|
|
|
307
307
|
}
|
|
308
308
|
this.maxRetries = options.maxRetries;
|
|
309
309
|
this.userAgent = common_1.util.getUserAgentFromPackageJson(config.packageJson);
|
|
310
|
+
if (this.providedUserAgent) {
|
|
311
|
+
this.userAgent = `${this.providedUserAgent} ${this.userAgent}`;
|
|
312
|
+
}
|
|
313
|
+
options['grpc.primary_user_agent'] = this.userAgent;
|
|
310
314
|
this.activeServiceMap_ = new Map();
|
|
311
315
|
this.protos = {};
|
|
312
316
|
const protoServices = config.protoServices;
|
package/build/src/database.d.ts
CHANGED
|
@@ -34,8 +34,11 @@ import { EnumKey, RequestConfig, TranslateEnumKeys } from '.';
|
|
|
34
34
|
import IPolicy = google.iam.v1.IPolicy;
|
|
35
35
|
import Policy = google.iam.v1.Policy;
|
|
36
36
|
import FieldMask = google.protobuf.FieldMask;
|
|
37
|
+
import IDatabase = google.spanner.admin.database.v1.IDatabase;
|
|
37
38
|
export type GetDatabaseRolesCallback = RequestCallback<IDatabaseRole, databaseAdmin.spanner.admin.database.v1.IListDatabaseRolesResponse>;
|
|
38
39
|
export type GetDatabaseRolesResponse = PagedResponse<IDatabaseRole, databaseAdmin.spanner.admin.database.v1.IListDatabaseRolesResponse>;
|
|
40
|
+
type SetDatabaseMetadataCallback = ResourceCallback<GaxOperation, IOperation>;
|
|
41
|
+
type SetDatabaseMetadataResponse = [GaxOperation, IOperation];
|
|
39
42
|
type IDatabaseRole = databaseAdmin.spanner.admin.database.v1.IDatabaseRole;
|
|
40
43
|
type CreateBatchTransactionCallback = ResourceCallback<BatchTransaction, google.spanner.v1.ITransaction | google.spanner.v1.ISession>;
|
|
41
44
|
type CreateBatchTransactionResponse = [
|
|
@@ -164,6 +167,69 @@ declare class Database extends common.GrpcServiceObject {
|
|
|
164
167
|
request: DatabaseRequest;
|
|
165
168
|
databaseRole?: string | null;
|
|
166
169
|
constructor(instance: Instance, name: string, poolOptions?: SessionPoolConstructor | SessionPoolOptions, queryOptions?: spannerClient.spanner.v1.ExecuteSqlRequest.IQueryOptions);
|
|
170
|
+
/**
|
|
171
|
+
* @typedef {array} SetDatabaseMetadataResponse
|
|
172
|
+
* @property {object} 0 The {@link Database} metadata.
|
|
173
|
+
* @property {object} 1 The full API response.
|
|
174
|
+
*/
|
|
175
|
+
/**
|
|
176
|
+
* @callback SetDatabaseMetadataCallback
|
|
177
|
+
* @param {?Error} err Request error, if any.
|
|
178
|
+
* @param {object} metadata The {@link Database} metadata.
|
|
179
|
+
* @param {object} apiResponse The full API response.
|
|
180
|
+
*/
|
|
181
|
+
/**
|
|
182
|
+
* Update the metadata for this database. Note that this method follows PATCH
|
|
183
|
+
* semantics, so previously-configured settings will persist.
|
|
184
|
+
*
|
|
185
|
+
* Wrapper around {@link v1.DatabaseAdminClient#updateDatabase}.
|
|
186
|
+
*
|
|
187
|
+
* @see {@link v1.DatabaseAdminClient#updateDatabase}
|
|
188
|
+
* @see [UpdateDatabase API Documentation](https://cloud.google.com/spanner/docs/reference/rpc/google.spanner.admin.database.v1#google.spanner.admin.database.v1.DatabaseAdmin.UpdateDatabase)
|
|
189
|
+
*
|
|
190
|
+
* @param {object} metadata The metadata you wish to set.
|
|
191
|
+
* @param {object} [gaxOptions] Request configuration options,
|
|
192
|
+
* See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions}
|
|
193
|
+
* for more details.
|
|
194
|
+
* @param {SetDatabaseMetadataCallback} [callback] Callback function.
|
|
195
|
+
* @returns {Promise<SetDatabaseMetadataResponse>}
|
|
196
|
+
*
|
|
197
|
+
* @example
|
|
198
|
+
* ```
|
|
199
|
+
* const {Spanner} = require('@google-cloud/spanner');
|
|
200
|
+
* const spanner = new Spanner();
|
|
201
|
+
*
|
|
202
|
+
* const instance = spanner.instance('my-instance');
|
|
203
|
+
* const database = instance.database('my-database');
|
|
204
|
+
*
|
|
205
|
+
* const metadata = {
|
|
206
|
+
* enableDropProtection: true
|
|
207
|
+
* };
|
|
208
|
+
*
|
|
209
|
+
* database.setMetadata(metadata, function(err, operation, apiResponse) {
|
|
210
|
+
* if (err) {
|
|
211
|
+
* // Error handling omitted.
|
|
212
|
+
* }
|
|
213
|
+
*
|
|
214
|
+
* operation
|
|
215
|
+
* .on('error', function(err) {})
|
|
216
|
+
* .on('complete', function() {
|
|
217
|
+
* // Metadata updated successfully.
|
|
218
|
+
* });
|
|
219
|
+
* });
|
|
220
|
+
*
|
|
221
|
+
* //-
|
|
222
|
+
* // If the callback is omitted, we'll return a Promise.
|
|
223
|
+
* //-
|
|
224
|
+
* database.setMetadata(metadata).then(function(data) {
|
|
225
|
+
* const operation = data[0];
|
|
226
|
+
* const apiResponse = data[1];
|
|
227
|
+
* });
|
|
228
|
+
* ```
|
|
229
|
+
*/
|
|
230
|
+
setMetadata(metadata: IDatabase, gaxOptions?: CallOptions): Promise<SetDatabaseMetadataResponse>;
|
|
231
|
+
setMetadata(metadata: IDatabase, callback: SetDatabaseMetadataCallback): void;
|
|
232
|
+
setMetadata(metadata: IDatabase, gaxOptions: CallOptions, callback: SetDatabaseMetadataCallback): void;
|
|
167
233
|
static getEnvironmentQueryOptions(): databaseAdmin.spanner.v1.ExecuteSqlRequest.IQueryOptions;
|
|
168
234
|
/**
|
|
169
235
|
* @typedef {object} BatchCreateSessionsOptions
|
package/build/src/database.js
CHANGED
|
@@ -31,6 +31,7 @@ const table_1 = require("./table");
|
|
|
31
31
|
const transaction_runner_1 = require("./transaction-runner");
|
|
32
32
|
const common_1 = require("./common");
|
|
33
33
|
const arrify = require("arrify");
|
|
34
|
+
const snakeCase = require("lodash.snakecase");
|
|
34
35
|
/**
|
|
35
36
|
* Create a Database object to interact with a Cloud Spanner database.
|
|
36
37
|
*
|
|
@@ -156,6 +157,25 @@ class Database extends common.GrpcServiceObject {
|
|
|
156
157
|
this.pool_.open();
|
|
157
158
|
this.queryOptions_ = Object.assign(Object.assign({}, queryOptions), Database.getEnvironmentQueryOptions());
|
|
158
159
|
}
|
|
160
|
+
setMetadata(metadata, optionsOrCallback, cb) {
|
|
161
|
+
const gaxOpts = typeof optionsOrCallback === 'object' ? optionsOrCallback : {};
|
|
162
|
+
const callback = typeof optionsOrCallback === 'function' ? optionsOrCallback : cb;
|
|
163
|
+
const reqOpts = {
|
|
164
|
+
database: extend({
|
|
165
|
+
name: this.formattedName_,
|
|
166
|
+
}, metadata),
|
|
167
|
+
updateMask: {
|
|
168
|
+
paths: Object.keys(metadata).map(snakeCase),
|
|
169
|
+
},
|
|
170
|
+
};
|
|
171
|
+
return this.request({
|
|
172
|
+
client: 'DatabaseAdminClient',
|
|
173
|
+
method: 'updateDatabase',
|
|
174
|
+
reqOpts,
|
|
175
|
+
gaxOpts,
|
|
176
|
+
headers: this.resourceHeader_,
|
|
177
|
+
}, callback);
|
|
178
|
+
}
|
|
159
179
|
static getEnvironmentQueryOptions() {
|
|
160
180
|
const options = {};
|
|
161
181
|
if (process.env.SPANNER_OPTIMIZER_VERSION) {
|
|
@@ -1243,6 +1263,7 @@ exports.Database = Database;
|
|
|
1243
1263
|
'runTransaction',
|
|
1244
1264
|
'runTransactionAsync',
|
|
1245
1265
|
'session',
|
|
1266
|
+
'setMetadata',
|
|
1246
1267
|
'table',
|
|
1247
1268
|
'updateSchema',
|
|
1248
1269
|
],
|
package/build/src/index.d.ts
CHANGED
|
@@ -48,8 +48,8 @@ export type GetInstanceConfigOperationsResponse = PagedResponse<IOperation, inst
|
|
|
48
48
|
export type GetInstanceConfigOperationsCallback = PagedCallback<IOperation, instanceAdmin.spanner.admin.instance.v1.IListInstanceConfigOperationsResponse>;
|
|
49
49
|
/**
|
|
50
50
|
* Session pool configuration options.
|
|
51
|
-
* @property {boolean} [routeToLeaderEnabled=
|
|
52
|
-
*
|
|
51
|
+
* @property {boolean} [routeToLeaderEnabled=False] If set to true leader aware routing will be enabled.
|
|
52
|
+
* Enabling leader aware routing would route all requests in RW/PDML transactions to leader region.
|
|
53
53
|
*/
|
|
54
54
|
export interface SpannerOptions extends GrpcClientOptions {
|
|
55
55
|
apiEndpoint?: string;
|
|
@@ -111,13 +111,13 @@ export interface SessionPoolInterface extends EventEmitter {
|
|
|
111
111
|
* @property {number} [acquireTimeout=Infinity] Time in milliseconds before
|
|
112
112
|
* giving up trying to acquire a session. If the specified value is
|
|
113
113
|
* `Infinity`, a timeout will not occur.
|
|
114
|
-
* @property {number} [concurrency=
|
|
114
|
+
* @property {number} [concurrency=Infinity] How many concurrent requests the pool is
|
|
115
115
|
* allowed to make.
|
|
116
116
|
* @property {boolean} [fail=false] If set to true, an error will be thrown when
|
|
117
117
|
* there are no available sessions for a request.
|
|
118
118
|
* @property {number} [idlesAfter=10] How long until a resource becomes idle, in
|
|
119
119
|
* minutes.
|
|
120
|
-
* @property {number} [keepAlive=
|
|
120
|
+
* @property {number} [keepAlive=30] How often to ping idle sessions, in
|
|
121
121
|
* minutes. Must be less than 1 hour.
|
|
122
122
|
* @property {Object<string, string>} [labels] Labels to apply to any session
|
|
123
123
|
* created by the pool.
|
|
@@ -125,7 +125,7 @@ export interface SessionPoolInterface extends EventEmitter {
|
|
|
125
125
|
* given time.
|
|
126
126
|
* @property {number} [maxIdle=1] Maximum number of idle resources to keep in
|
|
127
127
|
* the pool at any given time.
|
|
128
|
-
* @property {number} [min=
|
|
128
|
+
* @property {number} [min=25] Minimum number of resources to keep in the pool at
|
|
129
129
|
* any given time.
|
|
130
130
|
* @property {number} [writes=0.0]. Deprecated.
|
|
131
131
|
* @property {number} [incStep=25] The number of new sessions to create when at
|
|
@@ -460,6 +460,85 @@ export declare class DatabaseAdminClient {
|
|
|
460
460
|
* region_tag:spanner_v1_generated_DatabaseAdmin_CreateDatabase_async
|
|
461
461
|
*/
|
|
462
462
|
checkCreateDatabaseProgress(name: string): Promise<LROperation<protos.google.spanner.admin.database.v1.Database, protos.google.spanner.admin.database.v1.CreateDatabaseMetadata>>;
|
|
463
|
+
/**
|
|
464
|
+
* Updates a Cloud Spanner database. The returned
|
|
465
|
+
* {@link google.longrunning.Operation|long-running operation} can be used to track
|
|
466
|
+
* the progress of updating the database. If the named database does not
|
|
467
|
+
* exist, returns `NOT_FOUND`.
|
|
468
|
+
*
|
|
469
|
+
* While the operation is pending:
|
|
470
|
+
*
|
|
471
|
+
* * The database's
|
|
472
|
+
* {@link google.spanner.admin.database.v1.Database.reconciling|reconciling}
|
|
473
|
+
* field is set to true.
|
|
474
|
+
* * Cancelling the operation is best-effort. If the cancellation succeeds,
|
|
475
|
+
* the operation metadata's
|
|
476
|
+
* {@link google.spanner.admin.database.v1.UpdateDatabaseMetadata.cancel_time|cancel_time}
|
|
477
|
+
* is set, the updates are reverted, and the operation terminates with a
|
|
478
|
+
* `CANCELLED` status.
|
|
479
|
+
* * New UpdateDatabase requests will return a `FAILED_PRECONDITION` error
|
|
480
|
+
* until the pending operation is done (returns successfully or with
|
|
481
|
+
* error).
|
|
482
|
+
* * Reading the database via the API continues to give the pre-request
|
|
483
|
+
* values.
|
|
484
|
+
*
|
|
485
|
+
* Upon completion of the returned operation:
|
|
486
|
+
*
|
|
487
|
+
* * The new values are in effect and readable via the API.
|
|
488
|
+
* * The database's
|
|
489
|
+
* {@link google.spanner.admin.database.v1.Database.reconciling|reconciling}
|
|
490
|
+
* field becomes false.
|
|
491
|
+
*
|
|
492
|
+
* The returned {@link google.longrunning.Operation|long-running operation} will
|
|
493
|
+
* have a name of the format
|
|
494
|
+
* `projects/<project>/instances/<instance>/databases/<database>/operations/<operation_id>`
|
|
495
|
+
* and can be used to track the database modification. The
|
|
496
|
+
* {@link google.longrunning.Operation.metadata|metadata} field type is
|
|
497
|
+
* {@link google.spanner.admin.database.v1.UpdateDatabaseMetadata|UpdateDatabaseMetadata}.
|
|
498
|
+
* The {@link google.longrunning.Operation.response|response} field type is
|
|
499
|
+
* {@link google.spanner.admin.database.v1.Database|Database}, if successful.
|
|
500
|
+
*
|
|
501
|
+
* @param {Object} request
|
|
502
|
+
* The request object that will be sent.
|
|
503
|
+
* @param {google.spanner.admin.database.v1.Database} request.database
|
|
504
|
+
* Required. The database to update.
|
|
505
|
+
* The `name` field of the database is of the form
|
|
506
|
+
* `projects/<project>/instances/<instance>/databases/<database>`.
|
|
507
|
+
* @param {google.protobuf.FieldMask} request.updateMask
|
|
508
|
+
* Required. The list of fields to update. Currently, only
|
|
509
|
+
* `enable_drop_protection` field can be updated.
|
|
510
|
+
* @param {object} [options]
|
|
511
|
+
* Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
|
|
512
|
+
* @returns {Promise} - The promise which resolves to an array.
|
|
513
|
+
* The first element of the array is an object representing
|
|
514
|
+
* a long running operation. Its `promise()` method returns a promise
|
|
515
|
+
* you can `await` for.
|
|
516
|
+
* Please see the
|
|
517
|
+
* [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations)
|
|
518
|
+
* for more details and examples.
|
|
519
|
+
* @example <caption>include:samples/generated/v1/database_admin.update_database.js</caption>
|
|
520
|
+
* region_tag:spanner_v1_generated_DatabaseAdmin_UpdateDatabase_async
|
|
521
|
+
*/
|
|
522
|
+
updateDatabase(request?: protos.google.spanner.admin.database.v1.IUpdateDatabaseRequest, options?: CallOptions): Promise<[
|
|
523
|
+
LROperation<protos.google.spanner.admin.database.v1.IDatabase, protos.google.spanner.admin.database.v1.IUpdateDatabaseMetadata>,
|
|
524
|
+
protos.google.longrunning.IOperation | undefined,
|
|
525
|
+
{} | undefined
|
|
526
|
+
]>;
|
|
527
|
+
updateDatabase(request: protos.google.spanner.admin.database.v1.IUpdateDatabaseRequest, options: CallOptions, callback: Callback<LROperation<protos.google.spanner.admin.database.v1.IDatabase, protos.google.spanner.admin.database.v1.IUpdateDatabaseMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
|
|
528
|
+
updateDatabase(request: protos.google.spanner.admin.database.v1.IUpdateDatabaseRequest, callback: Callback<LROperation<protos.google.spanner.admin.database.v1.IDatabase, protos.google.spanner.admin.database.v1.IUpdateDatabaseMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
|
|
529
|
+
/**
|
|
530
|
+
* Check the status of the long running operation returned by `updateDatabase()`.
|
|
531
|
+
* @param {String} name
|
|
532
|
+
* The operation name that will be passed.
|
|
533
|
+
* @returns {Promise} - The promise which resolves to an object.
|
|
534
|
+
* The decoded operation object has result and metadata field to get information from.
|
|
535
|
+
* Please see the
|
|
536
|
+
* [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations)
|
|
537
|
+
* for more details and examples.
|
|
538
|
+
* @example <caption>include:samples/generated/v1/database_admin.update_database.js</caption>
|
|
539
|
+
* region_tag:spanner_v1_generated_DatabaseAdmin_UpdateDatabase_async
|
|
540
|
+
*/
|
|
541
|
+
checkUpdateDatabaseProgress(name: string): Promise<LROperation<protos.google.spanner.admin.database.v1.Database, protos.google.spanner.admin.database.v1.UpdateDatabaseMetadata>>;
|
|
463
542
|
/**
|
|
464
543
|
* Updates the schema of a Cloud Spanner database by
|
|
465
544
|
* creating/altering/dropping tables, columns, indexes, etc. The returned
|
|
@@ -220,6 +220,8 @@ class DatabaseAdminClient {
|
|
|
220
220
|
.operationsClient(opts);
|
|
221
221
|
const createDatabaseResponse = protoFilesRoot.lookup('.google.spanner.admin.database.v1.Database');
|
|
222
222
|
const createDatabaseMetadata = protoFilesRoot.lookup('.google.spanner.admin.database.v1.CreateDatabaseMetadata');
|
|
223
|
+
const updateDatabaseResponse = protoFilesRoot.lookup('.google.spanner.admin.database.v1.Database');
|
|
224
|
+
const updateDatabaseMetadata = protoFilesRoot.lookup('.google.spanner.admin.database.v1.UpdateDatabaseMetadata');
|
|
223
225
|
const updateDatabaseDdlResponse = protoFilesRoot.lookup('.google.protobuf.Empty');
|
|
224
226
|
const updateDatabaseDdlMetadata = protoFilesRoot.lookup('.google.spanner.admin.database.v1.UpdateDatabaseDdlMetadata');
|
|
225
227
|
const createBackupResponse = protoFilesRoot.lookup('.google.spanner.admin.database.v1.Backup');
|
|
@@ -230,6 +232,7 @@ class DatabaseAdminClient {
|
|
|
230
232
|
const restoreDatabaseMetadata = protoFilesRoot.lookup('.google.spanner.admin.database.v1.RestoreDatabaseMetadata');
|
|
231
233
|
this.descriptors.longrunning = {
|
|
232
234
|
createDatabase: new this._gaxModule.LongrunningDescriptor(this.operationsClient, createDatabaseResponse.decode.bind(createDatabaseResponse), createDatabaseMetadata.decode.bind(createDatabaseMetadata)),
|
|
235
|
+
updateDatabase: new this._gaxModule.LongrunningDescriptor(this.operationsClient, updateDatabaseResponse.decode.bind(updateDatabaseResponse), updateDatabaseMetadata.decode.bind(updateDatabaseMetadata)),
|
|
233
236
|
updateDatabaseDdl: new this._gaxModule.LongrunningDescriptor(this.operationsClient, updateDatabaseDdlResponse.decode.bind(updateDatabaseDdlResponse), updateDatabaseDdlMetadata.decode.bind(updateDatabaseDdlMetadata)),
|
|
234
237
|
createBackup: new this._gaxModule.LongrunningDescriptor(this.operationsClient, createBackupResponse.decode.bind(createBackupResponse), createBackupMetadata.decode.bind(createBackupMetadata)),
|
|
235
238
|
copyBackup: new this._gaxModule.LongrunningDescriptor(this.operationsClient, copyBackupResponse.decode.bind(copyBackupResponse), copyBackupMetadata.decode.bind(copyBackupMetadata)),
|
|
@@ -272,6 +275,7 @@ class DatabaseAdminClient {
|
|
|
272
275
|
'listDatabases',
|
|
273
276
|
'createDatabase',
|
|
274
277
|
'getDatabase',
|
|
278
|
+
'updateDatabase',
|
|
275
279
|
'updateDatabaseDdl',
|
|
276
280
|
'dropDatabase',
|
|
277
281
|
'getDatabaseDdl',
|
|
@@ -579,6 +583,45 @@ class DatabaseAdminClient {
|
|
|
579
583
|
const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createDatabase, this._gaxModule.createDefaultBackoffSettings());
|
|
580
584
|
return decodeOperation;
|
|
581
585
|
}
|
|
586
|
+
updateDatabase(request, optionsOrCallback, callback) {
|
|
587
|
+
var _a;
|
|
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
|
+
'database.name': (_a = request.database.name) !== null && _a !== void 0 ? _a : '',
|
|
603
|
+
});
|
|
604
|
+
this.initialize();
|
|
605
|
+
return this.innerApiCalls.updateDatabase(request, options, callback);
|
|
606
|
+
}
|
|
607
|
+
/**
|
|
608
|
+
* Check the status of the long running operation returned by `updateDatabase()`.
|
|
609
|
+
* @param {String} name
|
|
610
|
+
* The operation name that will be passed.
|
|
611
|
+
* @returns {Promise} - The promise which resolves to an object.
|
|
612
|
+
* The decoded operation object has result and metadata field to get information from.
|
|
613
|
+
* Please see the
|
|
614
|
+
* [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations)
|
|
615
|
+
* for more details and examples.
|
|
616
|
+
* @example <caption>include:samples/generated/v1/database_admin.update_database.js</caption>
|
|
617
|
+
* region_tag:spanner_v1_generated_DatabaseAdmin_UpdateDatabase_async
|
|
618
|
+
*/
|
|
619
|
+
async checkUpdateDatabaseProgress(name) {
|
|
620
|
+
const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({ name });
|
|
621
|
+
const [operation] = await this.operationsClient.getOperation(request);
|
|
622
|
+
const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateDatabase, this._gaxModule.createDefaultBackoffSettings());
|
|
623
|
+
return decodeOperation;
|
|
624
|
+
}
|
|
582
625
|
updateDatabaseDdl(request, optionsOrCallback, callback) {
|
|
583
626
|
var _a;
|
|
584
627
|
request = request || {};
|
|
@@ -44,6 +44,11 @@
|
|
|
44
44
|
"retry_codes_name": "idempotent",
|
|
45
45
|
"retry_params_name": "e9fafda332ce8a1702dc1575de3ca81c4feb4799"
|
|
46
46
|
},
|
|
47
|
+
"UpdateDatabase": {
|
|
48
|
+
"timeout_millis": 3600000,
|
|
49
|
+
"retry_codes_name": "idempotent",
|
|
50
|
+
"retry_params_name": "e9fafda332ce8a1702dc1575de3ca81c4feb4799"
|
|
51
|
+
},
|
|
47
52
|
"UpdateDatabaseDdl": {
|
|
48
53
|
"timeout_millis": 3600000,
|
|
49
54
|
"retry_codes_name": "idempotent",
|