Skip to content

Commit 864bb21

Browse files
summer-ji-engAce Nassri
authored andcommitted
feat: add minimum wrapper for compute LRO method (#618)
1 parent 50620e7 commit 864bb21

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

compute/createInstance.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ function main(
6060

6161
console.log(`Creating the ${instanceName} instance in ${zone}...`);
6262

63-
let [operation] = await instancesClient.insert({
63+
const [response] = await instancesClient.insert({
6464
instanceResource: {
6565
name: instanceName,
6666
disks: [
@@ -86,7 +86,7 @@ function main(
8686
project: projectId,
8787
zone,
8888
});
89-
89+
let operation = response.latestResponse;
9090
const operationsClient = new compute.ZoneOperationsClient();
9191

9292
// Wait for the create operation to complete.

compute/deleteInstance.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,12 @@ function main(projectId, zone, instanceName) {
3636

3737
console.log(`Deleting ${instanceName} from ${zone}...`);
3838

39-
let [operation] = await instancesClient.delete({
39+
const [response] = await instancesClient.delete({
4040
project: projectId,
4141
zone,
4242
instance: instanceName,
4343
});
44-
44+
let operation = response.latestResponse;
4545
const operationsClient = new compute.ZoneOperationsClient();
4646

4747
// Wait for the delete operation to complete.

compute/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"test": "mocha test --timeout 1200000"
1515
},
1616
"dependencies": {
17-
"@google-cloud/compute": "^3.0.0",
17+
"@google-cloud/compute": "^3.0.0-alpha.4",
1818
"@sendgrid/mail": "^7.0.0",
1919
"nodemailer": "^6.0.0",
2020
"nodemailer-smtp-transport": "^2.7.4"

compute/test/samples.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,13 +69,13 @@ describe('samples', () => {
6969

7070
execSync(`node createInstance ${projectId} ${zone} ${newinstanceName}`);
7171

72-
const [operation] = await instancesClient.delete({
72+
const [response] = await instancesClient.delete({
7373
project: projectId,
7474
zone,
7575
instance: newinstanceName,
7676
});
7777

78-
const operationString = JSON.stringify(operation);
78+
const operationString = JSON.stringify(response.latestResponse);
7979

8080
const output = execSync(
8181
`node waitForOperation ${projectId} '${operationString}'`

0 commit comments

Comments
 (0)