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

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

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

/**
 * Customize the CodeBuild Event Target.
 * 

* Example: *

*

 * import software.amazon.awscdk.services.codebuild.*;
 * import software.amazon.awscdk.services.codecommit.*;
 * Repository repo = Repository.Builder.create(this, "MyRepo")
 *         .repositoryName("aws-cdk-codebuild-events")
 *         .build();
 * Project project = Project.Builder.create(this, "MyProject")
 *         .source(Source.codeCommit(CodeCommitSourceProps.builder().repository(repo).build()))
 *         .build();
 * Queue deadLetterQueue = new Queue(this, "DeadLetterQueue");
 * // trigger a build when a commit is pushed to the repo
 * Rule onCommitRule = repo.onCommit("OnCommit", OnCommitOptions.builder()
 *         .target(CodeBuildProject.Builder.create(project)
 *                 .deadLetterQueue(deadLetterQueue)
 *                 .build())
 *         .branches(List.of("master"))
 *         .build());
 * 
*/ @javax.annotation.Generated(value = "jsii-pacmak/1.63.2 (build a8a8833)", date = "2022-08-17T17:31:21.288Z") @software.amazon.jsii.Jsii(module = software.amazon.awscdk.services.events.targets.$Module.class, fqn = "@aws-cdk/aws-events-targets.CodeBuildProjectProps") @software.amazon.jsii.Jsii.Proxy(CodeBuildProjectProps.Jsii$Proxy.class) @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) public interface CodeBuildProjectProps extends software.amazon.jsii.JsiiSerializable, software.amazon.awscdk.services.events.targets.TargetBaseProps { /** * The event to send to CodeBuild. *

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

* Default: - the entire EventBridge event */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) default @org.jetbrains.annotations.Nullable software.amazon.awscdk.services.events.RuleTargetInput getEvent() { return null; } /** * 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 */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) default @org.jetbrains.annotations.Nullable software.amazon.awscdk.services.iam.IRole getEventRole() { return null; } /** * @return a {@link Builder} of {@link CodeBuildProjectProps} */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) static Builder builder() { return new Builder(); } /** * A builder for {@link CodeBuildProjectProps} */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) public static final class Builder implements software.amazon.jsii.Builder { software.amazon.awscdk.services.events.RuleTargetInput event; software.amazon.awscdk.services.iam.IRole eventRole; software.amazon.awscdk.services.sqs.IQueue deadLetterQueue; software.amazon.awscdk.core.Duration maxEventAge; java.lang.Number retryAttempts; /** * Sets the value of {@link CodeBuildProjectProps#getEvent} * @param event The event to send to CodeBuild. * This will be the payload for the StartBuild API. * @return {@code this} */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) public Builder event(software.amazon.awscdk.services.events.RuleTargetInput event) { this.event = event; return this; } /** * Sets the value of {@link CodeBuildProjectProps#getEventRole} * @param eventRole The role to assume before invoking the target (i.e., the codebuild) when the given rule is triggered. * @return {@code this} */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) public Builder eventRole(software.amazon.awscdk.services.iam.IRole eventRole) { this.eventRole = eventRole; return this; } /** * Sets the value of {@link CodeBuildProjectProps#getDeadLetterQueue} * @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). * 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. * @return {@code this} */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) public Builder deadLetterQueue(software.amazon.awscdk.services.sqs.IQueue deadLetterQueue) { this.deadLetterQueue = deadLetterQueue; return this; } /** * Sets the value of {@link CodeBuildProjectProps#getMaxEventAge} * @param maxEventAge The maximum age of a request that Lambda sends to a function for processing. * Minimum value of 60. * Maximum value of 86400. * @return {@code this} */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) public Builder maxEventAge(software.amazon.awscdk.core.Duration maxEventAge) { this.maxEventAge = maxEventAge; return this; } /** * Sets the value of {@link CodeBuildProjectProps#getRetryAttempts} * @param retryAttempts The maximum number of times to retry when the function returns an error. * Minimum value of 0. * Maximum value of 185. * @return {@code this} */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) public Builder retryAttempts(java.lang.Number retryAttempts) { this.retryAttempts = retryAttempts; return this; } /** * Builds the configured instance. * @return a new instance of {@link CodeBuildProjectProps} * @throws NullPointerException if any required attribute was not provided */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) @Override public CodeBuildProjectProps build() { return new Jsii$Proxy(this); } } /** * An implementation for {@link CodeBuildProjectProps} */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) @software.amazon.jsii.Internal final class Jsii$Proxy extends software.amazon.jsii.JsiiObject implements CodeBuildProjectProps { private final software.amazon.awscdk.services.events.RuleTargetInput event; private final software.amazon.awscdk.services.iam.IRole eventRole; private final software.amazon.awscdk.services.sqs.IQueue deadLetterQueue; private final software.amazon.awscdk.core.Duration maxEventAge; private final java.lang.Number retryAttempts; /** * Constructor that initializes the object based on values retrieved from the JsiiObject. * @param objRef Reference to the JSII managed object. */ protected Jsii$Proxy(final software.amazon.jsii.JsiiObjectRef objRef) { super(objRef); this.event = software.amazon.jsii.Kernel.get(this, "event", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.events.RuleTargetInput.class)); this.eventRole = software.amazon.jsii.Kernel.get(this, "eventRole", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.iam.IRole.class)); this.deadLetterQueue = software.amazon.jsii.Kernel.get(this, "deadLetterQueue", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.sqs.IQueue.class)); this.maxEventAge = software.amazon.jsii.Kernel.get(this, "maxEventAge", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.core.Duration.class)); this.retryAttempts = software.amazon.jsii.Kernel.get(this, "retryAttempts", software.amazon.jsii.NativeType.forClass(java.lang.Number.class)); } /** * Constructor that initializes the object based on literal property values passed by the {@link Builder}. */ protected Jsii$Proxy(final Builder builder) { super(software.amazon.jsii.JsiiObject.InitializationMode.JSII); this.event = builder.event; this.eventRole = builder.eventRole; this.deadLetterQueue = builder.deadLetterQueue; this.maxEventAge = builder.maxEventAge; this.retryAttempts = builder.retryAttempts; } @Override public final software.amazon.awscdk.services.events.RuleTargetInput getEvent() { return this.event; } @Override public final software.amazon.awscdk.services.iam.IRole getEventRole() { return this.eventRole; } @Override public final software.amazon.awscdk.services.sqs.IQueue getDeadLetterQueue() { return this.deadLetterQueue; } @Override public final software.amazon.awscdk.core.Duration getMaxEventAge() { return this.maxEventAge; } @Override public final java.lang.Number getRetryAttempts() { return this.retryAttempts; } @Override @software.amazon.jsii.Internal public com.fasterxml.jackson.databind.JsonNode $jsii$toJson() { final com.fasterxml.jackson.databind.ObjectMapper om = software.amazon.jsii.JsiiObjectMapper.INSTANCE; final com.fasterxml.jackson.databind.node.ObjectNode data = com.fasterxml.jackson.databind.node.JsonNodeFactory.instance.objectNode(); if (this.getEvent() != null) { data.set("event", om.valueToTree(this.getEvent())); } if (this.getEventRole() != null) { data.set("eventRole", om.valueToTree(this.getEventRole())); } if (this.getDeadLetterQueue() != null) { data.set("deadLetterQueue", om.valueToTree(this.getDeadLetterQueue())); } if (this.getMaxEventAge() != null) { data.set("maxEventAge", om.valueToTree(this.getMaxEventAge())); } if (this.getRetryAttempts() != null) { data.set("retryAttempts", om.valueToTree(this.getRetryAttempts())); } final com.fasterxml.jackson.databind.node.ObjectNode struct = com.fasterxml.jackson.databind.node.JsonNodeFactory.instance.objectNode(); struct.set("fqn", om.valueToTree("@aws-cdk/aws-events-targets.CodeBuildProjectProps")); struct.set("data", data); final com.fasterxml.jackson.databind.node.ObjectNode obj = com.fasterxml.jackson.databind.node.JsonNodeFactory.instance.objectNode(); obj.set("$jsii.struct", struct); return obj; } @Override public final boolean equals(final Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; CodeBuildProjectProps.Jsii$Proxy that = (CodeBuildProjectProps.Jsii$Proxy) o; if (this.event != null ? !this.event.equals(that.event) : that.event != null) return false; if (this.eventRole != null ? !this.eventRole.equals(that.eventRole) : that.eventRole != null) return false; if (this.deadLetterQueue != null ? !this.deadLetterQueue.equals(that.deadLetterQueue) : that.deadLetterQueue != null) return false; if (this.maxEventAge != null ? !this.maxEventAge.equals(that.maxEventAge) : that.maxEventAge != null) return false; return this.retryAttempts != null ? this.retryAttempts.equals(that.retryAttempts) : that.retryAttempts == null; } @Override public final int hashCode() { int result = this.event != null ? this.event.hashCode() : 0; result = 31 * result + (this.eventRole != null ? this.eventRole.hashCode() : 0); result = 31 * result + (this.deadLetterQueue != null ? this.deadLetterQueue.hashCode() : 0); result = 31 * result + (this.maxEventAge != null ? this.maxEventAge.hashCode() : 0); result = 31 * result + (this.retryAttempts != null ? this.retryAttempts.hashCode() : 0); return result; } } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy