function parseDeploymentScope()

in src/config.ts [217:264]


function parseDeploymentScope():
  | TenantScope
  | ManagementGroupScope
  | SubscriptionScope
  | ResourceGroupScope {
  const type = getRequiredEnumInput("scope", [
    "tenant",
    "managementGroup",
    "subscription",
    "resourceGroup",
  ]);
  const tenantId = getOptionalStringInput("tenant-id");

  switch (type) {
    case "tenant": {
      return {
        type,
        tenantId,
      };
    }
    case "managementGroup": {
      const managementGroup = getRequiredStringInput("management-group-id");
      return {
        type,
        tenantId,
        managementGroup,
      };
    }
    case "subscription": {
      const subscriptionId = getRequiredStringInput("subscription-id");
      return {
        type,
        tenantId,
        subscriptionId,
      };
    }
    case "resourceGroup": {
      const subscriptionId = getRequiredStringInput("subscription-id");
      const resourceGroup = getRequiredStringInput("resource-group-name");
      return {
        type,
        tenantId,
        subscriptionId,
        resourceGroup,
      };
    }
  }
}