io.github.dontirun.statemachinesemaphore.SemaphoreProps Maven / Gradle / Ivy
Show all versions of statemachinesemaphore Show documentation
package io.github.dontirun.statemachinesemaphore;
/**
* Interface for creating a Semaphore.
*/
@javax.annotation.Generated(value = "jsii-pacmak/1.80.0 (build bce6a1d)", date = "2023-04-10T00:34:51.856Z")
@software.amazon.jsii.Jsii(module = io.github.dontirun.statemachinesemaphore.$Module.class, fqn = "@dontirun/state-machine-semaphore.SemaphoreProps")
@software.amazon.jsii.Jsii.Proxy(SemaphoreProps.Jsii$Proxy.class)
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public interface SemaphoreProps extends software.amazon.jsii.JsiiSerializable {
/**
* The job (or chained jobs) to be semaphored.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
@org.jetbrains.annotations.NotNull io.github.dontirun.statemachinesemaphore.IChainNextable getJob();
/**
* The maximum number of concurrent executions for the given lock.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
@org.jetbrains.annotations.NotNull java.lang.Number getLimit();
/**
* The name of the semaphore.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
@org.jetbrains.annotations.NotNull java.lang.String getLockName();
/**
* The State to go to after the semaphored job completes.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
@org.jetbrains.annotations.NotNull software.amazon.awscdk.services.stepfunctions.State getNextState();
/**
* Add detailed comments to lock related states.
*
* Significantly increases CloudFormation template size. Default: false.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
default @org.jetbrains.annotations.Nullable java.lang.Boolean getComments() {
return null;
}
/**
* Explicility allow the reuse of a named lock from a previously generated job.
*
* Throws an error if a different limit
is specified. Default: false.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
default @org.jetbrains.annotations.Nullable java.lang.Boolean getReuseLock() {
return null;
}
/**
* Optionally set the DynamoDB table to have a specific read/write capacity with PROVISIONED billing.
*
* Note: This property can only be set on the first instantiation of a Semaphore
per stack
*
* Default: PAY_PER_REQUEST
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
default @org.jetbrains.annotations.Nullable io.github.dontirun.statemachinesemaphore.TableReadWriteCapacity getTableReadWriteCapacity() {
return null;
}
/**
* @return a {@link Builder} of {@link SemaphoreProps}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
static Builder builder() {
return new Builder();
}
/**
* A builder for {@link SemaphoreProps}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public static final class Builder implements software.amazon.jsii.Builder {
io.github.dontirun.statemachinesemaphore.IChainNextable job;
java.lang.Number limit;
java.lang.String lockName;
software.amazon.awscdk.services.stepfunctions.State nextState;
java.lang.Boolean comments;
java.lang.Boolean reuseLock;
io.github.dontirun.statemachinesemaphore.TableReadWriteCapacity tableReadWriteCapacity;
/**
* Sets the value of {@link SemaphoreProps#getJob}
* @param job The job (or chained jobs) to be semaphored. This parameter is required.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder job(io.github.dontirun.statemachinesemaphore.IChainNextable job) {
this.job = job;
return this;
}
/**
* Sets the value of {@link SemaphoreProps#getLimit}
* @param limit The maximum number of concurrent executions for the given lock. This parameter is required.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder limit(java.lang.Number limit) {
this.limit = limit;
return this;
}
/**
* Sets the value of {@link SemaphoreProps#getLockName}
* @param lockName The name of the semaphore. This parameter is required.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder lockName(java.lang.String lockName) {
this.lockName = lockName;
return this;
}
/**
* Sets the value of {@link SemaphoreProps#getNextState}
* @param nextState The State to go to after the semaphored job completes. This parameter is required.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder nextState(software.amazon.awscdk.services.stepfunctions.State nextState) {
this.nextState = nextState;
return this;
}
/**
* Sets the value of {@link SemaphoreProps#getComments}
* @param comments Add detailed comments to lock related states.
* Significantly increases CloudFormation template size. Default: false.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder comments(java.lang.Boolean comments) {
this.comments = comments;
return this;
}
/**
* Sets the value of {@link SemaphoreProps#getReuseLock}
* @param reuseLock Explicility allow the reuse of a named lock from a previously generated job.
* Throws an error if a different limit
is specified. Default: false.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder reuseLock(java.lang.Boolean reuseLock) {
this.reuseLock = reuseLock;
return this;
}
/**
* Sets the value of {@link SemaphoreProps#getTableReadWriteCapacity}
* @param tableReadWriteCapacity Optionally set the DynamoDB table to have a specific read/write capacity with PROVISIONED billing.
* Note: This property can only be set on the first instantiation of a Semaphore
per stack
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder tableReadWriteCapacity(io.github.dontirun.statemachinesemaphore.TableReadWriteCapacity tableReadWriteCapacity) {
this.tableReadWriteCapacity = tableReadWriteCapacity;
return this;
}
/**
* Builds the configured instance.
* @return a new instance of {@link SemaphoreProps}
* @throws NullPointerException if any required attribute was not provided
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
@Override
public SemaphoreProps build() {
return new Jsii$Proxy(this);
}
}
/**
* An implementation for {@link SemaphoreProps}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
@software.amazon.jsii.Internal
final class Jsii$Proxy extends software.amazon.jsii.JsiiObject implements SemaphoreProps {
private final io.github.dontirun.statemachinesemaphore.IChainNextable job;
private final java.lang.Number limit;
private final java.lang.String lockName;
private final software.amazon.awscdk.services.stepfunctions.State nextState;
private final java.lang.Boolean comments;
private final java.lang.Boolean reuseLock;
private final io.github.dontirun.statemachinesemaphore.TableReadWriteCapacity tableReadWriteCapacity;
/**
* 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.job = software.amazon.jsii.Kernel.get(this, "job", software.amazon.jsii.NativeType.forClass(io.github.dontirun.statemachinesemaphore.IChainNextable.class));
this.limit = software.amazon.jsii.Kernel.get(this, "limit", software.amazon.jsii.NativeType.forClass(java.lang.Number.class));
this.lockName = software.amazon.jsii.Kernel.get(this, "lockName", software.amazon.jsii.NativeType.forClass(java.lang.String.class));
this.nextState = software.amazon.jsii.Kernel.get(this, "nextState", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.stepfunctions.State.class));
this.comments = software.amazon.jsii.Kernel.get(this, "comments", software.amazon.jsii.NativeType.forClass(java.lang.Boolean.class));
this.reuseLock = software.amazon.jsii.Kernel.get(this, "reuseLock", software.amazon.jsii.NativeType.forClass(java.lang.Boolean.class));
this.tableReadWriteCapacity = software.amazon.jsii.Kernel.get(this, "tableReadWriteCapacity", software.amazon.jsii.NativeType.forClass(io.github.dontirun.statemachinesemaphore.TableReadWriteCapacity.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.job = java.util.Objects.requireNonNull(builder.job, "job is required");
this.limit = java.util.Objects.requireNonNull(builder.limit, "limit is required");
this.lockName = java.util.Objects.requireNonNull(builder.lockName, "lockName is required");
this.nextState = java.util.Objects.requireNonNull(builder.nextState, "nextState is required");
this.comments = builder.comments;
this.reuseLock = builder.reuseLock;
this.tableReadWriteCapacity = builder.tableReadWriteCapacity;
}
@Override
public final io.github.dontirun.statemachinesemaphore.IChainNextable getJob() {
return this.job;
}
@Override
public final java.lang.Number getLimit() {
return this.limit;
}
@Override
public final java.lang.String getLockName() {
return this.lockName;
}
@Override
public final software.amazon.awscdk.services.stepfunctions.State getNextState() {
return this.nextState;
}
@Override
public final java.lang.Boolean getComments() {
return this.comments;
}
@Override
public final java.lang.Boolean getReuseLock() {
return this.reuseLock;
}
@Override
public final io.github.dontirun.statemachinesemaphore.TableReadWriteCapacity getTableReadWriteCapacity() {
return this.tableReadWriteCapacity;
}
@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();
data.set("job", om.valueToTree(this.getJob()));
data.set("limit", om.valueToTree(this.getLimit()));
data.set("lockName", om.valueToTree(this.getLockName()));
data.set("nextState", om.valueToTree(this.getNextState()));
if (this.getComments() != null) {
data.set("comments", om.valueToTree(this.getComments()));
}
if (this.getReuseLock() != null) {
data.set("reuseLock", om.valueToTree(this.getReuseLock()));
}
if (this.getTableReadWriteCapacity() != null) {
data.set("tableReadWriteCapacity", om.valueToTree(this.getTableReadWriteCapacity()));
}
final com.fasterxml.jackson.databind.node.ObjectNode struct = com.fasterxml.jackson.databind.node.JsonNodeFactory.instance.objectNode();
struct.set("fqn", om.valueToTree("@dontirun/state-machine-semaphore.SemaphoreProps"));
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;
SemaphoreProps.Jsii$Proxy that = (SemaphoreProps.Jsii$Proxy) o;
if (!job.equals(that.job)) return false;
if (!limit.equals(that.limit)) return false;
if (!lockName.equals(that.lockName)) return false;
if (!nextState.equals(that.nextState)) return false;
if (this.comments != null ? !this.comments.equals(that.comments) : that.comments != null) return false;
if (this.reuseLock != null ? !this.reuseLock.equals(that.reuseLock) : that.reuseLock != null) return false;
return this.tableReadWriteCapacity != null ? this.tableReadWriteCapacity.equals(that.tableReadWriteCapacity) : that.tableReadWriteCapacity == null;
}
@Override
public final int hashCode() {
int result = this.job.hashCode();
result = 31 * result + (this.limit.hashCode());
result = 31 * result + (this.lockName.hashCode());
result = 31 * result + (this.nextState.hashCode());
result = 31 * result + (this.comments != null ? this.comments.hashCode() : 0);
result = 31 * result + (this.reuseLock != null ? this.reuseLock.hashCode() : 0);
result = 31 * result + (this.tableReadWriteCapacity != null ? this.tableReadWriteCapacity.hashCode() : 0);
return result;
}
}
}