@fiftyten/db-toolkit
Version:
Complete database toolkit: connections, migration, and operations via AWS Session Manager
108 lines • 2.92 kB
TypeScript
export interface MigrationConfig {
environment: string;
legacyEndpoint: string;
legacyDatabase: string;
legacyUsername: string;
legacyPassword: string;
targetSecretArn: string;
migrationType?: 'full-load' | 'full-load-and-cdc';
notificationEmails?: string[];
}
export interface TargetDatabase {
name: string;
friendlyName: string;
secretArn: string;
endpoint?: string;
port?: string;
}
export interface MigrationStatus {
taskArn: string;
taskId: string;
status: string;
progress: number;
fullLoadProgressPercent?: number;
cdcStartDate?: Date;
stopReason?: string;
replicationTaskCreationDate?: Date;
replicationTaskStartDate?: Date;
}
export interface TableStatistics {
tableName: string;
fullLoadRows: number;
fullLoadCondtnlChkFailedRows: number;
fullLoadErrorRows: number;
fullLoadStartTime?: Date;
fullLoadEndTime?: Date;
lastUpdateTime?: Date;
tableState: string;
}
export declare class MigrationManager {
private cfnClient;
private dmsClient;
private cfnManager;
private mfaAuth;
private region;
private mfaAuthenticated;
constructor(region?: string);
/**
* Handle AWS API calls with automatic MFA authentication
*/
private callWithMfaRetry;
/**
* Discover available target databases from CloudFormation stacks
*/
discoverTargetDatabases(environment: string): Promise<TargetDatabase[]>;
/**
* Deploy migration infrastructure using CloudFormation
*/
deployMigration(config: MigrationConfig): Promise<void>;
/**
* Validate that both source and target endpoint connections are successful
*/
private validateEndpointConnections;
/**
* Test connection and wait for successful result with simplified retry logic
*/
private testAndWaitForConnection;
/**
* Get migration task ARN from stack outputs
*/
private getMigrationTaskArn;
/**
* Start migration task
*/
startMigration(environment: string): Promise<void>;
/**
* Stop migration task
*/
stopMigration(environment: string): Promise<void>;
/**
* Get migration status
*/
getMigrationStatus(environment: string): Promise<MigrationStatus>;
/**
* Show migration status
*/
showMigrationStatus(environment: string): Promise<void>;
/**
* Show table migration statistics
*/
private showTableStatistics;
/**
* Validate migration data
*/
validateMigration(environment: string): Promise<void>;
/**
* Cleanup migration infrastructure
*/
cleanupMigration(environment: string): Promise<void>;
/**
* Get colored status text
*/
private getStatusColor;
/**
* Get colored table state text
*/
private getTableStateColor;
}
//# sourceMappingURL=migration-manager.d.ts.map