How to use the @f5devcentral/f5-cloud-libs.util.getDataFromUrl function in @f5devcentral/f5-cloud-libs

To help you get started, we’ve selected a few @f5devcentral/f5-cloud-libs examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github F5Networks / f5-cloud-libs-gce / lib / gceCloudProvider.js View on Github external
function getMetadata(entry) {
    const options = {
        headers: {
            'Metadata-Flavor': 'Google'
        }
    };

    return cloudUtil.getDataFromUrl(
        `http://metadata.google.internal/computeMetadata/v1/${entry}`,
        options
    )
        .then((data) => {
            return data;
        })
        .catch((err) => {
            const message = `Error getting metadata ${err.message}`;
            logger.info(message);
            return q.reject(err);
        });
}