Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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();
}
}
async getEnv() {
return GCPEnv.APP_ENGINE;
},
};