Show / Hide Table of Contents

Class CodeBuildProject

Start a CodeBuild build when an Amazon EventBridge rule is triggered.

Inheritance
object
CodeBuildProject
Implements
IRuleTarget
Namespace: Amazon.CDK.AWS.Events.Targets
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public class CodeBuildProject : DeputyBase, IRuleTarget
Syntax (vb)
Public Class CodeBuildProject Inherits DeputyBase Implements IRuleTarget
Remarks

ExampleMetadata: infused

Examples
using Amazon.CDK.AWS.SNS;
            using Amazon.CDK.AWS.Events.Targets;

            Repository repo;
            PipelineProject project;
            Topic myTopic;


            // starts a CodeBuild project when a commit is pushed to the "main" branch of the repo
            repo.OnCommit("CommitToMain", new OnCommitOptions {
                Target = new CodeBuildProject(project),
                Branches = new [] { "main" }
            });

            // publishes a message to an Amazon SNS topic when a comment is made on a pull request
            var rule = repo.OnCommentOnPullRequest("CommentOnPullRequest", new OnEventOptions {
                Target = new SnsTopic(myTopic)
            });

Synopsis

Constructors

CodeBuildProject(IProject, ICodeBuildProjectProps?)

Start a CodeBuild build when an Amazon EventBridge rule is triggered.

Methods

Bind(IRule, string?)

Allows using build projects as event rule targets.

Constructors

CodeBuildProject(IProject, ICodeBuildProjectProps?)

Start a CodeBuild build when an Amazon EventBridge rule is triggered.

public CodeBuildProject(IProject project, ICodeBuildProjectProps? props = null)
Parameters
project IProject
props ICodeBuildProjectProps
Remarks

ExampleMetadata: infused

Examples
using Amazon.CDK.AWS.SNS;
            using Amazon.CDK.AWS.Events.Targets;

            Repository repo;
            PipelineProject project;
            Topic myTopic;


            // starts a CodeBuild project when a commit is pushed to the "main" branch of the repo
            repo.OnCommit("CommitToMain", new OnCommitOptions {
                Target = new CodeBuildProject(project),
                Branches = new [] { "main" }
            });

            // publishes a message to an Amazon SNS topic when a comment is made on a pull request
            var rule = repo.OnCommentOnPullRequest("CommentOnPullRequest", new OnEventOptions {
                Target = new SnsTopic(myTopic)
            });

Methods

Bind(IRule, string?)

Allows using build projects as event rule targets.

public virtual IRuleTargetConfig Bind(IRule rule, string? id = null)
Parameters
rule IRule
id string
Returns

IRuleTargetConfig

Remarks

ExampleMetadata: infused

Implements

IRuleTarget
Back to top Generated by DocFX