software.amazon.awscdk.services.events.targets.CodeBuildProjectProps Maven / Gradle / Ivy
Show all versions of events-targets Show documentation
package software.amazon.awscdk.services.events.targets;
/**
* Customize the CodeBuild Event Target.
*/
@javax.annotation.Generated(value = "jsii-pacmak/1.30.0 (build adae23f)", date = "2021-07-09T19:18:30.459Z")
@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 {
private software.amazon.awscdk.services.events.RuleTargetInput event;
private software.amazon.awscdk.services.iam.IRole eventRole;
private software.amazon.awscdk.services.sqs.IQueue deadLetterQueue;
private software.amazon.awscdk.core.Duration maxEventAge;
private 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(event, eventRole, deadLetterQueue, maxEventAge, retryAttempts);
}
}
/**
* 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 software.amazon.awscdk.services.events.RuleTargetInput event, final software.amazon.awscdk.services.iam.IRole eventRole, final software.amazon.awscdk.services.sqs.IQueue deadLetterQueue, final software.amazon.awscdk.core.Duration maxEventAge, final java.lang.Number retryAttempts) {
super(software.amazon.jsii.JsiiObject.InitializationMode.JSII);
this.event = event;
this.eventRole = eventRole;
this.deadLetterQueue = deadLetterQueue;
this.maxEventAge = maxEventAge;
this.retryAttempts = 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;
}
}
}