Skip to content

Commit 2eed901

Browse files
crwilcoxGautamSharda
authored andcommitted
fix: rollback to v3 release line (#847)
Release-As: v3.2.3
1 parent 93f5f03 commit 2eed901

3 files changed

Lines changed: 18 additions & 6 deletions

File tree

handwritten/bigtable/src/index.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,13 @@ export interface GetInstancesCallback {
4747
(
4848
err: ServiceError | null,
4949
result?: Instance[],
50+
failedLocations?: string[],
5051
response?: google.bigtable.admin.v2.IListInstancesResponse
5152
): void;
5253
}
5354
export type GetInstancesResponse = [
5455
Instance[],
56+
string[],
5557
google.bigtable.admin.v2.IListInstancesResponse
5658
];
5759

@@ -607,7 +609,8 @@ export class Bigtable {
607609
/**
608610
* @typedef {array} GetInstancesResponse
609611
* @property {Instance[]} 0 Array of {@link Instance} instances.
610-
* @property {object} 1 The full API response.
612+
* @property {string[]} 1 locations from which Instance information could not be retrieved
613+
* @property {object} 2 The full API response.
611614
* Note: 'failedLocations' property may contain locations from which
612615
* Instance information could not be retrieved.
613616
* Values are of the form `projects/<project>/locations/<zone_id>`
@@ -616,6 +619,7 @@ export class Bigtable {
616619
* @callback GetInstancesCallback
617620
* @param {?Error} err Request error, if any.
618621
* @param {Instance[]} instances Array of {@link Instance} instances.
622+
* @param {string[]} locations from which Instance information could not be retrieved
619623
* @param {object} apiResponse The full API response.
620624
* Note: 'failedLocations' property may contain locations from which
621625
* Instance information could not be retrieved.
@@ -646,7 +650,7 @@ export class Bigtable {
646650
* </caption>
647651
* bigtable.getInstances().then(function(data) {
648652
* const instances = data[0];
649-
* const fullResponse = data[1];
653+
* const fullResponse = data[2];
650654
*
651655
* if (fullResponse.failedLocations.length > 0) {
652656
* // These locations contain instances which could not be retrieved.
@@ -686,7 +690,7 @@ export class Bigtable {
686690
instance.metadata = instanceData;
687691
return instance;
688692
});
689-
callback!(null, instances, resp);
693+
callback!(null, instances, resp.failedLocations, resp);
690694
}
691695
);
692696
}

handwritten/bigtable/system-test/bigtable.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,9 @@ describe('Bigtable', () => {
103103

104104
describe('instances', () => {
105105
it('should get a list of instances', async () => {
106-
const [instances] = await bigtable.getInstances();
106+
const [instances, failedLocations] = await bigtable.getInstances();
107107
assert(instances.length > 0);
108+
assert(Array.isArray(failedLocations));
108109
});
109110

110111
it('should check if an instance exists', async () => {

handwritten/bigtable/test/index.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -571,7 +571,7 @@ describe('Bigtable', () => {
571571
});
572572
});
573573

574-
it('should return an array of instance objects', done => {
574+
it('should return an array of instance objects and failed locations', done => {
575575
const response = {
576576
instances: [
577577
{
@@ -581,6 +581,7 @@ describe('Bigtable', () => {
581581
name: 'b',
582582
},
583583
],
584+
failedLocations: ['projects/<project>/locations/<zone_id>'],
584585
};
585586
const fakeInstances = [{}, {}];
586587
bigtable.request = (config: {}, callback: Function) => {
@@ -593,12 +594,18 @@ describe('Bigtable', () => {
593594
};
594595

595596
bigtable.getInstances(
596-
(err: Error, instances: Instance[], apiResponse: {}) => {
597+
(
598+
err: Error,
599+
instances: Instance[],
600+
failedLocations: string[],
601+
apiResponse: {}
602+
) => {
597603
assert.ifError(err);
598604
assert.strictEqual(instances[0], fakeInstances[0]);
599605
assert.strictEqual(instances[0].metadata, response.instances[0]);
600606
assert.strictEqual(instances[1], fakeInstances[1]);
601607
assert.strictEqual(instances[1].metadata, response.instances[1]);
608+
assert.strictEqual(failedLocations, response.failedLocations);
602609
assert.strictEqual(apiResponse, response);
603610
done();
604611
}

0 commit comments

Comments
 (0)