@google-cloud/spanner 7.5.0 → 7.7.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.
@@ -92,7 +92,7 @@ class InstanceAdminClient {
92
92
  * ```
93
93
  */
94
94
  constructor(opts, gaxInstance) {
95
- var _a, _b, _c, _d;
95
+ var _a, _b, _c, _d, _e;
96
96
  this._terminated = false;
97
97
  this.descriptors = {
98
98
  page: {},
@@ -107,14 +107,17 @@ class InstanceAdminClient {
107
107
  (opts === null || opts === void 0 ? void 0 : opts.universe_domain) !== (opts === null || opts === void 0 ? void 0 : opts.universeDomain)) {
108
108
  throw new Error('Please set either universe_domain or universeDomain, but not both.');
109
109
  }
110
+ const universeDomainEnvVar = typeof process === 'object' && typeof process.env === 'object'
111
+ ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']
112
+ : undefined;
110
113
  this._universeDomain =
111
- (_b = (_a = opts === null || opts === void 0 ? void 0 : opts.universeDomain) !== null && _a !== void 0 ? _a : opts === null || opts === void 0 ? void 0 : opts.universe_domain) !== null && _b !== void 0 ? _b : 'googleapis.com';
114
+ (_c = (_b = (_a = opts === null || opts === void 0 ? void 0 : opts.universeDomain) !== null && _a !== void 0 ? _a : opts === null || opts === void 0 ? void 0 : opts.universe_domain) !== null && _b !== void 0 ? _b : universeDomainEnvVar) !== null && _c !== void 0 ? _c : 'googleapis.com';
112
115
  this._servicePath = 'spanner.' + this._universeDomain;
113
116
  const servicePath = (opts === null || opts === void 0 ? void 0 : opts.servicePath) || (opts === null || opts === void 0 ? void 0 : opts.apiEndpoint) || this._servicePath;
114
117
  this._providedCustomServicePath = !!((opts === null || opts === void 0 ? void 0 : opts.servicePath) || (opts === null || opts === void 0 ? void 0 : opts.apiEndpoint));
115
118
  const port = (opts === null || opts === void 0 ? void 0 : opts.port) || staticMembers.port;
116
- const clientConfig = (_c = opts === null || opts === void 0 ? void 0 : opts.clientConfig) !== null && _c !== void 0 ? _c : {};
117
- const fallback = (_d = opts === null || opts === void 0 ? void 0 : opts.fallback) !== null && _d !== void 0 ? _d : (typeof window !== 'undefined' && typeof (window === null || window === void 0 ? void 0 : window.fetch) === 'function');
119
+ const clientConfig = (_d = opts === null || opts === void 0 ? void 0 : opts.clientConfig) !== null && _d !== void 0 ? _d : {};
120
+ const fallback = (_e = opts === null || opts === void 0 ? void 0 : opts.fallback) !== null && _e !== void 0 ? _e : (typeof window !== 'undefined' && typeof (window === null || window === void 0 ? void 0 : window.fetch) === 'function');
118
121
  opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts);
119
122
  // Request numeric enum values if REST transport is used.
120
123
  opts.numericEnums = true;
@@ -144,7 +147,7 @@ class InstanceAdminClient {
144
147
  }
145
148
  // Determine the client header string.
146
149
  const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`];
147
- if (typeof process !== 'undefined' && 'versions' in process) {
150
+ if (typeof process === 'object' && 'versions' in process) {
148
151
  clientHeader.push(`gl-node/${process.versions.node}`);
149
152
  }
150
153
  else {
@@ -167,6 +170,7 @@ class InstanceAdminClient {
167
170
  this.pathTemplates = {
168
171
  instancePathTemplate: new this._gaxModule.PathTemplate('projects/{project}/instances/{instance}'),
169
172
  instanceConfigPathTemplate: new this._gaxModule.PathTemplate('projects/{project}/instanceConfigs/{instance_config}'),
173
+ instancePartitionPathTemplate: new this._gaxModule.PathTemplate('projects/{project}/instances/{instance}/instancePartitions/{instance_partition}'),
170
174
  projectPathTemplate: new this._gaxModule.PathTemplate('projects/{project}'),
171
175
  };
172
176
  // Some of the methods on this service return "paged" results,
@@ -176,6 +180,8 @@ class InstanceAdminClient {
176
180
  listInstanceConfigs: new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'instanceConfigs'),
177
181
  listInstanceConfigOperations: new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'operations'),
178
182
  listInstances: new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'instances'),
183
+ listInstancePartitions: new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'instancePartitions'),
184
+ listInstancePartitionOperations: new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'operations'),
179
185
  };
180
186
  const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
181
187
  // This API contains "long-running operations", which return a
@@ -229,11 +235,17 @@ class InstanceAdminClient {
229
235
  const createInstanceMetadata = protoFilesRoot.lookup('.google.spanner.admin.instance.v1.CreateInstanceMetadata');
230
236
  const updateInstanceResponse = protoFilesRoot.lookup('.google.spanner.admin.instance.v1.Instance');
231
237
  const updateInstanceMetadata = protoFilesRoot.lookup('.google.spanner.admin.instance.v1.UpdateInstanceMetadata');
238
+ const createInstancePartitionResponse = protoFilesRoot.lookup('.google.spanner.admin.instance.v1.InstancePartition');
239
+ const createInstancePartitionMetadata = protoFilesRoot.lookup('.google.spanner.admin.instance.v1.CreateInstancePartitionMetadata');
240
+ const updateInstancePartitionResponse = protoFilesRoot.lookup('.google.spanner.admin.instance.v1.InstancePartition');
241
+ const updateInstancePartitionMetadata = protoFilesRoot.lookup('.google.spanner.admin.instance.v1.UpdateInstancePartitionMetadata');
232
242
  this.descriptors.longrunning = {
233
243
  createInstanceConfig: new this._gaxModule.LongrunningDescriptor(this.operationsClient, createInstanceConfigResponse.decode.bind(createInstanceConfigResponse), createInstanceConfigMetadata.decode.bind(createInstanceConfigMetadata)),
234
244
  updateInstanceConfig: new this._gaxModule.LongrunningDescriptor(this.operationsClient, updateInstanceConfigResponse.decode.bind(updateInstanceConfigResponse), updateInstanceConfigMetadata.decode.bind(updateInstanceConfigMetadata)),
235
245
  createInstance: new this._gaxModule.LongrunningDescriptor(this.operationsClient, createInstanceResponse.decode.bind(createInstanceResponse), createInstanceMetadata.decode.bind(createInstanceMetadata)),
236
246
  updateInstance: new this._gaxModule.LongrunningDescriptor(this.operationsClient, updateInstanceResponse.decode.bind(updateInstanceResponse), updateInstanceMetadata.decode.bind(updateInstanceMetadata)),
247
+ createInstancePartition: new this._gaxModule.LongrunningDescriptor(this.operationsClient, createInstancePartitionResponse.decode.bind(createInstancePartitionResponse), createInstancePartitionMetadata.decode.bind(createInstancePartitionMetadata)),
248
+ updateInstancePartition: new this._gaxModule.LongrunningDescriptor(this.operationsClient, updateInstancePartitionResponse.decode.bind(updateInstancePartitionResponse), updateInstancePartitionMetadata.decode.bind(updateInstancePartitionMetadata)),
237
249
  };
238
250
  // Put together the default options sent with requests.
239
251
  this._defaults = this._gaxGrpc.constructSettings('google.spanner.admin.instance.v1.InstanceAdmin', gapicConfig, opts.clientConfig || {}, { 'x-goog-api-client': clientHeader.join(' ') });
@@ -276,6 +288,7 @@ class InstanceAdminClient {
276
288
  'deleteInstanceConfig',
277
289
  'listInstanceConfigOperations',
278
290
  'listInstances',
291
+ 'listInstancePartitions',
279
292
  'getInstance',
280
293
  'createInstance',
281
294
  'updateInstance',
@@ -283,6 +296,11 @@ class InstanceAdminClient {
283
296
  'setIamPolicy',
284
297
  'getIamPolicy',
285
298
  'testIamPermissions',
299
+ 'getInstancePartition',
300
+ 'createInstancePartition',
301
+ 'deleteInstancePartition',
302
+ 'updateInstancePartition',
303
+ 'listInstancePartitionOperations',
286
304
  ];
287
305
  for (const methodName of instanceAdminStubMethods) {
288
306
  const callPromise = this.instanceAdminStub.then(stub => (...args) => {
@@ -308,7 +326,7 @@ class InstanceAdminClient {
308
326
  * @returns {string} The DNS address for this service.
309
327
  */
310
328
  static get servicePath() {
311
- if (typeof process !== undefined &&
329
+ if (typeof process === 'object' &&
312
330
  typeof process.emitWarning === 'function') {
313
331
  process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning');
314
332
  }
@@ -320,7 +338,7 @@ class InstanceAdminClient {
320
338
  * @returns {string} The DNS address for this service.
321
339
  */
322
340
  static get apiEndpoint() {
323
- if (typeof process !== undefined &&
341
+ if (typeof process === 'object' &&
324
342
  typeof process.emitWarning === 'function') {
325
343
  process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning');
326
344
  }
@@ -512,6 +530,48 @@ class InstanceAdminClient {
512
530
  this.initialize();
513
531
  return this.innerApiCalls.testIamPermissions(request, options, callback);
514
532
  }
533
+ getInstancePartition(request, optionsOrCallback, callback) {
534
+ var _a;
535
+ request = request || {};
536
+ let options;
537
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
538
+ callback = optionsOrCallback;
539
+ options = {};
540
+ }
541
+ else {
542
+ options = optionsOrCallback;
543
+ }
544
+ options = options || {};
545
+ options.otherArgs = options.otherArgs || {};
546
+ options.otherArgs.headers = options.otherArgs.headers || {};
547
+ options.otherArgs.headers['x-goog-request-params'] =
548
+ this._gaxModule.routingHeader.fromParams({
549
+ name: (_a = request.name) !== null && _a !== void 0 ? _a : '',
550
+ });
551
+ this.initialize();
552
+ return this.innerApiCalls.getInstancePartition(request, options, callback);
553
+ }
554
+ deleteInstancePartition(request, optionsOrCallback, callback) {
555
+ var _a;
556
+ request = request || {};
557
+ let options;
558
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
559
+ callback = optionsOrCallback;
560
+ options = {};
561
+ }
562
+ else {
563
+ options = optionsOrCallback;
564
+ }
565
+ options = options || {};
566
+ options.otherArgs = options.otherArgs || {};
567
+ options.otherArgs.headers = options.otherArgs.headers || {};
568
+ options.otherArgs.headers['x-goog-request-params'] =
569
+ this._gaxModule.routingHeader.fromParams({
570
+ name: (_a = request.name) !== null && _a !== void 0 ? _a : '',
571
+ });
572
+ this.initialize();
573
+ return this.innerApiCalls.deleteInstancePartition(request, options, callback);
574
+ }
515
575
  createInstanceConfig(request, optionsOrCallback, callback) {
516
576
  var _a;
517
577
  request = request || {};
@@ -656,6 +716,78 @@ class InstanceAdminClient {
656
716
  const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateInstance, this._gaxModule.createDefaultBackoffSettings());
657
717
  return decodeOperation;
658
718
  }
719
+ createInstancePartition(request, optionsOrCallback, callback) {
720
+ var _a;
721
+ request = request || {};
722
+ let options;
723
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
724
+ callback = optionsOrCallback;
725
+ options = {};
726
+ }
727
+ else {
728
+ options = optionsOrCallback;
729
+ }
730
+ options = options || {};
731
+ options.otherArgs = options.otherArgs || {};
732
+ options.otherArgs.headers = options.otherArgs.headers || {};
733
+ options.otherArgs.headers['x-goog-request-params'] =
734
+ this._gaxModule.routingHeader.fromParams({
735
+ parent: (_a = request.parent) !== null && _a !== void 0 ? _a : '',
736
+ });
737
+ this.initialize();
738
+ return this.innerApiCalls.createInstancePartition(request, options, callback);
739
+ }
740
+ /**
741
+ * Check the status of the long running operation returned by `createInstancePartition()`.
742
+ * @param {String} name
743
+ * The operation name that will be passed.
744
+ * @returns {Promise} - The promise which resolves to an object.
745
+ * The decoded operation object has result and metadata field to get information from.
746
+ * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation }
747
+ * for more details and examples.
748
+ */
749
+ async checkCreateInstancePartitionProgress(name) {
750
+ const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({ name });
751
+ const [operation] = await this.operationsClient.getOperation(request);
752
+ const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createInstancePartition, this._gaxModule.createDefaultBackoffSettings());
753
+ return decodeOperation;
754
+ }
755
+ updateInstancePartition(request, optionsOrCallback, callback) {
756
+ var _a;
757
+ request = request || {};
758
+ let options;
759
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
760
+ callback = optionsOrCallback;
761
+ options = {};
762
+ }
763
+ else {
764
+ options = optionsOrCallback;
765
+ }
766
+ options = options || {};
767
+ options.otherArgs = options.otherArgs || {};
768
+ options.otherArgs.headers = options.otherArgs.headers || {};
769
+ options.otherArgs.headers['x-goog-request-params'] =
770
+ this._gaxModule.routingHeader.fromParams({
771
+ 'instance_partition.name': (_a = request.instancePartition.name) !== null && _a !== void 0 ? _a : '',
772
+ });
773
+ this.initialize();
774
+ return this.innerApiCalls.updateInstancePartition(request, options, callback);
775
+ }
776
+ /**
777
+ * Check the status of the long running operation returned by `updateInstancePartition()`.
778
+ * @param {String} name
779
+ * The operation name that will be passed.
780
+ * @returns {Promise} - The promise which resolves to an object.
781
+ * The decoded operation object has result and metadata field to get information from.
782
+ * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation }
783
+ * for more details and examples.
784
+ */
785
+ async checkUpdateInstancePartitionProgress(name) {
786
+ const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({ name });
787
+ const [operation] = await this.operationsClient.getOperation(request);
788
+ const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateInstancePartition, this._gaxModule.createDefaultBackoffSettings());
789
+ return decodeOperation;
790
+ }
659
791
  listInstanceConfigs(request, optionsOrCallback, callback) {
660
792
  var _a;
661
793
  request = request || {};
@@ -1012,6 +1144,13 @@ class InstanceAdminClient {
1012
1144
  * * `name:howl labels.env:dev` --> The instance's name contains "howl" and
1013
1145
  * it has the label "env" with its value
1014
1146
  * containing "dev".
1147
+ * @param {google.protobuf.Timestamp} request.instanceDeadline
1148
+ * Deadline used while retrieving metadata for instances.
1149
+ * Instances whose metadata cannot be retrieved within this deadline will be
1150
+ * added to
1151
+ * {@link protos.google.spanner.admin.instance.v1.ListInstancesResponse.unreachable|unreachable}
1152
+ * in
1153
+ * {@link protos.google.spanner.admin.instance.v1.ListInstancesResponse|ListInstancesResponse}.
1015
1154
  * @param {object} [options]
1016
1155
  * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
1017
1156
  * @returns {Stream}
@@ -1075,6 +1214,13 @@ class InstanceAdminClient {
1075
1214
  * * `name:howl labels.env:dev` --> The instance's name contains "howl" and
1076
1215
  * it has the label "env" with its value
1077
1216
  * containing "dev".
1217
+ * @param {google.protobuf.Timestamp} request.instanceDeadline
1218
+ * Deadline used while retrieving metadata for instances.
1219
+ * Instances whose metadata cannot be retrieved within this deadline will be
1220
+ * added to
1221
+ * {@link protos.google.spanner.admin.instance.v1.ListInstancesResponse.unreachable|unreachable}
1222
+ * in
1223
+ * {@link protos.google.spanner.admin.instance.v1.ListInstancesResponse|ListInstancesResponse}.
1078
1224
  * @param {object} [options]
1079
1225
  * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
1080
1226
  * @returns {Object}
@@ -1100,6 +1246,330 @@ class InstanceAdminClient {
1100
1246
  this.initialize();
1101
1247
  return this.descriptors.page.listInstances.asyncIterate(this.innerApiCalls['listInstances'], request, callSettings);
1102
1248
  }
1249
+ listInstancePartitions(request, optionsOrCallback, callback) {
1250
+ var _a;
1251
+ request = request || {};
1252
+ let options;
1253
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
1254
+ callback = optionsOrCallback;
1255
+ options = {};
1256
+ }
1257
+ else {
1258
+ options = optionsOrCallback;
1259
+ }
1260
+ options = options || {};
1261
+ options.otherArgs = options.otherArgs || {};
1262
+ options.otherArgs.headers = options.otherArgs.headers || {};
1263
+ options.otherArgs.headers['x-goog-request-params'] =
1264
+ this._gaxModule.routingHeader.fromParams({
1265
+ parent: (_a = request.parent) !== null && _a !== void 0 ? _a : '',
1266
+ });
1267
+ this.initialize();
1268
+ return this.innerApiCalls.listInstancePartitions(request, options, callback);
1269
+ }
1270
+ /**
1271
+ * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object.
1272
+ * @param {Object} request
1273
+ * The request object that will be sent.
1274
+ * @param {string} request.parent
1275
+ * Required. The instance whose instance partitions should be listed. Values
1276
+ * are of the form `projects/<project>/instances/<instance>`.
1277
+ * @param {number} request.pageSize
1278
+ * Number of instance partitions to be returned in the response. If 0 or less,
1279
+ * defaults to the server's maximum allowed page size.
1280
+ * @param {string} request.pageToken
1281
+ * If non-empty, `page_token` should contain a
1282
+ * {@link protos.google.spanner.admin.instance.v1.ListInstancePartitionsResponse.next_page_token|next_page_token}
1283
+ * from a previous
1284
+ * {@link protos.google.spanner.admin.instance.v1.ListInstancePartitionsResponse|ListInstancePartitionsResponse}.
1285
+ * @param {google.protobuf.Timestamp} [request.instancePartitionDeadline]
1286
+ * Optional. Deadline used while retrieving metadata for instance partitions.
1287
+ * Instance partitions whose metadata cannot be retrieved within this deadline
1288
+ * will be added to
1289
+ * {@link protos.google.spanner.admin.instance.v1.ListInstancePartitionsResponse.unreachable|unreachable}
1290
+ * in
1291
+ * {@link protos.google.spanner.admin.instance.v1.ListInstancePartitionsResponse|ListInstancePartitionsResponse}.
1292
+ * @param {object} [options]
1293
+ * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
1294
+ * @returns {Stream}
1295
+ * An object stream which emits an object representing {@link protos.google.spanner.admin.instance.v1.InstancePartition|InstancePartition} on 'data' event.
1296
+ * The client library will perform auto-pagination by default: it will call the API as many
1297
+ * times as needed. Note that it can affect your quota.
1298
+ * We recommend using `listInstancePartitionsAsync()`
1299
+ * method described below for async iteration which you can stop as needed.
1300
+ * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation }
1301
+ * for more details and examples.
1302
+ */
1303
+ listInstancePartitionsStream(request, options) {
1304
+ var _a;
1305
+ request = request || {};
1306
+ options = options || {};
1307
+ options.otherArgs = options.otherArgs || {};
1308
+ options.otherArgs.headers = options.otherArgs.headers || {};
1309
+ options.otherArgs.headers['x-goog-request-params'] =
1310
+ this._gaxModule.routingHeader.fromParams({
1311
+ parent: (_a = request.parent) !== null && _a !== void 0 ? _a : '',
1312
+ });
1313
+ const defaultCallSettings = this._defaults['listInstancePartitions'];
1314
+ const callSettings = defaultCallSettings.merge(options);
1315
+ this.initialize();
1316
+ return this.descriptors.page.listInstancePartitions.createStream(this.innerApiCalls.listInstancePartitions, request, callSettings);
1317
+ }
1318
+ /**
1319
+ * Equivalent to `listInstancePartitions`, but returns an iterable object.
1320
+ *
1321
+ * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand.
1322
+ * @param {Object} request
1323
+ * The request object that will be sent.
1324
+ * @param {string} request.parent
1325
+ * Required. The instance whose instance partitions should be listed. Values
1326
+ * are of the form `projects/<project>/instances/<instance>`.
1327
+ * @param {number} request.pageSize
1328
+ * Number of instance partitions to be returned in the response. If 0 or less,
1329
+ * defaults to the server's maximum allowed page size.
1330
+ * @param {string} request.pageToken
1331
+ * If non-empty, `page_token` should contain a
1332
+ * {@link protos.google.spanner.admin.instance.v1.ListInstancePartitionsResponse.next_page_token|next_page_token}
1333
+ * from a previous
1334
+ * {@link protos.google.spanner.admin.instance.v1.ListInstancePartitionsResponse|ListInstancePartitionsResponse}.
1335
+ * @param {google.protobuf.Timestamp} [request.instancePartitionDeadline]
1336
+ * Optional. Deadline used while retrieving metadata for instance partitions.
1337
+ * Instance partitions whose metadata cannot be retrieved within this deadline
1338
+ * will be added to
1339
+ * {@link protos.google.spanner.admin.instance.v1.ListInstancePartitionsResponse.unreachable|unreachable}
1340
+ * in
1341
+ * {@link protos.google.spanner.admin.instance.v1.ListInstancePartitionsResponse|ListInstancePartitionsResponse}.
1342
+ * @param {object} [options]
1343
+ * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
1344
+ * @returns {Object}
1345
+ * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }.
1346
+ * When you iterate the returned iterable, each element will be an object representing
1347
+ * {@link protos.google.spanner.admin.instance.v1.InstancePartition|InstancePartition}. The API will be called under the hood as needed, once per the page,
1348
+ * so you can stop the iteration when you don't need more results.
1349
+ * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation }
1350
+ * for more details and examples.
1351
+ */
1352
+ listInstancePartitionsAsync(request, options) {
1353
+ var _a;
1354
+ request = request || {};
1355
+ options = options || {};
1356
+ options.otherArgs = options.otherArgs || {};
1357
+ options.otherArgs.headers = options.otherArgs.headers || {};
1358
+ options.otherArgs.headers['x-goog-request-params'] =
1359
+ this._gaxModule.routingHeader.fromParams({
1360
+ parent: (_a = request.parent) !== null && _a !== void 0 ? _a : '',
1361
+ });
1362
+ const defaultCallSettings = this._defaults['listInstancePartitions'];
1363
+ const callSettings = defaultCallSettings.merge(options);
1364
+ this.initialize();
1365
+ return this.descriptors.page.listInstancePartitions.asyncIterate(this.innerApiCalls['listInstancePartitions'], request, callSettings);
1366
+ }
1367
+ listInstancePartitionOperations(request, optionsOrCallback, callback) {
1368
+ var _a;
1369
+ request = request || {};
1370
+ let options;
1371
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
1372
+ callback = optionsOrCallback;
1373
+ options = {};
1374
+ }
1375
+ else {
1376
+ options = optionsOrCallback;
1377
+ }
1378
+ options = options || {};
1379
+ options.otherArgs = options.otherArgs || {};
1380
+ options.otherArgs.headers = options.otherArgs.headers || {};
1381
+ options.otherArgs.headers['x-goog-request-params'] =
1382
+ this._gaxModule.routingHeader.fromParams({
1383
+ parent: (_a = request.parent) !== null && _a !== void 0 ? _a : '',
1384
+ });
1385
+ this.initialize();
1386
+ return this.innerApiCalls.listInstancePartitionOperations(request, options, callback);
1387
+ }
1388
+ /**
1389
+ * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object.
1390
+ * @param {Object} request
1391
+ * The request object that will be sent.
1392
+ * @param {string} request.parent
1393
+ * Required. The parent instance of the instance partition operations.
1394
+ * Values are of the form `projects/<project>/instances/<instance>`.
1395
+ * @param {string} [request.filter]
1396
+ * Optional. An expression that filters the list of returned operations.
1397
+ *
1398
+ * A filter expression consists of a field name, a
1399
+ * comparison operator, and a value for filtering.
1400
+ * The value must be a string, a number, or a boolean. The comparison operator
1401
+ * must be one of: `<`, `>`, `<=`, `>=`, `!=`, `=`, or `:`.
1402
+ * Colon `:` is the contains operator. Filter rules are not case sensitive.
1403
+ *
1404
+ * The following fields in the {@link protos.google.longrunning.Operation|Operation}
1405
+ * are eligible for filtering:
1406
+ *
1407
+ * * `name` - The name of the long-running operation
1408
+ * * `done` - False if the operation is in progress, else true.
1409
+ * * `metadata.@type` - the type of metadata. For example, the type string
1410
+ * for
1411
+ * {@link protos.google.spanner.admin.instance.v1.CreateInstancePartitionMetadata|CreateInstancePartitionMetadata}
1412
+ * is
1413
+ * `type.googleapis.com/google.spanner.admin.instance.v1.CreateInstancePartitionMetadata`.
1414
+ * * `metadata.<field_name>` - any field in metadata.value.
1415
+ * `metadata.@type` must be specified first, if filtering on metadata
1416
+ * fields.
1417
+ * * `error` - Error associated with the long-running operation.
1418
+ * * `response.@type` - the type of response.
1419
+ * * `response.<field_name>` - any field in response.value.
1420
+ *
1421
+ * You can combine multiple expressions by enclosing each expression in
1422
+ * parentheses. By default, expressions are combined with AND logic. However,
1423
+ * you can specify AND, OR, and NOT logic explicitly.
1424
+ *
1425
+ * Here are a few examples:
1426
+ *
1427
+ * * `done:true` - The operation is complete.
1428
+ * * `(metadata.@type=` \
1429
+ * `type.googleapis.com/google.spanner.admin.instance.v1.CreateInstancePartitionMetadata)
1430
+ * AND` \
1431
+ * `(metadata.instance_partition.name:custom-instance-partition) AND` \
1432
+ * `(metadata.start_time < \"2021-03-28T14:50:00Z\") AND` \
1433
+ * `(error:*)` - Return operations where:
1434
+ * * The operation's metadata type is
1435
+ * {@link protos.google.spanner.admin.instance.v1.CreateInstancePartitionMetadata|CreateInstancePartitionMetadata}.
1436
+ * * The instance partition name contains "custom-instance-partition".
1437
+ * * The operation started before 2021-03-28T14:50:00Z.
1438
+ * * The operation resulted in an error.
1439
+ * @param {number} [request.pageSize]
1440
+ * Optional. Number of operations to be returned in the response. If 0 or
1441
+ * less, defaults to the server's maximum allowed page size.
1442
+ * @param {string} [request.pageToken]
1443
+ * Optional. If non-empty, `page_token` should contain a
1444
+ * {@link protos.google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse.next_page_token|next_page_token}
1445
+ * from a previous
1446
+ * {@link protos.google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse|ListInstancePartitionOperationsResponse}
1447
+ * to the same `parent` and with the same `filter`.
1448
+ * @param {google.protobuf.Timestamp} [request.instancePartitionDeadline]
1449
+ * Optional. Deadline used while retrieving metadata for instance partition
1450
+ * operations. Instance partitions whose operation metadata cannot be
1451
+ * retrieved within this deadline will be added to
1452
+ * {@link protos.ListInstancePartitionOperationsResponse.unreachable|unreachable} in
1453
+ * {@link protos.google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse|ListInstancePartitionOperationsResponse}.
1454
+ * @param {object} [options]
1455
+ * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
1456
+ * @returns {Stream}
1457
+ * An object stream which emits an object representing {@link protos.google.longrunning.Operation|Operation} on 'data' event.
1458
+ * The client library will perform auto-pagination by default: it will call the API as many
1459
+ * times as needed. Note that it can affect your quota.
1460
+ * We recommend using `listInstancePartitionOperationsAsync()`
1461
+ * method described below for async iteration which you can stop as needed.
1462
+ * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation }
1463
+ * for more details and examples.
1464
+ */
1465
+ listInstancePartitionOperationsStream(request, options) {
1466
+ var _a;
1467
+ request = request || {};
1468
+ options = options || {};
1469
+ options.otherArgs = options.otherArgs || {};
1470
+ options.otherArgs.headers = options.otherArgs.headers || {};
1471
+ options.otherArgs.headers['x-goog-request-params'] =
1472
+ this._gaxModule.routingHeader.fromParams({
1473
+ parent: (_a = request.parent) !== null && _a !== void 0 ? _a : '',
1474
+ });
1475
+ const defaultCallSettings = this._defaults['listInstancePartitionOperations'];
1476
+ const callSettings = defaultCallSettings.merge(options);
1477
+ this.initialize();
1478
+ return this.descriptors.page.listInstancePartitionOperations.createStream(this.innerApiCalls.listInstancePartitionOperations, request, callSettings);
1479
+ }
1480
+ /**
1481
+ * Equivalent to `listInstancePartitionOperations`, but returns an iterable object.
1482
+ *
1483
+ * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand.
1484
+ * @param {Object} request
1485
+ * The request object that will be sent.
1486
+ * @param {string} request.parent
1487
+ * Required. The parent instance of the instance partition operations.
1488
+ * Values are of the form `projects/<project>/instances/<instance>`.
1489
+ * @param {string} [request.filter]
1490
+ * Optional. An expression that filters the list of returned operations.
1491
+ *
1492
+ * A filter expression consists of a field name, a
1493
+ * comparison operator, and a value for filtering.
1494
+ * The value must be a string, a number, or a boolean. The comparison operator
1495
+ * must be one of: `<`, `>`, `<=`, `>=`, `!=`, `=`, or `:`.
1496
+ * Colon `:` is the contains operator. Filter rules are not case sensitive.
1497
+ *
1498
+ * The following fields in the {@link protos.google.longrunning.Operation|Operation}
1499
+ * are eligible for filtering:
1500
+ *
1501
+ * * `name` - The name of the long-running operation
1502
+ * * `done` - False if the operation is in progress, else true.
1503
+ * * `metadata.@type` - the type of metadata. For example, the type string
1504
+ * for
1505
+ * {@link protos.google.spanner.admin.instance.v1.CreateInstancePartitionMetadata|CreateInstancePartitionMetadata}
1506
+ * is
1507
+ * `type.googleapis.com/google.spanner.admin.instance.v1.CreateInstancePartitionMetadata`.
1508
+ * * `metadata.<field_name>` - any field in metadata.value.
1509
+ * `metadata.@type` must be specified first, if filtering on metadata
1510
+ * fields.
1511
+ * * `error` - Error associated with the long-running operation.
1512
+ * * `response.@type` - the type of response.
1513
+ * * `response.<field_name>` - any field in response.value.
1514
+ *
1515
+ * You can combine multiple expressions by enclosing each expression in
1516
+ * parentheses. By default, expressions are combined with AND logic. However,
1517
+ * you can specify AND, OR, and NOT logic explicitly.
1518
+ *
1519
+ * Here are a few examples:
1520
+ *
1521
+ * * `done:true` - The operation is complete.
1522
+ * * `(metadata.@type=` \
1523
+ * `type.googleapis.com/google.spanner.admin.instance.v1.CreateInstancePartitionMetadata)
1524
+ * AND` \
1525
+ * `(metadata.instance_partition.name:custom-instance-partition) AND` \
1526
+ * `(metadata.start_time < \"2021-03-28T14:50:00Z\") AND` \
1527
+ * `(error:*)` - Return operations where:
1528
+ * * The operation's metadata type is
1529
+ * {@link protos.google.spanner.admin.instance.v1.CreateInstancePartitionMetadata|CreateInstancePartitionMetadata}.
1530
+ * * The instance partition name contains "custom-instance-partition".
1531
+ * * The operation started before 2021-03-28T14:50:00Z.
1532
+ * * The operation resulted in an error.
1533
+ * @param {number} [request.pageSize]
1534
+ * Optional. Number of operations to be returned in the response. If 0 or
1535
+ * less, defaults to the server's maximum allowed page size.
1536
+ * @param {string} [request.pageToken]
1537
+ * Optional. If non-empty, `page_token` should contain a
1538
+ * {@link protos.google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse.next_page_token|next_page_token}
1539
+ * from a previous
1540
+ * {@link protos.google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse|ListInstancePartitionOperationsResponse}
1541
+ * to the same `parent` and with the same `filter`.
1542
+ * @param {google.protobuf.Timestamp} [request.instancePartitionDeadline]
1543
+ * Optional. Deadline used while retrieving metadata for instance partition
1544
+ * operations. Instance partitions whose operation metadata cannot be
1545
+ * retrieved within this deadline will be added to
1546
+ * {@link protos.ListInstancePartitionOperationsResponse.unreachable|unreachable} in
1547
+ * {@link protos.google.spanner.admin.instance.v1.ListInstancePartitionOperationsResponse|ListInstancePartitionOperationsResponse}.
1548
+ * @param {object} [options]
1549
+ * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
1550
+ * @returns {Object}
1551
+ * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }.
1552
+ * When you iterate the returned iterable, each element will be an object representing
1553
+ * {@link protos.google.longrunning.Operation|Operation}. The API will be called under the hood as needed, once per the page,
1554
+ * so you can stop the iteration when you don't need more results.
1555
+ * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation }
1556
+ * for more details and examples.
1557
+ */
1558
+ listInstancePartitionOperationsAsync(request, options) {
1559
+ var _a;
1560
+ request = request || {};
1561
+ options = options || {};
1562
+ options.otherArgs = options.otherArgs || {};
1563
+ options.otherArgs.headers = options.otherArgs.headers || {};
1564
+ options.otherArgs.headers['x-goog-request-params'] =
1565
+ this._gaxModule.routingHeader.fromParams({
1566
+ parent: (_a = request.parent) !== null && _a !== void 0 ? _a : '',
1567
+ });
1568
+ const defaultCallSettings = this._defaults['listInstancePartitionOperations'];
1569
+ const callSettings = defaultCallSettings.merge(options);
1570
+ this.initialize();
1571
+ return this.descriptors.page.listInstancePartitionOperations.asyncIterate(this.innerApiCalls['listInstancePartitionOperations'], request, callSettings);
1572
+ }
1103
1573
  // --------------------
1104
1574
  // -- Path templates --
1105
1575
  // --------------------
@@ -1169,6 +1639,51 @@ class InstanceAdminClient {
1169
1639
  matchInstanceConfigFromInstanceConfigName(instanceConfigName) {
1170
1640
  return this.pathTemplates.instanceConfigPathTemplate.match(instanceConfigName).instance_config;
1171
1641
  }
1642
+ /**
1643
+ * Return a fully-qualified instancePartition resource name string.
1644
+ *
1645
+ * @param {string} project
1646
+ * @param {string} instance
1647
+ * @param {string} instance_partition
1648
+ * @returns {string} Resource name string.
1649
+ */
1650
+ instancePartitionPath(project, instance, instancePartition) {
1651
+ return this.pathTemplates.instancePartitionPathTemplate.render({
1652
+ project: project,
1653
+ instance: instance,
1654
+ instance_partition: instancePartition,
1655
+ });
1656
+ }
1657
+ /**
1658
+ * Parse the project from InstancePartition resource.
1659
+ *
1660
+ * @param {string} instancePartitionName
1661
+ * A fully-qualified path representing InstancePartition resource.
1662
+ * @returns {string} A string representing the project.
1663
+ */
1664
+ matchProjectFromInstancePartitionName(instancePartitionName) {
1665
+ return this.pathTemplates.instancePartitionPathTemplate.match(instancePartitionName).project;
1666
+ }
1667
+ /**
1668
+ * Parse the instance from InstancePartition resource.
1669
+ *
1670
+ * @param {string} instancePartitionName
1671
+ * A fully-qualified path representing InstancePartition resource.
1672
+ * @returns {string} A string representing the instance.
1673
+ */
1674
+ matchInstanceFromInstancePartitionName(instancePartitionName) {
1675
+ return this.pathTemplates.instancePartitionPathTemplate.match(instancePartitionName).instance;
1676
+ }
1677
+ /**
1678
+ * Parse the instance_partition from InstancePartition resource.
1679
+ *
1680
+ * @param {string} instancePartitionName
1681
+ * A fully-qualified path representing InstancePartition resource.
1682
+ * @returns {string} A string representing the instance_partition.
1683
+ */
1684
+ matchInstancePartitionFromInstancePartitionName(instancePartitionName) {
1685
+ return this.pathTemplates.instancePartitionPathTemplate.match(instancePartitionName).instance_partition;
1686
+ }
1172
1687
  /**
1173
1688
  * Return a fully-qualified project resource name string.
1174
1689
  *