Class PipelineDeployStackAction

java.lang.Object
software.amazon.jsii.JsiiObject
software.amazon.awscdk.appdelivery.PipelineDeployStackAction
All Implemented Interfaces:
IAction, software.amazon.jsii.JsiiSerializable

@Generated(value="jsii-pacmak/1.84.0 (build 5404dcf)", date="2023-06-19T16:30:49.289Z") @Stability(Deprecated) @Deprecated public class PipelineDeployStackAction extends software.amazon.jsii.JsiiObject implements IAction
Deprecated.
(deprecated) A class to deploy a stack that is part of a CDK App, using CodePipeline.

This composite Action takes care of preparing and executing a CloudFormation ChangeSet.

It currently does not support stacks that make use of Assets, and requires the deployed stack is in the same account and region where the CodePipeline is hosted.

Example:

 import software.amazon.awscdk.services.codebuild.*;
 import software.amazon.awscdk.services.codepipeline.*;
 import software.amazon.awscdk.services.codepipeline.actions.*;
 import software.amazon.awscdk.core.*;
 import software.amazon.awscdk.appdelivery.*;
 import software.amazon.awscdk.services.iam.*;
 public class MyServiceStackA extends Stack {
 }
 public class MyServiceStackB extends Stack {
 }
 App app = new App();
 // We define a stack that contains the CodePipeline
 Stack pipelineStack = new Stack(app, "PipelineStack");
 Pipeline pipeline = Pipeline.Builder.create(pipelineStack, "CodePipeline")
         // Mutating a CodePipeline can cause the currently propagating state to be
         // "lost". Ensure we re-run the latest change through the pipeline after it's
         // been mutated so we're sure the latest state is fully deployed through.
         .restartExecutionOnUpdate(true)
         .build();
 // Configure the CodePipeline source - where your CDK App's source code is hosted
 Artifact sourceOutput = new Artifact();
 GitHubSourceAction source = GitHubSourceAction.Builder.create()
         .actionName("GitHub")
         .output(sourceOutput)
         .owner("myName")
         .repo("myRepo")
         .oauthToken(SecretValue.unsafePlainText("secret"))
         .build();
 pipeline.addStage(StageOptions.builder()
         .stageName("source")
         .actions(List.of(source))
         .build());
 PipelineProject project = PipelineProject.Builder.create(pipelineStack, "CodeBuild").build();
 Artifact synthesizedApp = new Artifact();
 CodeBuildAction buildAction = CodeBuildAction.Builder.create()
         .actionName("CodeBuild")
         .project(project)
         .input(sourceOutput)
         .outputs(List.of(synthesizedApp))
         .build();
 pipeline.addStage(StageOptions.builder()
         .stageName("build")
         .actions(List.of(buildAction))
         .build());
 // Optionally, self-update the pipeline stack
 IStage selfUpdateStage = pipeline.addStage(StageOptions.builder().stageName("SelfUpdate").build());
 selfUpdateStage.addAction(PipelineDeployStackAction.Builder.create()
         .stack(pipelineStack)
         .input(synthesizedApp)
         .adminPermissions(true)
         .build());
 // Now add our service stacks
 IStage deployStage = pipeline.addStage(StageOptions.builder().stageName("Deploy").build());
 MyServiceStackA serviceStackA = MyServiceStackA.Builder.create(app, "ServiceStackA").build();
 // Add actions to deploy the stacks in the deploy stage:
 PipelineDeployStackAction deployServiceAAction = PipelineDeployStackAction.Builder.create()
         .stack(serviceStackA)
         .input(synthesizedApp)
         // See the note below for details about this option.
         .adminPermissions(false)
         .build();
 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.
 String myResourceArn = "arn:partition:service:region:account-id:resource-id";
 deployServiceAAction.addToDeploymentRolePolicy(PolicyStatement.Builder.create()
         .actions(List.of("service:SomeAction"))
         .resources(List.of(myResourceArn))
         .build());
 MyServiceStackB serviceStackB = MyServiceStackB.Builder.create(app, "ServiceStackB").build();
 deployStage.addAction(PipelineDeployStackAction.Builder.create()
         .stack(serviceStackB)
         .input(synthesizedApp)
         .createChangeSetRunOrder(998)
         .adminPermissions(true)
         .build());
 
  • Constructor Details

    • PipelineDeployStackAction

      protected PipelineDeployStackAction(software.amazon.jsii.JsiiObjectRef objRef)
      Deprecated.
    • PipelineDeployStackAction

      protected PipelineDeployStackAction(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
      Deprecated.
    • PipelineDeployStackAction

      @Stability(Deprecated) @Deprecated public PipelineDeployStackAction(@NotNull PipelineDeployStackActionProps props)
      Deprecated.
      Parameters:
      props - This parameter is required.
  • Method Details

    • addToDeploymentRolePolicy

      @Stability(Deprecated) @Deprecated public void addToDeploymentRolePolicy(@NotNull PolicyStatement statement)
      Deprecated.
      (deprecated) Add policy statements to the role deploying the stack.

      This role is passed to CloudFormation and must have the IAM permissions necessary to deploy the stack or you can grant this role adminPermissions by using that option during creation. If you do not grant adminPermissions you need to identify the proper statements to add to this role based on the CloudFormation Resources in your stack.

      Parameters:
      statement - This parameter is required.
    • bind

      @Stability(Deprecated) @Deprecated @NotNull public ActionConfig bind(@NotNull Construct scope, @NotNull IStage stage, @NotNull ActionBindOptions options)
      Deprecated.
      (deprecated) The callback invoked when this Action is added to a Pipeline.

      Specified by:
      bind in interface IAction
      Parameters:
      scope - This parameter is required.
      stage - This parameter is required.
      options - This parameter is required.
    • onStateChange

      @Stability(Deprecated) @Deprecated @NotNull public Rule onStateChange(@NotNull String name, @Nullable IRuleTarget target, @Nullable RuleProps options)
      Deprecated.
      (deprecated) Creates an Event that will be triggered whenever the state of this Action changes.

      Specified by:
      onStateChange in interface IAction
      Parameters:
      name - This parameter is required.
      target -
      options -
    • onStateChange

      @Stability(Deprecated) @Deprecated @NotNull public Rule onStateChange(@NotNull String name, @Nullable IRuleTarget target)
      Deprecated.
      (deprecated) Creates an Event that will be triggered whenever the state of this Action changes.

      Specified by:
      onStateChange in interface IAction
      Parameters:
      name - This parameter is required.
      target -
    • onStateChange

      @Stability(Deprecated) @Deprecated @NotNull public Rule onStateChange(@NotNull String name)
      Deprecated.
      (deprecated) Creates an Event that will be triggered whenever the state of this Action changes.

      Specified by:
      onStateChange in interface IAction
      Parameters:
      name - This parameter is required.
    • getActionProperties

      @Stability(Deprecated) @Deprecated @NotNull public ActionProperties getActionProperties()
      Deprecated.
      (deprecated) The simple properties of the Action, like its Owner, name, etc.

      Note that this accessor will be called before the bind(software.amazon.awscdk.core.Construct,software.amazon.awscdk.services.codepipeline.IStage,software.amazon.awscdk.services.codepipeline.ActionBindOptions) callback.

      Specified by:
      getActionProperties in interface IAction
    • getDeploymentRole

      @Stability(Deprecated) @Deprecated @NotNull public IRole getDeploymentRole()
      Deprecated.