UNPKG

@owloops/cdko

Version:

Multi-region AWS CDK deployment tool

151 lines (142 loc) 4.31 kB
import * as zx from 'zx'; interface StackDeployment { constructId: string; account: string; region: string; } interface StackGroup { [key: string]: StackDeployment; } interface CdkoConfig { version: string; stackGroups: { [stackName: string]: StackGroup; }; cdkTimeout?: string; suppressNotices?: boolean; createdAt?: string; updatedAt?: string; updatedBy?: string; } interface MatchedStackGroup { name: string; pattern: string; deployments: StackGroup; } interface FilteredDeployment { region: string; constructId: string; stackName: string; } declare class StackManager { private configPath; constructor(configPath?: string); detect(): Promise<{ version: string; stackGroups: { [stackName: string]: StackGroup; }; cdkTimeout: string | undefined; suppressNotices: boolean; lastUpdated: string; updatedBy: string; }>; loadConfig(): Promise<any>; detectStacks(): Promise<{ version: string; stackGroups: { [stackName: string]: StackGroup; }; cdkTimeout: string | undefined; suppressNotices: boolean; lastUpdated: string; updatedBy: string; }>; getCdkoVersion(): Promise<any>; saveConfig(config: CdkoConfig): Promise<void>; getRegions(config: CdkoConfig, cliRegions: string): string[]; matchStacks(stackPattern: string, stackConfig: CdkoConfig): MatchedStackGroup[]; filterDeployments(stackGroup: MatchedStackGroup, requestedRegions: string[]): FilteredDeployment[]; resolveDeployments(stackPattern: string, stackConfig: CdkoConfig, requestedRegions: string[]): FilteredDeployment[]; } interface AccountInfo { accountId: string; profile: string; userId: string; arn: string; } interface DeploymentTarget { profile: string; accountId: string; region: string; key: string; } declare class AccountManager { private configPath; private accountCache; constructor(configPath?: string); getAvailableProfiles(): Promise<string[]>; matchProfiles(profilePattern: string): Promise<string[]>; getAccountInfo(profile: string): Promise<AccountInfo>; getMultiAccountInfo(profiles: string[]): Promise<AccountInfo[]>; createDeploymentTargets(accountInfo: AccountInfo[], regions: string[]): DeploymentTarget[]; clearCache(): void; } interface SynthesizeOptions { profile?: string; environment?: string; outputDir?: string; } declare class CloudAssemblyManager { private cloudAssemblyPath; constructor(); getCloudAssemblyPath(): string; synthesize(options?: SynthesizeOptions): Promise<string>; getCdkArgs(baseArgs: string[]): string[]; isAvailable(): boolean; } interface CdkCommandOptions { verbose?: boolean; parameters?: string[]; includeDeps?: boolean; context?: string[]; executeChangeset?: boolean; cdkOptions?: string; signal?: AbortSignal; cloudAssemblyPath?: string | null; } declare function runCdkCommand(region: string, stackName: string, command: string, profile: string, options?: CdkCommandOptions): Promise<zx.ProcessOutput>; interface DeploymentArgs { mode: string; dryRun?: boolean; profile: string; stackPattern: string; sequential?: boolean; environment?: string; verbose?: boolean; parameters?: string[]; includeDeps?: boolean; context?: string[]; executeChangeset?: boolean; cdkOptions?: string; } interface DeploymentResult { success: boolean; region: string; stackName: string; duration?: string; error?: unknown; status?: string; } declare function deployToAllRegions(regions: string[], args: DeploymentArgs, signal: AbortSignal): Promise<DeploymentResult[]>; declare const logger: { error: (msg: string) => void; warn: (msg: string) => void; info: (msg: string) => void; success: (msg: string) => void; region: (region: string) => string; stack: (stackName: string) => string; dim: (text: string) => string; }; declare function checkPrerequisites(): Promise<void>; export { AccountManager, CloudAssemblyManager, StackManager, checkPrerequisites, deployToAllRegions, logger, runCdkCommand };