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