Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

networkInterfaces resource upon createVM completion #1085

Closed
frederikbrinck opened this issue Jan 25, 2016 · 2 comments
Closed

networkInterfaces resource upon createVM completion #1085

frederikbrinck opened this issue Jan 25, 2016 · 2 comments
Assignees
Labels
api: compute Issues related to the Compute Engine API.

Comments

@frederikbrinck
Copy link

The createVM api exposes four variables on call back, along with a callback variable. As far as I could see, the networkInterfaces resource for that given VM is not accessible anywhere. In other words, it is not possible to get the external IP for the VM should one have been assigned, a part from getting all VMs after the creation of a particular one.

zone.createVM(name, config, function(err, vm, operation, apiResponse){
    operation.on('complete', function(metadata){
        // metadata, vm, operation, apiResponse don't include the networkInterfaces
    });
})

Am I missing something, or is this feature not yet implemented? And if not, I like to request it as an enhancement. Thanks!

@stephenplusplus
Copy link
Contributor

I think the issue is the metadata in the context of operation.onComplete is the operation's properties. What you need to do is make another call on vm to refresh the metadata:

zone.createVM(name, config, function(err, vm, operation, apiResponse){
    operation.on('complete', function(){
      vm.getMetadata(function(err, metadata){
        // metadata.networkInterfaces[0].accessConfigs[0].natIP
      });
    });
})

Here's an example of doing that in gcloud-deploy: https://github.com/stephenplusplus/gcloud-deploy/blob/25233819ece801bc556957153e64d78a09993615/index.js#L221

Let me know if you run into any issues!

@stephenplusplus stephenplusplus added the api: compute Issues related to the Compute Engine API. label Jan 25, 2016
@frederikbrinck
Copy link
Author

Thanks for the quick and swift feedback. It worked!

sofisl added a commit that referenced this issue Nov 12, 2022
* chore: update github issue templates (#1085)

Source-Link: googleapis/synthtool@4dfd20a
Post-Processor: gcr.io/repo-automation-bots/owlbot-nodejs:latest@sha256:2d850512335d7adca3a4b08e02f8e63192978aea88c042dacb3e382aa996ae7c

* build: update owlbot and linkinator

* docs: test passing

* 🦉 Updates from OwlBot

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* update to latest image

* update node test

* 🦉 Updates from OwlBot

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* 🦉 Updates from OwlBot

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Co-authored-by: Sofia Leon <sofialeon@google.com>
sofisl pushed a commit that referenced this issue Jan 17, 2023
Co-authored-by: meredithslota <meredithslota@google.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: compute Issues related to the Compute Engine API.
Projects
None yet
Development

No branches or pull requests

2 participants