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

software.amazon.awscdk.services.gamelift.alpha.InstanceDefinition Maven / Gradle / Ivy

There is a newer version: 2.170.0-alpha.0
Show newest version
package software.amazon.awscdk.services.gamelift.alpha;

/**
 * (experimental) An allowed instance type for a game server group.
 * 

* All game server groups must have at least two instance types defined for it. * GameLift FleetIQ periodically evaluates each defined instance type for viability. * It then updates the Auto Scaling group with the list of viable instance types. *

* Example: *

*

 * // The code below shows an example of how to instantiate this type.
 * // The values are placeholders you should change.
 * import software.amazon.awscdk.services.gamelift.alpha.*;
 * import software.amazon.awscdk.services.ec2.*;
 * InstanceType instanceType;
 * InstanceDefinition instanceDefinition = InstanceDefinition.builder()
 *         .instanceType(instanceType)
 *         // the properties below are optional
 *         .weight(123)
 *         .build();
 * 
*/ @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.InstanceDefinition") @software.amazon.jsii.Jsii.Proxy(InstanceDefinition.Jsii$Proxy.class) @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) public interface InstanceDefinition extends software.amazon.jsii.JsiiSerializable { /** * (experimental) An Amazon EC2 instance type designation. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) @org.jetbrains.annotations.NotNull software.amazon.awscdk.services.ec2.InstanceType getInstanceType(); /** * (experimental) Instance weighting that indicates how much this instance type contributes to the total capacity of a game server group. *

* Instance weights are used by GameLift FleetIQ to calculate the instance type's cost per unit hour and better identify the most cost-effective options. *

* Default: default value is 1 *

* @see https://docs.aws.amazon.com/autoscaling/ec2/userguide/asg-instance-weighting.html */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) default @org.jetbrains.annotations.Nullable java.lang.Number getWeight() { return null; } /** * @return a {@link Builder} of {@link InstanceDefinition} */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) static Builder builder() { return new Builder(); } /** * A builder for {@link InstanceDefinition} */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) public static final class Builder implements software.amazon.jsii.Builder { software.amazon.awscdk.services.ec2.InstanceType instanceType; java.lang.Number weight; /** * Sets the value of {@link InstanceDefinition#getInstanceType} * @param instanceType An Amazon EC2 instance type designation. This parameter is required. * @return {@code this} */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) public Builder instanceType(software.amazon.awscdk.services.ec2.InstanceType instanceType) { this.instanceType = instanceType; return this; } /** * Sets the value of {@link InstanceDefinition#getWeight} * @param weight Instance weighting that indicates how much this instance type contributes to the total capacity of a game server group. * Instance weights are used by GameLift FleetIQ to calculate the instance type's cost per unit hour and better identify the most cost-effective options. * @return {@code this} */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) public Builder weight(java.lang.Number weight) { this.weight = weight; return this; } /** * Builds the configured instance. * @return a new instance of {@link InstanceDefinition} * @throws NullPointerException if any required attribute was not provided */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) @Override public InstanceDefinition build() { return new Jsii$Proxy(this); } } /** * An implementation for {@link InstanceDefinition} */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) @software.amazon.jsii.Internal final class Jsii$Proxy extends software.amazon.jsii.JsiiObject implements InstanceDefinition { private final software.amazon.awscdk.services.ec2.InstanceType instanceType; private final java.lang.Number weight; /** * 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.instanceType = software.amazon.jsii.Kernel.get(this, "instanceType", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.ec2.InstanceType.class)); this.weight = software.amazon.jsii.Kernel.get(this, "weight", 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.instanceType = java.util.Objects.requireNonNull(builder.instanceType, "instanceType is required"); this.weight = builder.weight; } @Override public final software.amazon.awscdk.services.ec2.InstanceType getInstanceType() { return this.instanceType; } @Override public final java.lang.Number getWeight() { return this.weight; } @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("instanceType", om.valueToTree(this.getInstanceType())); if (this.getWeight() != null) { data.set("weight", om.valueToTree(this.getWeight())); } 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.InstanceDefinition")); 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; InstanceDefinition.Jsii$Proxy that = (InstanceDefinition.Jsii$Proxy) o; if (!instanceType.equals(that.instanceType)) return false; return this.weight != null ? this.weight.equals(that.weight) : that.weight == null; } @Override public final int hashCode() { int result = this.instanceType.hashCode(); result = 31 * result + (this.weight != null ? this.weight.hashCode() : 0); return result; } } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy