UNPKG

@dataroadinc/setup-auth

Version:

CLI tool and programmatic API for automated OAuth setup across cloud platforms

21 lines (20 loc) 795 B
import { SetupAuthError } from "../../../utils/error.js"; export const GCP_VIEW_ITEMS = [ "project", "organization", "service-account", ]; export async function checkOptions(options) { if (!GCP_VIEW_ITEMS.includes(options.item)) { throw new SetupAuthError(`Invalid item: ${options.item}. Must be one of: ${GCP_VIEW_ITEMS.join(", ")}`); } if (options.auth && !["Service Account", "ADC", "User Account"].includes(options.auth)) { throw new SetupAuthError(`Invalid auth type: ${options.auth}. Must be one of: Service Account, ADC, User Account`); } if (options.item === "organization") { if (!options.gcpOauthOrganizationId) { throw new SetupAuthError("Missing required option: gcpOauthOrganizationId"); } } }