import { OrgFormationError } from '../../src/org-formation-error' ; import { CdkBuildTaskPlugin } from './impl/cdk-build-task-plugin' ; import { SlsBuildTaskPlugin } from './impl/sls-build-task-plugin' ; import { CopyToS3TaskPlugin } from './impl/s3-copy-build-task-plugin' ; import { RpBuildTaskPlugin } from './impl/rp-build-task-plugin' ; import { TfBuildTaskPlugin } from './impl/tf-apply-task-plugin' ; import { StediBuildTaskPlugin } from './impl/stedi-deploy-task-plugin' ; import { IBuildTaskConfiguration } from '~build-tasks/build-configuration' ; import { ICommandArgs } from '~commands/base-command' ; import { IPluginBinding , IPluginTask } from '~plugin/plugin-binder' ; import { IPerformTasksCommandArgs } from '~commands/index' ; import { IOrganizationBinding } from '~parser/parser' ; import { CfnExpressionResolver } from '~core/cfn-expression-resolver' ; export const CommonTaskAttributeNames = [ 'LogicalName' , 'DependsOn' , 'Type' , 'Skip' , 'LogVerbose' , 'ForceDeploy' , 'TaskRoleName' , 'OrganizationBinding' , 'FilePath' ] ; export interface IBuildTaskPlugin < TBuildTaskConfig extends IBuildTaskConfiguration , TCommandArgs extends IBuildTaskPluginCommandArgs , TTask extends IPluginTask > { type : string ; typeForTask : string ; convertToCommandArgs ( config , command ) : TCommandArgs ; validateCommandArgs ( command ) : void ; getValuesForEquality ( command ) : any ; convertToTask ( command , globalHash ) : TTask ; performRemove ( binding , resolver ) : Promise < void > ; performCreateOrUpdate ( binding , resolver ) : Promise < void > ; appendResolvers ( resolver , binding ) : Promise < void > ; getPhysicalIdForCleanup ( command ) : string | undefined ; } export interface IBuildTaskPluginCommandArgs extends ICommandArgs { name : string ; organizationFile ? : string ; organizationFileHash ? : string ; organizationBinding : IOrganizationBinding ; maxConcurrent : number ; failedTolerance : number ; taskRoleName ? : string ; logicalNamePrefix ? : string ; logicalName : string ; forceDeploy ? : boolean ; } export class PluginProvider { static GetPlugin ( type ) { const found = this . GetPlugins ( ) . find ( x => x . type === type ) ; if ( found === undefined ) { throw new OrgFormationError ( `unable to find plugin of type ${ type }` ) ; } return found ; } static GetPlugins ( ) { return [ new CdkBuildTaskPlugin ( ) , new SlsBuildTaskPlugin ( ) , new CopyToS3TaskPlugin ( ) , new RpBuildTaskPlugin ( ) , new TfBuildTaskPlugin ( ) , new StediBuildTaskPlugin ( ) , ] ; } }