Skip to content

Commit

Permalink
feat: add minimum wrapper for compute LRO method (#618)
Browse files Browse the repository at this point in the history
  • Loading branch information
summer-ji-eng authored Sep 13, 2021
1 parent 509efb4 commit 5274f07
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions compute/createInstance.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ function main(

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

let [operation] = await instancesClient.insert({
const [response] = await instancesClient.insert({
instanceResource: {
name: instanceName,
disks: [
Expand All @@ -86,7 +86,7 @@ function main(
project: projectId,
zone,
});

let operation = response.latestResponse;
const operationsClient = new compute.ZoneOperationsClient();

// Wait for the create operation to complete.
Expand Down
4 changes: 2 additions & 2 deletions compute/deleteInstance.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@ function main(projectId, zone, instanceName) {

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

let [operation] = await instancesClient.delete({
const [response] = await instancesClient.delete({
project: projectId,
zone,
instance: instanceName,
});

let operation = response.latestResponse;
const operationsClient = new compute.ZoneOperationsClient();

// Wait for the delete operation to complete.
Expand Down
2 changes: 1 addition & 1 deletion compute/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"test": "mocha test --timeout 1200000"
},
"dependencies": {
"@google-cloud/compute": "^3.0.0",
"@google-cloud/compute": "^3.0.0-alpha.4",
"@sendgrid/mail": "^7.0.0",
"nodemailer": "^6.0.0",
"nodemailer-smtp-transport": "^2.7.4"
Expand Down
4 changes: 2 additions & 2 deletions compute/test/samples.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,13 @@ describe('samples', () => {

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

const [operation] = await instancesClient.delete({
const [response] = await instancesClient.delete({
project: projectId,
zone,
instance: newinstanceName,
});

const operationString = JSON.stringify(operation);
const operationString = JSON.stringify(response.latestResponse);

const output = execSync(
`node waitForOperation ${projectId} '${operationString}'`
Expand Down

0 comments on commit 5274f07

Please sign in to comment.