From 9a3810932a130d2e4ba9dbe514b13207c4f0c48c Mon Sep 17 00:00:00 2001 From: Adam Ruka Date: Thu, 27 Jun 2019 15:43:34 -0700 Subject: [PATCH] doc(app-delivery): update the documentation in the ReadMe. (#3111) After the changes introduced with the IAction interface. --- packages/@aws-cdk/app-delivery/README.md | 26 +++++++++++------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/packages/@aws-cdk/app-delivery/README.md b/packages/@aws-cdk/app-delivery/README.md index a829aa4cc008e..bdfb225d24444 100644 --- a/packages/@aws-cdk/app-delivery/README.md +++ b/packages/@aws-cdk/app-delivery/README.md @@ -51,7 +51,7 @@ import codebuild = require('@aws-cdk/aws-codebuild'); import codepipeline = require('@aws-cdk/aws-codepipeline'); import codepipeline_actions = require('@aws-cdk/aws-codepipeline-actions'); import cdk = require('@aws-cdk/core'); -import cicd = require('@aws-cdk/cicd'); +import cicd = require('@aws-cdk/app-delivery'); const app = new cdk.App(); @@ -101,42 +101,40 @@ pipeline.addStage({ // Optionally, self-update the pipeline stack const selfUpdateStage = pipeline.addStage({ stageName: 'SelfUpdate' }); -new cicd.PipelineDeployStackAction(pipelineStack, 'SelfUpdatePipeline', { - stage: selfUpdateStage, +selfUpdateStage.addAction(new cicd.PipelineDeployStackAction({ stack: pipelineStack, input: synthesizedApp, -}); + adminPermissions: true, +})); // Now add our service stacks const deployStage = pipeline.addStage({ stageName: 'Deploy' }); const serviceStackA = new MyServiceStackA(app, 'ServiceStackA', { /* ... */ }); // Add actions to deploy the stacks in the deploy stage: -const deployServiceAAction = new cicd.PipelineDeployStackAction(pipelineStack, 'DeployServiceStackA', { - stage: deployStage, +const deployServiceAAction = new cicd.PipelineDeployStackAction({ stack: serviceStackA, input: synthesizedApp, // See the note below for details about this option. adminPermissions: false, }); +deployStage.addAction(deployServiceAAction); // Add the necessary permissions for you service deploy action. This role is // is passed to CloudFormation and needs the permissions necessary to deploy // stack. Alternatively you can enable [Administrator](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_job-functions.html#jf_administrator) permissions above, // users should understand the privileged nature of this role. -deployServiceAAction.addToRolePolicy( - new iam.PolicyStatement() - .addAction('service:SomeAction') - .addResource(myResource.myResourceArn) +deployServiceAAction.addToRolePolicy(new iam.PolicyStatement({ + actions: ['service:SomeAction'], + resources: [myResource.myResourceArn], // add more Action(s) and/or Resource(s) here, as needed -); +})); const serviceStackB = new MyServiceStackB(app, 'ServiceStackB', { /* ... */ }); -new cicd.PipelineDeployStackAction(pipelineStack, 'DeployServiceStackB', { - stage: deployStage, +deployStage.addAction(new cicd.PipelineDeployStackAction({ stack: serviceStackB, input: synthesizedApp, createChangeSetRunOrder: 998, adminPermissions: true, // no need to modify the role with admin -}); +})); ``` #### `buildspec.yml`