# AWS CodePipeline Construct Library

## Pipeline

To construct an empty Pipeline:

TypeScript:

```ts
// Construct an empty Pipeline
const pipeline = new codepipeline.Pipeline(this, 'MyFirstPipeline');
```

Python:

```python
# Construct an empty Pipeline
pipeline = codepipeline.Pipeline(self, "MyFirstPipeline")
```

Java:

```java
// Construct an empty Pipeline
Pipeline pipeline = new Pipeline(this, "MyFirstPipeline");
```

C#:

```csharp
// Construct an empty Pipeline
var pipeline = new Pipeline(this, "MyFirstPipeline");
```

Go:

```go
// Construct an empty Pipeline
pipeline := codepipeline.NewPipeline(this, jsii.String("MyFirstPipeline"))
```

To give the Pipeline a nice, human-readable name:

TypeScript:

```ts
// Give the Pipeline a nice, human-readable name
const pipeline = new codepipeline.Pipeline(this, 'MyFirstPipeline', {
  pipelineName: 'MyPipeline',
});
```

Python:

```python
# Give the Pipeline a nice, human-readable name
pipeline = codepipeline.Pipeline(self, "MyFirstPipeline",
    pipeline_name="MyPipeline"
)
```

Java:

```java
// Give the Pipeline a nice, human-readable name
Pipeline pipeline = Pipeline.Builder.create(this, "MyFirstPipeline")
        .pipelineName("MyPipeline")
        .build();
```

C#:

```csharp
// Give the Pipeline a nice, human-readable name
var pipeline = new Pipeline(this, "MyFirstPipeline", new PipelineProps {
    PipelineName = "MyPipeline"
});
```

Go:

```go
// Give the Pipeline a nice, human-readable name
pipeline := codepipeline.NewPipeline(this, jsii.String("MyFirstPipeline"), &PipelineProps{
	PipelineName: jsii.String("MyPipeline"),
})
```

Be aware that in the default configuration, the [`Pipeline`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_codepipeline.Pipeline.html) construct creates
an AWS Key Management Service (AWS KMS) Customer Master Key (CMK) for you to
encrypt the artifacts in the artifact bucket, which incurs a cost of
**$1/month**. This default configuration is necessary to allow cross-account
actions.

If you do not intend to perform cross-account deployments, you can disable
the creation of the Customer Master Keys by passing `crossAccountKeys: false`
when defining the Pipeline:

TypeScript:

```ts
// Don't create Customer Master Keys
const pipeline = new codepipeline.Pipeline(this, 'MyFirstPipeline', {
  crossAccountKeys: false,
});
```

Python:

```python
# Don't create Customer Master Keys
pipeline = codepipeline.Pipeline(self, "MyFirstPipeline",
    cross_account_keys=False
)
```

Java:

```java
// Don't create Customer Master Keys
Pipeline pipeline = Pipeline.Builder.create(this, "MyFirstPipeline")
        .crossAccountKeys(false)
        .build();
```

C#:

```csharp
// Don't create Customer Master Keys
var pipeline = new Pipeline(this, "MyFirstPipeline", new PipelineProps {
    CrossAccountKeys = false
});
```

Go:

```go
// Don't create Customer Master Keys
pipeline := codepipeline.NewPipeline(this, jsii.String("MyFirstPipeline"), &PipelineProps{
	CrossAccountKeys: jsii.Boolean(false),
})
```

If you want to enable key rotation for the generated KMS keys,
you can configure it by passing `enableKeyRotation: true` when creating the pipeline.
Note that key rotation will incur an additional cost of **$1/month**.

TypeScript:

```ts
// Enable key rotation for the generated KMS key
const pipeline = new codepipeline.Pipeline(this, 'MyFirstPipeline', {
  // ...
  enableKeyRotation: true,
});
```

Python:

```python
# Enable key rotation for the generated KMS key
pipeline = codepipeline.Pipeline(self, "MyFirstPipeline",
    # ...
    enable_key_rotation=True
)
```

Java:

```java
// Enable key rotation for the generated KMS key
Pipeline pipeline = Pipeline.Builder.create(this, "MyFirstPipeline")
        // ...
        .enableKeyRotation(true)
        .build();
```

C#:

```csharp
// Enable key rotation for the generated KMS key
var pipeline = new Pipeline(this, "MyFirstPipeline", new PipelineProps {
    // ...
    EnableKeyRotation = true
});
```

Go:

```go
// Enable key rotation for the generated KMS key
pipeline := codepipeline.NewPipeline(this, jsii.String("MyFirstPipeline"), &PipelineProps{
	// ...
	EnableKeyRotation: jsii.Boolean(true),
})
```

## Stages

You can provide Stages when creating the Pipeline:

TypeScript:

```ts
// Provide a Stage when creating a pipeline
const pipeline = new codepipeline.Pipeline(this, 'MyFirstPipeline', {
  stages: [
    {
      stageName: 'Source',
      actions: [
        // see below...
      ],
    },
  ],
});
```

Python:

```python
# Provide a Stage when creating a pipeline
pipeline = codepipeline.Pipeline(self, "MyFirstPipeline",
    stages=[codepipeline.StageProps(
        stage_name="Source",
        actions=[]
    )
    ]
)
```

Java:

```java
// Provide a Stage when creating a pipeline
Pipeline pipeline = Pipeline.Builder.create(this, "MyFirstPipeline")
        .stages(List.of(StageProps.builder()
                .stageName("Source")
                .actions(List.of())
                .build()))
        .build();
```

C#:

```csharp
// Provide a Stage when creating a pipeline
var pipeline = new Pipeline(this, "MyFirstPipeline", new PipelineProps {
    Stages = new [] { new StageProps {
        StageName = "Source",
        Actions = new [] {  }
    } }
});
```

Go:

```go
// Provide a Stage when creating a pipeline
pipeline := codepipeline.NewPipeline(this, jsii.String("MyFirstPipeline"), &PipelineProps{
	Stages: []StageProps{
		&StageProps{
			StageName: jsii.String("Source"),
			Actions: []IAction{
			},
		},
	},
})
```

Or append a Stage to an existing Pipeline:

TypeScript:

```ts
// Append a Stage to an existing Pipeline
declare const pipeline: codepipeline.Pipeline;
const sourceStage = pipeline.addStage({
  stageName: 'Source',
  actions: [ // optional property
    // see below...
  ],
});
```

Python:

```python
# Append a Stage to an existing Pipeline
# pipeline: codepipeline.Pipeline

source_stage = pipeline.add_stage(
    stage_name="Source",
    actions=[]
)
```

Java:

```java
// Append a Stage to an existing Pipeline
Pipeline pipeline;

IStage sourceStage = pipeline.addStage(StageOptions.builder()
        .stageName("Source")
        .actions(List.of())
        .build());
```

C#:

```csharp
// Append a Stage to an existing Pipeline
Pipeline pipeline;

var sourceStage = pipeline.AddStage(new StageOptions {
    StageName = "Source",
    Actions = new [] {  }
});
```

Go:

```go
// Append a Stage to an existing Pipeline
var pipeline Pipeline

sourceStage := pipeline.AddStage(&StageOptions{
	StageName: jsii.String("Source"),
	Actions: []IAction{
	},
})
```

You can insert the new Stage at an arbitrary point in the Pipeline:

TypeScript:

```ts
// Insert a new Stage at an arbitrary point
declare const pipeline: codepipeline.Pipeline;
declare const anotherStage: codepipeline.IStage;
declare const yetAnotherStage: codepipeline.IStage;

const someStage = pipeline.addStage({
  stageName: 'SomeStage',
  placement: {
    // note: you can only specify one of the below properties
    rightBefore: anotherStage,
    justAfter: yetAnotherStage,
  }
});
```

Python:

```python
# Insert a new Stage at an arbitrary point
# pipeline: codepipeline.Pipeline
# another_stage: codepipeline.IStage
# yet_another_stage: codepipeline.IStage

some_stage = pipeline.add_stage(
    stage_name="SomeStage",
    placement=codepipeline.StagePlacement(
        # note: you can only specify one of the below properties
        right_before=another_stage,
        just_after=yet_another_stage
    )
)
```

Java:

```java
// Insert a new Stage at an arbitrary point
Pipeline pipeline;
IStage anotherStage;
IStage yetAnotherStage;

IStage someStage = pipeline.addStage(StageOptions.builder()
        .stageName("SomeStage")
        .placement(StagePlacement.builder()
                // note: you can only specify one of the below properties
                .rightBefore(anotherStage)
                .justAfter(yetAnotherStage)
                .build())
        .build());
```

C#:

```csharp
// Insert a new Stage at an arbitrary point
Pipeline pipeline;
IStage anotherStage;
IStage yetAnotherStage;

var someStage = pipeline.AddStage(new StageOptions {
    StageName = "SomeStage",
    Placement = new StagePlacement {
        // note: you can only specify one of the below properties
        RightBefore = anotherStage,
        JustAfter = yetAnotherStage
    }
});
```

Go:

```go
// Insert a new Stage at an arbitrary point
var pipeline Pipeline
var anotherStage IStage
var yetAnotherStage IStage

someStage := pipeline.AddStage(&StageOptions{
	StageName: jsii.String("SomeStage"),
	Placement: &StagePlacement{
		// note: you can only specify one of the below properties
		RightBefore: anotherStage,
		JustAfter: yetAnotherStage,
	},
})
```

You can disable transition to a Stage:

TypeScript:

```ts
// Disable transition to a stage
declare const pipeline: codepipeline.Pipeline;

const someStage = pipeline.addStage({
  stageName: 'SomeStage',
  transitionToEnabled: false,
  transitionDisabledReason: 'Manual transition only', // optional reason
})
```

Python:

```python
# Disable transition to a stage
# pipeline: codepipeline.Pipeline

some_stage = pipeline.add_stage(
    stage_name="SomeStage",
    transition_to_enabled=False,
    transition_disabled_reason="Manual transition only"
)
```

Java:

```java
// Disable transition to a stage
Pipeline pipeline;

IStage someStage = pipeline.addStage(StageOptions.builder()
        .stageName("SomeStage")
        .transitionToEnabled(false)
        .transitionDisabledReason("Manual transition only")
        .build());
```

C#:

```csharp
// Disable transition to a stage
Pipeline pipeline;

var someStage = pipeline.AddStage(new StageOptions {
    StageName = "SomeStage",
    TransitionToEnabled = false,
    TransitionDisabledReason = "Manual transition only"
});
```

Go:

```go
// Disable transition to a stage
var pipeline Pipeline

someStage := pipeline.AddStage(&StageOptions{
	StageName: jsii.String("SomeStage"),
	TransitionToEnabled: jsii.Boolean(false),
	TransitionDisabledReason: jsii.String("Manual transition only"),
})
```

This is useful if you don't want every executions of the pipeline to flow into
this stage automatically. The transition can then be "manually" enabled later on.

## Actions

Actions live in a separate package, `aws-cdk-lib/aws-codepipeline-actions`.

To add an Action to a Stage, you can provide it when creating the Stage,
in the `actions` property,
or you can use the `IStage.addAction()` method to mutate an existing Stage:

TypeScript:

```ts
// Use the `IStage.addAction()` method to mutate an existing Stage.
declare const sourceStage: codepipeline.IStage;
declare const someAction: codepipeline.Action;
sourceStage.addAction(someAction);
```

Python:

```python
# Use the `IStage.addAction()` method to mutate an existing Stage.
# source_stage: codepipeline.IStage
# some_action: codepipeline.Action

source_stage.add_action(some_action)
```

Java:

```java
// Use the `IStage.addAction()` method to mutate an existing Stage.
IStage sourceStage;
Action someAction;

sourceStage.addAction(someAction);
```

C#:

```csharp
// Use the `IStage.addAction()` method to mutate an existing Stage.
IStage sourceStage;
Action someAction;

sourceStage.AddAction(someAction);
```

Go:

```go
// Use the `IStage.addAction()` method to mutate an existing Stage.
var sourceStage IStage
var someAction Action

sourceStage.AddAction(someAction)
```

## Custom Action Registration

To make your own custom CodePipeline Action requires registering the action provider. Look to the `JenkinsProvider` in `aws-cdk-lib/aws-codepipeline-actions` for an implementation example.

TypeScript:

```ts
// Make a custom CodePipeline Action
new codepipeline.CustomActionRegistration(this, 'GenericGitSourceProviderResource', {
  category: codepipeline.ActionCategory.SOURCE,
  artifactBounds: { minInputs: 0, maxInputs: 0, minOutputs: 1, maxOutputs: 1 },
  provider: 'GenericGitSource',
  version: '1',
  entityUrl: 'https://docs.aws.amazon.com/codepipeline/latest/userguide/actions-create-custom-action.html',
  executionUrl: 'https://docs.aws.amazon.com/codepipeline/latest/userguide/actions-create-custom-action.html',
  actionProperties: [
    {
      name: 'Branch',
      required: true,
      key: false,
      secret: false,
      queryable: false,
      description: 'Git branch to pull',
      type: 'String',
    },
    {
      name: 'GitUrl',
      required: true,
      key: false,
      secret: false,
      queryable: false,
      description: 'SSH git clone URL',
      type: 'String',
    },
  ],
});
```

Python:

```python
# Make a custom CodePipeline Action
codepipeline.CustomActionRegistration(self, "GenericGitSourceProviderResource",
    category=codepipeline.ActionCategory.SOURCE,
    artifact_bounds=codepipeline.ActionArtifactBounds(min_inputs=0, max_inputs=0, min_outputs=1, max_outputs=1),
    provider="GenericGitSource",
    version="1",
    entity_url="https://docs.aws.amazon.com/codepipeline/latest/userguide/actions-create-custom-action.html",
    execution_url="https://docs.aws.amazon.com/codepipeline/latest/userguide/actions-create-custom-action.html",
    action_properties=[codepipeline.CustomActionProperty(
        name="Branch",
        required=True,
        key=False,
        secret=False,
        queryable=False,
        description="Git branch to pull",
        type="String"
    ), codepipeline.CustomActionProperty(
        name="GitUrl",
        required=True,
        key=False,
        secret=False,
        queryable=False,
        description="SSH git clone URL",
        type="String"
    )
    ]
)
```

Java:

```java
// Make a custom CodePipeline Action
// Make a custom CodePipeline Action
CustomActionRegistration.Builder.create(this, "GenericGitSourceProviderResource")
        .category(ActionCategory.SOURCE)
        .artifactBounds(ActionArtifactBounds.builder().minInputs(0).maxInputs(0).minOutputs(1).maxOutputs(1).build())
        .provider("GenericGitSource")
        .version("1")
        .entityUrl("https://docs.aws.amazon.com/codepipeline/latest/userguide/actions-create-custom-action.html")
        .executionUrl("https://docs.aws.amazon.com/codepipeline/latest/userguide/actions-create-custom-action.html")
        .actionProperties(List.of(CustomActionProperty.builder()
                .name("Branch")
                .required(true)
                .key(false)
                .secret(false)
                .queryable(false)
                .description("Git branch to pull")
                .type("String")
                .build(), CustomActionProperty.builder()
                .name("GitUrl")
                .required(true)
                .key(false)
                .secret(false)
                .queryable(false)
                .description("SSH git clone URL")
                .type("String")
                .build()))
        .build();
```

C#:

```csharp
// Make a custom CodePipeline Action
// Make a custom CodePipeline Action
new CustomActionRegistration(this, "GenericGitSourceProviderResource", new CustomActionRegistrationProps {
    Category = ActionCategory.SOURCE,
    ArtifactBounds = new ActionArtifactBounds { MinInputs = 0, MaxInputs = 0, MinOutputs = 1, MaxOutputs = 1 },
    Provider = "GenericGitSource",
    Version = "1",
    EntityUrl = "https://docs.aws.amazon.com/codepipeline/latest/userguide/actions-create-custom-action.html",
    ExecutionUrl = "https://docs.aws.amazon.com/codepipeline/latest/userguide/actions-create-custom-action.html",
    ActionProperties = new [] { new CustomActionProperty {
        Name = "Branch",
        Required = true,
        Key = false,
        Secret = false,
        Queryable = false,
        Description = "Git branch to pull",
        Type = "String"
    }, new CustomActionProperty {
        Name = "GitUrl",
        Required = true,
        Key = false,
        Secret = false,
        Queryable = false,
        Description = "SSH git clone URL",
        Type = "String"
    } }
});
```

Go:

```go
// Make a custom CodePipeline Action
// Make a custom CodePipeline Action
codepipeline.NewCustomActionRegistration(this, jsii.String("GenericGitSourceProviderResource"), &CustomActionRegistrationProps{
	Category: codepipeline.ActionCategory_SOURCE,
	ArtifactBounds: &ActionArtifactBounds{
		MinInputs: jsii.Number(0),
		MaxInputs: jsii.Number(0),
		MinOutputs: jsii.Number(1),
		MaxOutputs: jsii.Number(1),
	},
	Provider: jsii.String("GenericGitSource"),
	Version: jsii.String("1"),
	EntityUrl: jsii.String("https://docs.aws.amazon.com/codepipeline/latest/userguide/actions-create-custom-action.html"),
	ExecutionUrl: jsii.String("https://docs.aws.amazon.com/codepipeline/latest/userguide/actions-create-custom-action.html"),
	ActionProperties: []CustomActionProperty{
		&CustomActionProperty{
			Name: jsii.String("Branch"),
			Required: jsii.Boolean(true),
			Key: jsii.Boolean(false),
			Secret: jsii.Boolean(false),
			Queryable: jsii.Boolean(false),
			Description: jsii.String("Git branch to pull"),
			Type: jsii.String("String"),
		},
		&CustomActionProperty{
			Name: jsii.String("GitUrl"),
			Required: jsii.Boolean(true),
			Key: jsii.Boolean(false),
			Secret: jsii.Boolean(false),
			Queryable: jsii.Boolean(false),
			Description: jsii.String("SSH git clone URL"),
			Type: jsii.String("String"),
		},
	},
})
```

## Cross-account CodePipelines

> Cross-account Pipeline actions require that the Pipeline has *not* been
> created with `crossAccountKeys: false`.

Most pipeline Actions accept an AWS resource object to operate on. For example:

* `S3DeployAction` accepts an `s3.IBucket`.
* `CodeBuildAction` accepts a `codebuild.IProject`.
* etc.

These resources can be either newly defined (`new s3.Bucket(...)`) or imported
(`s3.Bucket.fromBucketAttributes(...)`) and identify the resource that should
be changed.

These resources can be in different accounts than the pipeline itself. For
example, the following action deploys to an imported S3 bucket from a
different account:

TypeScript:

```ts
// Deploy an imported S3 bucket from a different account
declare const stage: codepipeline.IStage;
declare const input: codepipeline.Artifact;
stage.addAction(new codepipeline_actions.S3DeployAction({
  bucket: s3.Bucket.fromBucketAttributes(this, 'Bucket', {
    account: '123456789012',
    // ...
  }),
  input: input,
  actionName: 's3-deploy-action',
  // ...
}));
```

Python:

```python
# Deploy an imported S3 bucket from a different account
# stage: codepipeline.IStage
# input: codepipeline.Artifact

stage.add_action(codepipeline_actions.S3DeployAction(
    bucket=s3.Bucket.from_bucket_attributes(self, "Bucket",
        account="123456789012"
    ),
    input=input,
    action_name="s3-deploy-action"
))
```

Java:

```java
// Deploy an imported S3 bucket from a different account
IStage stage;
Artifact input;

stage.addAction(S3DeployAction.Builder.create()
        .bucket(Bucket.fromBucketAttributes(this, "Bucket", BucketAttributes.builder()
                .account("123456789012")
                .build()))
        .input(input)
        .actionName("s3-deploy-action")
        .build());
```

C#:

```csharp
// Deploy an imported S3 bucket from a different account
IStage stage;
Artifact input;

stage.AddAction(new S3DeployAction(new S3DeployActionProps {
    Bucket = Bucket.FromBucketAttributes(this, "Bucket", new BucketAttributes {
        Account = "123456789012"
    }),
    Input = input,
    ActionName = "s3-deploy-action"
}));
```

Go:

```go
// Deploy an imported S3 bucket from a different account
var stage IStage
var input Artifact

stage.AddAction(codepipeline_actions.NewS3DeployAction(&S3DeployActionProps{
	Bucket: s3.Bucket_FromBucketAttributes(this, jsii.String("Bucket"), &BucketAttributes{
		Account: jsii.String("123456789012"),
	}),
	Input: input,
	ActionName: jsii.String("s3-deploy-action"),
}))
```

Actions that don't accept a resource object accept an explicit `account` parameter:

TypeScript:

```ts
// Actions that don't accept a resource objet accept an explicit `account` parameter
declare const stage: codepipeline.IStage;
declare const templatePath: codepipeline.ArtifactPath;
stage.addAction(new codepipeline_actions.CloudFormationCreateUpdateStackAction({
  account: '123456789012',
  templatePath,
  adminPermissions: false,
  stackName: Stack.of(this).stackName,
  actionName: 'cloudformation-create-update',
  // ...
}));
```

Python:

```python
# Actions that don't accept a resource objet accept an explicit `account` parameter
# stage: codepipeline.IStage
# template_path: codepipeline.ArtifactPath

stage.add_action(codepipeline_actions.CloudFormationCreateUpdateStackAction(
    account="123456789012",
    template_path=template_path,
    admin_permissions=False,
    stack_name=Stack.of(self).stack_name,
    action_name="cloudformation-create-update"
))
```

Java:

```java
// Actions that don't accept a resource objet accept an explicit `account` parameter
IStage stage;
ArtifactPath templatePath;

stage.addAction(CloudFormationCreateUpdateStackAction.Builder.create()
        .account("123456789012")
        .templatePath(templatePath)
        .adminPermissions(false)
        .stackName(Stack.of(this).getStackName())
        .actionName("cloudformation-create-update")
        .build());
```

C#:

```csharp
// Actions that don't accept a resource objet accept an explicit `account` parameter
IStage stage;
ArtifactPath templatePath;

stage.AddAction(new CloudFormationCreateUpdateStackAction(new CloudFormationCreateUpdateStackActionProps {
    Account = "123456789012",
    TemplatePath = templatePath,
    AdminPermissions = false,
    StackName = Stack.Of(this).StackName,
    ActionName = "cloudformation-create-update"
}));
```

Go:

```go
// Actions that don't accept a resource objet accept an explicit `account` parameter
var stage IStage
var templatePath ArtifactPath

stage.AddAction(codepipeline_actions.NewCloudFormationCreateUpdateStackAction(&CloudFormationCreateUpdateStackActionProps{
	Account: jsii.String("123456789012"),
	TemplatePath: TemplatePath,
	AdminPermissions: jsii.Boolean(false),
	StackName: awscdk.*stack_Of(this).stackName,
	ActionName: jsii.String("cloudformation-create-update"),
}))
```

The [`Pipeline`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_codepipeline.Pipeline.html) construct automatically defines an **IAM Role** for you in the
target account which the pipeline will assume to perform that action. This
Role will be defined in a **support stack** named
`<PipelineStackName>-support-<account>`, that will automatically be deployed
before the stack containing the pipeline.

If you do not want to use the generated role, you can also explicitly pass a
`role` when creating the action. In that case, the action will operate in the
account the role belongs to:

TypeScript:

```ts
// Explicitly pass in a `role` when creating an action.
declare const stage: codepipeline.IStage;
declare const templatePath: codepipeline.ArtifactPath;
stage.addAction(new codepipeline_actions.CloudFormationCreateUpdateStackAction({
  templatePath,
  adminPermissions: false,
  stackName: Stack.of(this).stackName,
  actionName: 'cloudformation-create-update',
  // ...
  role: iam.Role.fromRoleArn(this, 'ActionRole', '...'),
}));
```

Python:

```python
# Explicitly pass in a `role` when creating an action.
# stage: codepipeline.IStage
# template_path: codepipeline.ArtifactPath

stage.add_action(codepipeline_actions.CloudFormationCreateUpdateStackAction(
    template_path=template_path,
    admin_permissions=False,
    stack_name=Stack.of(self).stack_name,
    action_name="cloudformation-create-update",
    # ...
    role=iam.Role.from_role_arn(self, "ActionRole", "...")
))
```

Java:

```java
// Explicitly pass in a `role` when creating an action.
IStage stage;
ArtifactPath templatePath;

stage.addAction(CloudFormationCreateUpdateStackAction.Builder.create()
        .templatePath(templatePath)
        .adminPermissions(false)
        .stackName(Stack.of(this).getStackName())
        .actionName("cloudformation-create-update")
        // ...
        .role(Role.fromRoleArn(this, "ActionRole", "..."))
        .build());
```

C#:

```csharp
// Explicitly pass in a `role` when creating an action.
IStage stage;
ArtifactPath templatePath;

stage.AddAction(new CloudFormationCreateUpdateStackAction(new CloudFormationCreateUpdateStackActionProps {
    TemplatePath = templatePath,
    AdminPermissions = false,
    StackName = Stack.Of(this).StackName,
    ActionName = "cloudformation-create-update",
    // ...
    Role = Role.FromRoleArn(this, "ActionRole", "...")
}));
```

Go:

```go
// Explicitly pass in a `role` when creating an action.
var stage IStage
var templatePath ArtifactPath

stage.AddAction(codepipeline_actions.NewCloudFormationCreateUpdateStackAction(&CloudFormationCreateUpdateStackActionProps{
	TemplatePath: TemplatePath,
	AdminPermissions: jsii.Boolean(false),
	StackName: awscdk.*stack_Of(this).stackName,
	ActionName: jsii.String("cloudformation-create-update"),
	// ...
	Role: iam.Role_FromRoleArn(this, jsii.String("ActionRole"), jsii.String("...")),
}))
```

## Cross-region CodePipelines

Similar to how you set up a cross-account Action, the AWS resource object you
pass to actions can also be in different *Regions*. For example, the
following Action deploys to an imported S3 bucket from a different Region:

TypeScript:

```ts
// Deploy to an imported S3 bucket from a different Region.
declare const stage: codepipeline.IStage;
declare const input: codepipeline.Artifact;
stage.addAction(new codepipeline_actions.S3DeployAction({
  bucket: s3.Bucket.fromBucketAttributes(this, 'Bucket', {
    region: 'us-west-1',
    // ...
  }),
  input: input,
  actionName: 's3-deploy-action',
  // ...
}));
```

Python:

```python
# Deploy to an imported S3 bucket from a different Region.
# stage: codepipeline.IStage
# input: codepipeline.Artifact

stage.add_action(codepipeline_actions.S3DeployAction(
    bucket=s3.Bucket.from_bucket_attributes(self, "Bucket",
        region="us-west-1"
    ),
    input=input,
    action_name="s3-deploy-action"
))
```

Java:

```java
// Deploy to an imported S3 bucket from a different Region.
IStage stage;
Artifact input;

stage.addAction(S3DeployAction.Builder.create()
        .bucket(Bucket.fromBucketAttributes(this, "Bucket", BucketAttributes.builder()
                .region("us-west-1")
                .build()))
        .input(input)
        .actionName("s3-deploy-action")
        .build());
```

C#:

```csharp
// Deploy to an imported S3 bucket from a different Region.
IStage stage;
Artifact input;

stage.AddAction(new S3DeployAction(new S3DeployActionProps {
    Bucket = Bucket.FromBucketAttributes(this, "Bucket", new BucketAttributes {
        Region = "us-west-1"
    }),
    Input = input,
    ActionName = "s3-deploy-action"
}));
```

Go:

```go
// Deploy to an imported S3 bucket from a different Region.
var stage IStage
var input Artifact

stage.AddAction(codepipeline_actions.NewS3DeployAction(&S3DeployActionProps{
	Bucket: s3.Bucket_FromBucketAttributes(this, jsii.String("Bucket"), &BucketAttributes{
		Region: jsii.String("us-west-1"),
	}),
	Input: input,
	ActionName: jsii.String("s3-deploy-action"),
}))
```

Actions that don't take an AWS resource will accept an explicit `region`
parameter:

TypeScript:

```ts
// Actions that don't take an AWS resource will accept an explicit `region` parameter.
declare const stage: codepipeline.IStage;
declare const templatePath: codepipeline.ArtifactPath;
stage.addAction(new codepipeline_actions.CloudFormationCreateUpdateStackAction({
  templatePath,
  adminPermissions: false,
  stackName: Stack.of(this).stackName,
  actionName: 'cloudformation-create-update',
  // ...
  region: 'us-west-1',
}));
```

Python:

```python
# Actions that don't take an AWS resource will accept an explicit `region` parameter.
# stage: codepipeline.IStage
# template_path: codepipeline.ArtifactPath

stage.add_action(codepipeline_actions.CloudFormationCreateUpdateStackAction(
    template_path=template_path,
    admin_permissions=False,
    stack_name=Stack.of(self).stack_name,
    action_name="cloudformation-create-update",
    # ...
    region="us-west-1"
))
```

Java:

```java
// Actions that don't take an AWS resource will accept an explicit `region` parameter.
IStage stage;
ArtifactPath templatePath;

stage.addAction(CloudFormationCreateUpdateStackAction.Builder.create()
        .templatePath(templatePath)
        .adminPermissions(false)
        .stackName(Stack.of(this).getStackName())
        .actionName("cloudformation-create-update")
        // ...
        .region("us-west-1")
        .build());
```

C#:

```csharp
// Actions that don't take an AWS resource will accept an explicit `region` parameter.
IStage stage;
ArtifactPath templatePath;

stage.AddAction(new CloudFormationCreateUpdateStackAction(new CloudFormationCreateUpdateStackActionProps {
    TemplatePath = templatePath,
    AdminPermissions = false,
    StackName = Stack.Of(this).StackName,
    ActionName = "cloudformation-create-update",
    // ...
    Region = "us-west-1"
}));
```

Go:

```go
// Actions that don't take an AWS resource will accept an explicit `region` parameter.
var stage IStage
var templatePath ArtifactPath

stage.AddAction(codepipeline_actions.NewCloudFormationCreateUpdateStackAction(&CloudFormationCreateUpdateStackActionProps{
	TemplatePath: TemplatePath,
	AdminPermissions: jsii.Boolean(false),
	StackName: awscdk.*stack_Of(this).stackName,
	ActionName: jsii.String("cloudformation-create-update"),
	// ...
	Region: jsii.String("us-west-1"),
}))
```

The [`Pipeline`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_codepipeline.Pipeline.html) construct automatically defines a **replication bucket** for
you in the target region, which the pipeline will replicate artifacts to and
from. This Bucket will be defined in a **support stack** named
`<PipelineStackName>-support-<region>`, that will automatically be deployed
before the stack containing the pipeline.

If you don't want to use these support stacks, and already have buckets in
place to serve as replication buckets, you can supply these at Pipeline definition
time using the `crossRegionReplicationBuckets` parameter. Example:

TypeScript:

```ts
// Supply replication buckets for the Pipeline instead of using the generated support stack
const pipeline = new codepipeline.Pipeline(this, 'MyFirstPipeline', {
  // ...

  crossRegionReplicationBuckets: {
    // note that a physical name of the replication Bucket must be known at synthesis time
    'us-west-1': s3.Bucket.fromBucketAttributes(this, 'UsWest1ReplicationBucket', {
      bucketName: 'amzn-s3-demo-bucket',
      // optional KMS key
      encryptionKey: kms.Key.fromKeyArn(this, 'UsWest1ReplicationKey',
        'arn:aws:kms:us-west-1:123456789012:key/1234-5678-9012'
      ),
    }),
  },
});
```

Python:

```python
# Supply replication buckets for the Pipeline instead of using the generated support stack
pipeline = codepipeline.Pipeline(self, "MyFirstPipeline",
    # ...

    cross_region_replication_buckets={
        # note that a physical name of the replication Bucket must be known at synthesis time
        "us-west-1": s3.Bucket.from_bucket_attributes(self, "UsWest1ReplicationBucket",
            bucket_name="amzn-s3-demo-bucket",
            # optional KMS key
            encryption_key=kms.Key.from_key_arn(self, "UsWest1ReplicationKey", "arn:aws:kms:us-west-1:123456789012:key/1234-5678-9012")
        )
    }
)
```

Java:

```java
// Supply replication buckets for the Pipeline instead of using the generated support stack
Pipeline pipeline = Pipeline.Builder.create(this, "MyFirstPipeline")
        // ...

        .crossRegionReplicationBuckets(Map.of(
                // note that a physical name of the replication Bucket must be known at synthesis time
                "us-west-1", Bucket.fromBucketAttributes(this, "UsWest1ReplicationBucket", BucketAttributes.builder()
                        .bucketName("amzn-s3-demo-bucket")
                        // optional KMS key
                        .encryptionKey(Key.fromKeyArn(this, "UsWest1ReplicationKey", "arn:aws:kms:us-west-1:123456789012:key/1234-5678-9012"))
                        .build())))
        .build();
```

C#:

```csharp
// Supply replication buckets for the Pipeline instead of using the generated support stack
var pipeline = new Pipeline(this, "MyFirstPipeline", new PipelineProps {
    // ...

    CrossRegionReplicationBuckets = new Dictionary<string, IBucket> {
        // note that a physical name of the replication Bucket must be known at synthesis time
        { "us-west-1", Bucket.FromBucketAttributes(this, "UsWest1ReplicationBucket", new BucketAttributes {
            BucketName = "amzn-s3-demo-bucket",
            // optional KMS key
            EncryptionKey = Key.FromKeyArn(this, "UsWest1ReplicationKey", "arn:aws:kms:us-west-1:123456789012:key/1234-5678-9012")
        }) }
    }
});
```

Go:

```go
// Supply replication buckets for the Pipeline instead of using the generated support stack
pipeline := codepipeline.NewPipeline(this, jsii.String("MyFirstPipeline"), &PipelineProps{
	// ...

	CrossRegionReplicationBuckets: map[string]IBucket{
		// note that a physical name of the replication Bucket must be known at synthesis time
		"us-west-1": s3.Bucket_fromBucketAttributes(this, jsii.String("UsWest1ReplicationBucket"), &BucketAttributes{
			"bucketName": jsii.String("amzn-s3-demo-bucket"),
			// optional KMS key
			"encryptionKey": kms.Key_fromKeyArn(this, jsii.String("UsWest1ReplicationKey"), jsii.String("arn:aws:kms:us-west-1:123456789012:key/1234-5678-9012")),
		}),
	},
})
```

See [the AWS docs here](https://docs.aws.amazon.com/codepipeline/latest/userguide/actions-create-cross-region.html)
for more information on cross-region CodePipelines.

### Creating an encrypted replication bucket

If you're passing a replication bucket created in a different stack,
like this:

TypeScript:

```ts
// Passing a replication bucket created in a different stack.
const app = new App();
const replicationStack = new Stack(app, 'ReplicationStack', {
  env: {
    region: 'us-west-1',
  },
});
const key = new kms.Key(replicationStack, 'ReplicationKey');
const replicationBucket = new s3.Bucket(replicationStack, 'ReplicationBucket', {
  // like was said above - replication buckets need a set physical name
  bucketName: PhysicalName.GENERATE_IF_NEEDED,
  encryptionKey: key, // does not work!
});

// later...
new codepipeline.Pipeline(replicationStack, 'Pipeline', {
  crossRegionReplicationBuckets: {
    'us-west-1': replicationBucket,
  },
});
```

Python:

```python
from aws_cdk import Environment
# Passing a replication bucket created in a different stack.
app = App()
replication_stack = Stack(app, "ReplicationStack",
    env=Environment(
        region="us-west-1"
    )
)
key = kms.Key(replication_stack, "ReplicationKey")
replication_bucket = s3.Bucket(replication_stack, "ReplicationBucket",
    # like was said above - replication buckets need a set physical name
    bucket_name=PhysicalName.GENERATE_IF_NEEDED,
    encryption_key=key
)

# later...
codepipeline.Pipeline(replication_stack, "Pipeline",
    cross_region_replication_buckets={
        "us-west-1": replication_bucket
    }
)
```

Java:

```java
// Passing a replication bucket created in a different stack.
App app = new App();
Stack replicationStack = Stack.Builder.create(app, "ReplicationStack")
        .env(Environment.builder()
                .region("us-west-1")
                .build())
        .build();
Key key = new Key(replicationStack, "ReplicationKey");
Bucket replicationBucket = Bucket.Builder.create(replicationStack, "ReplicationBucket")
        // like was said above - replication buckets need a set physical name
        .bucketName(PhysicalName.GENERATE_IF_NEEDED)
        .encryptionKey(key)
        .build();

// later...
// later...
Pipeline.Builder.create(replicationStack, "Pipeline")
        .crossRegionReplicationBuckets(Map.of(
                "us-west-1", replicationBucket))
        .build();
```

C#:

```csharp
// Passing a replication bucket created in a different stack.
var app = new App();
var replicationStack = new Stack(app, "ReplicationStack", new StackProps {
    Env = new Environment {
        Region = "us-west-1"
    }
});
var key = new Key(replicationStack, "ReplicationKey");
var replicationBucket = new Bucket(replicationStack, "ReplicationBucket", new BucketProps {
    // like was said above - replication buckets need a set physical name
    BucketName = PhysicalName.GENERATE_IF_NEEDED,
    EncryptionKey = key
});

// later...
// later...
new Pipeline(replicationStack, "Pipeline", new PipelineProps {
    CrossRegionReplicationBuckets = new Dictionary<string, IBucket> {
        { "us-west-1", replicationBucket }
    }
});
```

Go:

```go
// Passing a replication bucket created in a different stack.
app := awscdk.NewApp()
replicationStack := awscdk.Newstack(app, jsii.String("ReplicationStack"), &StackProps{
	Env: &Environment{
		Region: jsii.String("us-west-1"),
	},
})
key := kms.NewKey(replicationStack, jsii.String("ReplicationKey"))
replicationBucket := s3.NewBucket(replicationStack, jsii.String("ReplicationBucket"), &BucketProps{
	// like was said above - replication buckets need a set physical name
	BucketName: awscdk.PhysicalName_GENERATE_IF_NEEDED(),
	EncryptionKey: key,
})

// later...
// later...
codepipeline.NewPipeline(replicationStack, jsii.String("Pipeline"), &PipelineProps{
	CrossRegionReplicationBuckets: map[string]IBucket{
		"us-west-1": replicationBucket,
	},
})
```

When trying to encrypt it
(and note that if any of the cross-region actions happen to be cross-account as well,
the bucket *has to* be encrypted - otherwise the pipeline will fail at runtime),
you cannot use a key directly - KMS keys don't have physical names,
and so you can't reference them across environments.

In this case, you need to use an alias in place of the key when creating the bucket:

TypeScript:

```ts
// Passing an encrypted replication bucket created in a different stack.
const app = new App();
const replicationStack = new Stack(app, 'ReplicationStack', {
  env: {
    region: 'us-west-1',
  },
});
const key = new kms.Key(replicationStack, 'ReplicationKey');
const alias = new kms.Alias(replicationStack, 'ReplicationAlias', {
  // aliasName is required
  aliasName: PhysicalName.GENERATE_IF_NEEDED,
  targetKey: key,
});
const replicationBucket = new s3.Bucket(replicationStack, 'ReplicationBucket', {
  bucketName: PhysicalName.GENERATE_IF_NEEDED,
  encryptionKey: alias,
});
```

Python:

```python
from aws_cdk import Environment
# Passing an encrypted replication bucket created in a different stack.
app = App()
replication_stack = Stack(app, "ReplicationStack",
    env=Environment(
        region="us-west-1"
    )
)
key = kms.Key(replication_stack, "ReplicationKey")
alias = kms.Alias(replication_stack, "ReplicationAlias",
    # aliasName is required
    alias_name=PhysicalName.GENERATE_IF_NEEDED,
    target_key=key
)
replication_bucket = s3.Bucket(replication_stack, "ReplicationBucket",
    bucket_name=PhysicalName.GENERATE_IF_NEEDED,
    encryption_key=alias
)
```

Java:

```java
// Passing an encrypted replication bucket created in a different stack.
App app = new App();
Stack replicationStack = Stack.Builder.create(app, "ReplicationStack")
        .env(Environment.builder()
                .region("us-west-1")
                .build())
        .build();
Key key = new Key(replicationStack, "ReplicationKey");
Alias alias = Alias.Builder.create(replicationStack, "ReplicationAlias")
        // aliasName is required
        .aliasName(PhysicalName.GENERATE_IF_NEEDED)
        .targetKey(key)
        .build();
Bucket replicationBucket = Bucket.Builder.create(replicationStack, "ReplicationBucket")
        .bucketName(PhysicalName.GENERATE_IF_NEEDED)
        .encryptionKey(alias)
        .build();
```

C#:

```csharp
// Passing an encrypted replication bucket created in a different stack.
var app = new App();
var replicationStack = new Stack(app, "ReplicationStack", new StackProps {
    Env = new Environment {
        Region = "us-west-1"
    }
});
var key = new Key(replicationStack, "ReplicationKey");
var alias = new Alias(replicationStack, "ReplicationAlias", new AliasProps {
    // aliasName is required
    AliasName = PhysicalName.GENERATE_IF_NEEDED,
    TargetKey = key
});
var replicationBucket = new Bucket(replicationStack, "ReplicationBucket", new BucketProps {
    BucketName = PhysicalName.GENERATE_IF_NEEDED,
    EncryptionKey = alias
});
```

Go:

```go
// Passing an encrypted replication bucket created in a different stack.
app := awscdk.NewApp()
replicationStack := awscdk.Newstack(app, jsii.String("ReplicationStack"), &StackProps{
	Env: &Environment{
		Region: jsii.String("us-west-1"),
	},
})
key := kms.NewKey(replicationStack, jsii.String("ReplicationKey"))
alias := kms.NewAlias(replicationStack, jsii.String("ReplicationAlias"), &AliasProps{
	// aliasName is required
	AliasName: awscdk.PhysicalName_GENERATE_IF_NEEDED(),
	TargetKey: key,
})
replicationBucket := s3.NewBucket(replicationStack, jsii.String("ReplicationBucket"), &BucketProps{
	BucketName: awscdk.PhysicalName_GENERATE_IF_NEEDED(),
	EncryptionKey: alias,
})
```

## Variables

Variables are key-value pairs that can be used to dynamically configure actions in your pipeline.

There are two types of variables, Action-level variables and Pipeline-level variables. Action-level
variables are produced when an action is executed. Pipeline-level variables are defined when the
pipeline is created and resolved at pipeline run time. You specify the Pipeline-level variables
when the pipeline is created, and you can provide values at the time of the pipeline execution.

### Action-level variables

The library supports action-level variables.
Each action class that emits variables has a separate variables interface,
accessed as a property of the action instance called `variables`.
You instantiate the action class and assign it to a local variable;
when you want to use a variable in the configuration of a different action,
you access the appropriate property of the interface returned from `variables`,
which represents a single variable.
Example:

TypeScript:

```ts
// MyAction is some action type that produces variables, like EcrSourceAction
const myAction = new MyAction({
  // ...
  actionName: 'myAction',
});
new OtherAction({
  // ...
  config: myAction.variables.myVariable,
  actionName: 'otherAction',
});
```

Python:

```python
# MyAction is some action type that produces variables, like EcrSourceAction
my_action = MyAction(
    # ...
    action_name="myAction"
)
OtherAction(
    # ...
    config=my_action.variables.my_variable,
    action_name="otherAction"
)
```

Java:

```java
// MyAction is some action type that produces variables, like EcrSourceAction
MyAction myAction = new MyAction(new MyActionProps()
        // ...
        .actionName("myAction")
        );
new OtherAction(new OtherActionProps()
        // ...
        .config(myAction.getVariables().getMyVariable())
        .actionName("otherAction")
        );
```

C#:

```csharp
// MyAction is some action type that produces variables, like EcrSourceAction
var myAction = new MyAction(new MyActionProps {
    // ...
    ActionName = "myAction"
});
new OtherAction(new OtherActionProps {
    // ...
    Config = myAction.Variables.MyVariable,
    ActionName = "otherAction"
});
```

Go:

```go
// MyAction is some action type that produces variables, like EcrSourceAction
myAction := newMyAction(&myActionProps{
	// ...
	actionName: jsii.String("myAction"),
})
newOtherAction(&otherActionProps{
	// ...
	config: myAction.variables.myVariable,
	actionName: jsii.String("otherAction"),
})
```

The namespace name that will be used will be automatically generated by the pipeline construct,
based on the stage and action name;
you can pass a custom name when creating the action instance:

TypeScript:

```ts
// MyAction is some action type that produces variables, like EcrSourceAction
const myAction = new MyAction({
  // ...
  variablesNamespace: 'MyNamespace',
  actionName: 'myAction',
});
```

Python:

```python
# MyAction is some action type that produces variables, like EcrSourceAction
my_action = MyAction(
    # ...
    variables_namespace="MyNamespace",
    action_name="myAction"
)
```

Java:

```java
// MyAction is some action type that produces variables, like EcrSourceAction
MyAction myAction = new MyAction(new MyActionProps()
        // ...
        .variablesNamespace("MyNamespace")
        .actionName("myAction")
        );
```

C#:

```csharp
// MyAction is some action type that produces variables, like EcrSourceAction
var myAction = new MyAction(new MyActionProps {
    // ...
    VariablesNamespace = "MyNamespace",
    ActionName = "myAction"
});
```

Go:

```go
// MyAction is some action type that produces variables, like EcrSourceAction
myAction := newMyAction(&myActionProps{
	// ...
	variablesNamespace: jsii.String("MyNamespace"),
	actionName: jsii.String("myAction"),
})
```

There are also global variables available,
not tied to any action;
these are accessed through static properties of the [`GlobalVariables`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_codepipeline.GlobalVariables.html) class:

TypeScript:

```ts
// OtherAction is some action type that produces variables, like EcrSourceAction
new OtherAction({
  // ...
  config: codepipeline.GlobalVariables.executionId,
  actionName: 'otherAction',
});
```

Python:

```python
# OtherAction is some action type that produces variables, like EcrSourceAction
OtherAction(
    # ...
    config=codepipeline.GlobalVariables.execution_id,
    action_name="otherAction"
)
```

Java:

```java
// OtherAction is some action type that produces variables, like EcrSourceAction
// OtherAction is some action type that produces variables, like EcrSourceAction
new OtherAction(new OtherActionProps()
        // ...
        .config(GlobalVariables.executionId)
        .actionName("otherAction")
        );
```

C#:

```csharp
// OtherAction is some action type that produces variables, like EcrSourceAction
// OtherAction is some action type that produces variables, like EcrSourceAction
new OtherAction(new OtherActionProps {
    // ...
    Config = GlobalVariables.ExecutionId,
    ActionName = "otherAction"
});
```

Go:

```go
// OtherAction is some action type that produces variables, like EcrSourceAction
// OtherAction is some action type that produces variables, like EcrSourceAction
newOtherAction(&otherActionProps{
	// ...
	config: codepipeline.GlobalVariables_ExecutionId(),
	actionName: jsii.String("otherAction"),
})
```

The following is an actual code example.

TypeScript:

```ts
declare const sourceAction: codepipeline_actions.S3SourceAction;
declare const sourceOutput: codepipeline.Artifact;
declare const deployBucket: s3.Bucket;

new codepipeline.Pipeline(this, 'Pipeline', {
  stages: [
    {
      stageName: 'Source',
      actions: [sourceAction],
    },
    {
      stageName: 'Deploy',
      actions: [
        new codepipeline_actions.S3DeployAction({
          actionName: 'DeployAction',
          // can reference the variables
          objectKey: `${sourceAction.variables.versionId}.txt`,
          input: sourceOutput,
          bucket: deployBucket,
        }),
      ],
    },
  ],
});
```

Python:

```python
# source_action: codepipeline_actions.S3SourceAction
# source_output: codepipeline.Artifact
# deploy_bucket: s3.Bucket

codepipeline.Pipeline(self, "Pipeline",
    stages=[codepipeline.StageProps(
        stage_name="Source",
        actions=[source_action]
    ), codepipeline.StageProps(
        stage_name="Deploy",
        actions=[
            codepipeline_actions.S3DeployAction(
                action_name="DeployAction",
                # can reference the variables
                object_key=f"{sourceAction.variables.versionId}.txt",
                input=source_output,
                bucket=deploy_bucket
            )
        ]
    )
    ]
)
```

Java:

```java
S3SourceAction sourceAction;
Artifact sourceOutput;
Bucket deployBucket;

Pipeline.Builder.create(this, "Pipeline")
        .stages(List.of(StageProps.builder()
                .stageName("Source")
                .actions(List.of(sourceAction))
                .build(), StageProps.builder()
                .stageName("Deploy")
                .actions(List.of(
                    S3DeployAction.Builder.create()
                            .actionName("DeployAction")
                            // can reference the variables
                            .objectKey(String.format("%s.txt", sourceAction.getVariables().getVersionId()))
                            .input(sourceOutput)
                            .bucket(deployBucket)
                            .build()))
                .build()))
        .build();
```

C#:

```csharp
S3SourceAction sourceAction;
Artifact sourceOutput;
Bucket deployBucket;

new Pipeline(this, "Pipeline", new PipelineProps {
    Stages = new [] { new StageProps {
        StageName = "Source",
        Actions = new [] { sourceAction }
    }, new StageProps {
        StageName = "Deploy",
        Actions = new [] {
            new S3DeployAction(new S3DeployActionProps {
                ActionName = "DeployAction",
                // can reference the variables
                ObjectKey = $"{sourceAction.variables.versionId}.txt",
                Input = sourceOutput,
                Bucket = deployBucket
            }) }
    } }
});
```

Go:

```go
var sourceAction S3SourceAction
var sourceOutput Artifact
var deployBucket Bucket

codepipeline.NewPipeline(this, jsii.String("Pipeline"), &PipelineProps{
	Stages: []StageProps{
		&StageProps{
			StageName: jsii.String("Source"),
			Actions: []IAction{
				sourceAction,
			},
		},
		&StageProps{
			StageName: jsii.String("Deploy"),
			Actions: []IAction{
				codepipeline_actions.NewS3DeployAction(&S3DeployActionProps{
					ActionName: jsii.String("DeployAction"),
					// can reference the variables
					ObjectKey: fmt.Sprintf("%v.txt", sourceAction.variables.VersionId),
					Input: sourceOutput,
					Bucket: deployBucket,
				}),
			},
		},
	},
})
```

Check the documentation of the `aws-cdk-lib/aws-codepipeline-actions`
for details on how to use the variables for each action class.

See the [CodePipeline documentation](https://docs.aws.amazon.com/codepipeline/latest/userguide/reference-variables.html)
for more details on how to use the variables feature.

### Pipeline-level variables

You can add one or more variables at the pipeline level. You can reference
this value in the configuration of CodePipeline actions. You can add the
variable names, default values, and descriptions when you create the pipeline.
Variables are resolved at the time of execution.

Note that using pipeline-level variables in any kind of Source action is not supported.
Also, the variables can only be used with pipeline type V2.

TypeScript:

```ts
declare const sourceAction: codepipeline_actions.S3SourceAction;
declare const sourceOutput: codepipeline.Artifact;
declare const deployBucket: s3.Bucket;

// Pipeline-level variable
const variable = new codepipeline.Variable({
  variableName: 'bucket-var',
  description: 'description',
  defaultValue: 'sample',
});

new codepipeline.Pipeline(this, 'Pipeline', {
  pipelineType: codepipeline.PipelineType.V2,
  variables: [variable],
  stages: [
    {
      stageName: 'Source',
      actions: [sourceAction],
    },
    {
      stageName: 'Deploy',
      actions: [
        new codepipeline_actions.S3DeployAction({
          actionName: 'DeployAction',
          // can reference the variables
          objectKey: `${variable.reference()}.txt`,
          input: sourceOutput,
          bucket: deployBucket,
        }),
      ],
    },
  ],
});
```

Python:

```python
# source_action: codepipeline_actions.S3SourceAction
# source_output: codepipeline.Artifact
# deploy_bucket: s3.Bucket

# Pipeline-level variable
variable = codepipeline.Variable(
    variable_name="bucket-var",
    description="description",
    default_value="sample"
)

codepipeline.Pipeline(self, "Pipeline",
    pipeline_type=codepipeline.PipelineType.V2,
    variables=[variable],
    stages=[codepipeline.StageProps(
        stage_name="Source",
        actions=[source_action]
    ), codepipeline.StageProps(
        stage_name="Deploy",
        actions=[
            codepipeline_actions.S3DeployAction(
                action_name="DeployAction",
                # can reference the variables
                object_key=f"{variable.reference()}.txt",
                input=source_output,
                bucket=deploy_bucket
            )
        ]
    )
    ]
)
```

Java:

```java
S3SourceAction sourceAction;
Artifact sourceOutput;
Bucket deployBucket;

// Pipeline-level variable
Variable variable = Variable.Builder.create()
        .variableName("bucket-var")
        .description("description")
        .defaultValue("sample")
        .build();

Pipeline.Builder.create(this, "Pipeline")
        .pipelineType(PipelineType.V2)
        .variables(List.of(variable))
        .stages(List.of(StageProps.builder()
                .stageName("Source")
                .actions(List.of(sourceAction))
                .build(), StageProps.builder()
                .stageName("Deploy")
                .actions(List.of(
                    S3DeployAction.Builder.create()
                            .actionName("DeployAction")
                            // can reference the variables
                            .objectKey(String.format("%s.txt", variable.reference()))
                            .input(sourceOutput)
                            .bucket(deployBucket)
                            .build()))
                .build()))
        .build();
```

C#:

```csharp
S3SourceAction sourceAction;
Artifact sourceOutput;
Bucket deployBucket;

// Pipeline-level variable
var variable = new Variable(new VariableProps {
    VariableName = "bucket-var",
    Description = "description",
    DefaultValue = "sample"
});

new Pipeline(this, "Pipeline", new PipelineProps {
    PipelineType = PipelineType.V2,
    Variables = new [] { variable },
    Stages = new [] { new StageProps {
        StageName = "Source",
        Actions = new [] { sourceAction }
    }, new StageProps {
        StageName = "Deploy",
        Actions = new [] {
            new S3DeployAction(new S3DeployActionProps {
                ActionName = "DeployAction",
                // can reference the variables
                ObjectKey = $"{variable.reference()}.txt",
                Input = sourceOutput,
                Bucket = deployBucket
            }) }
    } }
});
```

Go:

```go
var sourceAction S3SourceAction
var sourceOutput Artifact
var deployBucket Bucket

// Pipeline-level variable
variable := codepipeline.NewVariable(&VariableProps{
	VariableName: jsii.String("bucket-var"),
	Description: jsii.String("description"),
	DefaultValue: jsii.String("sample"),
})

codepipeline.NewPipeline(this, jsii.String("Pipeline"), &PipelineProps{
	PipelineType: codepipeline.PipelineType_V2,
	Variables: []Variable{
		variable,
	},
	Stages: []StageProps{
		&StageProps{
			StageName: jsii.String("Source"),
			Actions: []IAction{
				sourceAction,
			},
		},
		&StageProps{
			StageName: jsii.String("Deploy"),
			Actions: []IAction{
				codepipeline_actions.NewS3DeployAction(&S3DeployActionProps{
					ActionName: jsii.String("DeployAction"),
					// can reference the variables
					ObjectKey: fmt.Sprintf("%v.txt", variable.Reference()),
					Input: sourceOutput,
					Bucket: deployBucket,
				}),
			},
		},
	},
})
```

Or append a variable to an existing pipeline:

TypeScript:

```ts
declare const pipeline: codepipeline.Pipeline;

const variable = new codepipeline.Variable({
  variableName: 'bucket-var',
  description: 'description',
  defaultValue: 'sample',
});
pipeline.addVariable(variable);
```

Python:

```python
# pipeline: codepipeline.Pipeline

variable = codepipeline.Variable(
    variable_name="bucket-var",
    description="description",
    default_value="sample"
)
pipeline.add_variable(variable)
```

Java:

```java
Pipeline pipeline;

Variable variable = Variable.Builder.create()
        .variableName("bucket-var")
        .description("description")
        .defaultValue("sample")
        .build();
pipeline.addVariable(variable);
```

C#:

```csharp
Pipeline pipeline;

var variable = new Variable(new VariableProps {
    VariableName = "bucket-var",
    Description = "description",
    DefaultValue = "sample"
});
pipeline.AddVariable(variable);
```

Go:

```go
var pipeline Pipeline

variable := codepipeline.NewVariable(&VariableProps{
	VariableName: jsii.String("bucket-var"),
	Description: jsii.String("description"),
	DefaultValue: jsii.String("sample"),
})
pipeline.AddVariable(variable)
```

## Events

### Using a pipeline as an event target

A pipeline can be used as a target for a CloudWatch event rule:

TypeScript:

```ts
// A pipeline being used as a target for a CloudWatch event rule.
import * as targets from 'aws-cdk-lib/aws-events-targets';
import * as events from 'aws-cdk-lib/aws-events';

// kick off the pipeline every day
const rule = new events.Rule(this, 'Daily', {
  schedule: events.Schedule.rate(Duration.days(1)),
});

declare const pipeline: codepipeline.Pipeline;
rule.addTarget(new targets.CodePipeline(pipeline));
```

Python:

```python
# A pipeline being used as a target for a CloudWatch event rule.
import aws_cdk.aws_events_targets as targets
import aws_cdk.aws_events as events

# pipeline: codepipeline.Pipeline

# kick off the pipeline every day
rule = events.Rule(self, "Daily",
    schedule=events.Schedule.rate(Duration.days(1))
)
rule.add_target(targets.CodePipeline(pipeline))
```

Java:

```java
// A pipeline being used as a target for a CloudWatch event rule.
import software.amazon.awscdk.services.events.targets.*;
import software.amazon.awscdk.services.events.*;

Pipeline pipeline;

// kick off the pipeline every day
Rule rule = Rule.Builder.create(this, "Daily")
        .schedule(Schedule.rate(Duration.days(1)))
        .build();
rule.addTarget(new CodePipeline(pipeline));
```

C#:

```csharp
// A pipeline being used as a target for a CloudWatch event rule.
using Amazon.CDK.AWS.Events.Targets;
using Amazon.CDK.AWS.Events;

Pipeline pipeline;

// kick off the pipeline every day
var rule = new Rule(this, "Daily", new RuleProps {
    Schedule = Schedule.Rate(Duration.Days(1))
});
rule.AddTarget(new CodePipeline(pipeline));
```

Go:

```go
// A pipeline being used as a target for a CloudWatch event rule.
import targets "github.com/aws/aws-cdk-go/awscdk"
import "github.com/aws/aws-cdk-go/awscdk"

var pipeline Pipeline

// kick off the pipeline every day
rule := events.NewRule(this, jsii.String("Daily"), &RuleProps{
	Schedule: events.Schedule_Rate(awscdk.Duration_Days(jsii.Number(1))),
})
rule.AddTarget(targets.NewCodePipeline(pipeline))
```

When a pipeline is used as an event target, the
"codepipeline:StartPipelineExecution" permission is granted to the AWS
CloudWatch Events service.

### Event sources

Pipelines emit CloudWatch events. To define event rules for events emitted by
the pipeline, stages or action, use the `onXxx` methods on the respective
construct:

TypeScript:

```ts
// Define event rules for events emitted by the pipeline
import * as events from 'aws-cdk-lib/aws-events';

declare const myPipeline: codepipeline.Pipeline;
declare const myStage: codepipeline.IStage;
declare const myAction: codepipeline.Action;
declare const target: events.IRuleTarget;
myPipeline.onStateChange('MyPipelineStateChange', { target: target } );
myStage.onStateChange('MyStageStateChange', target);
myAction.onStateChange('MyActionStateChange', target);
```

Python:

```python
# Define event rules for events emitted by the pipeline
import aws_cdk.aws_events as events

# my_pipeline: codepipeline.Pipeline
# my_stage: codepipeline.IStage
# my_action: codepipeline.Action
# target: events.IRuleTarget

my_pipeline.on_state_change("MyPipelineStateChange", target=target)
my_stage.on_state_change("MyStageStateChange", target)
my_action.on_state_change("MyActionStateChange", target)
```

Java:

```java
// Define event rules for events emitted by the pipeline
import software.amazon.awscdk.services.events.*;

Pipeline myPipeline;
IStage myStage;
Action myAction;
IRuleTarget target;

myPipeline.onStateChange("MyPipelineStateChange", OnEventOptions.builder().target(target).build());
myStage.onStateChange("MyStageStateChange", target);
myAction.onStateChange("MyActionStateChange", target);
```

C#:

```csharp
// Define event rules for events emitted by the pipeline
using Amazon.CDK.AWS.Events;

Pipeline myPipeline;
IStage myStage;
Action myAction;
IRuleTarget target;

myPipeline.OnStateChange("MyPipelineStateChange", new OnEventOptions { Target = target });
myStage.OnStateChange("MyStageStateChange", target);
myAction.OnStateChange("MyActionStateChange", target);
```

Go:

```go
// Define event rules for events emitted by the pipeline
import events "github.com/aws/aws-cdk-go/awscdk"

var myPipeline Pipeline
var myStage IStage
var myAction Action
var target IRuleTarget

myPipeline.onStateChange(jsii.String("MyPipelineStateChange"), &OnEventOptions{
	Target: target,
})
myStage.OnStateChange(jsii.String("MyStageStateChange"), target)
myAction.OnStateChange(jsii.String("MyActionStateChange"), target)
```

## CodeStar Notifications

To define CodeStar Notification rules for Pipelines, use one of the `notifyOnXxx()` methods.
They are very similar to `onXxx()` methods for CloudWatch events:

TypeScript:

```ts
// Define CodeStar Notification rules for Pipelines
import * as chatbot from 'aws-cdk-lib/aws-chatbot';
const target = new chatbot.SlackChannelConfiguration(this, 'MySlackChannel', {
  slackChannelConfigurationName: 'YOUR_CHANNEL_NAME',
  slackWorkspaceId: 'YOUR_SLACK_WORKSPACE_ID',
  slackChannelId: 'YOUR_SLACK_CHANNEL_ID',
});

declare const pipeline: codepipeline.Pipeline;
const rule = pipeline.notifyOnExecutionStateChange('NotifyOnExecutionStateChange', target);
```

Python:

```python
# Define CodeStar Notification rules for Pipelines
import aws_cdk.aws_chatbot as chatbot

# pipeline: codepipeline.Pipeline

target = chatbot.SlackChannelConfiguration(self, "MySlackChannel",
    slack_channel_configuration_name="YOUR_CHANNEL_NAME",
    slack_workspace_id="YOUR_SLACK_WORKSPACE_ID",
    slack_channel_id="YOUR_SLACK_CHANNEL_ID"
)
rule = pipeline.notify_on_execution_state_change("NotifyOnExecutionStateChange", target)
```

Java:

```java
// Define CodeStar Notification rules for Pipelines
import software.amazon.awscdk.services.chatbot.*;

Pipeline pipeline;

SlackChannelConfiguration target = SlackChannelConfiguration.Builder.create(this, "MySlackChannel")
        .slackChannelConfigurationName("YOUR_CHANNEL_NAME")
        .slackWorkspaceId("YOUR_SLACK_WORKSPACE_ID")
        .slackChannelId("YOUR_SLACK_CHANNEL_ID")
        .build();
INotificationRule rule = pipeline.notifyOnExecutionStateChange("NotifyOnExecutionStateChange", target);
```

C#:

```csharp
// Define CodeStar Notification rules for Pipelines
using Amazon.CDK.AWS.Chatbot;

Pipeline pipeline;

var target = new SlackChannelConfiguration(this, "MySlackChannel", new SlackChannelConfigurationProps {
    SlackChannelConfigurationName = "YOUR_CHANNEL_NAME",
    SlackWorkspaceId = "YOUR_SLACK_WORKSPACE_ID",
    SlackChannelId = "YOUR_SLACK_CHANNEL_ID"
});
var rule = pipeline.NotifyOnExecutionStateChange("NotifyOnExecutionStateChange", target);
```

Go:

```go
// Define CodeStar Notification rules for Pipelines
import chatbot "github.com/aws/aws-cdk-go/awscdk"

var pipeline Pipeline

target := chatbot.NewSlackChannelConfiguration(this, jsii.String("MySlackChannel"), &SlackChannelConfigurationProps{
	SlackChannelConfigurationName: jsii.String("YOUR_CHANNEL_NAME"),
	SlackWorkspaceId: jsii.String("YOUR_SLACK_WORKSPACE_ID"),
	SlackChannelId: jsii.String("YOUR_SLACK_CHANNEL_ID"),
})
rule := pipeline.notifyOnExecutionStateChange(jsii.String("NotifyOnExecutionStateChange"), target)
```

## Trigger

To trigger a pipeline with Git tags or branches, specify the `triggers` property.
The triggers can only be used with pipeline type V2.

### Push filter

Pipelines can be started based on push events. You can specify the `pushFilter` property to
filter the push events. The `pushFilter` can specify Git tags and branches.

In the case of Git tags, your pipeline starts when a Git tag is pushed.
You can filter with glob patterns. The `tagsExcludes` takes priority over the `tagsIncludes`.

TypeScript:

```ts
declare const sourceAction: codepipeline_actions.CodeStarConnectionsSourceAction;
declare const buildAction: codepipeline_actions.CodeBuildAction;

new codepipeline.Pipeline(this, 'Pipeline', {
  pipelineType: codepipeline.PipelineType.V2,
  stages: [
    {
      stageName: 'Source',
      actions: [sourceAction],
    },
    {
      stageName: 'Build',
      actions: [buildAction],
    },
  ],
  triggers: [{
    providerType: codepipeline.ProviderType.CODE_STAR_SOURCE_CONNECTION,
    gitConfiguration: {
      sourceAction,
      pushFilter: [{
        tagsExcludes: ['exclude1', 'exclude2'],
        tagsIncludes: ['include*'],
      }],
    },
  }],
});
```

Python:

```python
# source_action: codepipeline_actions.CodeStarConnectionsSourceAction
# build_action: codepipeline_actions.CodeBuildAction

codepipeline.Pipeline(self, "Pipeline",
    pipeline_type=codepipeline.PipelineType.V2,
    stages=[codepipeline.StageProps(
        stage_name="Source",
        actions=[source_action]
    ), codepipeline.StageProps(
        stage_name="Build",
        actions=[build_action]
    )
    ],
    triggers=[codepipeline.TriggerProps(
        provider_type=codepipeline.ProviderType.CODE_STAR_SOURCE_CONNECTION,
        git_configuration=codepipeline.GitConfiguration(
            source_action=source_action,
            push_filter=[codepipeline.GitPushFilter(
                tags_excludes=["exclude1", "exclude2"],
                tags_includes=["include*"]
            )]
        )
    )]
)
```

Java:

```java
CodeStarConnectionsSourceAction sourceAction;
CodeBuildAction buildAction;

Pipeline.Builder.create(this, "Pipeline")
        .pipelineType(PipelineType.V2)
        .stages(List.of(StageProps.builder()
                .stageName("Source")
                .actions(List.of(sourceAction))
                .build(), StageProps.builder()
                .stageName("Build")
                .actions(List.of(buildAction))
                .build()))
        .triggers(List.of(TriggerProps.builder()
                .providerType(ProviderType.CODE_STAR_SOURCE_CONNECTION)
                .gitConfiguration(GitConfiguration.builder()
                        .sourceAction(sourceAction)
                        .pushFilter(List.of(GitPushFilter.builder()
                                .tagsExcludes(List.of("exclude1", "exclude2"))
                                .tagsIncludes(List.of("include*"))
                                .build()))
                        .build())
                .build()))
        .build();
```

C#:

```csharp
CodeStarConnectionsSourceAction sourceAction;
CodeBuildAction buildAction;

new Pipeline(this, "Pipeline", new PipelineProps {
    PipelineType = PipelineType.V2,
    Stages = new [] { new StageProps {
        StageName = "Source",
        Actions = new [] { sourceAction }
    }, new StageProps {
        StageName = "Build",
        Actions = new [] { buildAction }
    } },
    Triggers = new [] { new TriggerProps {
        ProviderType = ProviderType.CODE_STAR_SOURCE_CONNECTION,
        GitConfiguration = new GitConfiguration {
            SourceAction = sourceAction,
            PushFilter = new [] { new GitPushFilter {
                TagsExcludes = new [] { "exclude1", "exclude2" },
                TagsIncludes = new [] { "include*" }
            } }
        }
    } }
});
```

Go:

```go
var sourceAction CodeStarConnectionsSourceAction
var buildAction CodeBuildAction

codepipeline.NewPipeline(this, jsii.String("Pipeline"), &PipelineProps{
	PipelineType: codepipeline.PipelineType_V2,
	Stages: []StageProps{
		&StageProps{
			StageName: jsii.String("Source"),
			Actions: []IAction{
				sourceAction,
			},
		},
		&StageProps{
			StageName: jsii.String("Build"),
			Actions: []IAction{
				buildAction,
			},
		},
	},
	Triggers: []TriggerProps{
		&TriggerProps{
			ProviderType: codepipeline.ProviderType_CODE_STAR_SOURCE_CONNECTION,
			GitConfiguration: &GitConfiguration{
				SourceAction: *SourceAction,
				PushFilter: []GitPushFilter{
					&GitPushFilter{
						TagsExcludes: []*string{
							jsii.String("exclude1"),
							jsii.String("exclude2"),
						},
						TagsIncludes: []*string{
							jsii.String("include*"),
						},
					},
				},
			},
		},
	},
})
```

In the case of branches, your pipeline starts when a commit is pushed on the specified branches.
You can filter with glob patterns. The `branchesExcludes` takes priority over the `branchesIncludes`.

TypeScript:

```ts
declare const sourceAction: codepipeline_actions.CodeStarConnectionsSourceAction;
declare const buildAction: codepipeline_actions.CodeBuildAction;

new codepipeline.Pipeline(this, 'Pipeline', {
  pipelineType: codepipeline.PipelineType.V2,
  stages: [
    {
      stageName: 'Source',
      actions: [sourceAction],
    },
    {
      stageName: 'Build',
      actions: [buildAction],
    },
  ],
  triggers: [{
    providerType: codepipeline.ProviderType.CODE_STAR_SOURCE_CONNECTION,
    gitConfiguration: {
      sourceAction,
      pushFilter: [{
        branchesExcludes: ['exclude1', 'exclude2'],
        branchesIncludes: ['include*'],
      }],
    },
  }],
});
```

Python:

```python
# source_action: codepipeline_actions.CodeStarConnectionsSourceAction
# build_action: codepipeline_actions.CodeBuildAction

codepipeline.Pipeline(self, "Pipeline",
    pipeline_type=codepipeline.PipelineType.V2,
    stages=[codepipeline.StageProps(
        stage_name="Source",
        actions=[source_action]
    ), codepipeline.StageProps(
        stage_name="Build",
        actions=[build_action]
    )
    ],
    triggers=[codepipeline.TriggerProps(
        provider_type=codepipeline.ProviderType.CODE_STAR_SOURCE_CONNECTION,
        git_configuration=codepipeline.GitConfiguration(
            source_action=source_action,
            push_filter=[codepipeline.GitPushFilter(
                branches_excludes=["exclude1", "exclude2"],
                branches_includes=["include*"]
            )]
        )
    )]
)
```

Java:

```java
CodeStarConnectionsSourceAction sourceAction;
CodeBuildAction buildAction;

Pipeline.Builder.create(this, "Pipeline")
        .pipelineType(PipelineType.V2)
        .stages(List.of(StageProps.builder()
                .stageName("Source")
                .actions(List.of(sourceAction))
                .build(), StageProps.builder()
                .stageName("Build")
                .actions(List.of(buildAction))
                .build()))
        .triggers(List.of(TriggerProps.builder()
                .providerType(ProviderType.CODE_STAR_SOURCE_CONNECTION)
                .gitConfiguration(GitConfiguration.builder()
                        .sourceAction(sourceAction)
                        .pushFilter(List.of(GitPushFilter.builder()
                                .branchesExcludes(List.of("exclude1", "exclude2"))
                                .branchesIncludes(List.of("include*"))
                                .build()))
                        .build())
                .build()))
        .build();
```

C#:

```csharp
CodeStarConnectionsSourceAction sourceAction;
CodeBuildAction buildAction;

new Pipeline(this, "Pipeline", new PipelineProps {
    PipelineType = PipelineType.V2,
    Stages = new [] { new StageProps {
        StageName = "Source",
        Actions = new [] { sourceAction }
    }, new StageProps {
        StageName = "Build",
        Actions = new [] { buildAction }
    } },
    Triggers = new [] { new TriggerProps {
        ProviderType = ProviderType.CODE_STAR_SOURCE_CONNECTION,
        GitConfiguration = new GitConfiguration {
            SourceAction = sourceAction,
            PushFilter = new [] { new GitPushFilter {
                BranchesExcludes = new [] { "exclude1", "exclude2" },
                BranchesIncludes = new [] { "include*" }
            } }
        }
    } }
});
```

Go:

```go
var sourceAction CodeStarConnectionsSourceAction
var buildAction CodeBuildAction

codepipeline.NewPipeline(this, jsii.String("Pipeline"), &PipelineProps{
	PipelineType: codepipeline.PipelineType_V2,
	Stages: []StageProps{
		&StageProps{
			StageName: jsii.String("Source"),
			Actions: []IAction{
				sourceAction,
			},
		},
		&StageProps{
			StageName: jsii.String("Build"),
			Actions: []IAction{
				buildAction,
			},
		},
	},
	Triggers: []TriggerProps{
		&TriggerProps{
			ProviderType: codepipeline.ProviderType_CODE_STAR_SOURCE_CONNECTION,
			GitConfiguration: &GitConfiguration{
				SourceAction: *SourceAction,
				PushFilter: []GitPushFilter{
					&GitPushFilter{
						BranchesExcludes: []*string{
							jsii.String("exclude1"),
							jsii.String("exclude2"),
						},
						BranchesIncludes: []*string{
							jsii.String("include*"),
						},
					},
				},
			},
		},
	},
})
```

File paths can also be specified along with the branches to start the pipeline.
You can filter with glob patterns. The `filePathsExcludes` takes priority over the `filePathsIncludes`.

TypeScript:

```ts
declare const sourceAction: codepipeline_actions.CodeStarConnectionsSourceAction;
declare const buildAction: codepipeline_actions.CodeBuildAction;

new codepipeline.Pipeline(this, 'Pipeline', {
  pipelineType: codepipeline.PipelineType.V2,
  stages: [
    {
      stageName: 'Source',
      actions: [sourceAction],
    },
    {
      stageName: 'Build',
      actions: [buildAction],
    },
  ],
  triggers: [{
    providerType: codepipeline.ProviderType.CODE_STAR_SOURCE_CONNECTION,
    gitConfiguration: {
      sourceAction,
      pushFilter: [{
        branchesExcludes: ['exclude1', 'exclude2'],
        branchesIncludes: ['include1', 'include2'],
        filePathsExcludes: ['/path/to/exclude1', '/path/to/exclude2'],
        filePathsIncludes: ['/path/to/include1', '/path/to/include1'],
      }],
    },
  }],
});
```

Python:

```python
# source_action: codepipeline_actions.CodeStarConnectionsSourceAction
# build_action: codepipeline_actions.CodeBuildAction

codepipeline.Pipeline(self, "Pipeline",
    pipeline_type=codepipeline.PipelineType.V2,
    stages=[codepipeline.StageProps(
        stage_name="Source",
        actions=[source_action]
    ), codepipeline.StageProps(
        stage_name="Build",
        actions=[build_action]
    )
    ],
    triggers=[codepipeline.TriggerProps(
        provider_type=codepipeline.ProviderType.CODE_STAR_SOURCE_CONNECTION,
        git_configuration=codepipeline.GitConfiguration(
            source_action=source_action,
            push_filter=[codepipeline.GitPushFilter(
                branches_excludes=["exclude1", "exclude2"],
                branches_includes=["include1", "include2"],
                file_paths_excludes=["/path/to/exclude1", "/path/to/exclude2"],
                file_paths_includes=["/path/to/include1", "/path/to/include1"]
            )]
        )
    )]
)
```

Java:

```java
CodeStarConnectionsSourceAction sourceAction;
CodeBuildAction buildAction;

Pipeline.Builder.create(this, "Pipeline")
        .pipelineType(PipelineType.V2)
        .stages(List.of(StageProps.builder()
                .stageName("Source")
                .actions(List.of(sourceAction))
                .build(), StageProps.builder()
                .stageName("Build")
                .actions(List.of(buildAction))
                .build()))
        .triggers(List.of(TriggerProps.builder()
                .providerType(ProviderType.CODE_STAR_SOURCE_CONNECTION)
                .gitConfiguration(GitConfiguration.builder()
                        .sourceAction(sourceAction)
                        .pushFilter(List.of(GitPushFilter.builder()
                                .branchesExcludes(List.of("exclude1", "exclude2"))
                                .branchesIncludes(List.of("include1", "include2"))
                                .filePathsExcludes(List.of("/path/to/exclude1", "/path/to/exclude2"))
                                .filePathsIncludes(List.of("/path/to/include1", "/path/to/include1"))
                                .build()))
                        .build())
                .build()))
        .build();
```

C#:

```csharp
CodeStarConnectionsSourceAction sourceAction;
CodeBuildAction buildAction;

new Pipeline(this, "Pipeline", new PipelineProps {
    PipelineType = PipelineType.V2,
    Stages = new [] { new StageProps {
        StageName = "Source",
        Actions = new [] { sourceAction }
    }, new StageProps {
        StageName = "Build",
        Actions = new [] { buildAction }
    } },
    Triggers = new [] { new TriggerProps {
        ProviderType = ProviderType.CODE_STAR_SOURCE_CONNECTION,
        GitConfiguration = new GitConfiguration {
            SourceAction = sourceAction,
            PushFilter = new [] { new GitPushFilter {
                BranchesExcludes = new [] { "exclude1", "exclude2" },
                BranchesIncludes = new [] { "include1", "include2" },
                FilePathsExcludes = new [] { "/path/to/exclude1", "/path/to/exclude2" },
                FilePathsIncludes = new [] { "/path/to/include1", "/path/to/include1" }
            } }
        }
    } }
});
```

Go:

```go
var sourceAction CodeStarConnectionsSourceAction
var buildAction CodeBuildAction

codepipeline.NewPipeline(this, jsii.String("Pipeline"), &PipelineProps{
	PipelineType: codepipeline.PipelineType_V2,
	Stages: []StageProps{
		&StageProps{
			StageName: jsii.String("Source"),
			Actions: []IAction{
				sourceAction,
			},
		},
		&StageProps{
			StageName: jsii.String("Build"),
			Actions: []IAction{
				buildAction,
			},
		},
	},
	Triggers: []TriggerProps{
		&TriggerProps{
			ProviderType: codepipeline.ProviderType_CODE_STAR_SOURCE_CONNECTION,
			GitConfiguration: &GitConfiguration{
				SourceAction: *SourceAction,
				PushFilter: []GitPushFilter{
					&GitPushFilter{
						BranchesExcludes: []*string{
							jsii.String("exclude1"),
							jsii.String("exclude2"),
						},
						BranchesIncludes: []*string{
							jsii.String("include1"),
							jsii.String("include2"),
						},
						FilePathsExcludes: []*string{
							jsii.String("/path/to/exclude1"),
							jsii.String("/path/to/exclude2"),
						},
						FilePathsIncludes: []*string{
							jsii.String("/path/to/include1"),
							jsii.String("/path/to/include1"),
						},
					},
				},
			},
		},
	},
})
```

### Pull request filter

Pipelines can be started based on pull request events. You can specify the `pullRequestFilter` property to
filter the pull request events. The `pullRequestFilter` can specify branches, file paths, and event types.

In the case of branches, your pipeline starts when a pull request event occurs on the specified branches.
You can filter with glob patterns. The `branchesExcludes` takes priority over the `branchesIncludes`.

TypeScript:

```ts
declare const sourceAction: codepipeline_actions.CodeStarConnectionsSourceAction;
declare const buildAction: codepipeline_actions.CodeBuildAction;

new codepipeline.Pipeline(this, 'Pipeline', {
  pipelineType: codepipeline.PipelineType.V2,
  stages: [
    {
      stageName: 'Source',
      actions: [sourceAction],
    },
    {
      stageName: 'Build',
      actions: [buildAction],
    },
  ],
  triggers: [{
    providerType: codepipeline.ProviderType.CODE_STAR_SOURCE_CONNECTION,
    gitConfiguration: {
      sourceAction,
      pullRequestFilter: [{
        branchesExcludes: ['exclude1', 'exclude2'],
        branchesIncludes: ['include*'],
      }],
    },
  }],
});
```

Python:

```python
# source_action: codepipeline_actions.CodeStarConnectionsSourceAction
# build_action: codepipeline_actions.CodeBuildAction

codepipeline.Pipeline(self, "Pipeline",
    pipeline_type=codepipeline.PipelineType.V2,
    stages=[codepipeline.StageProps(
        stage_name="Source",
        actions=[source_action]
    ), codepipeline.StageProps(
        stage_name="Build",
        actions=[build_action]
    )
    ],
    triggers=[codepipeline.TriggerProps(
        provider_type=codepipeline.ProviderType.CODE_STAR_SOURCE_CONNECTION,
        git_configuration=codepipeline.GitConfiguration(
            source_action=source_action,
            pull_request_filter=[codepipeline.GitPullRequestFilter(
                branches_excludes=["exclude1", "exclude2"],
                branches_includes=["include*"]
            )]
        )
    )]
)
```

Java:

```java
CodeStarConnectionsSourceAction sourceAction;
CodeBuildAction buildAction;

Pipeline.Builder.create(this, "Pipeline")
        .pipelineType(PipelineType.V2)
        .stages(List.of(StageProps.builder()
                .stageName("Source")
                .actions(List.of(sourceAction))
                .build(), StageProps.builder()
                .stageName("Build")
                .actions(List.of(buildAction))
                .build()))
        .triggers(List.of(TriggerProps.builder()
                .providerType(ProviderType.CODE_STAR_SOURCE_CONNECTION)
                .gitConfiguration(GitConfiguration.builder()
                        .sourceAction(sourceAction)
                        .pullRequestFilter(List.of(GitPullRequestFilter.builder()
                                .branchesExcludes(List.of("exclude1", "exclude2"))
                                .branchesIncludes(List.of("include*"))
                                .build()))
                        .build())
                .build()))
        .build();
```

C#:

```csharp
CodeStarConnectionsSourceAction sourceAction;
CodeBuildAction buildAction;

new Pipeline(this, "Pipeline", new PipelineProps {
    PipelineType = PipelineType.V2,
    Stages = new [] { new StageProps {
        StageName = "Source",
        Actions = new [] { sourceAction }
    }, new StageProps {
        StageName = "Build",
        Actions = new [] { buildAction }
    } },
    Triggers = new [] { new TriggerProps {
        ProviderType = ProviderType.CODE_STAR_SOURCE_CONNECTION,
        GitConfiguration = new GitConfiguration {
            SourceAction = sourceAction,
            PullRequestFilter = new [] { new GitPullRequestFilter {
                BranchesExcludes = new [] { "exclude1", "exclude2" },
                BranchesIncludes = new [] { "include*" }
            } }
        }
    } }
});
```

Go:

```go
var sourceAction CodeStarConnectionsSourceAction
var buildAction CodeBuildAction

codepipeline.NewPipeline(this, jsii.String("Pipeline"), &PipelineProps{
	PipelineType: codepipeline.PipelineType_V2,
	Stages: []StageProps{
		&StageProps{
			StageName: jsii.String("Source"),
			Actions: []IAction{
				sourceAction,
			},
		},
		&StageProps{
			StageName: jsii.String("Build"),
			Actions: []IAction{
				buildAction,
			},
		},
	},
	Triggers: []TriggerProps{
		&TriggerProps{
			ProviderType: codepipeline.ProviderType_CODE_STAR_SOURCE_CONNECTION,
			GitConfiguration: &GitConfiguration{
				SourceAction: *SourceAction,
				PullRequestFilter: []GitPullRequestFilter{
					&GitPullRequestFilter{
						BranchesExcludes: []*string{
							jsii.String("exclude1"),
							jsii.String("exclude2"),
						},
						BranchesIncludes: []*string{
							jsii.String("include*"),
						},
					},
				},
			},
		},
	},
})
```

File paths can also be specified along with the branches to start the pipeline.
You can filter with glob patterns. The `filePathsExcludes` takes priority over the `filePathsIncludes`.

TypeScript:

```ts
declare const sourceAction: codepipeline_actions.CodeStarConnectionsSourceAction;
declare const buildAction: codepipeline_actions.CodeBuildAction;

new codepipeline.Pipeline(this, 'Pipeline', {
  pipelineType: codepipeline.PipelineType.V2,
  stages: [
    {
      stageName: 'Source',
      actions: [sourceAction],
    },
    {
      stageName: 'Build',
      actions: [buildAction],
    },
  ],
  triggers: [{
    providerType: codepipeline.ProviderType.CODE_STAR_SOURCE_CONNECTION,
    gitConfiguration: {
      sourceAction,
      pullRequestFilter: [{
        branchesExcludes: ['exclude1', 'exclude2'],
        branchesIncludes: ['include1', 'include2'],
        filePathsExcludes: ['/path/to/exclude1', '/path/to/exclude2'],
        filePathsIncludes: ['/path/to/include1', '/path/to/include1'],
      }],
    },
  }],
});
```

Python:

```python
# source_action: codepipeline_actions.CodeStarConnectionsSourceAction
# build_action: codepipeline_actions.CodeBuildAction

codepipeline.Pipeline(self, "Pipeline",
    pipeline_type=codepipeline.PipelineType.V2,
    stages=[codepipeline.StageProps(
        stage_name="Source",
        actions=[source_action]
    ), codepipeline.StageProps(
        stage_name="Build",
        actions=[build_action]
    )
    ],
    triggers=[codepipeline.TriggerProps(
        provider_type=codepipeline.ProviderType.CODE_STAR_SOURCE_CONNECTION,
        git_configuration=codepipeline.GitConfiguration(
            source_action=source_action,
            pull_request_filter=[codepipeline.GitPullRequestFilter(
                branches_excludes=["exclude1", "exclude2"],
                branches_includes=["include1", "include2"],
                file_paths_excludes=["/path/to/exclude1", "/path/to/exclude2"],
                file_paths_includes=["/path/to/include1", "/path/to/include1"]
            )]
        )
    )]
)
```

Java:

```java
CodeStarConnectionsSourceAction sourceAction;
CodeBuildAction buildAction;

Pipeline.Builder.create(this, "Pipeline")
        .pipelineType(PipelineType.V2)
        .stages(List.of(StageProps.builder()
                .stageName("Source")
                .actions(List.of(sourceAction))
                .build(), StageProps.builder()
                .stageName("Build")
                .actions(List.of(buildAction))
                .build()))
        .triggers(List.of(TriggerProps.builder()
                .providerType(ProviderType.CODE_STAR_SOURCE_CONNECTION)
                .gitConfiguration(GitConfiguration.builder()
                        .sourceAction(sourceAction)
                        .pullRequestFilter(List.of(GitPullRequestFilter.builder()
                                .branchesExcludes(List.of("exclude1", "exclude2"))
                                .branchesIncludes(List.of("include1", "include2"))
                                .filePathsExcludes(List.of("/path/to/exclude1", "/path/to/exclude2"))
                                .filePathsIncludes(List.of("/path/to/include1", "/path/to/include1"))
                                .build()))
                        .build())
                .build()))
        .build();
```

C#:

```csharp
CodeStarConnectionsSourceAction sourceAction;
CodeBuildAction buildAction;

new Pipeline(this, "Pipeline", new PipelineProps {
    PipelineType = PipelineType.V2,
    Stages = new [] { new StageProps {
        StageName = "Source",
        Actions = new [] { sourceAction }
    }, new StageProps {
        StageName = "Build",
        Actions = new [] { buildAction }
    } },
    Triggers = new [] { new TriggerProps {
        ProviderType = ProviderType.CODE_STAR_SOURCE_CONNECTION,
        GitConfiguration = new GitConfiguration {
            SourceAction = sourceAction,
            PullRequestFilter = new [] { new GitPullRequestFilter {
                BranchesExcludes = new [] { "exclude1", "exclude2" },
                BranchesIncludes = new [] { "include1", "include2" },
                FilePathsExcludes = new [] { "/path/to/exclude1", "/path/to/exclude2" },
                FilePathsIncludes = new [] { "/path/to/include1", "/path/to/include1" }
            } }
        }
    } }
});
```

Go:

```go
var sourceAction CodeStarConnectionsSourceAction
var buildAction CodeBuildAction

codepipeline.NewPipeline(this, jsii.String("Pipeline"), &PipelineProps{
	PipelineType: codepipeline.PipelineType_V2,
	Stages: []StageProps{
		&StageProps{
			StageName: jsii.String("Source"),
			Actions: []IAction{
				sourceAction,
			},
		},
		&StageProps{
			StageName: jsii.String("Build"),
			Actions: []IAction{
				buildAction,
			},
		},
	},
	Triggers: []TriggerProps{
		&TriggerProps{
			ProviderType: codepipeline.ProviderType_CODE_STAR_SOURCE_CONNECTION,
			GitConfiguration: &GitConfiguration{
				SourceAction: *SourceAction,
				PullRequestFilter: []GitPullRequestFilter{
					&GitPullRequestFilter{
						BranchesExcludes: []*string{
							jsii.String("exclude1"),
							jsii.String("exclude2"),
						},
						BranchesIncludes: []*string{
							jsii.String("include1"),
							jsii.String("include2"),
						},
						FilePathsExcludes: []*string{
							jsii.String("/path/to/exclude1"),
							jsii.String("/path/to/exclude2"),
						},
						FilePathsIncludes: []*string{
							jsii.String("/path/to/include1"),
							jsii.String("/path/to/include1"),
						},
					},
				},
			},
		},
	},
})
```

To filter types of pull request events for triggers, you can specify the `events` property.

TypeScript:

```ts
declare const sourceAction: codepipeline_actions.CodeStarConnectionsSourceAction;
declare const buildAction: codepipeline_actions.CodeBuildAction;

new codepipeline.Pipeline(this, 'Pipeline', {
  pipelineType: codepipeline.PipelineType.V2,
  stages: [
    {
      stageName: 'Source',
      actions: [sourceAction],
    },
    {
      stageName: 'Build',
      actions: [buildAction],
    },
  ],
  triggers: [{
    providerType: codepipeline.ProviderType.CODE_STAR_SOURCE_CONNECTION,
    gitConfiguration: {
      sourceAction,
      pullRequestFilter: [{
        branchesExcludes: ['exclude1', 'exclude2'],
        branchesIncludes: ['include1', 'include2'],
        events: [
          codepipeline.GitPullRequestEvent.OPEN,
          codepipeline.GitPullRequestEvent.CLOSED,
        ],
      }],
    },
  }],
});
```

Python:

```python
# source_action: codepipeline_actions.CodeStarConnectionsSourceAction
# build_action: codepipeline_actions.CodeBuildAction

codepipeline.Pipeline(self, "Pipeline",
    pipeline_type=codepipeline.PipelineType.V2,
    stages=[codepipeline.StageProps(
        stage_name="Source",
        actions=[source_action]
    ), codepipeline.StageProps(
        stage_name="Build",
        actions=[build_action]
    )
    ],
    triggers=[codepipeline.TriggerProps(
        provider_type=codepipeline.ProviderType.CODE_STAR_SOURCE_CONNECTION,
        git_configuration=codepipeline.GitConfiguration(
            source_action=source_action,
            pull_request_filter=[codepipeline.GitPullRequestFilter(
                branches_excludes=["exclude1", "exclude2"],
                branches_includes=["include1", "include2"],
                events=[codepipeline.GitPullRequestEvent.OPEN, codepipeline.GitPullRequestEvent.CLOSED
                ]
            )]
        )
    )]
)
```

Java:

```java
CodeStarConnectionsSourceAction sourceAction;
CodeBuildAction buildAction;

Pipeline.Builder.create(this, "Pipeline")
        .pipelineType(PipelineType.V2)
        .stages(List.of(StageProps.builder()
                .stageName("Source")
                .actions(List.of(sourceAction))
                .build(), StageProps.builder()
                .stageName("Build")
                .actions(List.of(buildAction))
                .build()))
        .triggers(List.of(TriggerProps.builder()
                .providerType(ProviderType.CODE_STAR_SOURCE_CONNECTION)
                .gitConfiguration(GitConfiguration.builder()
                        .sourceAction(sourceAction)
                        .pullRequestFilter(List.of(GitPullRequestFilter.builder()
                                .branchesExcludes(List.of("exclude1", "exclude2"))
                                .branchesIncludes(List.of("include1", "include2"))
                                .events(List.of(GitPullRequestEvent.OPEN, GitPullRequestEvent.CLOSED))
                                .build()))
                        .build())
                .build()))
        .build();
```

C#:

```csharp
CodeStarConnectionsSourceAction sourceAction;
CodeBuildAction buildAction;

new Pipeline(this, "Pipeline", new PipelineProps {
    PipelineType = PipelineType.V2,
    Stages = new [] { new StageProps {
        StageName = "Source",
        Actions = new [] { sourceAction }
    }, new StageProps {
        StageName = "Build",
        Actions = new [] { buildAction }
    } },
    Triggers = new [] { new TriggerProps {
        ProviderType = ProviderType.CODE_STAR_SOURCE_CONNECTION,
        GitConfiguration = new GitConfiguration {
            SourceAction = sourceAction,
            PullRequestFilter = new [] { new GitPullRequestFilter {
                BranchesExcludes = new [] { "exclude1", "exclude2" },
                BranchesIncludes = new [] { "include1", "include2" },
                Events = new [] { GitPullRequestEvent.OPEN, GitPullRequestEvent.CLOSED }
            } }
        }
    } }
});
```

Go:

```go
var sourceAction CodeStarConnectionsSourceAction
var buildAction CodeBuildAction

codepipeline.NewPipeline(this, jsii.String("Pipeline"), &PipelineProps{
	PipelineType: codepipeline.PipelineType_V2,
	Stages: []StageProps{
		&StageProps{
			StageName: jsii.String("Source"),
			Actions: []IAction{
				sourceAction,
			},
		},
		&StageProps{
			StageName: jsii.String("Build"),
			Actions: []IAction{
				buildAction,
			},
		},
	},
	Triggers: []TriggerProps{
		&TriggerProps{
			ProviderType: codepipeline.ProviderType_CODE_STAR_SOURCE_CONNECTION,
			GitConfiguration: &GitConfiguration{
				SourceAction: *SourceAction,
				PullRequestFilter: []GitPullRequestFilter{
					&GitPullRequestFilter{
						BranchesExcludes: []*string{
							jsii.String("exclude1"),
							jsii.String("exclude2"),
						},
						BranchesIncludes: []*string{
							jsii.String("include1"),
							jsii.String("include2"),
						},
						Events: []GitPullRequestEvent{
							codepipeline.GitPullRequestEvent_OPEN,
							codepipeline.GitPullRequestEvent_CLOSED,
						},
					},
				},
			},
		},
	},
})
```

### Append a trigger to an existing pipeline

You can append a trigger to an existing pipeline:

TypeScript:

```ts
declare const pipeline: codepipeline.Pipeline;
declare const sourceAction: codepipeline_actions.CodeStarConnectionsSourceAction;

pipeline.addTrigger({
  providerType: codepipeline.ProviderType.CODE_STAR_SOURCE_CONNECTION,
  gitConfiguration: {
    sourceAction,
    pushFilter: [{
      tagsExcludes: ['exclude1', 'exclude2'],
      tagsIncludes: ['include*'],
    }],
  },
});
```

Python:

```python
# pipeline: codepipeline.Pipeline
# source_action: codepipeline_actions.CodeStarConnectionsSourceAction

pipeline.add_trigger(
    provider_type=codepipeline.ProviderType.CODE_STAR_SOURCE_CONNECTION,
    git_configuration=codepipeline.GitConfiguration(
        source_action=source_action,
        push_filter=[codepipeline.GitPushFilter(
            tags_excludes=["exclude1", "exclude2"],
            tags_includes=["include*"]
        )]
    )
)
```

Java:

```java
Pipeline pipeline;
CodeStarConnectionsSourceAction sourceAction;

pipeline.addTrigger(TriggerProps.builder()
        .providerType(ProviderType.CODE_STAR_SOURCE_CONNECTION)
        .gitConfiguration(GitConfiguration.builder()
                .sourceAction(sourceAction)
                .pushFilter(List.of(GitPushFilter.builder()
                        .tagsExcludes(List.of("exclude1", "exclude2"))
                        .tagsIncludes(List.of("include*"))
                        .build()))
                .build())
        .build());
```

C#:

```csharp
Pipeline pipeline;
CodeStarConnectionsSourceAction sourceAction;

pipeline.AddTrigger(new TriggerProps {
    ProviderType = ProviderType.CODE_STAR_SOURCE_CONNECTION,
    GitConfiguration = new GitConfiguration {
        SourceAction = sourceAction,
        PushFilter = new [] { new GitPushFilter {
            TagsExcludes = new [] { "exclude1", "exclude2" },
            TagsIncludes = new [] { "include*" }
        } }
    }
});
```

Go:

```go
var pipeline Pipeline
var sourceAction CodeStarConnectionsSourceAction

pipeline.AddTrigger(&TriggerProps{
	ProviderType: codepipeline.ProviderType_CODE_STAR_SOURCE_CONNECTION,
	GitConfiguration: &GitConfiguration{
		SourceAction: *SourceAction,
		PushFilter: []GitPushFilter{
			&GitPushFilter{
				TagsExcludes: []*string{
					jsii.String("exclude1"),
					jsii.String("exclude2"),
				},
				TagsIncludes: []*string{
					jsii.String("include*"),
				},
			},
		},
	},
})
```

## Execution mode

To control the concurrency behavior when multiple executions of a pipeline are started, you can use the `executionMode` property.

The execution mode can only be used with pipeline type V2.

TypeScript:

```ts
new codepipeline.Pipeline(this, 'Pipeline', {
  pipelineType: codepipeline.PipelineType.V2,
  executionMode: codepipeline.ExecutionMode.PARALLEL,
});
```

Python:

```python
codepipeline.Pipeline(self, "Pipeline",
    pipeline_type=codepipeline.PipelineType.V2,
    execution_mode=codepipeline.ExecutionMode.PARALLEL
)
```

Java:

```java
Pipeline.Builder.create(this, "Pipeline")
        .pipelineType(PipelineType.V2)
        .executionMode(ExecutionMode.PARALLEL)
        .build();
```

C#:

```csharp
new Pipeline(this, "Pipeline", new PipelineProps {
    PipelineType = PipelineType.V2,
    ExecutionMode = ExecutionMode.PARALLEL
});
```

Go:

```go
codepipeline.NewPipeline(this, jsii.String("Pipeline"), &PipelineProps{
	PipelineType: codepipeline.PipelineType_V2,
	ExecutionMode: codepipeline.ExecutionMode_PARALLEL,
})
```

## Stage Level Condition

Conditions are used for specific types of expressions and each has specific options for results available as follows:

  Entry - The conditions for making checks that, if met, allow entry to a stage. Rules are engaged with the following result options: Fail or Skip

  On Failure - The conditions for making checks for the stage when it fails. Rules are engaged with the following result option: Rollback

  On Success - The conditions for making checks for the stage when it succeeds. Rules are engaged with the following result options: Rollback or Fail

Conditions are supported by a set of rules for each type of condition.

For each type of condition, there are specific actions that are set up by the condition. The action is the result of the succeeded or failed condition check. For example, the condition for entry (entry condition) encounters an alarm (rule), then the check is successful and the result (action) is that the stage entry is blocked.

TypeScript:

```ts
declare const sourceAction: codepipeline_actions.CodeStarConnectionsSourceAction;
declare const buildAction: codepipeline_actions.CodeBuildAction;

new codepipeline.Pipeline(this, 'Pipeline', {
  pipelineType: codepipeline.PipelineType.V2,
  stages: [
    {
      stageName: 'Source',
      actions: [sourceAction],
    },
    {
      stageName: 'Build',
      actions: [buildAction],
      // BeforeEntry condition - checks before entering the stage
      beforeEntry: {
        conditions: [{
          rules: [ new codepipeline.Rule({
            name: 'LambdaCheck',
            provider: 'LambdaInvoke',
            version: '1',
            configuration: {
              FunctionName: 'LambdaFunctionName',
            },
          })],
          result:  codepipeline.Result.FAIL,
        }],
      },
      // OnSuccess condition - checks after successful stage completion
      onSuccess: {
        conditions: [{
          result: codepipeline.Result.FAIL,
          rules: [new codepipeline.Rule({
            name: 'CloudWatchCheck',
            provider: 'LambdaInvoke',
            version: '1',
            configuration: {
              AlarmName: 'AlarmName1',
              WaitTime: '300', // 5 minutes
              FunctionName: 'funcName2'
            },
          })],
        }],
      },
      // OnFailure condition - handles stage failure
      onFailure: {
        conditions: [{
          result: codepipeline.Result.ROLLBACK,
            rules: [new codepipeline.Rule({
            name: 'RollBackOnFailure',
            provider: 'LambdaInvoke',
            version: '1',
            configuration: {
              AlarmName: 'Alarm',
              WaitTime: '300', // 5 minutes
              FunctionName: 'funcName1'
            },
          })],
        }],
      },
    },
  ],

});
```

Python:

```python
# source_action: codepipeline_actions.CodeStarConnectionsSourceAction
# build_action: codepipeline_actions.CodeBuildAction

codepipeline.Pipeline(self, "Pipeline",
    pipeline_type=codepipeline.PipelineType.V2,
    stages=[codepipeline.StageProps(
        stage_name="Source",
        actions=[source_action]
    ), codepipeline.StageProps(
        stage_name="Build",
        actions=[build_action],
        # BeforeEntry condition - checks before entering the stage
        before_entry=codepipeline.Conditions(
            conditions=[codepipeline.Condition(
                rules=[codepipeline.Rule(
                    name="LambdaCheck",
                    provider="LambdaInvoke",
                    version="1",
                    configuration={
                        "FunctionName": "LambdaFunctionName"
                    }
                )],
                result=codepipeline.Result.FAIL
            )]
        ),
        # OnSuccess condition - checks after successful stage completion
        on_success=codepipeline.Conditions(
            conditions=[codepipeline.Condition(
                result=codepipeline.Result.FAIL,
                rules=[codepipeline.Rule(
                    name="CloudWatchCheck",
                    provider="LambdaInvoke",
                    version="1",
                    configuration={
                        "AlarmName": "AlarmName1",
                        "WaitTime": "300",  # 5 minutes
                        "FunctionName": "funcName2"
                    }
                )]
            )]
        ),
        # OnFailure condition - handles stage failure
        on_failure=codepipeline.FailureConditions(
            conditions=[codepipeline.Condition(
                result=codepipeline.Result.ROLLBACK,
                rules=[codepipeline.Rule(
                    name="RollBackOnFailure",
                    provider="LambdaInvoke",
                    version="1",
                    configuration={
                        "AlarmName": "Alarm",
                        "WaitTime": "300",  # 5 minutes
                        "FunctionName": "funcName1"
                    }
                )]
            )]
        )
    )
    ]
)
```

Java:

```java
CodeStarConnectionsSourceAction sourceAction;
CodeBuildAction buildAction;

Pipeline.Builder.create(this, "Pipeline")
        .pipelineType(PipelineType.V2)
        .stages(List.of(StageProps.builder()
                .stageName("Source")
                .actions(List.of(sourceAction))
                .build(), StageProps.builder()
                .stageName("Build")
                .actions(List.of(buildAction))
                // BeforeEntry condition - checks before entering the stage
                .beforeEntry(Conditions.builder()
                        .conditions(List.of(Condition.builder()
                                .rules(List.of(Rule.Builder.create()
                                        .name("LambdaCheck")
                                        .provider("LambdaInvoke")
                                        .version("1")
                                        .configuration(Map.of(
                                                "FunctionName", "LambdaFunctionName"))
                                        .build()))
                                .result(Result.FAIL)
                                .build()))
                        .build())
                // OnSuccess condition - checks after successful stage completion
                .onSuccess(Conditions.builder()
                        .conditions(List.of(Condition.builder()
                                .result(Result.FAIL)
                                .rules(List.of(Rule.Builder.create()
                                        .name("CloudWatchCheck")
                                        .provider("LambdaInvoke")
                                        .version("1")
                                        .configuration(Map.of(
                                                "AlarmName", "AlarmName1",
                                                "WaitTime", "300",  // 5 minutes
                                                "FunctionName", "funcName2"))
                                        .build()))
                                .build()))
                        .build())
                // OnFailure condition - handles stage failure
                .onFailure(FailureConditions.builder()
                        .conditions(List.of(Condition.builder()
                                .result(Result.ROLLBACK)
                                .rules(List.of(Rule.Builder.create()
                                        .name("RollBackOnFailure")
                                        .provider("LambdaInvoke")
                                        .version("1")
                                        .configuration(Map.of(
                                                "AlarmName", "Alarm",
                                                "WaitTime", "300",  // 5 minutes
                                                "FunctionName", "funcName1"))
                                        .build()))
                                .build()))
                        .build())
                .build()))
        .build();
```

C#:

```csharp
CodeStarConnectionsSourceAction sourceAction;
CodeBuildAction buildAction;

new Pipeline(this, "Pipeline", new PipelineProps {
    PipelineType = PipelineType.V2,
    Stages = new [] { new StageProps {
        StageName = "Source",
        Actions = new [] { sourceAction }
    }, new StageProps {
        StageName = "Build",
        Actions = new [] { buildAction },
        // BeforeEntry condition - checks before entering the stage
        BeforeEntry = new Conditions {
            Conditions = new [] { new Condition {
                Rules = new [] { new Rule(new RuleProps {
                    Name = "LambdaCheck",
                    Provider = "LambdaInvoke",
                    Version = "1",
                    Configuration = new Dictionary<string, string> {
                        { "FunctionName", "LambdaFunctionName" }
                    }
                }) },
                Result = Result.FAIL
            } }
        },
        // OnSuccess condition - checks after successful stage completion
        OnSuccess = new Conditions {
            Conditions = new [] { new Condition {
                Result = Result.FAIL,
                Rules = new [] { new Rule(new RuleProps {
                    Name = "CloudWatchCheck",
                    Provider = "LambdaInvoke",
                    Version = "1",
                    Configuration = new Dictionary<string, string> {
                        { "AlarmName", "AlarmName1" },
                        { "WaitTime", "300" },  // 5 minutes
                        { "FunctionName", "funcName2" }
                    }
                }) }
            } }
        },
        // OnFailure condition - handles stage failure
        OnFailure = new FailureConditions {
            Conditions = new [] { new Condition {
                Result = Result.ROLLBACK,
                Rules = new [] { new Rule(new RuleProps {
                    Name = "RollBackOnFailure",
                    Provider = "LambdaInvoke",
                    Version = "1",
                    Configuration = new Dictionary<string, string> {
                        { "AlarmName", "Alarm" },
                        { "WaitTime", "300" },  // 5 minutes
                        { "FunctionName", "funcName1" }
                    }
                }) }
            } }
        }
    } }
});
```

Go:

```go
var sourceAction CodeStarConnectionsSourceAction
var buildAction CodeBuildAction

codepipeline.NewPipeline(this, jsii.String("Pipeline"), &PipelineProps{
	PipelineType: codepipeline.PipelineType_V2,
	Stages: []StageProps{
		&StageProps{
			StageName: jsii.String("Source"),
			Actions: []IAction{
				sourceAction,
			},
		},
		&StageProps{
			StageName: jsii.String("Build"),
			Actions: []IAction{
				buildAction,
			},
			// BeforeEntry condition - checks before entering the stage
			BeforeEntry: &Conditions{
				Conditions: []Condition{
					&Condition{
						Rules: []Rule{
							codepipeline.NewRule(&RuleProps{
								Name: jsii.String("LambdaCheck"),
								Provider: jsii.String("LambdaInvoke"),
								Version: jsii.String("1"),
								Configuration: map[string]*string{
									"FunctionName": jsii.String("LambdaFunctionName"),
								},
							}),
						},
						Result: codepipeline.Result_FAIL,
					},
				},
			},
			// OnSuccess condition - checks after successful stage completion
			OnSuccess: &Conditions{
				Conditions: []Condition{
					&Condition{
						Result: codepipeline.Result_FAIL,
						Rules: []Rule{
							codepipeline.NewRule(&RuleProps{
								Name: jsii.String("CloudWatchCheck"),
								Provider: jsii.String("LambdaInvoke"),
								Version: jsii.String("1"),
								Configuration: map[string]*string{
									"AlarmName": jsii.String("AlarmName1"),
									"WaitTime": jsii.String("300"),
									 // 5 minutes
									"FunctionName": jsii.String("funcName2"),
								},
							}),
						},
					},
				},
			},
			// OnFailure condition - handles stage failure
			OnFailure: &FailureConditions{
				Conditions: []Condition{
					&Condition{
						Result: codepipeline.Result_ROLLBACK,
						Rules: []Rule{
							codepipeline.NewRule(&RuleProps{
								Name: jsii.String("RollBackOnFailure"),
								Provider: jsii.String("LambdaInvoke"),
								Version: jsii.String("1"),
								Configuration: map[string]*string{
									"AlarmName": jsii.String("Alarm"),
									"WaitTime": jsii.String("300"),
									 // 5 minutes
									"FunctionName": jsii.String("funcName1"),
								},
							}),
						},
					},
				},
			},
		},
	},
})
```

## Use pipeline service role as default action role in pipeline

You could enable this field to use pipeline service role as default action role in Codepipeline by set `usePipelineServiceRoleForActions` as true if no action role provided.

## Migrating a pipeline type from V1 to V2

To migrate your pipeline type from V1 to V2, you just need to update the `pipelineType` property to `PipelineType.V2`.
This migration does not cause replacement of your pipeline.

When the `@aws-cdk/aws-codepipeline:defaultPipelineTypeToV2` feature flag is set to `true` (default for new projects),
the V2 type is selected by default if you do not specify a value for `pipelineType` property. Otherwise, the V1 type is selected.

TypeScript:

```ts
new codepipeline.Pipeline(this, 'Pipeline', {
  pipelineType: codepipeline.PipelineType.V2, // here
});
```

Python:

```python
codepipeline.Pipeline(self, "Pipeline",
    pipeline_type=codepipeline.PipelineType.V2
)
```

Java:

```java
Pipeline.Builder.create(this, "Pipeline")
        .pipelineType(PipelineType.V2)
        .build();
```

C#:

```csharp
new Pipeline(this, "Pipeline", new PipelineProps {
    PipelineType = PipelineType.V2
});
```

Go:

```go
codepipeline.NewPipeline(this, jsii.String("Pipeline"), &PipelineProps{
	PipelineType: codepipeline.PipelineType_V2,
})
```

See the [CodePipeline documentation](https://docs.aws.amazon.com/codepipeline/latest/userguide/pipeline-types-planning.html)
for more details on the differences between each type.

## Types

### Constructs (L2)

- [`Pipeline`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_codepipeline.Pipeline.html) Construct (L2) An AWS CodePipeline pipeline with its associated IAM role and S3 bucket.

### Constructs (L1)

- [`CfnCustomActionType`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_codepipeline.CfnCustomActionType.html) Construct (L1) The `AWS::CodePipeline::CustomActionType` resource creates a custom action for activities that aren't included in the CodePipeline default actions, such as running an internally developed build process or a test suite.
- [`CfnPipeline`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_codepipeline.CfnPipeline.html) Construct (L1) The `AWS::CodePipeline::Pipeline` resource creates a CodePipeline pipeline that describes how software changes go through a release process.
- [`CfnWebhook`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_codepipeline.CfnWebhook.html) Construct (L1) The `AWS::CodePipeline::Webhook` resource creates and registers your webhook.

### Classes

- [`Action`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_codepipeline.Action.html) Class Low-level class for generic CodePipeline Actions implementing the `IAction` interface.
- [`Artifact`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_codepipeline.Artifact.html) Class An output artifact of an action.
- [`ArtifactPath`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_codepipeline.ArtifactPath.html) Class A specific file within an output artifact.
- [`GlobalVariables`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_codepipeline.GlobalVariables.html) Class The CodePipeline variables that are global, not bound to a specific action.
- [`Rule`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_codepipeline.Rule.html) Class Represents a rule in AWS CodePipeline that can be used to add conditions and controls to pipeline execution.
- [`Trigger`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_codepipeline.Trigger.html) Class Trigger.
- [`Variable`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_codepipeline.Variable.html) Class Pipeline-Level variable.

### Structs

- [`ActionArtifactBounds`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_codepipeline.ActionArtifactBounds.html) Struct Specifies the constraints on the number of input and output artifacts an action can have.
- [`ActionBindOptions`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_codepipeline.ActionBindOptions.html) Struct
- [`ActionConfig`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_codepipeline.ActionConfig.html) Struct
- [`ActionProperties`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_codepipeline.ActionProperties.html) Struct
- [`CfnCustomActionType.ArtifactDetailsProperty`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_codepipeline.CfnCustomActionType.ArtifactDetailsProperty.html) Struct Returns information about the details of an artifact.
- [`CfnCustomActionType.ConfigurationPropertiesProperty`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_codepipeline.CfnCustomActionType.ConfigurationPropertiesProperty.html) Struct The configuration properties for the custom action.
- [`CfnCustomActionType.SettingsProperty`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_codepipeline.CfnCustomActionType.SettingsProperty.html) Struct `Settings` is a property of the `AWS::CodePipeline::CustomActionType` resource that provides URLs that users can access to view information about the CodePipeline custom action.
- [`CfnCustomActionTypeProps`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_codepipeline.CfnCustomActionTypeProps.html) Struct Properties for defining a `CfnCustomActionType`.
- [`CfnPipeline.ActionDeclarationProperty`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_codepipeline.CfnPipeline.ActionDeclarationProperty.html) Struct Represents information about an action declaration.
- [`CfnPipeline.ActionTypeIdProperty`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_codepipeline.CfnPipeline.ActionTypeIdProperty.html) Struct Represents information about an action type.
- [`CfnPipeline.ArtifactStoreMapProperty`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_codepipeline.CfnPipeline.ArtifactStoreMapProperty.html) Struct A mapping of `artifactStore` objects and their corresponding AWS Regions.
- [`CfnPipeline.ArtifactStoreProperty`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_codepipeline.CfnPipeline.ArtifactStoreProperty.html) Struct The S3 bucket where artifacts for the pipeline are stored.
- [`CfnPipeline.BeforeEntryConditionsProperty`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_codepipeline.CfnPipeline.BeforeEntryConditionsProperty.html) Struct The conditions for making checks for entry to a stage.
- [`CfnPipeline.BlockerDeclarationProperty`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_codepipeline.CfnPipeline.BlockerDeclarationProperty.html) Struct Reserved for future use.
- [`CfnPipeline.ConditionProperty`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_codepipeline.CfnPipeline.ConditionProperty.html) Struct The condition for the stage.
- [`CfnPipeline.EncryptionKeyProperty`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_codepipeline.CfnPipeline.EncryptionKeyProperty.html) Struct Represents information about the key used to encrypt data in the artifact store, such as an AWS Key Management Service ( AWS KMS) key.
- [`CfnPipeline.EnvironmentVariableProperty`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_codepipeline.CfnPipeline.EnvironmentVariableProperty.html) Struct The environment variables for the action.
- [`CfnPipeline.FailureConditionsProperty`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_codepipeline.CfnPipeline.FailureConditionsProperty.html) Struct The configuration that specifies the result, such as rollback, to occur upon stage failure.
- [`CfnPipeline.GitBranchFilterCriteriaProperty`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_codepipeline.CfnPipeline.GitBranchFilterCriteriaProperty.html) Struct The Git repository branches specified as filter criteria to start the pipeline.
- [`CfnPipeline.GitConfigurationProperty`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_codepipeline.CfnPipeline.GitConfigurationProperty.html) Struct A type of trigger configuration for Git-based source actions.
- [`CfnPipeline.GitFilePathFilterCriteriaProperty`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_codepipeline.CfnPipeline.GitFilePathFilterCriteriaProperty.html) Struct The Git repository file paths specified as filter criteria to start the pipeline.
- [`CfnPipeline.GitPullRequestFilterProperty`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_codepipeline.CfnPipeline.GitPullRequestFilterProperty.html) Struct The event criteria for the pull request trigger configuration, such as the lists of branches or file paths to include and exclude.
- [`CfnPipeline.GitPushFilterProperty`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_codepipeline.CfnPipeline.GitPushFilterProperty.html) Struct The event criteria that specify when a specified repository event will start the pipeline for the specified trigger configuration, such as the lists of Git tags to include and exclude.
- [`CfnPipeline.GitTagFilterCriteriaProperty`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_codepipeline.CfnPipeline.GitTagFilterCriteriaProperty.html) Struct The Git tags specified as filter criteria for whether a Git tag repository event will start the pipeline.
- [`CfnPipeline.InputArtifactProperty`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_codepipeline.CfnPipeline.InputArtifactProperty.html) Struct Represents information about an artifact to be worked on, such as a test or build artifact.
- [`CfnPipeline.OutputArtifactProperty`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_codepipeline.CfnPipeline.OutputArtifactProperty.html) Struct Represents information about the output of an action.
- [`CfnPipeline.PipelineTriggerDeclarationProperty`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_codepipeline.CfnPipeline.PipelineTriggerDeclarationProperty.html) Struct Represents information about the specified trigger configuration, such as the filter criteria and the source stage for the action that contains the trigger.
- [`CfnPipeline.RetryConfigurationProperty`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_codepipeline.CfnPipeline.RetryConfigurationProperty.html) Struct The retry configuration specifies automatic retry for a failed stage, along with the configured retry mode.
- [`CfnPipeline.RuleDeclarationProperty`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_codepipeline.CfnPipeline.RuleDeclarationProperty.html) Struct Represents information about the rule to be created for an associated condition.
- [`CfnPipeline.RuleTypeIdProperty`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_codepipeline.CfnPipeline.RuleTypeIdProperty.html) Struct The ID for the rule type, which is made up of the combined values for category, owner, provider, and version.
- [`CfnPipeline.StageDeclarationProperty`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_codepipeline.CfnPipeline.StageDeclarationProperty.html) Struct Represents information about a stage and its definition.
- [`CfnPipeline.StageTransitionProperty`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_codepipeline.CfnPipeline.StageTransitionProperty.html) Struct The name of the pipeline in which you want to disable the flow of artifacts from one stage to another.
- [`CfnPipeline.SuccessConditionsProperty`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_codepipeline.CfnPipeline.SuccessConditionsProperty.html) Struct The conditions for making checks that, if met, succeed a stage.
- [`CfnPipeline.VariableDeclarationProperty`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_codepipeline.CfnPipeline.VariableDeclarationProperty.html) Struct A variable declared at the pipeline level.
- [`CfnPipelineProps`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_codepipeline.CfnPipelineProps.html) Struct Properties for defining a `CfnPipeline`.
- [`CfnWebhook.WebhookAuthConfigurationProperty`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_codepipeline.CfnWebhook.WebhookAuthConfigurationProperty.html) Struct The authentication applied to incoming webhook trigger requests.
- [`CfnWebhook.WebhookFilterRuleProperty`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_codepipeline.CfnWebhook.WebhookFilterRuleProperty.html) Struct The event criteria that specify when a webhook notification is sent to your URL.
- [`CfnWebhookProps`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_codepipeline.CfnWebhookProps.html) Struct Properties for defining a `CfnWebhook`.
- [`CommonActionProps`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_codepipeline.CommonActionProps.html) Struct Common properties shared by all Actions.
- [`CommonAwsActionProps`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_codepipeline.CommonAwsActionProps.html) Struct Common properties shared by all Actions whose `ActionProperties.owner` field is 'AWS' (or unset, as 'AWS' is the default).
- [`Condition`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_codepipeline.Condition.html) Struct The condition for the stage.
- [`Conditions`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_codepipeline.Conditions.html) Struct The conditions for making checks for the stage.
- [`CrossRegionSupport`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_codepipeline.CrossRegionSupport.html) Struct An interface representing resources generated in order to support the cross-region capabilities of CodePipeline.
- [`CustomActionProperty`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_codepipeline.CustomActionProperty.html) Struct The creation attributes used for defining a configuration property of a custom Action.
- [`CustomActionRegistrationProps`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_codepipeline.CustomActionRegistrationProps.html) Struct Properties of registering a custom Action.
- [`FailureConditions`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_codepipeline.FailureConditions.html) Struct The configuration that specifies the result, such as rollback, to occur upon stage failure.
- [`GitConfiguration`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_codepipeline.GitConfiguration.html) Struct Git configuration for trigger.
- [`GitPullRequestFilter`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_codepipeline.GitPullRequestFilter.html) Struct Git pull request filter for trigger.
- [`GitPushFilter`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_codepipeline.GitPushFilter.html) Struct Git push filter for trigger.
- [`PipelineNotifyOnOptions`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_codepipeline.PipelineNotifyOnOptions.html) Struct Additional options to pass to the notification rule.
- [`PipelineProps`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_codepipeline.PipelineProps.html) Struct
- [`RuleProps`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_codepipeline.RuleProps.html) Struct Properties for defining a CodePipeline Rule.
- [`StageOptions`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_codepipeline.StageOptions.html) Struct
- [`StagePlacement`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_codepipeline.StagePlacement.html) Struct Allows you to control where to place a new Stage when it's added to the Pipeline.
- [`StageProps`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_codepipeline.StageProps.html) Struct Construction properties of a Pipeline Stage.
- [`TriggerProps`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_codepipeline.TriggerProps.html) Struct Properties of trigger.
- [`VariableProps`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_codepipeline.VariableProps.html) Struct Properties of pipeline-level variable.

### Enums

- [`ActionCategory`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_codepipeline.ActionCategory.html) Enum
- [`ExecutionMode`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_codepipeline.ExecutionMode.html) Enum Execution mode.
- [`GitPullRequestEvent`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_codepipeline.GitPullRequestEvent.html) Enum Event for trigger with pull request filter.
- [`PipelineNotificationEvents`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_codepipeline.PipelineNotificationEvents.html) Enum The list of event types for AWS Codepipeline Pipeline.
- [`PipelineType`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_codepipeline.PipelineType.html) Enum Pipeline types.
- [`ProviderType`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_codepipeline.ProviderType.html) Enum Provider type for trigger.
- [`Result`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_codepipeline.Result.html) Enum The action to be done when the condition is met.
- [`RetryMode`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_codepipeline.RetryMode.html) Enum The method that you want to configure for automatic stage retry on stage failure.

### Constructs

- [`CustomActionRegistration`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_codepipeline.CustomActionRegistration.html) Construct The resource representing registering a custom Action with CodePipeline.

### Interfaces

- [`IAction`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_codepipeline.IAction.html) Interface A Pipeline Action.
- [`IPipeline`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_codepipeline.IPipeline.html) Interface The abstract view of an AWS CodePipeline as required and used by Actions.
- [`IStage`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_codepipeline.IStage.html) Interface The abstract interface of a Pipeline Stage that is used by Actions.
