How to use the google-auth-library.GCPEnv.KUBERNETES_ENGINE function in google-auth-library

To help you get started, we’ve selected a few google-auth-library 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 googleapis / nodejs-logging / src / metadata.ts View on Github external
export async function getDefaultResource(auth: GoogleAuth) {
  const env = await auth.getEnv();

  switch (env) {
    case GCPEnv.KUBERNETES_ENGINE:
      return getGKEDescriptor().catch(() => getGlobalDescriptor());
    case GCPEnv.APP_ENGINE:
      return getGAEDescriptor().catch(() => getGlobalDescriptor());
    case GCPEnv.CLOUD_FUNCTIONS:
      return getCloudFunctionDescriptor();
    case GCPEnv.COMPUTE_ENGINE:
      // Test for compute engine should be done after all the rest -
      // everything runs on top of compute engine.
      return getGCEDescriptor().catch(() => getGlobalDescriptor());
    default:
      return getGlobalDescriptor();
  }
}
github googleapis / nodejs-logging / test / metadata.ts View on Github external
async getEnv() {
          return GCPEnv.KUBERNETES_ENGINE;
        },
      };