JSPM

  • Created
  • Published
  • Downloads 19502099
  • Score
    100M100P100Q235025F
  • License MIT

Get the metadata from a Google Cloud Platform environment

Package Exports

  • gcp-metadata

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (gcp-metadata) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

gcp-metadata

Get the metadata from a Google Cloud Platform environment.

NPM Version CircleCI codecov

$ npm install --save gcp-metadata
const gcpMetadata = require('gcp-metadata');

Check to see if the metadata server is available

const isAvailable = await gcpMetadata.isAvailable();

Access all metadata

const res = await gcpMetadata.instance();
console.log(res.data); // ... All metadata properties

Access specific properties

const res = await gcpMetadata.instance('hostname');
console.log(res.data) // ...All metadata properties

Access specific properties with query parameters

const res = await gcpMetadata.instance({
  property: 'tags',
  params: { alt: 'text' }
});
console.log(res.data) // ...Tags as newline-delimited list