Skip to content
v2.274.0

Trigger Class ​

Trigger.

Example ​

ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_codepipeline as codepipeline } from 'aws-cdk-lib';

declare const action: codepipeline.Action;
const trigger = new codepipeline.Trigger({
  providerType: codepipeline.ProviderType.CODE_STAR_SOURCE_CONNECTION,

  // the properties below are optional
  gitConfiguration: {
    sourceAction: action,

    // the properties below are optional
    pullRequestFilter: [{
      branchesExcludes: ['branchesExcludes'],
      branchesIncludes: ['branchesIncludes'],
      events: [codepipeline.GitPullRequestEvent.OPEN],
      filePathsExcludes: ['filePathsExcludes'],
      filePathsIncludes: ['filePathsIncludes'],
    }],
    pushFilter: [{
      branchesExcludes: ['branchesExcludes'],
      branchesIncludes: ['branchesIncludes'],
      filePathsExcludes: ['filePathsExcludes'],
      filePathsIncludes: ['filePathsIncludes'],
      tagsExcludes: ['tagsExcludes'],
      tagsIncludes: ['tagsIncludes'],
    }],
  },
});
python
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_codepipeline as codepipeline

# action: codepipeline.Action

trigger = codepipeline.Trigger(
    provider_type=codepipeline.ProviderType.CODE_STAR_SOURCE_CONNECTION,

    # the properties below are optional
    git_configuration=codepipeline.GitConfiguration(
        source_action=action,

        # the properties below are optional
        pull_request_filter=[codepipeline.GitPullRequestFilter(
            branches_excludes=["branchesExcludes"],
            branches_includes=["branchesIncludes"],
            events=[codepipeline.GitPullRequestEvent.OPEN],
            file_paths_excludes=["filePathsExcludes"],
            file_paths_includes=["filePathsIncludes"]
        )],
        push_filter=[codepipeline.GitPushFilter(
            branches_excludes=["branchesExcludes"],
            branches_includes=["branchesIncludes"],
            file_paths_excludes=["filePathsExcludes"],
            file_paths_includes=["filePathsIncludes"],
            tags_excludes=["tagsExcludes"],
            tags_includes=["tagsIncludes"]
        )]
    )
)
java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.services.codepipeline.*;

Action action;

Trigger trigger = Trigger.Builder.create()
        .providerType(ProviderType.CODE_STAR_SOURCE_CONNECTION)

        // the properties below are optional
        .gitConfiguration(GitConfiguration.builder()
                .sourceAction(action)

                // the properties below are optional
                .pullRequestFilter(List.of(GitPullRequestFilter.builder()
                        .branchesExcludes(List.of("branchesExcludes"))
                        .branchesIncludes(List.of("branchesIncludes"))
                        .events(List.of(GitPullRequestEvent.OPEN))
                        .filePathsExcludes(List.of("filePathsExcludes"))
                        .filePathsIncludes(List.of("filePathsIncludes"))
                        .build()))
                .pushFilter(List.of(GitPushFilter.builder()
                        .branchesExcludes(List.of("branchesExcludes"))
                        .branchesIncludes(List.of("branchesIncludes"))
                        .filePathsExcludes(List.of("filePathsExcludes"))
                        .filePathsIncludes(List.of("filePathsIncludes"))
                        .tagsExcludes(List.of("tagsExcludes"))
                        .tagsIncludes(List.of("tagsIncludes"))
                        .build()))
                .build())
        .build();
csharp
// Install: dotnet add package Amazon.CDK.Lib
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.CodePipeline;

Action action;

var trigger = new Trigger(new TriggerProps {
    ProviderType = ProviderType.CODE_STAR_SOURCE_CONNECTION,

    // the properties below are optional
    GitConfiguration = new GitConfiguration {
        SourceAction = action,

        // the properties below are optional
        PullRequestFilter = new [] { new GitPullRequestFilter {
            BranchesExcludes = new [] { "branchesExcludes" },
            BranchesIncludes = new [] { "branchesIncludes" },
            Events = new [] { GitPullRequestEvent.OPEN },
            FilePathsExcludes = new [] { "filePathsExcludes" },
            FilePathsIncludes = new [] { "filePathsIncludes" }
        } },
        PushFilter = new [] { new GitPushFilter {
            BranchesExcludes = new [] { "branchesExcludes" },
            BranchesIncludes = new [] { "branchesIncludes" },
            FilePathsExcludes = new [] { "filePathsExcludes" },
            FilePathsIncludes = new [] { "filePathsIncludes" },
            TagsExcludes = new [] { "tagsExcludes" },
            TagsIncludes = new [] { "tagsIncludes" }
        } }
    }
});
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"

var action Action

trigger := awscdk.Aws_codepipeline.NewTrigger(&TriggerProps{
	ProviderType: awscdk.*Aws_codepipeline.ProviderType_CODE_STAR_SOURCE_CONNECTION,

	// the properties below are optional
	GitConfiguration: &GitConfiguration{
		SourceAction: action,

		// the properties below are optional
		PullRequestFilter: []GitPullRequestFilter{
			&GitPullRequestFilter{
				BranchesExcludes: []*string{
					jsii.String("branchesExcludes"),
				},
				BranchesIncludes: []*string{
					jsii.String("branchesIncludes"),
				},
				Events: []GitPullRequestEvent{
					awscdk.*Aws_codepipeline.GitPullRequestEvent_OPEN,
				},
				FilePathsExcludes: []*string{
					jsii.String("filePathsExcludes"),
				},
				FilePathsIncludes: []*string{
					jsii.String("filePathsIncludes"),
				},
			},
		},
		PushFilter: []GitPushFilter{
			&GitPushFilter{
				BranchesExcludes: []*string{
					jsii.String("branchesExcludes"),
				},
				BranchesIncludes: []*string{
					jsii.String("branchesIncludes"),
				},
				FilePathsExcludes: []*string{
					jsii.String("filePathsExcludes"),
				},
				FilePathsIncludes: []*string{
					jsii.String("filePathsIncludes"),
				},
				TagsExcludes: []*string{
					jsii.String("tagsExcludes"),
				},
				TagsIncludes: []*string{
					jsii.String("tagsIncludes"),
				},
			},
		},
	},
})

Initializer ​

ts
new Trigger(props: TriggerProps)
python
Trigger(props: TriggerProps)
java
new Trigger(TriggerProps props)
csharp
new Trigger(TriggerProps props)
go
NewTrigger(Props TriggerProps)

Properties ​

sourceActionIActionsource_actionIActionsourceActionIActionSourceActionIActionSourceActionIAction#
The pipeline source action where the trigger configuration.