From 5a22d97fd39f4f09f215d17f03851e8faf7ffe8c Mon Sep 17 00:00:00 2001 From: Adam Ruka Date: Mon, 24 Sep 2018 17:01:27 -0700 Subject: [PATCH] feat(aws-cloudformation): rename the CFN CodePipeline Actions. BREAKING CHANGE: this renames all CloudFormation Actions for CodePipeline to bring them in line with Actions defined in other service packages. --- .../lib/pipeline-actions.ts | 44 +++++++++---------- .../test/integ.cfn-template-from-repo.lit.ts | 4 +- .../test/integ.pipeline-cfn.ts | 2 +- .../test.cloudformation-pipeline-actions.ts | 14 +++--- 4 files changed, 32 insertions(+), 32 deletions(-) diff --git a/packages/@aws-cdk/aws-cloudformation/lib/pipeline-actions.ts b/packages/@aws-cdk/aws-cloudformation/lib/pipeline-actions.ts index 7a7106063bdef..261fdd1765a1e 100644 --- a/packages/@aws-cdk/aws-cloudformation/lib/pipeline-actions.ts +++ b/packages/@aws-cdk/aws-cloudformation/lib/pipeline-actions.ts @@ -5,7 +5,7 @@ import cdk = require('@aws-cdk/cdk'); /** * Properties common to all CloudFormation actions */ -export interface CloudFormationCommonProps extends codepipeline.CommonActionProps { +export interface PipelineCloudFormationActionProps extends codepipeline.CommonActionProps { /** * The name of the stack to apply this action to */ @@ -37,7 +37,7 @@ export interface CloudFormationCommonProps extends codepipeline.CommonActionProp /** * Base class for Actions that execute CloudFormation */ -export abstract class CloudFormationAction extends codepipeline.DeployAction { +export abstract class PipelineCloudFormationAction extends codepipeline.DeployAction { /** * Output artifact containing the CloudFormation call response * @@ -45,7 +45,7 @@ export abstract class CloudFormationAction extends codepipeline.DeployAction { */ public artifact?: codepipeline.Artifact; - constructor(parent: cdk.Construct, id: string, props: CloudFormationCommonProps, configuration?: any) { + constructor(parent: cdk.Construct, id: string, props: PipelineCloudFormationActionProps, configuration?: any) { super(parent, id, { stage: props.stage, artifactBounds: { @@ -70,9 +70,9 @@ export abstract class CloudFormationAction extends codepipeline.DeployAction { } /** - * Properties for the ExecuteChangeSet action. + * Properties for the PipelineExecuteChangeSetAction. */ -export interface ExecuteChangeSetProps extends CloudFormationCommonProps { +export interface PipelineExecuteChangeSetActionProps extends PipelineCloudFormationActionProps { /** * Name of the change set to execute. */ @@ -82,8 +82,8 @@ export interface ExecuteChangeSetProps extends CloudFormationCommonProps { /** * CodePipeline action to execute a prepared change set. */ -export class ExecuteChangeSet extends CloudFormationAction { - constructor(parent: cdk.Construct, id: string, props: ExecuteChangeSetProps) { +export class PipelineExecuteChangeSetAction extends PipelineCloudFormationAction { + constructor(parent: cdk.Construct, id: string, props: PipelineExecuteChangeSetActionProps) { super(parent, id, props, { ActionMode: 'CHANGE_SET_EXECUTE', ChangeSetName: props.changeSetName, @@ -95,7 +95,7 @@ export class ExecuteChangeSet extends CloudFormationAction { /** * Properties common to CloudFormation actions that stage deployments */ -export interface CloudFormationDeploymentActionCommonProps extends CloudFormationCommonProps { +export interface PipelineCloudFormationDeployActionProps extends PipelineCloudFormationActionProps { /** * IAM role to assume when deploying changes. * @@ -176,10 +176,10 @@ export interface CloudFormationDeploymentActionCommonProps extends CloudFormatio /** * Base class for all CloudFormation actions that execute or stage deployments. */ -export abstract class CloudFormationDeploymentAction extends CloudFormationAction { +export abstract class PipelineCloudFormationDeployAction extends PipelineCloudFormationAction { public readonly role: iam.Role; - constructor(parent: cdk.Construct, id: string, props: CloudFormationDeploymentActionCommonProps, configuration: any) { + constructor(parent: cdk.Construct, id: string, props: PipelineCloudFormationDeployActionProps, configuration: any) { const capabilities = props.fullPermissions && props.capabilities === undefined ? [CloudFormationCapabilities.NamedIAM] : props.capabilities; super(parent, id, props, { @@ -214,9 +214,9 @@ export abstract class CloudFormationDeploymentAction extends CloudFormationActio } /** - * Properties for the CreateReplaceChangeSet action. + * Properties for the PipelineCreateReplaceChangeSetAction. */ -export interface CreateReplaceChangeSetProps extends CloudFormationDeploymentActionCommonProps { +export interface PipelineCreateReplaceChangeSetActionProps extends PipelineCloudFormationDeployActionProps { /** * Name of the change set to create or update. */ @@ -234,8 +234,8 @@ export interface CreateReplaceChangeSetProps extends CloudFormationDeploymentAct * Creates the change set if it doesn't exist based on the stack name and template that you submit. * If the change set exists, AWS CloudFormation deletes it, and then creates a new one. */ -export class CreateReplaceChangeSet extends CloudFormationDeploymentAction { - constructor(parent: cdk.Construct, id: string, props: CreateReplaceChangeSetProps) { +export class PipelineCreateReplaceChangeSetAction extends PipelineCloudFormationDeployAction { + constructor(parent: cdk.Construct, id: string, props: PipelineCreateReplaceChangeSetActionProps) { super(parent, id, props, { ActionMode: 'CHANGE_SET_REPLACE', ChangeSetName: props.changeSetName, @@ -247,9 +247,9 @@ export class CreateReplaceChangeSet extends CloudFormationDeploymentAction { } /** - * Properties for the CreateUpdate action + * Properties for the PipelineCreateUpdateStackAction. */ -export interface CreateUpdateProps extends CloudFormationDeploymentActionCommonProps { +export interface PipelineCreateUpdateStackActionProps extends PipelineCloudFormationDeployActionProps { /** * Input artifact with the CloudFormation template to deploy */ @@ -285,8 +285,8 @@ export interface CreateUpdateProps extends CloudFormationDeploymentActionCommonP * Use this action to automatically replace failed stacks without recovering or * troubleshooting them. You would typically choose this mode for testing. */ -export class CreateUpdateStack extends CloudFormationDeploymentAction { - constructor(parent: cdk.Construct, id: string, props: CreateUpdateProps) { +export class PipelineCreateUpdateStackAction extends PipelineCloudFormationDeployAction { + constructor(parent: cdk.Construct, id: string, props: PipelineCreateUpdateStackActionProps) { super(parent, id, props, { ActionMode: props.replaceOnFailure ? 'REPLACE_ON_FAILURE' : 'CREATE_UPDATE', TemplatePath: props.templatePath.location @@ -296,10 +296,10 @@ export class CreateUpdateStack extends CloudFormationDeploymentAction { } /** - * Properties for the DeleteOnly action + * Properties for the PipelineDeleteStackAction. */ // tslint:disable-next-line:no-empty-interface -export interface DeleteStackOnlyProps extends CloudFormationDeploymentActionCommonProps { +export interface PipelineDeleteStackActionProps extends PipelineCloudFormationDeployActionProps { } /** @@ -308,8 +308,8 @@ export interface DeleteStackOnlyProps extends CloudFormationDeploymentActionComm * Deletes a stack. If you specify a stack that doesn't exist, the action completes successfully * without deleting a stack. */ -export class DeleteStackOnly extends CloudFormationDeploymentAction { - constructor(parent: cdk.Construct, id: string, props: DeleteStackOnlyProps) { +export class PipelineDeleteStackAction extends PipelineCloudFormationDeployAction { + constructor(parent: cdk.Construct, id: string, props: PipelineDeleteStackActionProps) { super(parent, id, props, { ActionMode: 'DELETE_ONLY', }); diff --git a/packages/@aws-cdk/aws-codepipeline/test/integ.cfn-template-from-repo.lit.ts b/packages/@aws-cdk/aws-codepipeline/test/integ.cfn-template-from-repo.lit.ts index 20829d18ead2d..5845be53d9d5e 100644 --- a/packages/@aws-cdk/aws-codepipeline/test/integ.cfn-template-from-repo.lit.ts +++ b/packages/@aws-cdk/aws-codepipeline/test/integ.cfn-template-from-repo.lit.ts @@ -25,7 +25,7 @@ const prodStage = new codepipeline.Stage(pipeline, 'Deploy', { pipeline }); const stackName = 'OurStack'; const changeSetName = 'StagedChangeSet'; -new cfn.CreateReplaceChangeSet(prodStage, 'PrepareChanges', { +new cfn.PipelineCreateReplaceChangeSetAction(prodStage, 'PrepareChanges', { stage: prodStage, stackName, changeSetName, @@ -37,7 +37,7 @@ new codepipeline.ManualApprovalAction(stack, 'ApproveChanges', { stage: prodStage, }); -new cfn.ExecuteChangeSet(stack, 'ExecuteChanges', { +new cfn.PipelineExecuteChangeSetAction(stack, 'ExecuteChanges', { stage: prodStage, stackName, changeSetName, diff --git a/packages/@aws-cdk/aws-codepipeline/test/integ.pipeline-cfn.ts b/packages/@aws-cdk/aws-codepipeline/test/integ.pipeline-cfn.ts index ee572c2f15972..5a27dfc715ee9 100644 --- a/packages/@aws-cdk/aws-codepipeline/test/integ.pipeline-cfn.ts +++ b/packages/@aws-cdk/aws-codepipeline/test/integ.pipeline-cfn.ts @@ -32,7 +32,7 @@ const role = new Role(stack, 'CfnChangeSetRole', { assumedBy: new ServicePrincipal('cloudformation.amazonaws.com'), }); -new cfn.CreateReplaceChangeSet(stack, 'DeployCFN', { +new cfn.PipelineCreateReplaceChangeSetAction(stack, 'DeployCFN', { stage: cfnStage, changeSetName, stackName, diff --git a/packages/@aws-cdk/aws-codepipeline/test/test.cloudformation-pipeline-actions.ts b/packages/@aws-cdk/aws-codepipeline/test/test.cloudformation-pipeline-actions.ts index 2c17fb1e5b00a..dc9de0e93fd20 100644 --- a/packages/@aws-cdk/aws-codepipeline/test/test.cloudformation-pipeline-actions.ts +++ b/packages/@aws-cdk/aws-codepipeline/test/test.cloudformation-pipeline-actions.ts @@ -1,5 +1,5 @@ import { expect, haveResource } from '@aws-cdk/assert'; -import { CreateReplaceChangeSet, CreateUpdateStack, ExecuteChangeSet } from '@aws-cdk/aws-cloudformation'; +import { PipelineCreateReplaceChangeSetAction, PipelineCreateUpdateStackAction, PipelineExecuteChangeSetAction } from '@aws-cdk/aws-cloudformation'; import { CodePipelineBuildArtifacts, CodePipelineSource, PipelineBuildAction, Project } from '@aws-cdk/aws-codebuild'; import { PipelineSourceAction, Repository } from '@aws-cdk/aws-codecommit'; import { ArtifactPath } from '@aws-cdk/aws-codepipeline-api'; @@ -57,7 +57,7 @@ export = { const stackName = 'BrelandsStack'; const changeSetName = 'MyMagicalChangeSet'; - new CreateReplaceChangeSet(stack, 'BuildChangeSetProd', { + new PipelineCreateReplaceChangeSetAction(stack, 'BuildChangeSetProd', { stage: prodStage, stackName, changeSetName, @@ -66,7 +66,7 @@ export = { templateConfiguration: new ArtifactPath(buildAction.artifact!, 'templateConfig.json') }); - new ExecuteChangeSet(stack, 'ExecuteChangeSetProd', { + new PipelineExecuteChangeSetAction(stack, 'ExecuteChangeSetProd', { stage: prodStage, stackName, changeSetName, @@ -200,7 +200,7 @@ export = { const stack = new TestFixture(); // WHEN - new CreateUpdateStack(stack.deployStage, 'CreateUpdate', { + new PipelineCreateUpdateStackAction(stack.deployStage, 'CreateUpdate', { stage: stack.deployStage, stackName: 'MyStack', templatePath: stack.source.artifact.subartifact('template.yaml'), @@ -253,7 +253,7 @@ export = { const stack = new TestFixture(); // WHEN - new CreateUpdateStack(stack, 'CreateUpdate', { + new PipelineCreateUpdateStackAction(stack, 'CreateUpdate', { stage: stack.deployStage, stackName: 'MyStack', templatePath: stack.source.artifact.subartifact('template.yaml'), @@ -284,7 +284,7 @@ export = { const stack = new TestFixture(); // WHEN - new CreateUpdateStack(stack, 'CreateUpdate', { + new PipelineCreateUpdateStackAction(stack, 'CreateUpdate', { stage: stack.deployStage, stackName: 'MyStack', templatePath: stack.source.artifact.subartifact('template.yaml'), @@ -317,7 +317,7 @@ export = { const stack = new TestFixture(); // WHEN - new CreateUpdateStack(stack, 'CreateUpdate', { + new PipelineCreateUpdateStackAction(stack, 'CreateUpdate', { stage: stack.deployStage, stackName: 'MyStack', templatePath: stack.source.artifact.subartifact('template.yaml'),