@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,2411 @@
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.InstanceAdminClient = 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/instance_admin_client_config.json`.
26
+ * This file defines retry strategy and timeouts for all API methods in this library.
27
+ */
28
+ const gapicConfig = require("./instance_admin_client_config.json");
29
+ const version = require('../../../package.json').version;
30
+ /**
31
+ * Cloud Spanner Instance Admin API
32
+ *
33
+ * The Cloud Spanner Instance Admin API can be used to create, delete,
34
+ * modify and list instances. Instances are dedicated Cloud Spanner serving
35
+ * and storage resources to be used by Cloud Spanner databases.
36
+ *
37
+ * Each instance has a "configuration", which dictates where the
38
+ * serving resources for the Cloud Spanner instance are located (e.g.,
39
+ * US-central, Europe). Configurations are created by Google based on
40
+ * resource availability.
41
+ *
42
+ * Cloud Spanner billing is based on the instances that exist and their
43
+ * sizes. After an instance exists, there are no additional
44
+ * per-database or per-operation charges for use of the instance
45
+ * (though there may be additional network bandwidth charges).
46
+ * Instances offer isolation: problems with databases in one instance
47
+ * will not affect other instances. However, within an instance
48
+ * databases can affect each other. For example, if one database in an
49
+ * instance receives a lot of requests and consumes most of the
50
+ * instance resources, fewer resources are available for other
51
+ * databases in that instance, and their performance may suffer.
52
+ * @class
53
+ * @memberof v1
54
+ */
55
+ class InstanceAdminClient {
56
+ _terminated = false;
57
+ _opts;
58
+ _providedCustomServicePath;
59
+ _gaxModule;
60
+ _gaxGrpc;
61
+ _protos;
62
+ _defaults;
63
+ _universeDomain;
64
+ _servicePath;
65
+ _log = google_gax_1.loggingUtils.log('spanner-api');
66
+ auth;
67
+ descriptors = {
68
+ page: {},
69
+ stream: {},
70
+ longrunning: {},
71
+ batching: {},
72
+ };
73
+ warn;
74
+ innerApiCalls;
75
+ pathTemplates;
76
+ operationsClient;
77
+ instanceAdminStub;
78
+ /**
79
+ * Construct an instance of InstanceAdminClient.
80
+ *
81
+ * @param {object} [options] - The configuration object.
82
+ * The options accepted by the constructor are described in detail
83
+ * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance).
84
+ * The common options are:
85
+ * @param {object} [options.credentials] - Credentials object.
86
+ * @param {string} [options.credentials.client_email]
87
+ * @param {string} [options.credentials.private_key]
88
+ * @param {string} [options.email] - Account email address. Required when
89
+ * using a .pem or .p12 keyFilename.
90
+ * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or
91
+ * .p12 key downloaded from the Google Developers Console. If you provide
92
+ * a path to a JSON file, the projectId option below is not necessary.
93
+ * NOTE: .pem and .p12 require you to specify options.email as well.
94
+ * @param {number} [options.port] - The port on which to connect to
95
+ * the remote host.
96
+ * @param {string} [options.projectId] - The project ID from the Google
97
+ * Developer's Console, e.g. 'grape-spaceship-123'. We will also check
98
+ * the environment variable GCLOUD_PROJECT for your project ID. If your
99
+ * app is running in an environment which supports
100
+ * {@link https://cloud.google.com/docs/authentication/application-default-credentials Application Default Credentials},
101
+ * your project ID will be detected automatically.
102
+ * @param {string} [options.apiEndpoint] - The domain name of the
103
+ * API remote host.
104
+ * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override.
105
+ * Follows the structure of {@link gapicConfig}.
106
+ * @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode.
107
+ * For more information, please check the
108
+ * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}.
109
+ * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you
110
+ * need to avoid loading the default gRPC version and want to use the fallback
111
+ * HTTP implementation. Load only fallback version and pass it to the constructor:
112
+ * ```
113
+ * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC
114
+ * const client = new InstanceAdminClient({fallback: true}, gax);
115
+ * ```
116
+ */
117
+ constructor(opts, gaxInstance) {
118
+ // Ensure that options include all the required fields.
119
+ const staticMembers = this.constructor;
120
+ if (opts?.universe_domain &&
121
+ opts?.universeDomain &&
122
+ opts?.universe_domain !== opts?.universeDomain) {
123
+ throw new Error('Please set either universe_domain or universeDomain, but not both.');
124
+ }
125
+ const universeDomainEnvVar = typeof process === 'object' && typeof process.env === 'object'
126
+ ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']
127
+ : undefined;
128
+ this._universeDomain =
129
+ opts?.universeDomain ??
130
+ opts?.universe_domain ??
131
+ universeDomainEnvVar ??
132
+ 'googleapis.com';
133
+ this._servicePath = 'spanner.' + this._universeDomain;
134
+ const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath;
135
+ this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint);
136
+ const port = opts?.port || staticMembers.port;
137
+ const clientConfig = opts?.clientConfig ?? {};
138
+ const fallback = opts?.fallback ??
139
+ (typeof window !== 'undefined' && typeof window?.fetch === 'function');
140
+ opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts);
141
+ // Request numeric enum values if REST transport is used.
142
+ opts.numericEnums = true;
143
+ // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case.
144
+ if (servicePath !== this._servicePath && !('scopes' in opts)) {
145
+ opts['scopes'] = staticMembers.scopes;
146
+ }
147
+ // Load google-gax module synchronously if needed
148
+ if (!gaxInstance) {
149
+ gaxInstance = require('google-gax');
150
+ }
151
+ // Choose either gRPC or proto-over-HTTP implementation of google-gax.
152
+ this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance;
153
+ // Create a `gaxGrpc` object, with any grpc-specific options sent to the client.
154
+ this._gaxGrpc = new this._gaxModule.GrpcClient(opts);
155
+ // Save options to use in initialize() method.
156
+ this._opts = opts;
157
+ // Save the auth object to the client, for use by other methods.
158
+ this.auth = this._gaxGrpc.auth;
159
+ // Set useJWTAccessWithScope on the auth object.
160
+ this.auth.useJWTAccessWithScope = true;
161
+ // Set defaultServicePath on the auth object.
162
+ this.auth.defaultServicePath = this._servicePath;
163
+ // Set the default scopes in auth client if needed.
164
+ if (servicePath === this._servicePath) {
165
+ this.auth.defaultScopes = staticMembers.scopes;
166
+ }
167
+ // Determine the client header string.
168
+ const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`];
169
+ if (typeof process === 'object' && 'versions' in process) {
170
+ clientHeader.push(`gl-node/${process.versions.node}`);
171
+ }
172
+ else {
173
+ clientHeader.push(`gl-web/${this._gaxModule.version}`);
174
+ }
175
+ if (!opts.fallback) {
176
+ clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`);
177
+ }
178
+ else {
179
+ clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`);
180
+ }
181
+ if (opts.libName && opts.libVersion) {
182
+ clientHeader.push(`${opts.libName}/${opts.libVersion}`);
183
+ }
184
+ // Load the applicable protos.
185
+ this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos);
186
+ // This API contains "path templates"; forward-slash-separated
187
+ // identifiers to uniquely identify resources within the API.
188
+ // Create useful helper objects for these.
189
+ this.pathTemplates = {
190
+ instancePathTemplate: new this._gaxModule.PathTemplate('projects/{project}/instances/{instance}'),
191
+ instanceConfigPathTemplate: new this._gaxModule.PathTemplate('projects/{project}/instanceConfigs/{instance_config}'),
192
+ instancePartitionPathTemplate: new this._gaxModule.PathTemplate('projects/{project}/instances/{instance}/instancePartitions/{instance_partition}'),
193
+ projectPathTemplate: new this._gaxModule.PathTemplate('projects/{project}'),
194
+ };
195
+ // Some of the methods on this service return "paged" results,
196
+ // (e.g. 50 results at a time, with tokens to get subsequent
197
+ // pages). Denote the keys used for pagination and results.
198
+ this.descriptors.page = {
199
+ listInstanceConfigs: new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'instanceConfigs'),
200
+ listInstanceConfigOperations: new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'operations'),
201
+ listInstances: new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'instances'),
202
+ listInstancePartitions: new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'instancePartitions'),
203
+ listInstancePartitionOperations: new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'operations'),
204
+ };
205
+ const protoFilesRoot = this._gaxModule.protobufFromJSON(jsonProtos);
206
+ // This API contains "long-running operations", which return a
207
+ // an Operation object that allows for tracking of the operation,
208
+ // rather than holding a request open.
209
+ const lroOptions = {
210
+ auth: this.auth,
211
+ grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined,
212
+ };
213
+ if (opts.fallback) {
214
+ lroOptions.protoJson = protoFilesRoot;
215
+ lroOptions.httpRules = [
216
+ {
217
+ selector: 'google.longrunning.Operations.CancelOperation',
218
+ post: '/v1/{name=projects/*/instances/*/databases/*/operations/*}:cancel',
219
+ additional_bindings: [
220
+ { post: '/v1/{name=projects/*/instances/*/operations/*}:cancel' },
221
+ {
222
+ post: '/v1/{name=projects/*/instances/*/backups/*/operations/*}:cancel',
223
+ },
224
+ {
225
+ post: '/v1/{name=projects/*/instances/*/instancePartitions/*/operations/*}:cancel',
226
+ },
227
+ {
228
+ post: '/v1/{name=projects/*/instanceConfigs/*/operations/*}:cancel',
229
+ },
230
+ {
231
+ post: '/v1/{name=projects/*/instanceConfigs/*/ssdCaches/*/operations/*}:cancel',
232
+ },
233
+ ],
234
+ },
235
+ {
236
+ selector: 'google.longrunning.Operations.DeleteOperation',
237
+ delete: '/v1/{name=projects/*/instances/*/databases/*/operations/*}',
238
+ additional_bindings: [
239
+ { delete: '/v1/{name=projects/*/instances/*/operations/*}' },
240
+ {
241
+ delete: '/v1/{name=projects/*/instances/*/backups/*/operations/*}',
242
+ },
243
+ {
244
+ delete: '/v1/{name=projects/*/instances/*/instancePartitions/*/operations/*}',
245
+ },
246
+ { delete: '/v1/{name=projects/*/instanceConfigs/*/operations/*}' },
247
+ {
248
+ delete: '/v1/{name=projects/*/instanceConfigs/*/ssdCaches/*/operations/*}',
249
+ },
250
+ ],
251
+ },
252
+ {
253
+ selector: 'google.longrunning.Operations.GetOperation',
254
+ get: '/v1/{name=projects/*/instances/*/databases/*/operations/*}',
255
+ additional_bindings: [
256
+ { get: '/v1/{name=projects/*/instances/*/operations/*}' },
257
+ { get: '/v1/{name=projects/*/instances/*/backups/*/operations/*}' },
258
+ {
259
+ get: '/v1/{name=projects/*/instances/*/instancePartitions/*/operations/*}',
260
+ },
261
+ { get: '/v1/{name=projects/*/instanceConfigs/*/operations/*}' },
262
+ {
263
+ get: '/v1/{name=projects/*/instanceConfigs/*/ssdCaches/*/operations/*}',
264
+ },
265
+ ],
266
+ },
267
+ {
268
+ selector: 'google.longrunning.Operations.ListOperations',
269
+ get: '/v1/{name=projects/*/instances/*/databases/*/operations}',
270
+ additional_bindings: [
271
+ { get: '/v1/{name=projects/*/instances/*/operations}' },
272
+ { get: '/v1/{name=projects/*/instances/*/backups/*/operations}' },
273
+ {
274
+ get: '/v1/{name=projects/*/instances/*/instancePartitions/*/operations}',
275
+ },
276
+ { get: '/v1/{name=projects/*/instanceConfigs/*/operations}' },
277
+ {
278
+ get: '/v1/{name=projects/*/instanceConfigs/*/ssdCaches/*/operations}',
279
+ },
280
+ ],
281
+ },
282
+ ];
283
+ }
284
+ this.operationsClient = this._gaxModule
285
+ .lro(lroOptions)
286
+ .operationsClient(opts);
287
+ const createInstanceConfigResponse = protoFilesRoot.lookup('.google.spanner.admin.instance.v1.InstanceConfig');
288
+ const createInstanceConfigMetadata = protoFilesRoot.lookup('.google.spanner.admin.instance.v1.CreateInstanceConfigMetadata');
289
+ const updateInstanceConfigResponse = protoFilesRoot.lookup('.google.spanner.admin.instance.v1.InstanceConfig');
290
+ const updateInstanceConfigMetadata = protoFilesRoot.lookup('.google.spanner.admin.instance.v1.UpdateInstanceConfigMetadata');
291
+ const createInstanceResponse = protoFilesRoot.lookup('.google.spanner.admin.instance.v1.Instance');
292
+ const createInstanceMetadata = protoFilesRoot.lookup('.google.spanner.admin.instance.v1.CreateInstanceMetadata');
293
+ const updateInstanceResponse = protoFilesRoot.lookup('.google.spanner.admin.instance.v1.Instance');
294
+ const updateInstanceMetadata = protoFilesRoot.lookup('.google.spanner.admin.instance.v1.UpdateInstanceMetadata');
295
+ const createInstancePartitionResponse = protoFilesRoot.lookup('.google.spanner.admin.instance.v1.InstancePartition');
296
+ const createInstancePartitionMetadata = protoFilesRoot.lookup('.google.spanner.admin.instance.v1.CreateInstancePartitionMetadata');
297
+ const updateInstancePartitionResponse = protoFilesRoot.lookup('.google.spanner.admin.instance.v1.InstancePartition');
298
+ const updateInstancePartitionMetadata = protoFilesRoot.lookup('.google.spanner.admin.instance.v1.UpdateInstancePartitionMetadata');
299
+ const moveInstanceResponse = protoFilesRoot.lookup('.google.spanner.admin.instance.v1.MoveInstanceResponse');
300
+ const moveInstanceMetadata = protoFilesRoot.lookup('.google.spanner.admin.instance.v1.MoveInstanceMetadata');
301
+ this.descriptors.longrunning = {
302
+ createInstanceConfig: new this._gaxModule.LongrunningDescriptor(this.operationsClient, createInstanceConfigResponse.decode.bind(createInstanceConfigResponse), createInstanceConfigMetadata.decode.bind(createInstanceConfigMetadata)),
303
+ updateInstanceConfig: new this._gaxModule.LongrunningDescriptor(this.operationsClient, updateInstanceConfigResponse.decode.bind(updateInstanceConfigResponse), updateInstanceConfigMetadata.decode.bind(updateInstanceConfigMetadata)),
304
+ createInstance: new this._gaxModule.LongrunningDescriptor(this.operationsClient, createInstanceResponse.decode.bind(createInstanceResponse), createInstanceMetadata.decode.bind(createInstanceMetadata)),
305
+ updateInstance: new this._gaxModule.LongrunningDescriptor(this.operationsClient, updateInstanceResponse.decode.bind(updateInstanceResponse), updateInstanceMetadata.decode.bind(updateInstanceMetadata)),
306
+ createInstancePartition: new this._gaxModule.LongrunningDescriptor(this.operationsClient, createInstancePartitionResponse.decode.bind(createInstancePartitionResponse), createInstancePartitionMetadata.decode.bind(createInstancePartitionMetadata)),
307
+ updateInstancePartition: new this._gaxModule.LongrunningDescriptor(this.operationsClient, updateInstancePartitionResponse.decode.bind(updateInstancePartitionResponse), updateInstancePartitionMetadata.decode.bind(updateInstancePartitionMetadata)),
308
+ moveInstance: new this._gaxModule.LongrunningDescriptor(this.operationsClient, moveInstanceResponse.decode.bind(moveInstanceResponse), moveInstanceMetadata.decode.bind(moveInstanceMetadata)),
309
+ };
310
+ // Put together the default options sent with requests.
311
+ this._defaults = this._gaxGrpc.constructSettings('google.spanner.admin.instance.v1.InstanceAdmin', gapicConfig, opts.clientConfig || {}, { 'x-goog-api-client': clientHeader.join(' ') });
312
+ // Set up a dictionary of "inner API calls"; the core implementation
313
+ // of calling the API is handled in `google-gax`, with this code
314
+ // merely providing the destination and request information.
315
+ this.innerApiCalls = {};
316
+ // Add a warn function to the client constructor so it can be easily tested.
317
+ this.warn = this._gaxModule.warn;
318
+ }
319
+ /**
320
+ * Initialize the client.
321
+ * Performs asynchronous operations (such as authentication) and prepares the client.
322
+ * This function will be called automatically when any class method is called for the
323
+ * first time, but if you need to initialize it before calling an actual method,
324
+ * feel free to call initialize() directly.
325
+ *
326
+ * You can await on this method if you want to make sure the client is initialized.
327
+ *
328
+ * @returns {Promise} A promise that resolves to an authenticated service stub.
329
+ */
330
+ initialize() {
331
+ // If the client stub promise is already initialized, return immediately.
332
+ if (this.instanceAdminStub) {
333
+ return this.instanceAdminStub;
334
+ }
335
+ // Put together the "service stub" for
336
+ // google.spanner.admin.instance.v1.InstanceAdmin.
337
+ this.instanceAdminStub = this._gaxGrpc.createStub(this._opts.fallback
338
+ ? this._protos.lookupService('google.spanner.admin.instance.v1.InstanceAdmin')
339
+ : // eslint-disable-next-line @typescript-eslint/no-explicit-any
340
+ this._protos.google.spanner.admin.instance.v1.InstanceAdmin, this._opts, this._providedCustomServicePath);
341
+ // Iterate over each of the methods that the service provides
342
+ // and create an API call method for each.
343
+ const instanceAdminStubMethods = [
344
+ 'listInstanceConfigs',
345
+ 'getInstanceConfig',
346
+ 'createInstanceConfig',
347
+ 'updateInstanceConfig',
348
+ 'deleteInstanceConfig',
349
+ 'listInstanceConfigOperations',
350
+ 'listInstances',
351
+ 'listInstancePartitions',
352
+ 'getInstance',
353
+ 'createInstance',
354
+ 'updateInstance',
355
+ 'deleteInstance',
356
+ 'setIamPolicy',
357
+ 'getIamPolicy',
358
+ 'testIamPermissions',
359
+ 'getInstancePartition',
360
+ 'createInstancePartition',
361
+ 'deleteInstancePartition',
362
+ 'updateInstancePartition',
363
+ 'listInstancePartitionOperations',
364
+ 'moveInstance',
365
+ ];
366
+ for (const methodName of instanceAdminStubMethods) {
367
+ const callPromise = this.instanceAdminStub.then((stub) => (...args) => {
368
+ if (this._terminated) {
369
+ return Promise.reject('The client has already been closed.');
370
+ }
371
+ const func = stub[methodName];
372
+ return func.apply(stub, args);
373
+ }, (err) => () => {
374
+ throw err;
375
+ });
376
+ const descriptor = this.descriptors.page[methodName] ||
377
+ this.descriptors.longrunning[methodName] ||
378
+ undefined;
379
+ const apiCall = this._gaxModule.createApiCall(callPromise, this._defaults[methodName], descriptor, this._opts.fallback);
380
+ this.innerApiCalls[methodName] = apiCall;
381
+ }
382
+ return this.instanceAdminStub;
383
+ }
384
+ /**
385
+ * The DNS address for this API service.
386
+ * @deprecated Use the apiEndpoint method of the client instance.
387
+ * @returns {string} The DNS address for this service.
388
+ */
389
+ static get servicePath() {
390
+ if (typeof process === 'object' &&
391
+ typeof process.emitWarning === 'function') {
392
+ process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning');
393
+ }
394
+ return 'spanner.googleapis.com';
395
+ }
396
+ /**
397
+ * The DNS address for this API service - same as servicePath.
398
+ * @deprecated Use the apiEndpoint method of the client instance.
399
+ * @returns {string} The DNS address for this service.
400
+ */
401
+ static get apiEndpoint() {
402
+ if (typeof process === 'object' &&
403
+ typeof process.emitWarning === 'function') {
404
+ process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning');
405
+ }
406
+ return 'spanner.googleapis.com';
407
+ }
408
+ /**
409
+ * The DNS address for this API service.
410
+ * @returns {string} The DNS address for this service.
411
+ */
412
+ get apiEndpoint() {
413
+ return this._servicePath;
414
+ }
415
+ get universeDomain() {
416
+ return this._universeDomain;
417
+ }
418
+ /**
419
+ * The port for this API service.
420
+ * @returns {number} The default port for this service.
421
+ */
422
+ static get port() {
423
+ return 443;
424
+ }
425
+ /**
426
+ * The scopes needed to make gRPC calls for every method defined
427
+ * in this service.
428
+ * @returns {string[]} List of default scopes.
429
+ */
430
+ static get scopes() {
431
+ return [
432
+ 'https://www.googleapis.com/auth/cloud-platform',
433
+ 'https://www.googleapis.com/auth/spanner.admin',
434
+ ];
435
+ }
436
+ /**
437
+ * Return the project ID used by this class.
438
+ * @returns {Promise} A promise that resolves to string containing the project ID.
439
+ */
440
+ getProjectId(callback) {
441
+ if (callback) {
442
+ this.auth.getProjectId(callback);
443
+ return;
444
+ }
445
+ return this.auth.getProjectId();
446
+ }
447
+ getInstanceConfig(request, optionsOrCallback, callback) {
448
+ request = request || {};
449
+ let options;
450
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
451
+ callback = optionsOrCallback;
452
+ options = {};
453
+ }
454
+ else {
455
+ options = optionsOrCallback;
456
+ }
457
+ options = options || {};
458
+ options.otherArgs = options.otherArgs || {};
459
+ options.otherArgs.headers = options.otherArgs.headers || {};
460
+ options.otherArgs.headers['x-goog-request-params'] =
461
+ this._gaxModule.routingHeader.fromParams({
462
+ name: request.name ?? '',
463
+ });
464
+ this.initialize().catch((err) => {
465
+ throw err;
466
+ });
467
+ this._log.info('getInstanceConfig request %j', request);
468
+ const wrappedCallback = callback
469
+ ? (error, response, options, rawResponse) => {
470
+ this._log.info('getInstanceConfig response %j', response);
471
+ callback(error, response, options, rawResponse); // We verified callback above.
472
+ }
473
+ : undefined;
474
+ return this.innerApiCalls
475
+ .getInstanceConfig(request, options, wrappedCallback)
476
+ ?.then(([response, options, rawResponse]) => {
477
+ this._log.info('getInstanceConfig response %j', response);
478
+ return [response, options, rawResponse];
479
+ })
480
+ .catch((error) => {
481
+ if (error &&
482
+ 'statusDetails' in error &&
483
+ error.statusDetails instanceof Array) {
484
+ const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
485
+ error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
486
+ }
487
+ throw error;
488
+ });
489
+ }
490
+ deleteInstanceConfig(request, optionsOrCallback, callback) {
491
+ request = request || {};
492
+ let options;
493
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
494
+ callback = optionsOrCallback;
495
+ options = {};
496
+ }
497
+ else {
498
+ options = optionsOrCallback;
499
+ }
500
+ options = options || {};
501
+ options.otherArgs = options.otherArgs || {};
502
+ options.otherArgs.headers = options.otherArgs.headers || {};
503
+ options.otherArgs.headers['x-goog-request-params'] =
504
+ this._gaxModule.routingHeader.fromParams({
505
+ name: request.name ?? '',
506
+ });
507
+ this.initialize().catch((err) => {
508
+ throw err;
509
+ });
510
+ this._log.info('deleteInstanceConfig request %j', request);
511
+ const wrappedCallback = callback
512
+ ? (error, response, options, rawResponse) => {
513
+ this._log.info('deleteInstanceConfig response %j', response);
514
+ callback(error, response, options, rawResponse); // We verified callback above.
515
+ }
516
+ : undefined;
517
+ return this.innerApiCalls
518
+ .deleteInstanceConfig(request, options, wrappedCallback)
519
+ ?.then(([response, options, rawResponse]) => {
520
+ this._log.info('deleteInstanceConfig response %j', response);
521
+ return [response, options, rawResponse];
522
+ })
523
+ .catch((error) => {
524
+ if (error &&
525
+ 'statusDetails' in error &&
526
+ error.statusDetails instanceof Array) {
527
+ const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
528
+ error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
529
+ }
530
+ throw error;
531
+ });
532
+ }
533
+ getInstance(request, optionsOrCallback, callback) {
534
+ request = request || {};
535
+ let options;
536
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
537
+ callback = optionsOrCallback;
538
+ options = {};
539
+ }
540
+ else {
541
+ options = optionsOrCallback;
542
+ }
543
+ options = options || {};
544
+ options.otherArgs = options.otherArgs || {};
545
+ options.otherArgs.headers = options.otherArgs.headers || {};
546
+ options.otherArgs.headers['x-goog-request-params'] =
547
+ this._gaxModule.routingHeader.fromParams({
548
+ name: request.name ?? '',
549
+ });
550
+ this.initialize().catch((err) => {
551
+ throw err;
552
+ });
553
+ this._log.info('getInstance request %j', request);
554
+ const wrappedCallback = callback
555
+ ? (error, response, options, rawResponse) => {
556
+ this._log.info('getInstance response %j', response);
557
+ callback(error, response, options, rawResponse); // We verified callback above.
558
+ }
559
+ : undefined;
560
+ return this.innerApiCalls
561
+ .getInstance(request, options, wrappedCallback)
562
+ ?.then(([response, options, rawResponse]) => {
563
+ this._log.info('getInstance response %j', response);
564
+ return [response, options, rawResponse];
565
+ })
566
+ .catch((error) => {
567
+ if (error &&
568
+ 'statusDetails' in error &&
569
+ error.statusDetails instanceof Array) {
570
+ const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
571
+ error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
572
+ }
573
+ throw error;
574
+ });
575
+ }
576
+ deleteInstance(request, optionsOrCallback, callback) {
577
+ request = request || {};
578
+ let options;
579
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
580
+ callback = optionsOrCallback;
581
+ options = {};
582
+ }
583
+ else {
584
+ options = optionsOrCallback;
585
+ }
586
+ options = options || {};
587
+ options.otherArgs = options.otherArgs || {};
588
+ options.otherArgs.headers = options.otherArgs.headers || {};
589
+ options.otherArgs.headers['x-goog-request-params'] =
590
+ this._gaxModule.routingHeader.fromParams({
591
+ name: request.name ?? '',
592
+ });
593
+ this.initialize().catch((err) => {
594
+ throw err;
595
+ });
596
+ this._log.info('deleteInstance request %j', request);
597
+ const wrappedCallback = callback
598
+ ? (error, response, options, rawResponse) => {
599
+ this._log.info('deleteInstance response %j', response);
600
+ callback(error, response, options, rawResponse); // We verified callback above.
601
+ }
602
+ : undefined;
603
+ return this.innerApiCalls
604
+ .deleteInstance(request, options, wrappedCallback)
605
+ ?.then(([response, options, rawResponse]) => {
606
+ this._log.info('deleteInstance response %j', response);
607
+ return [response, options, rawResponse];
608
+ })
609
+ .catch((error) => {
610
+ if (error &&
611
+ 'statusDetails' in error &&
612
+ error.statusDetails instanceof Array) {
613
+ const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
614
+ error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
615
+ }
616
+ throw error;
617
+ });
618
+ }
619
+ setIamPolicy(request, optionsOrCallback, callback) {
620
+ request = request || {};
621
+ let options;
622
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
623
+ callback = optionsOrCallback;
624
+ options = {};
625
+ }
626
+ else {
627
+ options = optionsOrCallback;
628
+ }
629
+ options = options || {};
630
+ options.otherArgs = options.otherArgs || {};
631
+ options.otherArgs.headers = options.otherArgs.headers || {};
632
+ options.otherArgs.headers['x-goog-request-params'] =
633
+ this._gaxModule.routingHeader.fromParams({
634
+ resource: request.resource ?? '',
635
+ });
636
+ this.initialize().catch((err) => {
637
+ throw err;
638
+ });
639
+ this._log.info('setIamPolicy request %j', request);
640
+ const wrappedCallback = callback
641
+ ? (error, response, options, rawResponse) => {
642
+ this._log.info('setIamPolicy response %j', response);
643
+ callback(error, response, options, rawResponse); // We verified callback above.
644
+ }
645
+ : undefined;
646
+ return this.innerApiCalls
647
+ .setIamPolicy(request, options, wrappedCallback)
648
+ ?.then(([response, options, rawResponse]) => {
649
+ this._log.info('setIamPolicy response %j', response);
650
+ return [response, options, rawResponse];
651
+ })
652
+ .catch((error) => {
653
+ if (error &&
654
+ 'statusDetails' in error &&
655
+ error.statusDetails instanceof Array) {
656
+ const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
657
+ error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
658
+ }
659
+ throw error;
660
+ });
661
+ }
662
+ getIamPolicy(request, optionsOrCallback, callback) {
663
+ request = request || {};
664
+ let options;
665
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
666
+ callback = optionsOrCallback;
667
+ options = {};
668
+ }
669
+ else {
670
+ options = optionsOrCallback;
671
+ }
672
+ options = options || {};
673
+ options.otherArgs = options.otherArgs || {};
674
+ options.otherArgs.headers = options.otherArgs.headers || {};
675
+ options.otherArgs.headers['x-goog-request-params'] =
676
+ this._gaxModule.routingHeader.fromParams({
677
+ resource: request.resource ?? '',
678
+ });
679
+ this.initialize().catch((err) => {
680
+ throw err;
681
+ });
682
+ this._log.info('getIamPolicy request %j', request);
683
+ const wrappedCallback = callback
684
+ ? (error, response, options, rawResponse) => {
685
+ this._log.info('getIamPolicy response %j', response);
686
+ callback(error, response, options, rawResponse); // We verified callback above.
687
+ }
688
+ : undefined;
689
+ return this.innerApiCalls
690
+ .getIamPolicy(request, options, wrappedCallback)
691
+ ?.then(([response, options, rawResponse]) => {
692
+ this._log.info('getIamPolicy response %j', response);
693
+ return [response, options, rawResponse];
694
+ })
695
+ .catch((error) => {
696
+ if (error &&
697
+ 'statusDetails' in error &&
698
+ error.statusDetails instanceof Array) {
699
+ const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
700
+ error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
701
+ }
702
+ throw error;
703
+ });
704
+ }
705
+ testIamPermissions(request, optionsOrCallback, callback) {
706
+ request = request || {};
707
+ let options;
708
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
709
+ callback = optionsOrCallback;
710
+ options = {};
711
+ }
712
+ else {
713
+ options = optionsOrCallback;
714
+ }
715
+ options = options || {};
716
+ options.otherArgs = options.otherArgs || {};
717
+ options.otherArgs.headers = options.otherArgs.headers || {};
718
+ options.otherArgs.headers['x-goog-request-params'] =
719
+ this._gaxModule.routingHeader.fromParams({
720
+ resource: request.resource ?? '',
721
+ });
722
+ this.initialize().catch((err) => {
723
+ throw err;
724
+ });
725
+ this._log.info('testIamPermissions request %j', request);
726
+ const wrappedCallback = callback
727
+ ? (error, response, options, rawResponse) => {
728
+ this._log.info('testIamPermissions response %j', response);
729
+ callback(error, response, options, rawResponse); // We verified callback above.
730
+ }
731
+ : undefined;
732
+ return this.innerApiCalls
733
+ .testIamPermissions(request, options, wrappedCallback)
734
+ ?.then(([response, options, rawResponse]) => {
735
+ this._log.info('testIamPermissions response %j', response);
736
+ return [response, options, rawResponse];
737
+ })
738
+ .catch((error) => {
739
+ if (error &&
740
+ 'statusDetails' in error &&
741
+ error.statusDetails instanceof Array) {
742
+ const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
743
+ error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
744
+ }
745
+ throw error;
746
+ });
747
+ }
748
+ getInstancePartition(request, optionsOrCallback, callback) {
749
+ request = request || {};
750
+ let options;
751
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
752
+ callback = optionsOrCallback;
753
+ options = {};
754
+ }
755
+ else {
756
+ options = optionsOrCallback;
757
+ }
758
+ options = options || {};
759
+ options.otherArgs = options.otherArgs || {};
760
+ options.otherArgs.headers = options.otherArgs.headers || {};
761
+ options.otherArgs.headers['x-goog-request-params'] =
762
+ this._gaxModule.routingHeader.fromParams({
763
+ name: request.name ?? '',
764
+ });
765
+ this.initialize().catch((err) => {
766
+ throw err;
767
+ });
768
+ this._log.info('getInstancePartition request %j', request);
769
+ const wrappedCallback = callback
770
+ ? (error, response, options, rawResponse) => {
771
+ this._log.info('getInstancePartition response %j', response);
772
+ callback(error, response, options, rawResponse); // We verified callback above.
773
+ }
774
+ : undefined;
775
+ return this.innerApiCalls
776
+ .getInstancePartition(request, options, wrappedCallback)
777
+ ?.then(([response, options, rawResponse]) => {
778
+ this._log.info('getInstancePartition response %j', response);
779
+ return [response, options, rawResponse];
780
+ })
781
+ .catch((error) => {
782
+ if (error &&
783
+ 'statusDetails' in error &&
784
+ error.statusDetails instanceof Array) {
785
+ const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
786
+ error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
787
+ }
788
+ throw error;
789
+ });
790
+ }
791
+ deleteInstancePartition(request, optionsOrCallback, callback) {
792
+ request = request || {};
793
+ let options;
794
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
795
+ callback = optionsOrCallback;
796
+ options = {};
797
+ }
798
+ else {
799
+ options = optionsOrCallback;
800
+ }
801
+ options = options || {};
802
+ options.otherArgs = options.otherArgs || {};
803
+ options.otherArgs.headers = options.otherArgs.headers || {};
804
+ options.otherArgs.headers['x-goog-request-params'] =
805
+ this._gaxModule.routingHeader.fromParams({
806
+ name: request.name ?? '',
807
+ });
808
+ this.initialize().catch((err) => {
809
+ throw err;
810
+ });
811
+ this._log.info('deleteInstancePartition request %j', request);
812
+ const wrappedCallback = callback
813
+ ? (error, response, options, rawResponse) => {
814
+ this._log.info('deleteInstancePartition response %j', response);
815
+ callback(error, response, options, rawResponse); // We verified callback above.
816
+ }
817
+ : undefined;
818
+ return this.innerApiCalls
819
+ .deleteInstancePartition(request, options, wrappedCallback)
820
+ ?.then(([response, options, rawResponse]) => {
821
+ this._log.info('deleteInstancePartition response %j', response);
822
+ return [response, options, rawResponse];
823
+ })
824
+ .catch((error) => {
825
+ if (error &&
826
+ 'statusDetails' in error &&
827
+ error.statusDetails instanceof Array) {
828
+ const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
829
+ error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
830
+ }
831
+ throw error;
832
+ });
833
+ }
834
+ createInstanceConfig(request, optionsOrCallback, callback) {
835
+ request = request || {};
836
+ let options;
837
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
838
+ callback = optionsOrCallback;
839
+ options = {};
840
+ }
841
+ else {
842
+ options = optionsOrCallback;
843
+ }
844
+ options = options || {};
845
+ options.otherArgs = options.otherArgs || {};
846
+ options.otherArgs.headers = options.otherArgs.headers || {};
847
+ options.otherArgs.headers['x-goog-request-params'] =
848
+ this._gaxModule.routingHeader.fromParams({
849
+ parent: request.parent ?? '',
850
+ });
851
+ this.initialize().catch((err) => {
852
+ throw err;
853
+ });
854
+ const wrappedCallback = callback
855
+ ? (error, response, rawResponse, _) => {
856
+ this._log.info('createInstanceConfig response %j', rawResponse);
857
+ callback(error, response, rawResponse, _); // We verified callback above.
858
+ }
859
+ : undefined;
860
+ this._log.info('createInstanceConfig request %j', request);
861
+ return this.innerApiCalls
862
+ .createInstanceConfig(request, options, wrappedCallback)
863
+ ?.then(([response, rawResponse, _]) => {
864
+ this._log.info('createInstanceConfig response %j', rawResponse);
865
+ return [response, rawResponse, _];
866
+ });
867
+ }
868
+ /**
869
+ * Check the status of the long running operation returned by `createInstanceConfig()`.
870
+ * @param {String} name
871
+ * The operation name that will be passed.
872
+ * @returns {Promise} - The promise which resolves to an object.
873
+ * The decoded operation object has result and metadata field to get information from.
874
+ * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation }
875
+ * for more details and examples.
876
+ * @example <caption>include:samples/generated/v1/instance_admin.create_instance_config.js</caption>
877
+ * region_tag:spanner_v1_generated_InstanceAdmin_CreateInstanceConfig_async
878
+ */
879
+ async checkCreateInstanceConfigProgress(name) {
880
+ this._log.info('createInstanceConfig long-running');
881
+ const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({ name });
882
+ const [operation] = await this.operationsClient.getOperation(request);
883
+ const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createInstanceConfig, this._gaxModule.createDefaultBackoffSettings());
884
+ return decodeOperation;
885
+ }
886
+ updateInstanceConfig(request, optionsOrCallback, callback) {
887
+ request = request || {};
888
+ let options;
889
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
890
+ callback = optionsOrCallback;
891
+ options = {};
892
+ }
893
+ else {
894
+ options = optionsOrCallback;
895
+ }
896
+ options = options || {};
897
+ options.otherArgs = options.otherArgs || {};
898
+ options.otherArgs.headers = options.otherArgs.headers || {};
899
+ options.otherArgs.headers['x-goog-request-params'] =
900
+ this._gaxModule.routingHeader.fromParams({
901
+ 'instance_config.name': request.instanceConfig.name ?? '',
902
+ });
903
+ this.initialize().catch((err) => {
904
+ throw err;
905
+ });
906
+ const wrappedCallback = callback
907
+ ? (error, response, rawResponse, _) => {
908
+ this._log.info('updateInstanceConfig response %j', rawResponse);
909
+ callback(error, response, rawResponse, _); // We verified callback above.
910
+ }
911
+ : undefined;
912
+ this._log.info('updateInstanceConfig request %j', request);
913
+ return this.innerApiCalls
914
+ .updateInstanceConfig(request, options, wrappedCallback)
915
+ ?.then(([response, rawResponse, _]) => {
916
+ this._log.info('updateInstanceConfig response %j', rawResponse);
917
+ return [response, rawResponse, _];
918
+ });
919
+ }
920
+ /**
921
+ * Check the status of the long running operation returned by `updateInstanceConfig()`.
922
+ * @param {String} name
923
+ * The operation name that will be passed.
924
+ * @returns {Promise} - The promise which resolves to an object.
925
+ * The decoded operation object has result and metadata field to get information from.
926
+ * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation }
927
+ * for more details and examples.
928
+ * @example <caption>include:samples/generated/v1/instance_admin.update_instance_config.js</caption>
929
+ * region_tag:spanner_v1_generated_InstanceAdmin_UpdateInstanceConfig_async
930
+ */
931
+ async checkUpdateInstanceConfigProgress(name) {
932
+ this._log.info('updateInstanceConfig long-running');
933
+ const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({ name });
934
+ const [operation] = await this.operationsClient.getOperation(request);
935
+ const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateInstanceConfig, this._gaxModule.createDefaultBackoffSettings());
936
+ return decodeOperation;
937
+ }
938
+ createInstance(request, optionsOrCallback, callback) {
939
+ request = request || {};
940
+ let options;
941
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
942
+ callback = optionsOrCallback;
943
+ options = {};
944
+ }
945
+ else {
946
+ options = optionsOrCallback;
947
+ }
948
+ options = options || {};
949
+ options.otherArgs = options.otherArgs || {};
950
+ options.otherArgs.headers = options.otherArgs.headers || {};
951
+ options.otherArgs.headers['x-goog-request-params'] =
952
+ this._gaxModule.routingHeader.fromParams({
953
+ parent: request.parent ?? '',
954
+ });
955
+ this.initialize().catch((err) => {
956
+ throw err;
957
+ });
958
+ const wrappedCallback = callback
959
+ ? (error, response, rawResponse, _) => {
960
+ this._log.info('createInstance response %j', rawResponse);
961
+ callback(error, response, rawResponse, _); // We verified callback above.
962
+ }
963
+ : undefined;
964
+ this._log.info('createInstance request %j', request);
965
+ return this.innerApiCalls
966
+ .createInstance(request, options, wrappedCallback)
967
+ ?.then(([response, rawResponse, _]) => {
968
+ this._log.info('createInstance response %j', rawResponse);
969
+ return [response, rawResponse, _];
970
+ });
971
+ }
972
+ /**
973
+ * Check the status of the long running operation returned by `createInstance()`.
974
+ * @param {String} name
975
+ * The operation name that will be passed.
976
+ * @returns {Promise} - The promise which resolves to an object.
977
+ * The decoded operation object has result and metadata field to get information from.
978
+ * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation }
979
+ * for more details and examples.
980
+ * @example <caption>include:samples/generated/v1/instance_admin.create_instance.js</caption>
981
+ * region_tag:spanner_v1_generated_InstanceAdmin_CreateInstance_async
982
+ */
983
+ async checkCreateInstanceProgress(name) {
984
+ this._log.info('createInstance long-running');
985
+ const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({ name });
986
+ const [operation] = await this.operationsClient.getOperation(request);
987
+ const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createInstance, this._gaxModule.createDefaultBackoffSettings());
988
+ return decodeOperation;
989
+ }
990
+ updateInstance(request, optionsOrCallback, callback) {
991
+ request = request || {};
992
+ let options;
993
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
994
+ callback = optionsOrCallback;
995
+ options = {};
996
+ }
997
+ else {
998
+ options = optionsOrCallback;
999
+ }
1000
+ options = options || {};
1001
+ options.otherArgs = options.otherArgs || {};
1002
+ options.otherArgs.headers = options.otherArgs.headers || {};
1003
+ options.otherArgs.headers['x-goog-request-params'] =
1004
+ this._gaxModule.routingHeader.fromParams({
1005
+ 'instance.name': request.instance.name ?? '',
1006
+ });
1007
+ this.initialize().catch((err) => {
1008
+ throw err;
1009
+ });
1010
+ const wrappedCallback = callback
1011
+ ? (error, response, rawResponse, _) => {
1012
+ this._log.info('updateInstance response %j', rawResponse);
1013
+ callback(error, response, rawResponse, _); // We verified callback above.
1014
+ }
1015
+ : undefined;
1016
+ this._log.info('updateInstance request %j', request);
1017
+ return this.innerApiCalls
1018
+ .updateInstance(request, options, wrappedCallback)
1019
+ ?.then(([response, rawResponse, _]) => {
1020
+ this._log.info('updateInstance response %j', rawResponse);
1021
+ return [response, rawResponse, _];
1022
+ });
1023
+ }
1024
+ /**
1025
+ * Check the status of the long running operation returned by `updateInstance()`.
1026
+ * @param {String} name
1027
+ * The operation name that will be passed.
1028
+ * @returns {Promise} - The promise which resolves to an object.
1029
+ * The decoded operation object has result and metadata field to get information from.
1030
+ * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation }
1031
+ * for more details and examples.
1032
+ * @example <caption>include:samples/generated/v1/instance_admin.update_instance.js</caption>
1033
+ * region_tag:spanner_v1_generated_InstanceAdmin_UpdateInstance_async
1034
+ */
1035
+ async checkUpdateInstanceProgress(name) {
1036
+ this._log.info('updateInstance long-running');
1037
+ const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({ name });
1038
+ const [operation] = await this.operationsClient.getOperation(request);
1039
+ const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateInstance, this._gaxModule.createDefaultBackoffSettings());
1040
+ return decodeOperation;
1041
+ }
1042
+ createInstancePartition(request, optionsOrCallback, callback) {
1043
+ request = request || {};
1044
+ let options;
1045
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
1046
+ callback = optionsOrCallback;
1047
+ options = {};
1048
+ }
1049
+ else {
1050
+ options = optionsOrCallback;
1051
+ }
1052
+ options = options || {};
1053
+ options.otherArgs = options.otherArgs || {};
1054
+ options.otherArgs.headers = options.otherArgs.headers || {};
1055
+ options.otherArgs.headers['x-goog-request-params'] =
1056
+ this._gaxModule.routingHeader.fromParams({
1057
+ parent: request.parent ?? '',
1058
+ });
1059
+ this.initialize().catch((err) => {
1060
+ throw err;
1061
+ });
1062
+ const wrappedCallback = callback
1063
+ ? (error, response, rawResponse, _) => {
1064
+ this._log.info('createInstancePartition response %j', rawResponse);
1065
+ callback(error, response, rawResponse, _); // We verified callback above.
1066
+ }
1067
+ : undefined;
1068
+ this._log.info('createInstancePartition request %j', request);
1069
+ return this.innerApiCalls
1070
+ .createInstancePartition(request, options, wrappedCallback)
1071
+ ?.then(([response, rawResponse, _]) => {
1072
+ this._log.info('createInstancePartition response %j', rawResponse);
1073
+ return [response, rawResponse, _];
1074
+ });
1075
+ }
1076
+ /**
1077
+ * Check the status of the long running operation returned by `createInstancePartition()`.
1078
+ * @param {String} name
1079
+ * The operation name that will be passed.
1080
+ * @returns {Promise} - The promise which resolves to an object.
1081
+ * The decoded operation object has result and metadata field to get information from.
1082
+ * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation }
1083
+ * for more details and examples.
1084
+ * @example <caption>include:samples/generated/v1/instance_admin.create_instance_partition.js</caption>
1085
+ * region_tag:spanner_v1_generated_InstanceAdmin_CreateInstancePartition_async
1086
+ */
1087
+ async checkCreateInstancePartitionProgress(name) {
1088
+ this._log.info('createInstancePartition long-running');
1089
+ const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({ name });
1090
+ const [operation] = await this.operationsClient.getOperation(request);
1091
+ const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createInstancePartition, this._gaxModule.createDefaultBackoffSettings());
1092
+ return decodeOperation;
1093
+ }
1094
+ updateInstancePartition(request, optionsOrCallback, callback) {
1095
+ request = request || {};
1096
+ let options;
1097
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
1098
+ callback = optionsOrCallback;
1099
+ options = {};
1100
+ }
1101
+ else {
1102
+ options = optionsOrCallback;
1103
+ }
1104
+ options = options || {};
1105
+ options.otherArgs = options.otherArgs || {};
1106
+ options.otherArgs.headers = options.otherArgs.headers || {};
1107
+ options.otherArgs.headers['x-goog-request-params'] =
1108
+ this._gaxModule.routingHeader.fromParams({
1109
+ 'instance_partition.name': request.instancePartition.name ?? '',
1110
+ });
1111
+ this.initialize().catch((err) => {
1112
+ throw err;
1113
+ });
1114
+ const wrappedCallback = callback
1115
+ ? (error, response, rawResponse, _) => {
1116
+ this._log.info('updateInstancePartition response %j', rawResponse);
1117
+ callback(error, response, rawResponse, _); // We verified callback above.
1118
+ }
1119
+ : undefined;
1120
+ this._log.info('updateInstancePartition request %j', request);
1121
+ return this.innerApiCalls
1122
+ .updateInstancePartition(request, options, wrappedCallback)
1123
+ ?.then(([response, rawResponse, _]) => {
1124
+ this._log.info('updateInstancePartition response %j', rawResponse);
1125
+ return [response, rawResponse, _];
1126
+ });
1127
+ }
1128
+ /**
1129
+ * Check the status of the long running operation returned by `updateInstancePartition()`.
1130
+ * @param {String} name
1131
+ * The operation name that will be passed.
1132
+ * @returns {Promise} - The promise which resolves to an object.
1133
+ * The decoded operation object has result and metadata field to get information from.
1134
+ * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation }
1135
+ * for more details and examples.
1136
+ * @example <caption>include:samples/generated/v1/instance_admin.update_instance_partition.js</caption>
1137
+ * region_tag:spanner_v1_generated_InstanceAdmin_UpdateInstancePartition_async
1138
+ */
1139
+ async checkUpdateInstancePartitionProgress(name) {
1140
+ this._log.info('updateInstancePartition long-running');
1141
+ const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({ name });
1142
+ const [operation] = await this.operationsClient.getOperation(request);
1143
+ const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateInstancePartition, this._gaxModule.createDefaultBackoffSettings());
1144
+ return decodeOperation;
1145
+ }
1146
+ moveInstance(request, optionsOrCallback, callback) {
1147
+ request = request || {};
1148
+ let options;
1149
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
1150
+ callback = optionsOrCallback;
1151
+ options = {};
1152
+ }
1153
+ else {
1154
+ options = optionsOrCallback;
1155
+ }
1156
+ options = options || {};
1157
+ options.otherArgs = options.otherArgs || {};
1158
+ options.otherArgs.headers = options.otherArgs.headers || {};
1159
+ options.otherArgs.headers['x-goog-request-params'] =
1160
+ this._gaxModule.routingHeader.fromParams({
1161
+ name: request.name ?? '',
1162
+ });
1163
+ this.initialize().catch((err) => {
1164
+ throw err;
1165
+ });
1166
+ const wrappedCallback = callback
1167
+ ? (error, response, rawResponse, _) => {
1168
+ this._log.info('moveInstance response %j', rawResponse);
1169
+ callback(error, response, rawResponse, _); // We verified callback above.
1170
+ }
1171
+ : undefined;
1172
+ this._log.info('moveInstance request %j', request);
1173
+ return this.innerApiCalls
1174
+ .moveInstance(request, options, wrappedCallback)
1175
+ ?.then(([response, rawResponse, _]) => {
1176
+ this._log.info('moveInstance response %j', rawResponse);
1177
+ return [response, rawResponse, _];
1178
+ });
1179
+ }
1180
+ /**
1181
+ * Check the status of the long running operation returned by `moveInstance()`.
1182
+ * @param {String} name
1183
+ * The operation name that will be passed.
1184
+ * @returns {Promise} - The promise which resolves to an object.
1185
+ * The decoded operation object has result and metadata field to get information from.
1186
+ * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation }
1187
+ * for more details and examples.
1188
+ * @example <caption>include:samples/generated/v1/instance_admin.move_instance.js</caption>
1189
+ * region_tag:spanner_v1_generated_InstanceAdmin_MoveInstance_async
1190
+ */
1191
+ async checkMoveInstanceProgress(name) {
1192
+ this._log.info('moveInstance long-running');
1193
+ const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({ name });
1194
+ const [operation] = await this.operationsClient.getOperation(request);
1195
+ const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.moveInstance, this._gaxModule.createDefaultBackoffSettings());
1196
+ return decodeOperation;
1197
+ }
1198
+ listInstanceConfigs(request, optionsOrCallback, callback) {
1199
+ request = request || {};
1200
+ let options;
1201
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
1202
+ callback = optionsOrCallback;
1203
+ options = {};
1204
+ }
1205
+ else {
1206
+ options = optionsOrCallback;
1207
+ }
1208
+ options = options || {};
1209
+ options.otherArgs = options.otherArgs || {};
1210
+ options.otherArgs.headers = options.otherArgs.headers || {};
1211
+ options.otherArgs.headers['x-goog-request-params'] =
1212
+ this._gaxModule.routingHeader.fromParams({
1213
+ parent: request.parent ?? '',
1214
+ });
1215
+ this.initialize().catch((err) => {
1216
+ throw err;
1217
+ });
1218
+ const wrappedCallback = callback
1219
+ ? (error, values, nextPageRequest, rawResponse) => {
1220
+ this._log.info('listInstanceConfigs values %j', values);
1221
+ callback(error, values, nextPageRequest, rawResponse); // We verified callback above.
1222
+ }
1223
+ : undefined;
1224
+ this._log.info('listInstanceConfigs request %j', request);
1225
+ return this.innerApiCalls
1226
+ .listInstanceConfigs(request, options, wrappedCallback)
1227
+ ?.then(([response, input, output]) => {
1228
+ this._log.info('listInstanceConfigs values %j', response);
1229
+ return [response, input, output];
1230
+ });
1231
+ }
1232
+ /**
1233
+ * Equivalent to `listInstanceConfigs`, but returns a NodeJS Stream object.
1234
+ * @param {Object} request
1235
+ * The request object that will be sent.
1236
+ * @param {string} request.parent
1237
+ * Required. The name of the project for which a list of supported instance
1238
+ * configurations is requested. Values are of the form
1239
+ * `projects/<project>`.
1240
+ * @param {number} request.pageSize
1241
+ * Number of instance configurations to be returned in the response. If 0 or
1242
+ * less, defaults to the server's maximum allowed page size.
1243
+ * @param {string} request.pageToken
1244
+ * If non-empty, `page_token` should contain a
1245
+ * {@link protos.google.spanner.admin.instance.v1.ListInstanceConfigsResponse.next_page_token|next_page_token}
1246
+ * from a previous
1247
+ * {@link protos.google.spanner.admin.instance.v1.ListInstanceConfigsResponse|ListInstanceConfigsResponse}.
1248
+ * @param {object} [options]
1249
+ * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
1250
+ * @returns {Stream}
1251
+ * An object stream which emits an object representing {@link protos.google.spanner.admin.instance.v1.InstanceConfig|InstanceConfig} on 'data' event.
1252
+ * The client library will perform auto-pagination by default: it will call the API as many
1253
+ * times as needed. Note that it can affect your quota.
1254
+ * We recommend using `listInstanceConfigsAsync()`
1255
+ * method described below for async iteration which you can stop as needed.
1256
+ * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation }
1257
+ * for more details and examples.
1258
+ */
1259
+ listInstanceConfigsStream(request, options) {
1260
+ request = request || {};
1261
+ options = options || {};
1262
+ options.otherArgs = options.otherArgs || {};
1263
+ options.otherArgs.headers = options.otherArgs.headers || {};
1264
+ options.otherArgs.headers['x-goog-request-params'] =
1265
+ this._gaxModule.routingHeader.fromParams({
1266
+ parent: request.parent ?? '',
1267
+ });
1268
+ const defaultCallSettings = this._defaults['listInstanceConfigs'];
1269
+ const callSettings = defaultCallSettings.merge(options);
1270
+ this.initialize().catch((err) => {
1271
+ throw err;
1272
+ });
1273
+ this._log.info('listInstanceConfigs stream %j', request);
1274
+ return this.descriptors.page.listInstanceConfigs.createStream(this.innerApiCalls.listInstanceConfigs, request, callSettings);
1275
+ }
1276
+ /**
1277
+ * Equivalent to `listInstanceConfigs`, but returns an iterable object.
1278
+ *
1279
+ * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand.
1280
+ * @param {Object} request
1281
+ * The request object that will be sent.
1282
+ * @param {string} request.parent
1283
+ * Required. The name of the project for which a list of supported instance
1284
+ * configurations is requested. Values are of the form
1285
+ * `projects/<project>`.
1286
+ * @param {number} request.pageSize
1287
+ * Number of instance configurations to be returned in the response. If 0 or
1288
+ * less, defaults to the server's maximum allowed page size.
1289
+ * @param {string} request.pageToken
1290
+ * If non-empty, `page_token` should contain a
1291
+ * {@link protos.google.spanner.admin.instance.v1.ListInstanceConfigsResponse.next_page_token|next_page_token}
1292
+ * from a previous
1293
+ * {@link protos.google.spanner.admin.instance.v1.ListInstanceConfigsResponse|ListInstanceConfigsResponse}.
1294
+ * @param {object} [options]
1295
+ * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
1296
+ * @returns {Object}
1297
+ * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }.
1298
+ * When you iterate the returned iterable, each element will be an object representing
1299
+ * {@link protos.google.spanner.admin.instance.v1.InstanceConfig|InstanceConfig}. The API will be called under the hood as needed, once per the page,
1300
+ * so you can stop the iteration when you don't need more results.
1301
+ * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation }
1302
+ * for more details and examples.
1303
+ * @example <caption>include:samples/generated/v1/instance_admin.list_instance_configs.js</caption>
1304
+ * region_tag:spanner_v1_generated_InstanceAdmin_ListInstanceConfigs_async
1305
+ */
1306
+ listInstanceConfigsAsync(request, options) {
1307
+ request = request || {};
1308
+ options = options || {};
1309
+ options.otherArgs = options.otherArgs || {};
1310
+ options.otherArgs.headers = options.otherArgs.headers || {};
1311
+ options.otherArgs.headers['x-goog-request-params'] =
1312
+ this._gaxModule.routingHeader.fromParams({
1313
+ parent: request.parent ?? '',
1314
+ });
1315
+ const defaultCallSettings = this._defaults['listInstanceConfigs'];
1316
+ const callSettings = defaultCallSettings.merge(options);
1317
+ this.initialize().catch((err) => {
1318
+ throw err;
1319
+ });
1320
+ this._log.info('listInstanceConfigs iterate %j', request);
1321
+ return this.descriptors.page.listInstanceConfigs.asyncIterate(this.innerApiCalls['listInstanceConfigs'], request, callSettings);
1322
+ }
1323
+ listInstanceConfigOperations(request, optionsOrCallback, callback) {
1324
+ request = request || {};
1325
+ let options;
1326
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
1327
+ callback = optionsOrCallback;
1328
+ options = {};
1329
+ }
1330
+ else {
1331
+ options = optionsOrCallback;
1332
+ }
1333
+ options = options || {};
1334
+ options.otherArgs = options.otherArgs || {};
1335
+ options.otherArgs.headers = options.otherArgs.headers || {};
1336
+ options.otherArgs.headers['x-goog-request-params'] =
1337
+ this._gaxModule.routingHeader.fromParams({
1338
+ parent: request.parent ?? '',
1339
+ });
1340
+ this.initialize().catch((err) => {
1341
+ throw err;
1342
+ });
1343
+ const wrappedCallback = callback
1344
+ ? (error, values, nextPageRequest, rawResponse) => {
1345
+ this._log.info('listInstanceConfigOperations values %j', values);
1346
+ callback(error, values, nextPageRequest, rawResponse); // We verified callback above.
1347
+ }
1348
+ : undefined;
1349
+ this._log.info('listInstanceConfigOperations request %j', request);
1350
+ return this.innerApiCalls
1351
+ .listInstanceConfigOperations(request, options, wrappedCallback)
1352
+ ?.then(([response, input, output]) => {
1353
+ this._log.info('listInstanceConfigOperations values %j', response);
1354
+ return [response, input, output];
1355
+ });
1356
+ }
1357
+ /**
1358
+ * Equivalent to `listInstanceConfigOperations`, but returns a NodeJS Stream object.
1359
+ * @param {Object} request
1360
+ * The request object that will be sent.
1361
+ * @param {string} request.parent
1362
+ * Required. The project of the instance configuration operations.
1363
+ * Values are of the form `projects/<project>`.
1364
+ * @param {string} request.filter
1365
+ * An expression that filters the list of returned operations.
1366
+ *
1367
+ * A filter expression consists of a field name, a
1368
+ * comparison operator, and a value for filtering.
1369
+ * The value must be a string, a number, or a boolean. The comparison operator
1370
+ * must be one of: `<`, `>`, `<=`, `>=`, `!=`, `=`, or `:`.
1371
+ * Colon `:` is the contains operator. Filter rules are not case sensitive.
1372
+ *
1373
+ * The following fields in the Operation are eligible for filtering:
1374
+ *
1375
+ * * `name` - The name of the long-running operation
1376
+ * * `done` - False if the operation is in progress, else true.
1377
+ * * `metadata.@type` - the type of metadata. For example, the type string
1378
+ * for
1379
+ * {@link protos.google.spanner.admin.instance.v1.CreateInstanceConfigMetadata|CreateInstanceConfigMetadata}
1380
+ * is
1381
+ * `type.googleapis.com/google.spanner.admin.instance.v1.CreateInstanceConfigMetadata`.
1382
+ * * `metadata.<field_name>` - any field in metadata.value.
1383
+ * `metadata.@type` must be specified first, if filtering on metadata
1384
+ * fields.
1385
+ * * `error` - Error associated with the long-running operation.
1386
+ * * `response.@type` - the type of response.
1387
+ * * `response.<field_name>` - any field in response.value.
1388
+ *
1389
+ * You can combine multiple expressions by enclosing each expression in
1390
+ * parentheses. By default, expressions are combined with AND logic. However,
1391
+ * you can specify AND, OR, and NOT logic explicitly.
1392
+ *
1393
+ * Here are a few examples:
1394
+ *
1395
+ * * `done:true` - The operation is complete.
1396
+ * * `(metadata.@type=` \
1397
+ * `type.googleapis.com/google.spanner.admin.instance.v1.CreateInstanceConfigMetadata)
1398
+ * AND` \
1399
+ * `(metadata.instance_config.name:custom-config) AND` \
1400
+ * `(metadata.progress.start_time < \"2021-03-28T14:50:00Z\") AND` \
1401
+ * `(error:*)` - Return operations where:
1402
+ * * The operation's metadata type is
1403
+ * {@link protos.google.spanner.admin.instance.v1.CreateInstanceConfigMetadata|CreateInstanceConfigMetadata}.
1404
+ * * The instance configuration name contains "custom-config".
1405
+ * * The operation started before 2021-03-28T14:50:00Z.
1406
+ * * The operation resulted in an error.
1407
+ * @param {number} request.pageSize
1408
+ * Number of operations to be returned in the response. If 0 or
1409
+ * less, defaults to the server's maximum allowed page size.
1410
+ * @param {string} request.pageToken
1411
+ * If non-empty, `page_token` should contain a
1412
+ * {@link protos.google.spanner.admin.instance.v1.ListInstanceConfigOperationsResponse.next_page_token|next_page_token}
1413
+ * from a previous
1414
+ * {@link protos.google.spanner.admin.instance.v1.ListInstanceConfigOperationsResponse|ListInstanceConfigOperationsResponse}
1415
+ * to the same `parent` and with the same `filter`.
1416
+ * @param {object} [options]
1417
+ * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
1418
+ * @returns {Stream}
1419
+ * An object stream which emits an object representing {@link protos.google.longrunning.Operation|Operation} on 'data' event.
1420
+ * The client library will perform auto-pagination by default: it will call the API as many
1421
+ * times as needed. Note that it can affect your quota.
1422
+ * We recommend using `listInstanceConfigOperationsAsync()`
1423
+ * method described below for async iteration which you can stop as needed.
1424
+ * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation }
1425
+ * for more details and examples.
1426
+ */
1427
+ listInstanceConfigOperationsStream(request, options) {
1428
+ request = request || {};
1429
+ options = options || {};
1430
+ options.otherArgs = options.otherArgs || {};
1431
+ options.otherArgs.headers = options.otherArgs.headers || {};
1432
+ options.otherArgs.headers['x-goog-request-params'] =
1433
+ this._gaxModule.routingHeader.fromParams({
1434
+ parent: request.parent ?? '',
1435
+ });
1436
+ const defaultCallSettings = this._defaults['listInstanceConfigOperations'];
1437
+ const callSettings = defaultCallSettings.merge(options);
1438
+ this.initialize().catch((err) => {
1439
+ throw err;
1440
+ });
1441
+ this._log.info('listInstanceConfigOperations stream %j', request);
1442
+ return this.descriptors.page.listInstanceConfigOperations.createStream(this.innerApiCalls.listInstanceConfigOperations, request, callSettings);
1443
+ }
1444
+ /**
1445
+ * Equivalent to `listInstanceConfigOperations`, but returns an iterable object.
1446
+ *
1447
+ * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand.
1448
+ * @param {Object} request
1449
+ * The request object that will be sent.
1450
+ * @param {string} request.parent
1451
+ * Required. The project of the instance configuration operations.
1452
+ * Values are of the form `projects/<project>`.
1453
+ * @param {string} request.filter
1454
+ * An expression that filters the list of returned operations.
1455
+ *
1456
+ * A filter expression consists of a field name, a
1457
+ * comparison operator, and a value for filtering.
1458
+ * The value must be a string, a number, or a boolean. The comparison operator
1459
+ * must be one of: `<`, `>`, `<=`, `>=`, `!=`, `=`, or `:`.
1460
+ * Colon `:` is the contains operator. Filter rules are not case sensitive.
1461
+ *
1462
+ * The following fields in the Operation are eligible for filtering:
1463
+ *
1464
+ * * `name` - The name of the long-running operation
1465
+ * * `done` - False if the operation is in progress, else true.
1466
+ * * `metadata.@type` - the type of metadata. For example, the type string
1467
+ * for
1468
+ * {@link protos.google.spanner.admin.instance.v1.CreateInstanceConfigMetadata|CreateInstanceConfigMetadata}
1469
+ * is
1470
+ * `type.googleapis.com/google.spanner.admin.instance.v1.CreateInstanceConfigMetadata`.
1471
+ * * `metadata.<field_name>` - any field in metadata.value.
1472
+ * `metadata.@type` must be specified first, if filtering on metadata
1473
+ * fields.
1474
+ * * `error` - Error associated with the long-running operation.
1475
+ * * `response.@type` - the type of response.
1476
+ * * `response.<field_name>` - any field in response.value.
1477
+ *
1478
+ * You can combine multiple expressions by enclosing each expression in
1479
+ * parentheses. By default, expressions are combined with AND logic. However,
1480
+ * you can specify AND, OR, and NOT logic explicitly.
1481
+ *
1482
+ * Here are a few examples:
1483
+ *
1484
+ * * `done:true` - The operation is complete.
1485
+ * * `(metadata.@type=` \
1486
+ * `type.googleapis.com/google.spanner.admin.instance.v1.CreateInstanceConfigMetadata)
1487
+ * AND` \
1488
+ * `(metadata.instance_config.name:custom-config) AND` \
1489
+ * `(metadata.progress.start_time < \"2021-03-28T14:50:00Z\") AND` \
1490
+ * `(error:*)` - Return operations where:
1491
+ * * The operation's metadata type is
1492
+ * {@link protos.google.spanner.admin.instance.v1.CreateInstanceConfigMetadata|CreateInstanceConfigMetadata}.
1493
+ * * The instance configuration name contains "custom-config".
1494
+ * * The operation started before 2021-03-28T14:50:00Z.
1495
+ * * The operation resulted in an error.
1496
+ * @param {number} request.pageSize
1497
+ * Number of operations to be returned in the response. If 0 or
1498
+ * less, defaults to the server's maximum allowed page size.
1499
+ * @param {string} request.pageToken
1500
+ * If non-empty, `page_token` should contain a
1501
+ * {@link protos.google.spanner.admin.instance.v1.ListInstanceConfigOperationsResponse.next_page_token|next_page_token}
1502
+ * from a previous
1503
+ * {@link protos.google.spanner.admin.instance.v1.ListInstanceConfigOperationsResponse|ListInstanceConfigOperationsResponse}
1504
+ * to the same `parent` and with the same `filter`.
1505
+ * @param {object} [options]
1506
+ * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
1507
+ * @returns {Object}
1508
+ * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }.
1509
+ * When you iterate the returned iterable, each element will be an object representing
1510
+ * {@link protos.google.longrunning.Operation|Operation}. The API will be called under the hood as needed, once per the page,
1511
+ * so you can stop the iteration when you don't need more results.
1512
+ * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation }
1513
+ * for more details and examples.
1514
+ * @example <caption>include:samples/generated/v1/instance_admin.list_instance_config_operations.js</caption>
1515
+ * region_tag:spanner_v1_generated_InstanceAdmin_ListInstanceConfigOperations_async
1516
+ */
1517
+ listInstanceConfigOperationsAsync(request, options) {
1518
+ request = request || {};
1519
+ options = options || {};
1520
+ options.otherArgs = options.otherArgs || {};
1521
+ options.otherArgs.headers = options.otherArgs.headers || {};
1522
+ options.otherArgs.headers['x-goog-request-params'] =
1523
+ this._gaxModule.routingHeader.fromParams({
1524
+ parent: request.parent ?? '',
1525
+ });
1526
+ const defaultCallSettings = this._defaults['listInstanceConfigOperations'];
1527
+ const callSettings = defaultCallSettings.merge(options);
1528
+ this.initialize().catch((err) => {
1529
+ throw err;
1530
+ });
1531
+ this._log.info('listInstanceConfigOperations iterate %j', request);
1532
+ return this.descriptors.page.listInstanceConfigOperations.asyncIterate(this.innerApiCalls['listInstanceConfigOperations'], request, callSettings);
1533
+ }
1534
+ listInstances(request, optionsOrCallback, callback) {
1535
+ request = request || {};
1536
+ let options;
1537
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
1538
+ callback = optionsOrCallback;
1539
+ options = {};
1540
+ }
1541
+ else {
1542
+ options = optionsOrCallback;
1543
+ }
1544
+ options = options || {};
1545
+ options.otherArgs = options.otherArgs || {};
1546
+ options.otherArgs.headers = options.otherArgs.headers || {};
1547
+ options.otherArgs.headers['x-goog-request-params'] =
1548
+ this._gaxModule.routingHeader.fromParams({
1549
+ parent: request.parent ?? '',
1550
+ });
1551
+ this.initialize().catch((err) => {
1552
+ throw err;
1553
+ });
1554
+ const wrappedCallback = callback
1555
+ ? (error, values, nextPageRequest, rawResponse) => {
1556
+ this._log.info('listInstances values %j', values);
1557
+ callback(error, values, nextPageRequest, rawResponse); // We verified callback above.
1558
+ }
1559
+ : undefined;
1560
+ this._log.info('listInstances request %j', request);
1561
+ return this.innerApiCalls
1562
+ .listInstances(request, options, wrappedCallback)
1563
+ ?.then(([response, input, output]) => {
1564
+ this._log.info('listInstances values %j', response);
1565
+ return [response, input, output];
1566
+ });
1567
+ }
1568
+ /**
1569
+ * Equivalent to `listInstances`, but returns a NodeJS Stream object.
1570
+ * @param {Object} request
1571
+ * The request object that will be sent.
1572
+ * @param {string} request.parent
1573
+ * Required. The name of the project for which a list of instances is
1574
+ * requested. Values are of the form `projects/<project>`.
1575
+ * @param {number} request.pageSize
1576
+ * Number of instances to be returned in the response. If 0 or less, defaults
1577
+ * to the server's maximum allowed page size.
1578
+ * @param {string} request.pageToken
1579
+ * If non-empty, `page_token` should contain a
1580
+ * {@link protos.google.spanner.admin.instance.v1.ListInstancesResponse.next_page_token|next_page_token}
1581
+ * from a previous
1582
+ * {@link protos.google.spanner.admin.instance.v1.ListInstancesResponse|ListInstancesResponse}.
1583
+ * @param {string} request.filter
1584
+ * An expression for filtering the results of the request. Filter rules are
1585
+ * case insensitive. The fields eligible for filtering are:
1586
+ *
1587
+ * * `name`
1588
+ * * `display_name`
1589
+ * * `labels.key` where key is the name of a label
1590
+ *
1591
+ * Some examples of using filters are:
1592
+ *
1593
+ * * `name:*` --> The instance has a name.
1594
+ * * `name:Howl` --> The instance's name contains the string "howl".
1595
+ * * `name:HOWL` --> Equivalent to above.
1596
+ * * `NAME:howl` --> Equivalent to above.
1597
+ * * `labels.env:*` --> The instance has the label "env".
1598
+ * * `labels.env:dev` --> The instance has the label "env" and the value of
1599
+ * the label contains the string "dev".
1600
+ * * `name:howl labels.env:dev` --> The instance's name contains "howl" and
1601
+ * it has the label "env" with its value
1602
+ * containing "dev".
1603
+ * @param {google.protobuf.Timestamp} request.instanceDeadline
1604
+ * Deadline used while retrieving metadata for instances.
1605
+ * Instances whose metadata cannot be retrieved within this deadline will be
1606
+ * added to
1607
+ * {@link protos.google.spanner.admin.instance.v1.ListInstancesResponse.unreachable|unreachable}
1608
+ * in
1609
+ * {@link protos.google.spanner.admin.instance.v1.ListInstancesResponse|ListInstancesResponse}.
1610
+ * @param {object} [options]
1611
+ * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
1612
+ * @returns {Stream}
1613
+ * An object stream which emits an object representing {@link protos.google.spanner.admin.instance.v1.Instance|Instance} on 'data' event.
1614
+ * The client library will perform auto-pagination by default: it will call the API as many
1615
+ * times as needed. Note that it can affect your quota.
1616
+ * We recommend using `listInstancesAsync()`
1617
+ * method described below for async iteration which you can stop as needed.
1618
+ * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation }
1619
+ * for more details and examples.
1620
+ */
1621
+ listInstancesStream(request, options) {
1622
+ request = request || {};
1623
+ options = options || {};
1624
+ options.otherArgs = options.otherArgs || {};
1625
+ options.otherArgs.headers = options.otherArgs.headers || {};
1626
+ options.otherArgs.headers['x-goog-request-params'] =
1627
+ this._gaxModule.routingHeader.fromParams({
1628
+ parent: request.parent ?? '',
1629
+ });
1630
+ const defaultCallSettings = this._defaults['listInstances'];
1631
+ const callSettings = defaultCallSettings.merge(options);
1632
+ this.initialize().catch((err) => {
1633
+ throw err;
1634
+ });
1635
+ this._log.info('listInstances stream %j', request);
1636
+ return this.descriptors.page.listInstances.createStream(this.innerApiCalls.listInstances, request, callSettings);
1637
+ }
1638
+ /**
1639
+ * Equivalent to `listInstances`, but returns an iterable object.
1640
+ *
1641
+ * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand.
1642
+ * @param {Object} request
1643
+ * The request object that will be sent.
1644
+ * @param {string} request.parent
1645
+ * Required. The name of the project for which a list of instances is
1646
+ * requested. Values are of the form `projects/<project>`.
1647
+ * @param {number} request.pageSize
1648
+ * Number of instances to be returned in the response. If 0 or less, defaults
1649
+ * to the server's maximum allowed page size.
1650
+ * @param {string} request.pageToken
1651
+ * If non-empty, `page_token` should contain a
1652
+ * {@link protos.google.spanner.admin.instance.v1.ListInstancesResponse.next_page_token|next_page_token}
1653
+ * from a previous
1654
+ * {@link protos.google.spanner.admin.instance.v1.ListInstancesResponse|ListInstancesResponse}.
1655
+ * @param {string} request.filter
1656
+ * An expression for filtering the results of the request. Filter rules are
1657
+ * case insensitive. The fields eligible for filtering are:
1658
+ *
1659
+ * * `name`
1660
+ * * `display_name`
1661
+ * * `labels.key` where key is the name of a label
1662
+ *
1663
+ * Some examples of using filters are:
1664
+ *
1665
+ * * `name:*` --> The instance has a name.
1666
+ * * `name:Howl` --> The instance's name contains the string "howl".
1667
+ * * `name:HOWL` --> Equivalent to above.
1668
+ * * `NAME:howl` --> Equivalent to above.
1669
+ * * `labels.env:*` --> The instance has the label "env".
1670
+ * * `labels.env:dev` --> The instance has the label "env" and the value of
1671
+ * the label contains the string "dev".
1672
+ * * `name:howl labels.env:dev` --> The instance's name contains "howl" and
1673
+ * it has the label "env" with its value
1674
+ * containing "dev".
1675
+ * @param {google.protobuf.Timestamp} request.instanceDeadline
1676
+ * Deadline used while retrieving metadata for instances.
1677
+ * Instances whose metadata cannot be retrieved within this deadline will be
1678
+ * added to
1679
+ * {@link protos.google.spanner.admin.instance.v1.ListInstancesResponse.unreachable|unreachable}
1680
+ * in
1681
+ * {@link protos.google.spanner.admin.instance.v1.ListInstancesResponse|ListInstancesResponse}.
1682
+ * @param {object} [options]
1683
+ * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
1684
+ * @returns {Object}
1685
+ * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }.
1686
+ * When you iterate the returned iterable, each element will be an object representing
1687
+ * {@link protos.google.spanner.admin.instance.v1.Instance|Instance}. The API will be called under the hood as needed, once per the page,
1688
+ * so you can stop the iteration when you don't need more results.
1689
+ * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation }
1690
+ * for more details and examples.
1691
+ * @example <caption>include:samples/generated/v1/instance_admin.list_instances.js</caption>
1692
+ * region_tag:spanner_v1_generated_InstanceAdmin_ListInstances_async
1693
+ */
1694
+ listInstancesAsync(request, options) {
1695
+ request = request || {};
1696
+ options = options || {};
1697
+ options.otherArgs = options.otherArgs || {};
1698
+ options.otherArgs.headers = options.otherArgs.headers || {};
1699
+ options.otherArgs.headers['x-goog-request-params'] =
1700
+ this._gaxModule.routingHeader.fromParams({
1701
+ parent: request.parent ?? '',
1702
+ });
1703
+ const defaultCallSettings = this._defaults['listInstances'];
1704
+ const callSettings = defaultCallSettings.merge(options);
1705
+ this.initialize().catch((err) => {
1706
+ throw err;
1707
+ });
1708
+ this._log.info('listInstances iterate %j', request);
1709
+ return this.descriptors.page.listInstances.asyncIterate(this.innerApiCalls['listInstances'], request, callSettings);
1710
+ }
1711
+ listInstancePartitions(request, optionsOrCallback, callback) {
1712
+ request = request || {};
1713
+ let options;
1714
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
1715
+ callback = optionsOrCallback;
1716
+ options = {};
1717
+ }
1718
+ else {
1719
+ options = optionsOrCallback;
1720
+ }
1721
+ options = options || {};
1722
+ options.otherArgs = options.otherArgs || {};
1723
+ options.otherArgs.headers = options.otherArgs.headers || {};
1724
+ options.otherArgs.headers['x-goog-request-params'] =
1725
+ this._gaxModule.routingHeader.fromParams({
1726
+ parent: request.parent ?? '',
1727
+ });
1728
+ this.initialize().catch((err) => {
1729
+ throw err;
1730
+ });
1731
+ const wrappedCallback = callback
1732
+ ? (error, values, nextPageRequest, rawResponse) => {
1733
+ this._log.info('listInstancePartitions values %j', values);
1734
+ callback(error, values, nextPageRequest, rawResponse); // We verified callback above.
1735
+ }
1736
+ : undefined;
1737
+ this._log.info('listInstancePartitions request %j', request);
1738
+ return this.innerApiCalls
1739
+ .listInstancePartitions(request, options, wrappedCallback)
1740
+ ?.then(([response, input, output]) => {
1741
+ this._log.info('listInstancePartitions values %j', response);
1742
+ return [response, input, output];
1743
+ });
1744
+ }
1745
+ /**
1746
+ * Equivalent to `listInstancePartitions`, but returns a NodeJS Stream object.
1747
+ * @param {Object} request
1748
+ * The request object that will be sent.
1749
+ * @param {string} request.parent
1750
+ * Required. The instance whose instance partitions should be listed. Values
1751
+ * are of the form `projects/<project>/instances/<instance>`. Use `{instance}
1752
+ * = '-'` to list instance partitions for all Instances in a project, e.g.,
1753
+ * `projects/myproject/instances/-`.
1754
+ * @param {number} request.pageSize
1755
+ * Number of instance partitions to be returned in the response. If 0 or less,
1756
+ * defaults to the server's maximum allowed page size.
1757
+ * @param {string} request.pageToken
1758
+ * If non-empty, `page_token` should contain a
1759
+ * {@link protos.google.spanner.admin.instance.v1.ListInstancePartitionsResponse.next_page_token|next_page_token}
1760
+ * from a previous
1761
+ * {@link protos.google.spanner.admin.instance.v1.ListInstancePartitionsResponse|ListInstancePartitionsResponse}.
1762
+ * @param {google.protobuf.Timestamp} [request.instancePartitionDeadline]
1763
+ * Optional. Deadline used while retrieving metadata for instance partitions.
1764
+ * Instance partitions whose metadata cannot be retrieved within this deadline
1765
+ * will be added to
1766
+ * {@link protos.google.spanner.admin.instance.v1.ListInstancePartitionsResponse.unreachable|unreachable}
1767
+ * in
1768
+ * {@link protos.google.spanner.admin.instance.v1.ListInstancePartitionsResponse|ListInstancePartitionsResponse}.
1769
+ * @param {object} [options]
1770
+ * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
1771
+ * @returns {Stream}
1772
+ * An object stream which emits an object representing {@link protos.google.spanner.admin.instance.v1.InstancePartition|InstancePartition} on 'data' event.
1773
+ * The client library will perform auto-pagination by default: it will call the API as many
1774
+ * times as needed. Note that it can affect your quota.
1775
+ * We recommend using `listInstancePartitionsAsync()`
1776
+ * method described below for async iteration which you can stop as needed.
1777
+ * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation }
1778
+ * for more details and examples.
1779
+ */
1780
+ listInstancePartitionsStream(request, options) {
1781
+ request = request || {};
1782
+ options = options || {};
1783
+ options.otherArgs = options.otherArgs || {};
1784
+ options.otherArgs.headers = options.otherArgs.headers || {};
1785
+ options.otherArgs.headers['x-goog-request-params'] =
1786
+ this._gaxModule.routingHeader.fromParams({
1787
+ parent: request.parent ?? '',
1788
+ });
1789
+ const defaultCallSettings = this._defaults['listInstancePartitions'];
1790
+ const callSettings = defaultCallSettings.merge(options);
1791
+ this.initialize().catch((err) => {
1792
+ throw err;
1793
+ });
1794
+ this._log.info('listInstancePartitions stream %j', request);
1795
+ return this.descriptors.page.listInstancePartitions.createStream(this.innerApiCalls.listInstancePartitions, request, callSettings);
1796
+ }
1797
+ /**
1798
+ * Equivalent to `listInstancePartitions`, but returns an iterable object.
1799
+ *
1800
+ * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand.
1801
+ * @param {Object} request
1802
+ * The request object that will be sent.
1803
+ * @param {string} request.parent
1804
+ * Required. The instance whose instance partitions should be listed. Values
1805
+ * are of the form `projects/<project>/instances/<instance>`. Use `{instance}
1806
+ * = '-'` to list instance partitions for all Instances in a project, e.g.,
1807
+ * `projects/myproject/instances/-`.
1808
+ * @param {number} request.pageSize
1809
+ * Number of instance partitions to be returned in the response. If 0 or less,
1810
+ * defaults to the server's maximum allowed page size.
1811
+ * @param {string} request.pageToken
1812
+ * If non-empty, `page_token` should contain a
1813
+ * {@link protos.google.spanner.admin.instance.v1.ListInstancePartitionsResponse.next_page_token|next_page_token}
1814
+ * from a previous
1815
+ * {@link protos.google.spanner.admin.instance.v1.ListInstancePartitionsResponse|ListInstancePartitionsResponse}.
1816
+ * @param {google.protobuf.Timestamp} [request.instancePartitionDeadline]
1817
+ * Optional. Deadline used while retrieving metadata for instance partitions.
1818
+ * Instance partitions whose metadata cannot be retrieved within this deadline
1819
+ * will be added to
1820
+ * {@link protos.google.spanner.admin.instance.v1.ListInstancePartitionsResponse.unreachable|unreachable}
1821
+ * in
1822
+ * {@link protos.google.spanner.admin.instance.v1.ListInstancePartitionsResponse|ListInstancePartitionsResponse}.
1823
+ * @param {object} [options]
1824
+ * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
1825
+ * @returns {Object}
1826
+ * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }.
1827
+ * When you iterate the returned iterable, each element will be an object representing
1828
+ * {@link protos.google.spanner.admin.instance.v1.InstancePartition|InstancePartition}. The API will be called under the hood as needed, once per the page,
1829
+ * so you can stop the iteration when you don't need more results.
1830
+ * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation }
1831
+ * for more details and examples.
1832
+ * @example <caption>include:samples/generated/v1/instance_admin.list_instance_partitions.js</caption>
1833
+ * region_tag:spanner_v1_generated_InstanceAdmin_ListInstancePartitions_async
1834
+ */
1835
+ listInstancePartitionsAsync(request, options) {
1836
+ request = request || {};
1837
+ options = options || {};
1838
+ options.otherArgs = options.otherArgs || {};
1839
+ options.otherArgs.headers = options.otherArgs.headers || {};
1840
+ options.otherArgs.headers['x-goog-request-params'] =
1841
+ this._gaxModule.routingHeader.fromParams({
1842
+ parent: request.parent ?? '',
1843
+ });
1844
+ const defaultCallSettings = this._defaults['listInstancePartitions'];
1845
+ const callSettings = defaultCallSettings.merge(options);
1846
+ this.initialize().catch((err) => {
1847
+ throw err;
1848
+ });
1849
+ this._log.info('listInstancePartitions iterate %j', request);
1850
+ return this.descriptors.page.listInstancePartitions.asyncIterate(this.innerApiCalls['listInstancePartitions'], request, callSettings);
1851
+ }
1852
+ listInstancePartitionOperations(request, optionsOrCallback, callback) {
1853
+ request = request || {};
1854
+ let options;
1855
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
1856
+ callback = optionsOrCallback;
1857
+ options = {};
1858
+ }
1859
+ else {
1860
+ options = optionsOrCallback;
1861
+ }
1862
+ options = options || {};
1863
+ options.otherArgs = options.otherArgs || {};
1864
+ options.otherArgs.headers = options.otherArgs.headers || {};
1865
+ options.otherArgs.headers['x-goog-request-params'] =
1866
+ this._gaxModule.routingHeader.fromParams({
1867
+ parent: request.parent ?? '',
1868
+ });
1869
+ this.initialize().catch((err) => {
1870
+ throw err;
1871
+ });
1872
+ const wrappedCallback = callback
1873
+ ? (error, values, nextPageRequest, rawResponse) => {
1874
+ this._log.info('listInstancePartitionOperations values %j', values);
1875
+ callback(error, values, nextPageRequest, rawResponse); // We verified callback above.
1876
+ }
1877
+ : undefined;
1878
+ this._log.info('listInstancePartitionOperations request %j', request);
1879
+ return this.innerApiCalls
1880
+ .listInstancePartitionOperations(request, options, wrappedCallback)
1881
+ ?.then(([response, input, output]) => {
1882
+ this._log.info('listInstancePartitionOperations values %j', response);
1883
+ return [response, input, output];
1884
+ });
1885
+ }
1886
+ /**
1887
+ * Equivalent to `listInstancePartitionOperations`, but returns a NodeJS Stream object.
1888
+ * @param {Object} request
1889
+ * The request object that will be sent.
1890
+ * @param {string} request.parent
1891
+ * Required. The parent instance of the instance partition operations.
1892
+ * Values are of the form `projects/<project>/instances/<instance>`.
1893
+ * @param {string} [request.filter]
1894
+ * Optional. An expression that filters the list of returned operations.
1895
+ *
1896
+ * A filter expression consists of a field name, a
1897
+ * comparison operator, and a value for filtering.
1898
+ * The value must be a string, a number, or a boolean. The comparison operator
1899
+ * must be one of: `<`, `>`, `<=`, `>=`, `!=`, `=`, or `:`.
1900
+ * Colon `:` is the contains operator. Filter rules are not case sensitive.
1901
+ *
1902
+ * The following fields in the Operation are eligible for filtering:
1903
+ *
1904
+ * * `name` - The name of the long-running operation
1905
+ * * `done` - False if the operation is in progress, else true.
1906
+ * * `metadata.@type` - the type of metadata. For example, the type string
1907
+ * for
1908
+ * {@link protos.google.spanner.admin.instance.v1.CreateInstancePartitionMetadata|CreateInstancePartitionMetadata}
1909
+ * is
1910
+ * `type.googleapis.com/google.spanner.admin.instance.v1.CreateInstancePartitionMetadata`.
1911
+ * * `metadata.<field_name>` - any field in metadata.value.
1912
+ * `metadata.@type` must be specified first, if filtering on metadata
1913
+ * fields.
1914
+ * * `error` - Error associated with the long-running operation.
1915
+ * * `response.@type` - the type of response.
1916
+ * * `response.<field_name>` - any field in response.value.
1917
+ *
1918
+ * You can combine multiple expressions by enclosing each expression in
1919
+ * parentheses. By default, expressions are combined with AND logic. However,
1920
+ * you can specify AND, OR, and NOT logic explicitly.
1921
+ *
1922
+ * Here are a few examples:
1923
+ *
1924
+ * * `done:true` - The operation is complete.
1925
+ * * `(metadata.@type=` \
1926
+ * `type.googleapis.com/google.spanner.admin.instance.v1.CreateInstancePartitionMetadata)
1927
+ * AND` \
1928
+ * `(metadata.instance_partition.name:custom-instance-partition) AND` \
1929
+ * `(metadata.start_time < \"2021-03-28T14:50:00Z\") AND` \
1930
+ * `(error:*)` - Return operations where:
1931
+ * * The operation's metadata type is
1932
+ * {@link protos.google.spanner.admin.instance.v1.CreateInstancePartitionMetadata|CreateInstancePartitionMetadata}.
1933
+ * * The instance partition name contains "custom-instance-partition".
1934
+ * * The operation started before 2021-03-28T14:50:00Z.
1935
+ * * The operation resulted in an error.
1936
+ * @param {number} [request.pageSize]
1937
+ * Optional. Number of operations to be returned in the response. If 0 or
1938
+ * less, defaults to the server's maximum allowed page size.
1939
+ * @param {string} [request.pageToken]
1940
+ * Optional. If non-empty, `page_token` should contain a
1941
+ * {@link protos.google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse.next_page_token|next_page_token}
1942
+ * from a previous
1943
+ * {@link protos.google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse|ListInstancePartitionOperationsResponse}
1944
+ * to the same `parent` and with the same `filter`.
1945
+ * @param {google.protobuf.Timestamp} [request.instancePartitionDeadline]
1946
+ * Optional. Deadline used while retrieving metadata for instance partition
1947
+ * operations. Instance partitions whose operation metadata cannot be
1948
+ * retrieved within this deadline will be added to
1949
+ * {@link protos.google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse.unreachable_instance_partitions|unreachable_instance_partitions}
1950
+ * in
1951
+ * {@link protos.google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse|ListInstancePartitionOperationsResponse}.
1952
+ * @param {object} [options]
1953
+ * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
1954
+ * @returns {Stream}
1955
+ * An object stream which emits an object representing {@link protos.google.longrunning.Operation|Operation} on 'data' event.
1956
+ * The client library will perform auto-pagination by default: it will call the API as many
1957
+ * times as needed. Note that it can affect your quota.
1958
+ * We recommend using `listInstancePartitionOperationsAsync()`
1959
+ * method described below for async iteration which you can stop as needed.
1960
+ * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation }
1961
+ * for more details and examples.
1962
+ */
1963
+ listInstancePartitionOperationsStream(request, options) {
1964
+ request = request || {};
1965
+ options = options || {};
1966
+ options.otherArgs = options.otherArgs || {};
1967
+ options.otherArgs.headers = options.otherArgs.headers || {};
1968
+ options.otherArgs.headers['x-goog-request-params'] =
1969
+ this._gaxModule.routingHeader.fromParams({
1970
+ parent: request.parent ?? '',
1971
+ });
1972
+ const defaultCallSettings = this._defaults['listInstancePartitionOperations'];
1973
+ const callSettings = defaultCallSettings.merge(options);
1974
+ this.initialize().catch((err) => {
1975
+ throw err;
1976
+ });
1977
+ this._log.info('listInstancePartitionOperations stream %j', request);
1978
+ return this.descriptors.page.listInstancePartitionOperations.createStream(this.innerApiCalls.listInstancePartitionOperations, request, callSettings);
1979
+ }
1980
+ /**
1981
+ * Equivalent to `listInstancePartitionOperations`, but returns an iterable object.
1982
+ *
1983
+ * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand.
1984
+ * @param {Object} request
1985
+ * The request object that will be sent.
1986
+ * @param {string} request.parent
1987
+ * Required. The parent instance of the instance partition operations.
1988
+ * Values are of the form `projects/<project>/instances/<instance>`.
1989
+ * @param {string} [request.filter]
1990
+ * Optional. An expression that filters the list of returned operations.
1991
+ *
1992
+ * A filter expression consists of a field name, a
1993
+ * comparison operator, and a value for filtering.
1994
+ * The value must be a string, a number, or a boolean. The comparison operator
1995
+ * must be one of: `<`, `>`, `<=`, `>=`, `!=`, `=`, or `:`.
1996
+ * Colon `:` is the contains operator. Filter rules are not case sensitive.
1997
+ *
1998
+ * The following fields in the Operation are eligible for filtering:
1999
+ *
2000
+ * * `name` - The name of the long-running operation
2001
+ * * `done` - False if the operation is in progress, else true.
2002
+ * * `metadata.@type` - the type of metadata. For example, the type string
2003
+ * for
2004
+ * {@link protos.google.spanner.admin.instance.v1.CreateInstancePartitionMetadata|CreateInstancePartitionMetadata}
2005
+ * is
2006
+ * `type.googleapis.com/google.spanner.admin.instance.v1.CreateInstancePartitionMetadata`.
2007
+ * * `metadata.<field_name>` - any field in metadata.value.
2008
+ * `metadata.@type` must be specified first, if filtering on metadata
2009
+ * fields.
2010
+ * * `error` - Error associated with the long-running operation.
2011
+ * * `response.@type` - the type of response.
2012
+ * * `response.<field_name>` - any field in response.value.
2013
+ *
2014
+ * You can combine multiple expressions by enclosing each expression in
2015
+ * parentheses. By default, expressions are combined with AND logic. However,
2016
+ * you can specify AND, OR, and NOT logic explicitly.
2017
+ *
2018
+ * Here are a few examples:
2019
+ *
2020
+ * * `done:true` - The operation is complete.
2021
+ * * `(metadata.@type=` \
2022
+ * `type.googleapis.com/google.spanner.admin.instance.v1.CreateInstancePartitionMetadata)
2023
+ * AND` \
2024
+ * `(metadata.instance_partition.name:custom-instance-partition) AND` \
2025
+ * `(metadata.start_time < \"2021-03-28T14:50:00Z\") AND` \
2026
+ * `(error:*)` - Return operations where:
2027
+ * * The operation's metadata type is
2028
+ * {@link protos.google.spanner.admin.instance.v1.CreateInstancePartitionMetadata|CreateInstancePartitionMetadata}.
2029
+ * * The instance partition name contains "custom-instance-partition".
2030
+ * * The operation started before 2021-03-28T14:50:00Z.
2031
+ * * The operation resulted in an error.
2032
+ * @param {number} [request.pageSize]
2033
+ * Optional. Number of operations to be returned in the response. If 0 or
2034
+ * less, defaults to the server's maximum allowed page size.
2035
+ * @param {string} [request.pageToken]
2036
+ * Optional. If non-empty, `page_token` should contain a
2037
+ * {@link protos.google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse.next_page_token|next_page_token}
2038
+ * from a previous
2039
+ * {@link protos.google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse|ListInstancePartitionOperationsResponse}
2040
+ * to the same `parent` and with the same `filter`.
2041
+ * @param {google.protobuf.Timestamp} [request.instancePartitionDeadline]
2042
+ * Optional. Deadline used while retrieving metadata for instance partition
2043
+ * operations. Instance partitions whose operation metadata cannot be
2044
+ * retrieved within this deadline will be added to
2045
+ * {@link protos.google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse.unreachable_instance_partitions|unreachable_instance_partitions}
2046
+ * in
2047
+ * {@link protos.google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse|ListInstancePartitionOperationsResponse}.
2048
+ * @param {object} [options]
2049
+ * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
2050
+ * @returns {Object}
2051
+ * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }.
2052
+ * When you iterate the returned iterable, each element will be an object representing
2053
+ * {@link protos.google.longrunning.Operation|Operation}. The API will be called under the hood as needed, once per the page,
2054
+ * so you can stop the iteration when you don't need more results.
2055
+ * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation }
2056
+ * for more details and examples.
2057
+ * @example <caption>include:samples/generated/v1/instance_admin.list_instance_partition_operations.js</caption>
2058
+ * region_tag:spanner_v1_generated_InstanceAdmin_ListInstancePartitionOperations_async
2059
+ */
2060
+ listInstancePartitionOperationsAsync(request, options) {
2061
+ request = request || {};
2062
+ options = options || {};
2063
+ options.otherArgs = options.otherArgs || {};
2064
+ options.otherArgs.headers = options.otherArgs.headers || {};
2065
+ options.otherArgs.headers['x-goog-request-params'] =
2066
+ this._gaxModule.routingHeader.fromParams({
2067
+ parent: request.parent ?? '',
2068
+ });
2069
+ const defaultCallSettings = this._defaults['listInstancePartitionOperations'];
2070
+ const callSettings = defaultCallSettings.merge(options);
2071
+ this.initialize().catch((err) => {
2072
+ throw err;
2073
+ });
2074
+ this._log.info('listInstancePartitionOperations iterate %j', request);
2075
+ return this.descriptors.page.listInstancePartitionOperations.asyncIterate(this.innerApiCalls['listInstancePartitionOperations'], request, callSettings);
2076
+ }
2077
+ /**
2078
+ * Gets the latest state of a long-running operation. Clients can use this
2079
+ * method to poll the operation result at intervals as recommended by the API
2080
+ * service.
2081
+ *
2082
+ * @param {Object} request - The request object that will be sent.
2083
+ * @param {string} request.name - The name of the operation resource.
2084
+ * @param {Object=} options
2085
+ * Optional parameters. You can override the default settings for this call,
2086
+ * e.g, timeout, retries, paginations, etc. See {@link
2087
+ * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions}
2088
+ * for the details.
2089
+ * @param {function(?Error, ?Object)=} callback
2090
+ * The function which will be called with the result of the API call.
2091
+ *
2092
+ * The second parameter to the callback is an object representing
2093
+ * {@link google.longrunning.Operation | google.longrunning.Operation}.
2094
+ * @return {Promise} - The promise which resolves to an array.
2095
+ * The first element of the array is an object representing
2096
+ * {@link google.longrunning.Operation | google.longrunning.Operation}.
2097
+ * The promise has a method named "cancel" which cancels the ongoing API call.
2098
+ *
2099
+ * @example
2100
+ * ```
2101
+ * const client = longrunning.operationsClient();
2102
+ * const name = '';
2103
+ * const [response] = await client.getOperation({name});
2104
+ * // doThingsWith(response)
2105
+ * ```
2106
+ */
2107
+ getOperation(request, optionsOrCallback, callback) {
2108
+ let options;
2109
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
2110
+ callback = optionsOrCallback;
2111
+ options = {};
2112
+ }
2113
+ else {
2114
+ options = optionsOrCallback;
2115
+ }
2116
+ options = options || {};
2117
+ options.otherArgs = options.otherArgs || {};
2118
+ options.otherArgs.headers = options.otherArgs.headers || {};
2119
+ options.otherArgs.headers['x-goog-request-params'] =
2120
+ this._gaxModule.routingHeader.fromParams({
2121
+ name: request.name ?? '',
2122
+ });
2123
+ return this.operationsClient.getOperation(request, options, callback);
2124
+ }
2125
+ /**
2126
+ * Lists operations that match the specified filter in the request. If the
2127
+ * server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object.
2128
+ *
2129
+ * For-await-of syntax is used with the iterable to recursively get response element on-demand.
2130
+ *
2131
+ * @param {Object} request - The request object that will be sent.
2132
+ * @param {string} request.name - The name of the operation collection.
2133
+ * @param {string} request.filter - The standard list filter.
2134
+ * @param {number=} request.pageSize -
2135
+ * The maximum number of resources contained in the underlying API
2136
+ * response. If page streaming is performed per-resource, this
2137
+ * parameter does not affect the return value. If page streaming is
2138
+ * performed per-page, this determines the maximum number of
2139
+ * resources in a page.
2140
+ * @param {Object=} options
2141
+ * Optional parameters. You can override the default settings for this call,
2142
+ * e.g, timeout, retries, paginations, etc. See {@link
2143
+ * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} for the
2144
+ * details.
2145
+ * @returns {Object}
2146
+ * An iterable Object that conforms to {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | iteration protocols}.
2147
+ *
2148
+ * @example
2149
+ * ```
2150
+ * const client = longrunning.operationsClient();
2151
+ * for await (const response of client.listOperationsAsync(request));
2152
+ * // doThingsWith(response)
2153
+ * ```
2154
+ */
2155
+ listOperationsAsync(request, options) {
2156
+ options = options || {};
2157
+ options.otherArgs = options.otherArgs || {};
2158
+ options.otherArgs.headers = options.otherArgs.headers || {};
2159
+ options.otherArgs.headers['x-goog-request-params'] =
2160
+ this._gaxModule.routingHeader.fromParams({
2161
+ name: request.name ?? '',
2162
+ });
2163
+ return this.operationsClient.listOperationsAsync(request, options);
2164
+ }
2165
+ /**
2166
+ * Starts asynchronous cancellation on a long-running operation. The server
2167
+ * makes a best effort to cancel the operation, but success is not
2168
+ * guaranteed. If the server doesn't support this method, it returns
2169
+ * `google.rpc.Code.UNIMPLEMENTED`. Clients can use
2170
+ * {@link Operations.GetOperation} or
2171
+ * other methods to check whether the cancellation succeeded or whether the
2172
+ * operation completed despite cancellation. On successful cancellation,
2173
+ * the operation is not deleted; instead, it becomes an operation with
2174
+ * an {@link Operation.error} value with a {@link google.rpc.Status.code} of
2175
+ * 1, corresponding to `Code.CANCELLED`.
2176
+ *
2177
+ * @param {Object} request - The request object that will be sent.
2178
+ * @param {string} request.name - The name of the operation resource to be cancelled.
2179
+ * @param {Object=} options
2180
+ * Optional parameters. You can override the default settings for this call,
2181
+ * e.g, timeout, retries, paginations, etc. See {@link
2182
+ * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} for the
2183
+ * details.
2184
+ * @param {function(?Error)=} callback
2185
+ * The function which will be called with the result of the API call.
2186
+ * @return {Promise} - The promise which resolves when API call finishes.
2187
+ * The promise has a method named "cancel" which cancels the ongoing API
2188
+ * call.
2189
+ *
2190
+ * @example
2191
+ * ```
2192
+ * const client = longrunning.operationsClient();
2193
+ * await client.cancelOperation({name: ''});
2194
+ * ```
2195
+ */
2196
+ cancelOperation(request, optionsOrCallback, callback) {
2197
+ let options;
2198
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
2199
+ callback = optionsOrCallback;
2200
+ options = {};
2201
+ }
2202
+ else {
2203
+ options = optionsOrCallback;
2204
+ }
2205
+ options = options || {};
2206
+ options.otherArgs = options.otherArgs || {};
2207
+ options.otherArgs.headers = options.otherArgs.headers || {};
2208
+ options.otherArgs.headers['x-goog-request-params'] =
2209
+ this._gaxModule.routingHeader.fromParams({
2210
+ name: request.name ?? '',
2211
+ });
2212
+ return this.operationsClient.cancelOperation(request, options, callback);
2213
+ }
2214
+ /**
2215
+ * Deletes a long-running operation. This method indicates that the client is
2216
+ * no longer interested in the operation result. It does not cancel the
2217
+ * operation. If the server doesn't support this method, it returns
2218
+ * `google.rpc.Code.UNIMPLEMENTED`.
2219
+ *
2220
+ * @param {Object} request - The request object that will be sent.
2221
+ * @param {string} request.name - The name of the operation resource to be deleted.
2222
+ * @param {Object=} options
2223
+ * Optional parameters. You can override the default settings for this call,
2224
+ * e.g, timeout, retries, paginations, etc. See {@link
2225
+ * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions}
2226
+ * for the details.
2227
+ * @param {function(?Error)=} callback
2228
+ * The function which will be called with the result of the API call.
2229
+ * @return {Promise} - The promise which resolves when API call finishes.
2230
+ * The promise has a method named "cancel" which cancels the ongoing API
2231
+ * call.
2232
+ *
2233
+ * @example
2234
+ * ```
2235
+ * const client = longrunning.operationsClient();
2236
+ * await client.deleteOperation({name: ''});
2237
+ * ```
2238
+ */
2239
+ deleteOperation(request, optionsOrCallback, callback) {
2240
+ let options;
2241
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
2242
+ callback = optionsOrCallback;
2243
+ options = {};
2244
+ }
2245
+ else {
2246
+ options = optionsOrCallback;
2247
+ }
2248
+ options = options || {};
2249
+ options.otherArgs = options.otherArgs || {};
2250
+ options.otherArgs.headers = options.otherArgs.headers || {};
2251
+ options.otherArgs.headers['x-goog-request-params'] =
2252
+ this._gaxModule.routingHeader.fromParams({
2253
+ name: request.name ?? '',
2254
+ });
2255
+ return this.operationsClient.deleteOperation(request, options, callback);
2256
+ }
2257
+ // --------------------
2258
+ // -- Path templates --
2259
+ // --------------------
2260
+ /**
2261
+ * Return a fully-qualified instance resource name string.
2262
+ *
2263
+ * @param {string} project
2264
+ * @param {string} instance
2265
+ * @returns {string} Resource name string.
2266
+ */
2267
+ instancePath(project, instance) {
2268
+ return this.pathTemplates.instancePathTemplate.render({
2269
+ project: project,
2270
+ instance: instance,
2271
+ });
2272
+ }
2273
+ /**
2274
+ * Parse the project from Instance resource.
2275
+ *
2276
+ * @param {string} instanceName
2277
+ * A fully-qualified path representing Instance resource.
2278
+ * @returns {string} A string representing the project.
2279
+ */
2280
+ matchProjectFromInstanceName(instanceName) {
2281
+ return this.pathTemplates.instancePathTemplate.match(instanceName).project;
2282
+ }
2283
+ /**
2284
+ * Parse the instance from Instance resource.
2285
+ *
2286
+ * @param {string} instanceName
2287
+ * A fully-qualified path representing Instance resource.
2288
+ * @returns {string} A string representing the instance.
2289
+ */
2290
+ matchInstanceFromInstanceName(instanceName) {
2291
+ return this.pathTemplates.instancePathTemplate.match(instanceName).instance;
2292
+ }
2293
+ /**
2294
+ * Return a fully-qualified instanceConfig resource name string.
2295
+ *
2296
+ * @param {string} project
2297
+ * @param {string} instance_config
2298
+ * @returns {string} Resource name string.
2299
+ */
2300
+ instanceConfigPath(project, instanceConfig) {
2301
+ return this.pathTemplates.instanceConfigPathTemplate.render({
2302
+ project: project,
2303
+ instance_config: instanceConfig,
2304
+ });
2305
+ }
2306
+ /**
2307
+ * Parse the project from InstanceConfig resource.
2308
+ *
2309
+ * @param {string} instanceConfigName
2310
+ * A fully-qualified path representing InstanceConfig resource.
2311
+ * @returns {string} A string representing the project.
2312
+ */
2313
+ matchProjectFromInstanceConfigName(instanceConfigName) {
2314
+ return this.pathTemplates.instanceConfigPathTemplate.match(instanceConfigName).project;
2315
+ }
2316
+ /**
2317
+ * Parse the instance_config from InstanceConfig resource.
2318
+ *
2319
+ * @param {string} instanceConfigName
2320
+ * A fully-qualified path representing InstanceConfig resource.
2321
+ * @returns {string} A string representing the instance_config.
2322
+ */
2323
+ matchInstanceConfigFromInstanceConfigName(instanceConfigName) {
2324
+ return this.pathTemplates.instanceConfigPathTemplate.match(instanceConfigName).instance_config;
2325
+ }
2326
+ /**
2327
+ * Return a fully-qualified instancePartition resource name string.
2328
+ *
2329
+ * @param {string} project
2330
+ * @param {string} instance
2331
+ * @param {string} instance_partition
2332
+ * @returns {string} Resource name string.
2333
+ */
2334
+ instancePartitionPath(project, instance, instancePartition) {
2335
+ return this.pathTemplates.instancePartitionPathTemplate.render({
2336
+ project: project,
2337
+ instance: instance,
2338
+ instance_partition: instancePartition,
2339
+ });
2340
+ }
2341
+ /**
2342
+ * Parse the project from InstancePartition resource.
2343
+ *
2344
+ * @param {string} instancePartitionName
2345
+ * A fully-qualified path representing InstancePartition resource.
2346
+ * @returns {string} A string representing the project.
2347
+ */
2348
+ matchProjectFromInstancePartitionName(instancePartitionName) {
2349
+ return this.pathTemplates.instancePartitionPathTemplate.match(instancePartitionName).project;
2350
+ }
2351
+ /**
2352
+ * Parse the instance from InstancePartition resource.
2353
+ *
2354
+ * @param {string} instancePartitionName
2355
+ * A fully-qualified path representing InstancePartition resource.
2356
+ * @returns {string} A string representing the instance.
2357
+ */
2358
+ matchInstanceFromInstancePartitionName(instancePartitionName) {
2359
+ return this.pathTemplates.instancePartitionPathTemplate.match(instancePartitionName).instance;
2360
+ }
2361
+ /**
2362
+ * Parse the instance_partition from InstancePartition resource.
2363
+ *
2364
+ * @param {string} instancePartitionName
2365
+ * A fully-qualified path representing InstancePartition resource.
2366
+ * @returns {string} A string representing the instance_partition.
2367
+ */
2368
+ matchInstancePartitionFromInstancePartitionName(instancePartitionName) {
2369
+ return this.pathTemplates.instancePartitionPathTemplate.match(instancePartitionName).instance_partition;
2370
+ }
2371
+ /**
2372
+ * Return a fully-qualified project resource name string.
2373
+ *
2374
+ * @param {string} project
2375
+ * @returns {string} Resource name string.
2376
+ */
2377
+ projectPath(project) {
2378
+ return this.pathTemplates.projectPathTemplate.render({
2379
+ project: project,
2380
+ });
2381
+ }
2382
+ /**
2383
+ * Parse the project from Project resource.
2384
+ *
2385
+ * @param {string} projectName
2386
+ * A fully-qualified path representing Project resource.
2387
+ * @returns {string} A string representing the project.
2388
+ */
2389
+ matchProjectFromProjectName(projectName) {
2390
+ return this.pathTemplates.projectPathTemplate.match(projectName).project;
2391
+ }
2392
+ /**
2393
+ * Terminate the gRPC channel and close the client.
2394
+ *
2395
+ * The client will no longer be usable and all future behavior is undefined.
2396
+ * @returns {Promise} A promise that resolves when the client is closed.
2397
+ */
2398
+ close() {
2399
+ if (this.instanceAdminStub && !this._terminated) {
2400
+ return this.instanceAdminStub.then((stub) => {
2401
+ this._log.info('ending gRPC channel');
2402
+ this._terminated = true;
2403
+ stub.close();
2404
+ void this.operationsClient.close();
2405
+ });
2406
+ }
2407
+ return Promise.resolve();
2408
+ }
2409
+ }
2410
+ exports.InstanceAdminClient = InstanceAdminClient;
2411
+ //# sourceMappingURL=instance_admin_client.js.map