software.amazon.awscdk.services.gamelift.alpha.RuntimeConfiguration Maven / Gradle / Ivy
Show all versions of gamelift-alpha Show documentation
package software.amazon.awscdk.services.gamelift.alpha;
/**
* (experimental) A collection of server process configurations that describe the set of processes to run on each instance in a fleet.
*
* Server processes run either an executable in a custom game build or a Realtime Servers script.
* GameLift launches the configured processes, manages their life cycle, and replaces them as needed.
* Each instance checks regularly for an updated runtime configuration.
*
* A GameLift instance is limited to 50 processes running concurrently.
* To calculate the total number of processes in a runtime configuration, add the values of the ConcurrentExecutions
parameter for each ServerProcess
.
*
* Example:
*
*
* Build build;
* // Server processes can be delcared in a declarative way through the 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")
* .parameters("-logFile /local/game/logs/myserver1935.log -port 1935")
* .concurrentExecutions(100)
* .build()))
* .build())
* .build();
*
*
* @see https://docs.aws.amazon.com/gamelift/latest/developerguide/fleets-multiprocess.html
*/
@javax.annotation.Generated(value = "jsii-pacmak/1.102.0 (build e354887)", date = "2024-08-23T05:56:25.545Z")
@software.amazon.jsii.Jsii(module = software.amazon.awscdk.services.gamelift.alpha.$Module.class, fqn = "@aws-cdk/aws-gamelift-alpha.RuntimeConfiguration")
@software.amazon.jsii.Jsii.Proxy(RuntimeConfiguration.Jsii$Proxy.class)
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public interface RuntimeConfiguration extends software.amazon.jsii.JsiiSerializable {
/**
* (experimental) A collection of server process configurations that identify what server processes to run on each instance in a fleet.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@org.jetbrains.annotations.NotNull java.util.List getServerProcesses();
/**
* (experimental) The maximum amount of time allowed to launch a new game session and have it report ready to host players.
*
* During this time, the game session is in status ACTIVATING
.
*
* If the game session does not become active before the timeout, it is ended and the game session status is changed to TERMINATED
.
*
* Default: by default game session activation timeout is 300 seconds
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
default @org.jetbrains.annotations.Nullable software.amazon.awscdk.Duration getGameSessionActivationTimeout() {
return null;
}
/**
* (experimental) The number of game sessions in status ACTIVATING
to allow on an instance.
*
* This setting limits the instance resources that can be used for new game activations at any one time.
*
* Default: no limit
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
default @org.jetbrains.annotations.Nullable java.lang.Number getMaxConcurrentGameSessionActivations() {
return null;
}
/**
* @return a {@link Builder} of {@link RuntimeConfiguration}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
static Builder builder() {
return new Builder();
}
/**
* A builder for {@link RuntimeConfiguration}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public static final class Builder implements software.amazon.jsii.Builder {
java.util.List serverProcesses;
software.amazon.awscdk.Duration gameSessionActivationTimeout;
java.lang.Number maxConcurrentGameSessionActivations;
/**
* Sets the value of {@link RuntimeConfiguration#getServerProcesses}
* @param serverProcesses A collection of server process configurations that identify what server processes to run on each instance in a fleet. This parameter is required.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@SuppressWarnings("unchecked")
public Builder serverProcesses(java.util.List extends software.amazon.awscdk.services.gamelift.alpha.ServerProcess> serverProcesses) {
this.serverProcesses = (java.util.List)serverProcesses;
return this;
}
/**
* Sets the value of {@link RuntimeConfiguration#getGameSessionActivationTimeout}
* @param gameSessionActivationTimeout The maximum amount of time allowed to launch a new game session and have it report ready to host players.
* During this time, the game session is in status ACTIVATING
.
*
* If the game session does not become active before the timeout, it is ended and the game session status is changed to TERMINATED
.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder gameSessionActivationTimeout(software.amazon.awscdk.Duration gameSessionActivationTimeout) {
this.gameSessionActivationTimeout = gameSessionActivationTimeout;
return this;
}
/**
* Sets the value of {@link RuntimeConfiguration#getMaxConcurrentGameSessionActivations}
* @param maxConcurrentGameSessionActivations The number of game sessions in status ACTIVATING
to allow on an instance.
* This setting limits the instance resources that can be used for new game activations at any one time.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder maxConcurrentGameSessionActivations(java.lang.Number maxConcurrentGameSessionActivations) {
this.maxConcurrentGameSessionActivations = maxConcurrentGameSessionActivations;
return this;
}
/**
* Builds the configured instance.
* @return a new instance of {@link RuntimeConfiguration}
* @throws NullPointerException if any required attribute was not provided
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@Override
public RuntimeConfiguration build() {
return new Jsii$Proxy(this);
}
}
/**
* An implementation for {@link RuntimeConfiguration}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@software.amazon.jsii.Internal
final class Jsii$Proxy extends software.amazon.jsii.JsiiObject implements RuntimeConfiguration {
private final java.util.List serverProcesses;
private final software.amazon.awscdk.Duration gameSessionActivationTimeout;
private final java.lang.Number maxConcurrentGameSessionActivations;
/**
* 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.serverProcesses = software.amazon.jsii.Kernel.get(this, "serverProcesses", software.amazon.jsii.NativeType.listOf(software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.gamelift.alpha.ServerProcess.class)));
this.gameSessionActivationTimeout = software.amazon.jsii.Kernel.get(this, "gameSessionActivationTimeout", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.Duration.class));
this.maxConcurrentGameSessionActivations = software.amazon.jsii.Kernel.get(this, "maxConcurrentGameSessionActivations", software.amazon.jsii.NativeType.forClass(java.lang.Number.class));
}
/**
* Constructor that initializes the object based on literal property values passed by the {@link Builder}.
*/
@SuppressWarnings("unchecked")
protected Jsii$Proxy(final Builder builder) {
super(software.amazon.jsii.JsiiObject.InitializationMode.JSII);
this.serverProcesses = (java.util.List)java.util.Objects.requireNonNull(builder.serverProcesses, "serverProcesses is required");
this.gameSessionActivationTimeout = builder.gameSessionActivationTimeout;
this.maxConcurrentGameSessionActivations = builder.maxConcurrentGameSessionActivations;
}
@Override
public final java.util.List getServerProcesses() {
return this.serverProcesses;
}
@Override
public final software.amazon.awscdk.Duration getGameSessionActivationTimeout() {
return this.gameSessionActivationTimeout;
}
@Override
public final java.lang.Number getMaxConcurrentGameSessionActivations() {
return this.maxConcurrentGameSessionActivations;
}
@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("serverProcesses", om.valueToTree(this.getServerProcesses()));
if (this.getGameSessionActivationTimeout() != null) {
data.set("gameSessionActivationTimeout", om.valueToTree(this.getGameSessionActivationTimeout()));
}
if (this.getMaxConcurrentGameSessionActivations() != null) {
data.set("maxConcurrentGameSessionActivations", om.valueToTree(this.getMaxConcurrentGameSessionActivations()));
}
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.RuntimeConfiguration"));
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;
RuntimeConfiguration.Jsii$Proxy that = (RuntimeConfiguration.Jsii$Proxy) o;
if (!serverProcesses.equals(that.serverProcesses)) return false;
if (this.gameSessionActivationTimeout != null ? !this.gameSessionActivationTimeout.equals(that.gameSessionActivationTimeout) : that.gameSessionActivationTimeout != null) return false;
return this.maxConcurrentGameSessionActivations != null ? this.maxConcurrentGameSessionActivations.equals(that.maxConcurrentGameSessionActivations) : that.maxConcurrentGameSessionActivations == null;
}
@Override
public final int hashCode() {
int result = this.serverProcesses.hashCode();
result = 31 * result + (this.gameSessionActivationTimeout != null ? this.gameSessionActivationTimeout.hashCode() : 0);
result = 31 * result + (this.maxConcurrentGameSessionActivations != null ? this.maxConcurrentGameSessionActivations.hashCode() : 0);
return result;
}
}
}