io.github.jogold.cloudstructs.EcsServiceRollerProps Maven / Gradle / Ivy
Show all versions of cloudstructs Show documentation
package io.github.jogold.cloudstructs;
/**
* Properties for a EcsServiceRoller.
*/
@javax.annotation.Generated(value = "jsii-pacmak/1.103.1 (build bef2dea)", date = "2024-09-23T12:43:48.154Z")
@software.amazon.jsii.Jsii(module = io.github.jogold.cloudstructs.$Module.class, fqn = "cloudstructs.EcsServiceRollerProps")
@software.amazon.jsii.Jsii.Proxy(EcsServiceRollerProps.Jsii$Proxy.class)
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public interface EcsServiceRollerProps extends software.amazon.jsii.JsiiSerializable {
/**
* The ECS cluster where the services run.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
@org.jetbrains.annotations.NotNull software.amazon.awscdk.services.ecs.ICluster getCluster();
/**
* The ECS service for which tasks should be rolled.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
@org.jetbrains.annotations.NotNull software.amazon.awscdk.services.ecs.IService getService();
/**
* The rule or schedule that should trigger a roll.
*
* Default: - roll everyday at midnight
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
default @org.jetbrains.annotations.Nullable io.github.jogold.cloudstructs.RollTrigger getTrigger() {
return null;
}
/**
* @return a {@link Builder} of {@link EcsServiceRollerProps}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
static Builder builder() {
return new Builder();
}
/**
* A builder for {@link EcsServiceRollerProps}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public static final class Builder implements software.amazon.jsii.Builder {
software.amazon.awscdk.services.ecs.ICluster cluster;
software.amazon.awscdk.services.ecs.IService service;
io.github.jogold.cloudstructs.RollTrigger trigger;
/**
* Sets the value of {@link EcsServiceRollerProps#getCluster}
* @param cluster The ECS cluster where the services run. This parameter is required.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder cluster(software.amazon.awscdk.services.ecs.ICluster cluster) {
this.cluster = cluster;
return this;
}
/**
* Sets the value of {@link EcsServiceRollerProps#getService}
* @param service The ECS service for which tasks should be rolled. This parameter is required.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder service(software.amazon.awscdk.services.ecs.IService service) {
this.service = service;
return this;
}
/**
* Sets the value of {@link EcsServiceRollerProps#getTrigger}
* @param trigger The rule or schedule that should trigger a roll.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder trigger(io.github.jogold.cloudstructs.RollTrigger trigger) {
this.trigger = trigger;
return this;
}
/**
* Builds the configured instance.
* @return a new instance of {@link EcsServiceRollerProps}
* @throws NullPointerException if any required attribute was not provided
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
@Override
public EcsServiceRollerProps build() {
return new Jsii$Proxy(this);
}
}
/**
* An implementation for {@link EcsServiceRollerProps}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
@software.amazon.jsii.Internal
final class Jsii$Proxy extends software.amazon.jsii.JsiiObject implements EcsServiceRollerProps {
private final software.amazon.awscdk.services.ecs.ICluster cluster;
private final software.amazon.awscdk.services.ecs.IService service;
private final io.github.jogold.cloudstructs.RollTrigger trigger;
/**
* 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.cluster = software.amazon.jsii.Kernel.get(this, "cluster", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.ecs.ICluster.class));
this.service = software.amazon.jsii.Kernel.get(this, "service", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.ecs.IService.class));
this.trigger = software.amazon.jsii.Kernel.get(this, "trigger", software.amazon.jsii.NativeType.forClass(io.github.jogold.cloudstructs.RollTrigger.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.cluster = java.util.Objects.requireNonNull(builder.cluster, "cluster is required");
this.service = java.util.Objects.requireNonNull(builder.service, "service is required");
this.trigger = builder.trigger;
}
@Override
public final software.amazon.awscdk.services.ecs.ICluster getCluster() {
return this.cluster;
}
@Override
public final software.amazon.awscdk.services.ecs.IService getService() {
return this.service;
}
@Override
public final io.github.jogold.cloudstructs.RollTrigger getTrigger() {
return this.trigger;
}
@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("cluster", om.valueToTree(this.getCluster()));
data.set("service", om.valueToTree(this.getService()));
if (this.getTrigger() != null) {
data.set("trigger", om.valueToTree(this.getTrigger()));
}
final com.fasterxml.jackson.databind.node.ObjectNode struct = com.fasterxml.jackson.databind.node.JsonNodeFactory.instance.objectNode();
struct.set("fqn", om.valueToTree("cloudstructs.EcsServiceRollerProps"));
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;
EcsServiceRollerProps.Jsii$Proxy that = (EcsServiceRollerProps.Jsii$Proxy) o;
if (!cluster.equals(that.cluster)) return false;
if (!service.equals(that.service)) return false;
return this.trigger != null ? this.trigger.equals(that.trigger) : that.trigger == null;
}
@Override
public final int hashCode() {
int result = this.cluster.hashCode();
result = 31 * result + (this.service.hashCode());
result = 31 * result + (this.trigger != null ? this.trigger.hashCode() : 0);
return result;
}
}
}