software.amazon.awscdk.services.gamelift.alpha.LocationCapacity Maven / Gradle / Ivy
Show all versions of gamelift-alpha Show documentation
package software.amazon.awscdk.services.gamelift.alpha;
/**
* (experimental) Current resource capacity settings in a specified fleet or location.
*
* The location value might refer to a fleet's remote location or its home Region.
*
* Example:
*
*
* Build build;
* // Locations can be added directly through constructor
* BuildFleet fleet = BuildFleet.Builder.create(this, "Game server fleet")
* .fleetName("test-fleet")
* .content(build)
* .instanceType(InstanceType.of(InstanceClass.C4, InstanceSize.LARGE))
* .runtimeConfiguration(RuntimeConfiguration.builder()
* .serverProcesses(List.of(ServerProcess.builder()
* .launchPath("/local/game/GameLiftExampleServer.x86_64")
* .build()))
* .build())
* .locations(List.of(Location.builder()
* .region("eu-west-1")
* .capacity(LocationCapacity.builder()
* .desiredCapacity(5)
* .minSize(2)
* .maxSize(10)
* .build())
* .build(), Location.builder()
* .region("us-east-1")
* .capacity(LocationCapacity.builder()
* .desiredCapacity(5)
* .minSize(2)
* .maxSize(10)
* .build())
* .build()))
* .build();
* // Or through dedicated methods
* fleet.addLocation("ap-southeast-1", 5, 2, 10);
*
*/
@javax.annotation.Generated(value = "jsii-pacmak/1.104.0 (build e79254c)", date = "2024-12-27T17:02:12.130Z")
@software.amazon.jsii.Jsii(module = software.amazon.awscdk.services.gamelift.alpha.$Module.class, fqn = "@aws-cdk/aws-gamelift-alpha.LocationCapacity")
@software.amazon.jsii.Jsii.Proxy(LocationCapacity.Jsii$Proxy.class)
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public interface LocationCapacity extends software.amazon.jsii.JsiiSerializable {
/**
* (experimental) The number of Amazon EC2 instances you want to maintain in the specified fleet location.
*
* This value must fall between the minimum and maximum size limits.
*
* Default: the default value is 0
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
default @org.jetbrains.annotations.Nullable java.lang.Number getDesiredCapacity() {
return null;
}
/**
* (experimental) The maximum number of instances that are allowed in the specified fleet location.
*
* Default: the default value is 1
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
default @org.jetbrains.annotations.Nullable java.lang.Number getMaxSize() {
return null;
}
/**
* (experimental) The minimum number of instances that are allowed in the specified fleet location.
*
* Default: the default value is 0
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
default @org.jetbrains.annotations.Nullable java.lang.Number getMinSize() {
return null;
}
/**
* @return a {@link Builder} of {@link LocationCapacity}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
static Builder builder() {
return new Builder();
}
/**
* A builder for {@link LocationCapacity}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public static final class Builder implements software.amazon.jsii.Builder {
java.lang.Number desiredCapacity;
java.lang.Number maxSize;
java.lang.Number minSize;
/**
* Sets the value of {@link LocationCapacity#getDesiredCapacity}
* @param desiredCapacity The number of Amazon EC2 instances you want to maintain in the specified fleet location.
* This value must fall between the minimum and maximum size limits.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder desiredCapacity(java.lang.Number desiredCapacity) {
this.desiredCapacity = desiredCapacity;
return this;
}
/**
* Sets the value of {@link LocationCapacity#getMaxSize}
* @param maxSize The maximum number of instances that are allowed in the specified fleet location.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder maxSize(java.lang.Number maxSize) {
this.maxSize = maxSize;
return this;
}
/**
* Sets the value of {@link LocationCapacity#getMinSize}
* @param minSize The minimum number of instances that are allowed in the specified fleet location.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder minSize(java.lang.Number minSize) {
this.minSize = minSize;
return this;
}
/**
* Builds the configured instance.
* @return a new instance of {@link LocationCapacity}
* @throws NullPointerException if any required attribute was not provided
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@Override
public LocationCapacity build() {
return new Jsii$Proxy(this);
}
}
/**
* An implementation for {@link LocationCapacity}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@software.amazon.jsii.Internal
final class Jsii$Proxy extends software.amazon.jsii.JsiiObject implements LocationCapacity {
private final java.lang.Number desiredCapacity;
private final java.lang.Number maxSize;
private final java.lang.Number minSize;
/**
* 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.desiredCapacity = software.amazon.jsii.Kernel.get(this, "desiredCapacity", software.amazon.jsii.NativeType.forClass(java.lang.Number.class));
this.maxSize = software.amazon.jsii.Kernel.get(this, "maxSize", software.amazon.jsii.NativeType.forClass(java.lang.Number.class));
this.minSize = software.amazon.jsii.Kernel.get(this, "minSize", 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.desiredCapacity = builder.desiredCapacity;
this.maxSize = builder.maxSize;
this.minSize = builder.minSize;
}
@Override
public final java.lang.Number getDesiredCapacity() {
return this.desiredCapacity;
}
@Override
public final java.lang.Number getMaxSize() {
return this.maxSize;
}
@Override
public final java.lang.Number getMinSize() {
return this.minSize;
}
@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.getDesiredCapacity() != null) {
data.set("desiredCapacity", om.valueToTree(this.getDesiredCapacity()));
}
if (this.getMaxSize() != null) {
data.set("maxSize", om.valueToTree(this.getMaxSize()));
}
if (this.getMinSize() != null) {
data.set("minSize", om.valueToTree(this.getMinSize()));
}
final com.fasterxml.jackson.databind.node.ObjectNode struct = com.fasterxml.jackson.databind.node.JsonNodeFactory.instance.objectNode();
struct.set("fqn", om.valueToTree("@aws-cdk/aws-gamelift-alpha.LocationCapacity"));
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;
LocationCapacity.Jsii$Proxy that = (LocationCapacity.Jsii$Proxy) o;
if (this.desiredCapacity != null ? !this.desiredCapacity.equals(that.desiredCapacity) : that.desiredCapacity != null) return false;
if (this.maxSize != null ? !this.maxSize.equals(that.maxSize) : that.maxSize != null) return false;
return this.minSize != null ? this.minSize.equals(that.minSize) : that.minSize == null;
}
@Override
public final int hashCode() {
int result = this.desiredCapacity != null ? this.desiredCapacity.hashCode() : 0;
result = 31 * result + (this.maxSize != null ? this.maxSize.hashCode() : 0);
result = 31 * result + (this.minSize != null ? this.minSize.hashCode() : 0);
return result;
}
}
}