@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.
Files changed (49) hide show
  1. package/README.md +111 -0
  2. package/build/protos/google/spanner/admin/database/v1/backup.proto +773 -0
  3. package/build/protos/google/spanner/admin/database/v1/backup_schedule.proto +230 -0
  4. package/build/protos/google/spanner/admin/database/v1/common.proto +132 -0
  5. package/build/protos/google/spanner/admin/database/v1/spanner_database_admin.proto +1314 -0
  6. package/build/protos/google/spanner/admin/instance/v1/common.proto +64 -0
  7. package/build/protos/google/spanner/admin/instance/v1/spanner_instance_admin.proto +2184 -0
  8. package/build/protos/google/spanner/executor/v1/cloud_executor.proto +1610 -0
  9. package/build/protos/google/spanner/v1/change_stream.proto +451 -0
  10. package/build/protos/google/spanner/v1/commit_response.proto +80 -0
  11. package/build/protos/google/spanner/v1/keys.proto +163 -0
  12. package/build/protos/google/spanner/v1/location.proto +388 -0
  13. package/build/protos/google/spanner/v1/mutation.proto +156 -0
  14. package/build/protos/google/spanner/v1/query_plan.proto +156 -0
  15. package/build/protos/google/spanner/v1/result_set.proto +260 -0
  16. package/build/protos/google/spanner/v1/spanner.proto +1472 -0
  17. package/build/protos/google/spanner/v1/transaction.proto +329 -0
  18. package/build/protos/google/spanner/v1/type.proto +214 -0
  19. package/build/protos/protos.d.ts +42547 -0
  20. package/build/protos/protos.js +1 -0
  21. package/build/protos/protos.json +1 -0
  22. package/build/src/index.d.ts +20 -0
  23. package/build/src/index.js +34 -0
  24. package/build/src/index.js.map +1 -0
  25. package/build/src/v1/database_admin_client.d.ts +2433 -0
  26. package/build/src/v1/database_admin_client.js +2938 -0
  27. package/build/src/v1/database_admin_client.js.map +1 -0
  28. package/build/src/v1/database_admin_client_config.json +169 -0
  29. package/build/src/v1/database_admin_proto_list.json +6 -0
  30. package/build/src/v1/gapic_metadata.json +253 -0
  31. package/build/src/v1/index.d.ts +4 -0
  32. package/build/src/v1/index.js +29 -0
  33. package/build/src/v1/index.js.map +1 -0
  34. package/build/src/v1/instance_admin_client.d.ts +2162 -0
  35. package/build/src/v1/instance_admin_client.js +2411 -0
  36. package/build/src/v1/instance_admin_client.js.map +1 -0
  37. package/build/src/v1/instance_admin_client_config.json +129 -0
  38. package/build/src/v1/instance_admin_proto_list.json +4 -0
  39. package/build/src/v1/spanner_client.d.ts +1353 -0
  40. package/build/src/v1/spanner_client.js +1456 -0
  41. package/build/src/v1/spanner_client.js.map +1 -0
  42. package/build/src/v1/spanner_client_config.json +123 -0
  43. package/build/src/v1/spanner_executor_proxy_client.d.ts +419 -0
  44. package/build/src/v1/spanner_executor_proxy_client.js +730 -0
  45. package/build/src/v1/spanner_executor_proxy_client.js.map +1 -0
  46. package/build/src/v1/spanner_executor_proxy_client_config.json +30 -0
  47. package/build/src/v1/spanner_executor_proxy_proto_list.json +15 -0
  48. package/build/src/v1/spanner_proto_list.json +12 -0
  49. package/package.json +65 -0
@@ -0,0 +1,730 @@
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.SpannerExecutorProxyClient = void 0;
21
+ const stream_1 = require("stream");
22
+ const jsonProtos = require("../../protos/protos.json");
23
+ const google_gax_1 = require("google-gax");
24
+ /**
25
+ * Client JSON configuration object, loaded from
26
+ * `src/v1/spanner_executor_proxy_client_config.json`.
27
+ * This file defines retry strategy and timeouts for all API methods in this library.
28
+ */
29
+ const gapicConfig = require("./spanner_executor_proxy_client_config.json");
30
+ const version = require('../../../package.json').version;
31
+ /**
32
+ * Service that executes SpannerActions asynchronously.
33
+ * @class
34
+ * @memberof v1
35
+ */
36
+ class SpannerExecutorProxyClient {
37
+ _terminated = false;
38
+ _opts;
39
+ _providedCustomServicePath;
40
+ _gaxModule;
41
+ _gaxGrpc;
42
+ _protos;
43
+ _defaults;
44
+ _universeDomain;
45
+ _servicePath;
46
+ _log = google_gax_1.loggingUtils.log('spanner-api');
47
+ auth;
48
+ descriptors = {
49
+ page: {},
50
+ stream: {},
51
+ longrunning: {},
52
+ batching: {},
53
+ };
54
+ warn;
55
+ innerApiCalls;
56
+ pathTemplates;
57
+ spannerExecutorProxyStub;
58
+ /**
59
+ * Construct an instance of SpannerExecutorProxyClient.
60
+ *
61
+ * @param {object} [options] - The configuration object.
62
+ * The options accepted by the constructor are described in detail
63
+ * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance).
64
+ * The common options are:
65
+ * @param {object} [options.credentials] - Credentials object.
66
+ * @param {string} [options.credentials.client_email]
67
+ * @param {string} [options.credentials.private_key]
68
+ * @param {string} [options.email] - Account email address. Required when
69
+ * using a .pem or .p12 keyFilename.
70
+ * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or
71
+ * .p12 key downloaded from the Google Developers Console. If you provide
72
+ * a path to a JSON file, the projectId option below is not necessary.
73
+ * NOTE: .pem and .p12 require you to specify options.email as well.
74
+ * @param {number} [options.port] - The port on which to connect to
75
+ * the remote host.
76
+ * @param {string} [options.projectId] - The project ID from the Google
77
+ * Developer's Console, e.g. 'grape-spaceship-123'. We will also check
78
+ * the environment variable GCLOUD_PROJECT for your project ID. If your
79
+ * app is running in an environment which supports
80
+ * {@link https://cloud.google.com/docs/authentication/application-default-credentials Application Default Credentials},
81
+ * your project ID will be detected automatically.
82
+ * @param {string} [options.apiEndpoint] - The domain name of the
83
+ * API remote host.
84
+ * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override.
85
+ * Follows the structure of {@link gapicConfig}.
86
+ * @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode.
87
+ * For more information, please check the
88
+ * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}.
89
+ * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you
90
+ * need to avoid loading the default gRPC version and want to use the fallback
91
+ * HTTP implementation. Load only fallback version and pass it to the constructor:
92
+ * ```
93
+ * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC
94
+ * const client = new SpannerExecutorProxyClient({fallback: true}, gax);
95
+ * ```
96
+ */
97
+ constructor(opts, gaxInstance) {
98
+ // Ensure that options include all the required fields.
99
+ const staticMembers = this.constructor;
100
+ if (opts?.universe_domain &&
101
+ opts?.universeDomain &&
102
+ opts?.universe_domain !== opts?.universeDomain) {
103
+ throw new Error('Please set either universe_domain or universeDomain, but not both.');
104
+ }
105
+ const universeDomainEnvVar = typeof process === 'object' && typeof process.env === 'object'
106
+ ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']
107
+ : undefined;
108
+ this._universeDomain =
109
+ opts?.universeDomain ??
110
+ opts?.universe_domain ??
111
+ universeDomainEnvVar ??
112
+ 'googleapis.com';
113
+ this._servicePath = 'spanner-cloud-executor.' + this._universeDomain;
114
+ const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath;
115
+ this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint);
116
+ const port = opts?.port || staticMembers.port;
117
+ const clientConfig = opts?.clientConfig ?? {};
118
+ const fallback = opts?.fallback ??
119
+ (typeof window !== 'undefined' && typeof window?.fetch === 'function');
120
+ opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts);
121
+ // Request numeric enum values if REST transport is used.
122
+ opts.numericEnums = true;
123
+ // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case.
124
+ if (servicePath !== this._servicePath && !('scopes' in opts)) {
125
+ opts['scopes'] = staticMembers.scopes;
126
+ }
127
+ // Load google-gax module synchronously if needed
128
+ if (!gaxInstance) {
129
+ gaxInstance = require('google-gax');
130
+ }
131
+ // Choose either gRPC or proto-over-HTTP implementation of google-gax.
132
+ this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance;
133
+ // Create a `gaxGrpc` object, with any grpc-specific options sent to the client.
134
+ this._gaxGrpc = new this._gaxModule.GrpcClient(opts);
135
+ // Save options to use in initialize() method.
136
+ this._opts = opts;
137
+ // Save the auth object to the client, for use by other methods.
138
+ this.auth = this._gaxGrpc.auth;
139
+ // Set useJWTAccessWithScope on the auth object.
140
+ this.auth.useJWTAccessWithScope = true;
141
+ // Set defaultServicePath on the auth object.
142
+ this.auth.defaultServicePath = this._servicePath;
143
+ // Set the default scopes in auth client if needed.
144
+ if (servicePath === this._servicePath) {
145
+ this.auth.defaultScopes = staticMembers.scopes;
146
+ }
147
+ // Determine the client header string.
148
+ const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`];
149
+ if (typeof process === 'object' && 'versions' in process) {
150
+ clientHeader.push(`gl-node/${process.versions.node}`);
151
+ }
152
+ else {
153
+ clientHeader.push(`gl-web/${this._gaxModule.version}`);
154
+ }
155
+ if (!opts.fallback) {
156
+ clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`);
157
+ }
158
+ else {
159
+ clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`);
160
+ }
161
+ if (opts.libName && opts.libVersion) {
162
+ clientHeader.push(`${opts.libName}/${opts.libVersion}`);
163
+ }
164
+ // Load the applicable protos.
165
+ this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos);
166
+ // This API contains "path templates"; forward-slash-separated
167
+ // identifiers to uniquely identify resources within the API.
168
+ // Create useful helper objects for these.
169
+ this.pathTemplates = {
170
+ backupPathTemplate: new this._gaxModule.PathTemplate('projects/{project}/instances/{instance}/backups/{backup}'),
171
+ backupSchedulePathTemplate: new this._gaxModule.PathTemplate('projects/{project}/instances/{instance}/databases/{database}/backupSchedules/{schedule}'),
172
+ databasePathTemplate: new this._gaxModule.PathTemplate('projects/{project}/instances/{instance}/databases/{database}'),
173
+ databaseRolePathTemplate: new this._gaxModule.PathTemplate('projects/{project}/instances/{instance}/databases/{database}/databaseRoles/{role}'),
174
+ instancePathTemplate: new this._gaxModule.PathTemplate('projects/{project}/instances/{instance}'),
175
+ instanceConfigPathTemplate: new this._gaxModule.PathTemplate('projects/{project}/instanceConfigs/{instance_config}'),
176
+ instancePartitionPathTemplate: new this._gaxModule.PathTemplate('projects/{project}/instances/{instance}/instancePartitions/{instance_partition}'),
177
+ sessionPathTemplate: new this._gaxModule.PathTemplate('projects/{project}/instances/{instance}/databases/{database}/sessions/{session}'),
178
+ };
179
+ // Some of the methods on this service provide streaming responses.
180
+ // Provide descriptors for these.
181
+ this.descriptors.stream = {
182
+ executeActionAsync: new this._gaxModule.StreamDescriptor(this._gaxModule.StreamType.BIDI_STREAMING, !!opts.fallback, !!opts.gaxServerStreamingRetries),
183
+ };
184
+ // Put together the default options sent with requests.
185
+ this._defaults = this._gaxGrpc.constructSettings('google.spanner.executor.v1.SpannerExecutorProxy', gapicConfig, opts.clientConfig || {}, { 'x-goog-api-client': clientHeader.join(' ') });
186
+ // Set up a dictionary of "inner API calls"; the core implementation
187
+ // of calling the API is handled in `google-gax`, with this code
188
+ // merely providing the destination and request information.
189
+ this.innerApiCalls = {};
190
+ // Add a warn function to the client constructor so it can be easily tested.
191
+ this.warn = this._gaxModule.warn;
192
+ }
193
+ /**
194
+ * Initialize the client.
195
+ * Performs asynchronous operations (such as authentication) and prepares the client.
196
+ * This function will be called automatically when any class method is called for the
197
+ * first time, but if you need to initialize it before calling an actual method,
198
+ * feel free to call initialize() directly.
199
+ *
200
+ * You can await on this method if you want to make sure the client is initialized.
201
+ *
202
+ * @returns {Promise} A promise that resolves to an authenticated service stub.
203
+ */
204
+ initialize() {
205
+ // If the client stub promise is already initialized, return immediately.
206
+ if (this.spannerExecutorProxyStub) {
207
+ return this.spannerExecutorProxyStub;
208
+ }
209
+ // Put together the "service stub" for
210
+ // google.spanner.executor.v1.SpannerExecutorProxy.
211
+ this.spannerExecutorProxyStub = this._gaxGrpc.createStub(this._opts.fallback
212
+ ? this._protos.lookupService('google.spanner.executor.v1.SpannerExecutorProxy')
213
+ : // eslint-disable-next-line @typescript-eslint/no-explicit-any
214
+ this._protos.google.spanner.executor.v1.SpannerExecutorProxy, this._opts, this._providedCustomServicePath);
215
+ // Iterate over each of the methods that the service provides
216
+ // and create an API call method for each.
217
+ const spannerExecutorProxyStubMethods = ['executeActionAsync'];
218
+ for (const methodName of spannerExecutorProxyStubMethods) {
219
+ const callPromise = this.spannerExecutorProxyStub.then((stub) => (...args) => {
220
+ if (this._terminated) {
221
+ if (methodName in this.descriptors.stream) {
222
+ const stream = new stream_1.PassThrough({ objectMode: true });
223
+ setImmediate(() => {
224
+ stream.emit('error', new this._gaxModule.GoogleError('The client has already been closed.'));
225
+ });
226
+ return stream;
227
+ }
228
+ return Promise.reject('The client has already been closed.');
229
+ }
230
+ const func = stub[methodName];
231
+ return func.apply(stub, args);
232
+ }, (err) => () => {
233
+ throw err;
234
+ });
235
+ const descriptor = this.descriptors.stream[methodName] || undefined;
236
+ const apiCall = this._gaxModule.createApiCall(callPromise, this._defaults[methodName], descriptor, this._opts.fallback);
237
+ this.innerApiCalls[methodName] = apiCall;
238
+ }
239
+ return this.spannerExecutorProxyStub;
240
+ }
241
+ /**
242
+ * The DNS address for this API service.
243
+ * @deprecated Use the apiEndpoint method of the client instance.
244
+ * @returns {string} The DNS address for this service.
245
+ */
246
+ static get servicePath() {
247
+ if (typeof process === 'object' &&
248
+ typeof process.emitWarning === 'function') {
249
+ process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning');
250
+ }
251
+ return 'spanner-cloud-executor.googleapis.com';
252
+ }
253
+ /**
254
+ * The DNS address for this API service - same as servicePath.
255
+ * @deprecated Use the apiEndpoint method of the client instance.
256
+ * @returns {string} The DNS address for this service.
257
+ */
258
+ static get apiEndpoint() {
259
+ if (typeof process === 'object' &&
260
+ typeof process.emitWarning === 'function') {
261
+ process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning');
262
+ }
263
+ return 'spanner-cloud-executor.googleapis.com';
264
+ }
265
+ /**
266
+ * The DNS address for this API service.
267
+ * @returns {string} The DNS address for this service.
268
+ */
269
+ get apiEndpoint() {
270
+ return this._servicePath;
271
+ }
272
+ get universeDomain() {
273
+ return this._universeDomain;
274
+ }
275
+ /**
276
+ * The port for this API service.
277
+ * @returns {number} The default port for this service.
278
+ */
279
+ static get port() {
280
+ return 443;
281
+ }
282
+ /**
283
+ * The scopes needed to make gRPC calls for every method defined
284
+ * in this service.
285
+ * @returns {string[]} List of default scopes.
286
+ */
287
+ static get scopes() {
288
+ return [];
289
+ }
290
+ /**
291
+ * Return the project ID used by this class.
292
+ * @returns {Promise} A promise that resolves to string containing the project ID.
293
+ */
294
+ getProjectId(callback) {
295
+ if (callback) {
296
+ this.auth.getProjectId(callback);
297
+ return;
298
+ }
299
+ return this.auth.getProjectId();
300
+ }
301
+ // -------------------
302
+ // -- Service calls --
303
+ // -------------------
304
+ /**
305
+ * ExecuteActionAsync is a streaming call that starts executing a new Spanner
306
+ * action.
307
+ *
308
+ * For each request, the server will reply with one or more responses, but
309
+ * only the last response will contain status in the outcome.
310
+ *
311
+ * Responses can be matched to requests by action_id. It is allowed to have
312
+ * multiple actions in flight--in that case, actions are be executed in
313
+ * parallel.
314
+ *
315
+ * @param {object} [options]
316
+ * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
317
+ * @returns {Stream}
318
+ * An object stream which is both readable and writable. It accepts objects
319
+ * representing {@link protos.google.spanner.executor.v1.SpannerAsyncActionRequest|SpannerAsyncActionRequest} for write() method, and
320
+ * will emit objects representing {@link protos.google.spanner.executor.v1.SpannerAsyncActionResponse|SpannerAsyncActionResponse} on 'data' event asynchronously.
321
+ * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#bi-directional-streaming | documentation }
322
+ * for more details and examples.
323
+ * @example <caption>include:samples/generated/v1/spanner_executor_proxy.execute_action_async.js</caption>
324
+ * region_tag:spanner-cloud-executor_v1_generated_SpannerExecutorProxy_ExecuteActionAsync_async
325
+ */
326
+ executeActionAsync(options) {
327
+ this.initialize().catch((err) => {
328
+ throw err;
329
+ });
330
+ this._log.info('executeActionAsync stream %j', options);
331
+ return this.innerApiCalls.executeActionAsync(null, options);
332
+ }
333
+ // --------------------
334
+ // -- Path templates --
335
+ // --------------------
336
+ /**
337
+ * Return a fully-qualified backup resource name string.
338
+ *
339
+ * @param {string} project
340
+ * @param {string} instance
341
+ * @param {string} backup
342
+ * @returns {string} Resource name string.
343
+ */
344
+ backupPath(project, instance, backup) {
345
+ return this.pathTemplates.backupPathTemplate.render({
346
+ project: project,
347
+ instance: instance,
348
+ backup: backup,
349
+ });
350
+ }
351
+ /**
352
+ * Parse the project from Backup resource.
353
+ *
354
+ * @param {string} backupName
355
+ * A fully-qualified path representing Backup resource.
356
+ * @returns {string} A string representing the project.
357
+ */
358
+ matchProjectFromBackupName(backupName) {
359
+ return this.pathTemplates.backupPathTemplate.match(backupName).project;
360
+ }
361
+ /**
362
+ * Parse the instance from Backup resource.
363
+ *
364
+ * @param {string} backupName
365
+ * A fully-qualified path representing Backup resource.
366
+ * @returns {string} A string representing the instance.
367
+ */
368
+ matchInstanceFromBackupName(backupName) {
369
+ return this.pathTemplates.backupPathTemplate.match(backupName).instance;
370
+ }
371
+ /**
372
+ * Parse the backup from Backup resource.
373
+ *
374
+ * @param {string} backupName
375
+ * A fully-qualified path representing Backup resource.
376
+ * @returns {string} A string representing the backup.
377
+ */
378
+ matchBackupFromBackupName(backupName) {
379
+ return this.pathTemplates.backupPathTemplate.match(backupName).backup;
380
+ }
381
+ /**
382
+ * Return a fully-qualified backupSchedule resource name string.
383
+ *
384
+ * @param {string} project
385
+ * @param {string} instance
386
+ * @param {string} database
387
+ * @param {string} schedule
388
+ * @returns {string} Resource name string.
389
+ */
390
+ backupSchedulePath(project, instance, database, schedule) {
391
+ return this.pathTemplates.backupSchedulePathTemplate.render({
392
+ project: project,
393
+ instance: instance,
394
+ database: database,
395
+ schedule: schedule,
396
+ });
397
+ }
398
+ /**
399
+ * Parse the project from BackupSchedule resource.
400
+ *
401
+ * @param {string} backupScheduleName
402
+ * A fully-qualified path representing BackupSchedule resource.
403
+ * @returns {string} A string representing the project.
404
+ */
405
+ matchProjectFromBackupScheduleName(backupScheduleName) {
406
+ return this.pathTemplates.backupSchedulePathTemplate.match(backupScheduleName).project;
407
+ }
408
+ /**
409
+ * Parse the instance from BackupSchedule resource.
410
+ *
411
+ * @param {string} backupScheduleName
412
+ * A fully-qualified path representing BackupSchedule resource.
413
+ * @returns {string} A string representing the instance.
414
+ */
415
+ matchInstanceFromBackupScheduleName(backupScheduleName) {
416
+ return this.pathTemplates.backupSchedulePathTemplate.match(backupScheduleName).instance;
417
+ }
418
+ /**
419
+ * Parse the database from BackupSchedule resource.
420
+ *
421
+ * @param {string} backupScheduleName
422
+ * A fully-qualified path representing BackupSchedule resource.
423
+ * @returns {string} A string representing the database.
424
+ */
425
+ matchDatabaseFromBackupScheduleName(backupScheduleName) {
426
+ return this.pathTemplates.backupSchedulePathTemplate.match(backupScheduleName).database;
427
+ }
428
+ /**
429
+ * Parse the schedule from BackupSchedule resource.
430
+ *
431
+ * @param {string} backupScheduleName
432
+ * A fully-qualified path representing BackupSchedule resource.
433
+ * @returns {string} A string representing the schedule.
434
+ */
435
+ matchScheduleFromBackupScheduleName(backupScheduleName) {
436
+ return this.pathTemplates.backupSchedulePathTemplate.match(backupScheduleName).schedule;
437
+ }
438
+ /**
439
+ * Return a fully-qualified database resource name string.
440
+ *
441
+ * @param {string} project
442
+ * @param {string} instance
443
+ * @param {string} database
444
+ * @returns {string} Resource name string.
445
+ */
446
+ databasePath(project, instance, database) {
447
+ return this.pathTemplates.databasePathTemplate.render({
448
+ project: project,
449
+ instance: instance,
450
+ database: database,
451
+ });
452
+ }
453
+ /**
454
+ * Parse the project from Database resource.
455
+ *
456
+ * @param {string} databaseName
457
+ * A fully-qualified path representing Database resource.
458
+ * @returns {string} A string representing the project.
459
+ */
460
+ matchProjectFromDatabaseName(databaseName) {
461
+ return this.pathTemplates.databasePathTemplate.match(databaseName).project;
462
+ }
463
+ /**
464
+ * Parse the instance from Database resource.
465
+ *
466
+ * @param {string} databaseName
467
+ * A fully-qualified path representing Database resource.
468
+ * @returns {string} A string representing the instance.
469
+ */
470
+ matchInstanceFromDatabaseName(databaseName) {
471
+ return this.pathTemplates.databasePathTemplate.match(databaseName).instance;
472
+ }
473
+ /**
474
+ * Parse the database from Database resource.
475
+ *
476
+ * @param {string} databaseName
477
+ * A fully-qualified path representing Database resource.
478
+ * @returns {string} A string representing the database.
479
+ */
480
+ matchDatabaseFromDatabaseName(databaseName) {
481
+ return this.pathTemplates.databasePathTemplate.match(databaseName).database;
482
+ }
483
+ /**
484
+ * Return a fully-qualified databaseRole resource name string.
485
+ *
486
+ * @param {string} project
487
+ * @param {string} instance
488
+ * @param {string} database
489
+ * @param {string} role
490
+ * @returns {string} Resource name string.
491
+ */
492
+ databaseRolePath(project, instance, database, role) {
493
+ return this.pathTemplates.databaseRolePathTemplate.render({
494
+ project: project,
495
+ instance: instance,
496
+ database: database,
497
+ role: role,
498
+ });
499
+ }
500
+ /**
501
+ * Parse the project from DatabaseRole resource.
502
+ *
503
+ * @param {string} databaseRoleName
504
+ * A fully-qualified path representing DatabaseRole resource.
505
+ * @returns {string} A string representing the project.
506
+ */
507
+ matchProjectFromDatabaseRoleName(databaseRoleName) {
508
+ return this.pathTemplates.databaseRolePathTemplate.match(databaseRoleName)
509
+ .project;
510
+ }
511
+ /**
512
+ * Parse the instance from DatabaseRole resource.
513
+ *
514
+ * @param {string} databaseRoleName
515
+ * A fully-qualified path representing DatabaseRole resource.
516
+ * @returns {string} A string representing the instance.
517
+ */
518
+ matchInstanceFromDatabaseRoleName(databaseRoleName) {
519
+ return this.pathTemplates.databaseRolePathTemplate.match(databaseRoleName)
520
+ .instance;
521
+ }
522
+ /**
523
+ * Parse the database from DatabaseRole resource.
524
+ *
525
+ * @param {string} databaseRoleName
526
+ * A fully-qualified path representing DatabaseRole resource.
527
+ * @returns {string} A string representing the database.
528
+ */
529
+ matchDatabaseFromDatabaseRoleName(databaseRoleName) {
530
+ return this.pathTemplates.databaseRolePathTemplate.match(databaseRoleName)
531
+ .database;
532
+ }
533
+ /**
534
+ * Parse the role from DatabaseRole resource.
535
+ *
536
+ * @param {string} databaseRoleName
537
+ * A fully-qualified path representing DatabaseRole resource.
538
+ * @returns {string} A string representing the role.
539
+ */
540
+ matchRoleFromDatabaseRoleName(databaseRoleName) {
541
+ return this.pathTemplates.databaseRolePathTemplate.match(databaseRoleName)
542
+ .role;
543
+ }
544
+ /**
545
+ * Return a fully-qualified instance resource name string.
546
+ *
547
+ * @param {string} project
548
+ * @param {string} instance
549
+ * @returns {string} Resource name string.
550
+ */
551
+ instancePath(project, instance) {
552
+ return this.pathTemplates.instancePathTemplate.render({
553
+ project: project,
554
+ instance: instance,
555
+ });
556
+ }
557
+ /**
558
+ * Parse the project from Instance resource.
559
+ *
560
+ * @param {string} instanceName
561
+ * A fully-qualified path representing Instance resource.
562
+ * @returns {string} A string representing the project.
563
+ */
564
+ matchProjectFromInstanceName(instanceName) {
565
+ return this.pathTemplates.instancePathTemplate.match(instanceName).project;
566
+ }
567
+ /**
568
+ * Parse the instance from Instance resource.
569
+ *
570
+ * @param {string} instanceName
571
+ * A fully-qualified path representing Instance resource.
572
+ * @returns {string} A string representing the instance.
573
+ */
574
+ matchInstanceFromInstanceName(instanceName) {
575
+ return this.pathTemplates.instancePathTemplate.match(instanceName).instance;
576
+ }
577
+ /**
578
+ * Return a fully-qualified instanceConfig resource name string.
579
+ *
580
+ * @param {string} project
581
+ * @param {string} instance_config
582
+ * @returns {string} Resource name string.
583
+ */
584
+ instanceConfigPath(project, instanceConfig) {
585
+ return this.pathTemplates.instanceConfigPathTemplate.render({
586
+ project: project,
587
+ instance_config: instanceConfig,
588
+ });
589
+ }
590
+ /**
591
+ * Parse the project from InstanceConfig resource.
592
+ *
593
+ * @param {string} instanceConfigName
594
+ * A fully-qualified path representing InstanceConfig resource.
595
+ * @returns {string} A string representing the project.
596
+ */
597
+ matchProjectFromInstanceConfigName(instanceConfigName) {
598
+ return this.pathTemplates.instanceConfigPathTemplate.match(instanceConfigName).project;
599
+ }
600
+ /**
601
+ * Parse the instance_config from InstanceConfig resource.
602
+ *
603
+ * @param {string} instanceConfigName
604
+ * A fully-qualified path representing InstanceConfig resource.
605
+ * @returns {string} A string representing the instance_config.
606
+ */
607
+ matchInstanceConfigFromInstanceConfigName(instanceConfigName) {
608
+ return this.pathTemplates.instanceConfigPathTemplate.match(instanceConfigName).instance_config;
609
+ }
610
+ /**
611
+ * Return a fully-qualified instancePartition resource name string.
612
+ *
613
+ * @param {string} project
614
+ * @param {string} instance
615
+ * @param {string} instance_partition
616
+ * @returns {string} Resource name string.
617
+ */
618
+ instancePartitionPath(project, instance, instancePartition) {
619
+ return this.pathTemplates.instancePartitionPathTemplate.render({
620
+ project: project,
621
+ instance: instance,
622
+ instance_partition: instancePartition,
623
+ });
624
+ }
625
+ /**
626
+ * Parse the project from InstancePartition resource.
627
+ *
628
+ * @param {string} instancePartitionName
629
+ * A fully-qualified path representing InstancePartition resource.
630
+ * @returns {string} A string representing the project.
631
+ */
632
+ matchProjectFromInstancePartitionName(instancePartitionName) {
633
+ return this.pathTemplates.instancePartitionPathTemplate.match(instancePartitionName).project;
634
+ }
635
+ /**
636
+ * Parse the instance from InstancePartition resource.
637
+ *
638
+ * @param {string} instancePartitionName
639
+ * A fully-qualified path representing InstancePartition resource.
640
+ * @returns {string} A string representing the instance.
641
+ */
642
+ matchInstanceFromInstancePartitionName(instancePartitionName) {
643
+ return this.pathTemplates.instancePartitionPathTemplate.match(instancePartitionName).instance;
644
+ }
645
+ /**
646
+ * Parse the instance_partition from InstancePartition resource.
647
+ *
648
+ * @param {string} instancePartitionName
649
+ * A fully-qualified path representing InstancePartition resource.
650
+ * @returns {string} A string representing the instance_partition.
651
+ */
652
+ matchInstancePartitionFromInstancePartitionName(instancePartitionName) {
653
+ return this.pathTemplates.instancePartitionPathTemplate.match(instancePartitionName).instance_partition;
654
+ }
655
+ /**
656
+ * Return a fully-qualified session resource name string.
657
+ *
658
+ * @param {string} project
659
+ * @param {string} instance
660
+ * @param {string} database
661
+ * @param {string} session
662
+ * @returns {string} Resource name string.
663
+ */
664
+ sessionPath(project, instance, database, session) {
665
+ return this.pathTemplates.sessionPathTemplate.render({
666
+ project: project,
667
+ instance: instance,
668
+ database: database,
669
+ session: session,
670
+ });
671
+ }
672
+ /**
673
+ * Parse the project from Session resource.
674
+ *
675
+ * @param {string} sessionName
676
+ * A fully-qualified path representing Session resource.
677
+ * @returns {string} A string representing the project.
678
+ */
679
+ matchProjectFromSessionName(sessionName) {
680
+ return this.pathTemplates.sessionPathTemplate.match(sessionName).project;
681
+ }
682
+ /**
683
+ * Parse the instance from Session resource.
684
+ *
685
+ * @param {string} sessionName
686
+ * A fully-qualified path representing Session resource.
687
+ * @returns {string} A string representing the instance.
688
+ */
689
+ matchInstanceFromSessionName(sessionName) {
690
+ return this.pathTemplates.sessionPathTemplate.match(sessionName).instance;
691
+ }
692
+ /**
693
+ * Parse the database from Session resource.
694
+ *
695
+ * @param {string} sessionName
696
+ * A fully-qualified path representing Session resource.
697
+ * @returns {string} A string representing the database.
698
+ */
699
+ matchDatabaseFromSessionName(sessionName) {
700
+ return this.pathTemplates.sessionPathTemplate.match(sessionName).database;
701
+ }
702
+ /**
703
+ * Parse the session from Session resource.
704
+ *
705
+ * @param {string} sessionName
706
+ * A fully-qualified path representing Session resource.
707
+ * @returns {string} A string representing the session.
708
+ */
709
+ matchSessionFromSessionName(sessionName) {
710
+ return this.pathTemplates.sessionPathTemplate.match(sessionName).session;
711
+ }
712
+ /**
713
+ * Terminate the gRPC channel and close the client.
714
+ *
715
+ * The client will no longer be usable and all future behavior is undefined.
716
+ * @returns {Promise} A promise that resolves when the client is closed.
717
+ */
718
+ close() {
719
+ if (this.spannerExecutorProxyStub && !this._terminated) {
720
+ return this.spannerExecutorProxyStub.then((stub) => {
721
+ this._log.info('ending gRPC channel');
722
+ this._terminated = true;
723
+ stub.close();
724
+ });
725
+ }
726
+ return Promise.resolve();
727
+ }
728
+ }
729
+ exports.SpannerExecutorProxyClient = SpannerExecutorProxyClient;
730
+ //# sourceMappingURL=spanner_executor_proxy_client.js.map