Friday 19 May 2017

How to use the filter option in Google Cloud Compute node.js getVMs

In the Google Cloud Compute library for Node JS, how can I use the options.filter within the getVMs method?

Docs: https://googlecloudplatform.github.io/google-cloud-node/#/docs/compute/0.7.1/compute?method=getVMs

My attempt below returns an empty array, and there's no clear example in the docs (yet!). My goal is to get the first 100 instances that start with "prefix" as their name:

compute.getVMs({
    maxResults: 100,
    filter: 'name eq ^prefix'
});

Search filter in the format of {name} {comparison} {filterString}. name: the name of the field to compare comparison: the comparison operator, eq (equal) or ne (not equal) filterString: the string to filter to. For string fields, this can be a regular expression.



via d-_-b

No comments:

Post a Comment