All Downloads are FREE. Search and download functionalities are using the official Maven repository.

software.amazon.awscdk.services.events.targets.CodeBuildProject Maven / Gradle / Ivy

There is a newer version: 1.204.0
Show newest version
package software.amazon.awscdk.services.events.targets;

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

* Example: *

*

 * import software.amazon.awscdk.services.sns.*;
 * import software.amazon.awscdk.services.events.targets.*;
 * Repository repo;
 * PipelineProject project;
 * Topic myTopic;
 * // starts a CodeBuild project when a commit is pushed to the "master" branch of the repo
 * repo.onCommit("CommitToMaster", OnCommitOptions.builder()
 *         .target(new CodeBuildProject(project))
 *         .branches(List.of("master"))
 *         .build());
 * // publishes a message to an Amazon SNS topic when a comment is made on a pull request
 * Rule rule = repo.onCommentOnPullRequest("CommentOnPullRequest", OnEventOptions.builder()
 *         .target(new SnsTopic(myTopic))
 *         .build());
 * 
*/ @javax.annotation.Generated(value = "jsii-pacmak/1.63.2 (build a8a8833)", date = "2022-08-17T17:31:21.287Z") @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) @software.amazon.jsii.Jsii(module = software.amazon.awscdk.services.events.targets.$Module.class, fqn = "@aws-cdk/aws-events-targets.CodeBuildProject") public class CodeBuildProject extends software.amazon.jsii.JsiiObject implements software.amazon.awscdk.services.events.IRuleTarget { protected CodeBuildProject(final software.amazon.jsii.JsiiObjectRef objRef) { super(objRef); } protected CodeBuildProject(final software.amazon.jsii.JsiiObject.InitializationMode initializationMode) { super(initializationMode); } /** * @param project This parameter is required. * @param props */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) public CodeBuildProject(final @org.jetbrains.annotations.NotNull software.amazon.awscdk.services.codebuild.IProject project, final @org.jetbrains.annotations.Nullable software.amazon.awscdk.services.events.targets.CodeBuildProjectProps props) { super(software.amazon.jsii.JsiiObject.InitializationMode.JSII); software.amazon.jsii.JsiiEngine.getInstance().createNewObject(this, new Object[] { java.util.Objects.requireNonNull(project, "project is required"), props }); } /** * @param project This parameter is required. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) public CodeBuildProject(final @org.jetbrains.annotations.NotNull software.amazon.awscdk.services.codebuild.IProject project) { super(software.amazon.jsii.JsiiObject.InitializationMode.JSII); software.amazon.jsii.JsiiEngine.getInstance().createNewObject(this, new Object[] { java.util.Objects.requireNonNull(project, "project is required") }); } /** * Allows using build projects as event rule targets. *

* @param _rule This parameter is required. * @param _id */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) @Override public @org.jetbrains.annotations.NotNull software.amazon.awscdk.services.events.RuleTargetConfig bind(final @org.jetbrains.annotations.NotNull software.amazon.awscdk.services.events.IRule _rule, final @org.jetbrains.annotations.Nullable java.lang.String _id) { return software.amazon.jsii.Kernel.call(this, "bind", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.events.RuleTargetConfig.class), new Object[] { java.util.Objects.requireNonNull(_rule, "_rule is required"), _id }); } /** * Allows using build projects as event rule targets. *

* @param _rule This parameter is required. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) @Override public @org.jetbrains.annotations.NotNull software.amazon.awscdk.services.events.RuleTargetConfig bind(final @org.jetbrains.annotations.NotNull software.amazon.awscdk.services.events.IRule _rule) { return software.amazon.jsii.Kernel.call(this, "bind", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.events.RuleTargetConfig.class), new Object[] { java.util.Objects.requireNonNull(_rule, "_rule is required") }); } /** * A fluent builder for {@link software.amazon.awscdk.services.events.targets.CodeBuildProject}. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) public static final class Builder implements software.amazon.jsii.Builder { /** * @return a new instance of {@link Builder}. * @param project This parameter is required. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) public static Builder create(final software.amazon.awscdk.services.codebuild.IProject project) { return new Builder(project); } private final software.amazon.awscdk.services.codebuild.IProject project; private software.amazon.awscdk.services.events.targets.CodeBuildProjectProps.Builder props; private Builder(final software.amazon.awscdk.services.codebuild.IProject project) { this.project = project; } /** * The SQS queue to be used as deadLetterQueue. Check out the [considerations for using a dead-letter queue](https://docs.aws.amazon.com/eventbridge/latest/userguide/rule-dlq.html#dlq-considerations). *

* The events not successfully delivered are automatically retried for a specified period of time, * depending on the retry policy of the target. * If an event is not delivered before all retry attempts are exhausted, it will be sent to the dead letter queue. *

* Default: - no dead-letter queue *

* @return {@code this} * @param deadLetterQueue The SQS queue to be used as deadLetterQueue. Check out the [considerations for using a dead-letter queue](https://docs.aws.amazon.com/eventbridge/latest/userguide/rule-dlq.html#dlq-considerations). This parameter is required. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) public Builder deadLetterQueue(final software.amazon.awscdk.services.sqs.IQueue deadLetterQueue) { this.props().deadLetterQueue(deadLetterQueue); return this; } /** * The maximum age of a request that Lambda sends to a function for processing. *

* Minimum value of 60. * Maximum value of 86400. *

* Default: Duration.hours(24) *

* @return {@code this} * @param maxEventAge The maximum age of a request that Lambda sends to a function for processing. This parameter is required. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) public Builder maxEventAge(final software.amazon.awscdk.core.Duration maxEventAge) { this.props().maxEventAge(maxEventAge); return this; } /** * The maximum number of times to retry when the function returns an error. *

* Minimum value of 0. * Maximum value of 185. *

* Default: 185 *

* @return {@code this} * @param retryAttempts The maximum number of times to retry when the function returns an error. This parameter is required. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) public Builder retryAttempts(final java.lang.Number retryAttempts) { this.props().retryAttempts(retryAttempts); return this; } /** * The event to send to CodeBuild. *

* This will be the payload for the StartBuild API. *

* Default: - the entire EventBridge event *

* @return {@code this} * @param event The event to send to CodeBuild. This parameter is required. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) public Builder event(final software.amazon.awscdk.services.events.RuleTargetInput event) { this.props().event(event); return this; } /** * The role to assume before invoking the target (i.e., the codebuild) when the given rule is triggered. *

* Default: - a new role will be created *

* @return {@code this} * @param eventRole The role to assume before invoking the target (i.e., the codebuild) when the given rule is triggered. This parameter is required. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) public Builder eventRole(final software.amazon.awscdk.services.iam.IRole eventRole) { this.props().eventRole(eventRole); return this; } /** * @returns a newly built instance of {@link software.amazon.awscdk.services.events.targets.CodeBuildProject}. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) @Override public software.amazon.awscdk.services.events.targets.CodeBuildProject build() { return new software.amazon.awscdk.services.events.targets.CodeBuildProject( this.project, this.props != null ? this.props.build() : null ); } private software.amazon.awscdk.services.events.targets.CodeBuildProjectProps.Builder props() { if (this.props == null) { this.props = new software.amazon.awscdk.services.events.targets.CodeBuildProjectProps.Builder(); } return this.props; } } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy