ofrobots / gcp-metadata

Get the metadata from a Google Cloud Platform environment

Repository from Github https://github.comofrobots/gcp-metadataRepository from Github https://github.comofrobots/gcp-metadata

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

About

Get the metadata from a Google Cloud Platform environment

License:MIT License


Languages

Language:TypeScript 100.0%