
software.amazon.awssdk.services.gamelift.model.FleetUtilization Maven / Gradle / Ivy
/*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
* the License. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
package software.amazon.awssdk.services.gamelift.model;
import java.io.Serializable;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.function.BiConsumer;
import java.util.function.Function;
import software.amazon.awssdk.annotations.Generated;
import software.amazon.awssdk.core.SdkField;
import software.amazon.awssdk.core.SdkPojo;
import software.amazon.awssdk.core.protocol.MarshallLocation;
import software.amazon.awssdk.core.protocol.MarshallingType;
import software.amazon.awssdk.core.traits.LocationTrait;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*
* Current status of fleet utilization, including the number of game and player sessions being hosted.
*
*
* -
*
* CreateFleet
*
*
* -
*
* ListFleets
*
*
* -
*
* DeleteFleet
*
*
* -
*
*
* -
*
*
* -
*
*
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class FleetUtilization implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField FLEET_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(FleetUtilization::fleetId)).setter(setter(Builder::fleetId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("FleetId").build()).build();
private static final SdkField ACTIVE_SERVER_PROCESS_COUNT_FIELD = SdkField
. builder(MarshallingType.INTEGER).getter(getter(FleetUtilization::activeServerProcessCount))
.setter(setter(Builder::activeServerProcessCount))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ActiveServerProcessCount").build())
.build();
private static final SdkField ACTIVE_GAME_SESSION_COUNT_FIELD = SdkField. builder(MarshallingType.INTEGER)
.getter(getter(FleetUtilization::activeGameSessionCount)).setter(setter(Builder::activeGameSessionCount))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ActiveGameSessionCount").build())
.build();
private static final SdkField CURRENT_PLAYER_SESSION_COUNT_FIELD = SdkField
. builder(MarshallingType.INTEGER).getter(getter(FleetUtilization::currentPlayerSessionCount))
.setter(setter(Builder::currentPlayerSessionCount))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CurrentPlayerSessionCount").build())
.build();
private static final SdkField MAXIMUM_PLAYER_SESSION_COUNT_FIELD = SdkField
. builder(MarshallingType.INTEGER).getter(getter(FleetUtilization::maximumPlayerSessionCount))
.setter(setter(Builder::maximumPlayerSessionCount))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("MaximumPlayerSessionCount").build())
.build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(FLEET_ID_FIELD,
ACTIVE_SERVER_PROCESS_COUNT_FIELD, ACTIVE_GAME_SESSION_COUNT_FIELD, CURRENT_PLAYER_SESSION_COUNT_FIELD,
MAXIMUM_PLAYER_SESSION_COUNT_FIELD));
private static final long serialVersionUID = 1L;
private final String fleetId;
private final Integer activeServerProcessCount;
private final Integer activeGameSessionCount;
private final Integer currentPlayerSessionCount;
private final Integer maximumPlayerSessionCount;
private FleetUtilization(BuilderImpl builder) {
this.fleetId = builder.fleetId;
this.activeServerProcessCount = builder.activeServerProcessCount;
this.activeGameSessionCount = builder.activeGameSessionCount;
this.currentPlayerSessionCount = builder.currentPlayerSessionCount;
this.maximumPlayerSessionCount = builder.maximumPlayerSessionCount;
}
/**
*
* A unique identifier for a fleet.
*
*
* @return A unique identifier for a fleet.
*/
public String fleetId() {
return fleetId;
}
/**
*
* Number of server processes in an ACTIVE
status currently running across all instances in the fleet
*
*
* @return Number of server processes in an ACTIVE
status currently running across all instances in the
* fleet
*/
public Integer activeServerProcessCount() {
return activeServerProcessCount;
}
/**
*
* Number of active game sessions currently being hosted on all instances in the fleet.
*
*
* @return Number of active game sessions currently being hosted on all instances in the fleet.
*/
public Integer activeGameSessionCount() {
return activeGameSessionCount;
}
/**
*
* Number of active player sessions currently being hosted on all instances in the fleet.
*
*
* @return Number of active player sessions currently being hosted on all instances in the fleet.
*/
public Integer currentPlayerSessionCount() {
return currentPlayerSessionCount;
}
/**
*
* The maximum number of players allowed across all game sessions currently being hosted on all instances in the
* fleet.
*
*
* @return The maximum number of players allowed across all game sessions currently being hosted on all instances in
* the fleet.
*/
public Integer maximumPlayerSessionCount() {
return maximumPlayerSessionCount;
}
@Override
public Builder toBuilder() {
return new BuilderImpl(this);
}
public static Builder builder() {
return new BuilderImpl();
}
public static Class extends Builder> serializableBuilderClass() {
return BuilderImpl.class;
}
@Override
public int hashCode() {
int hashCode = 1;
hashCode = 31 * hashCode + Objects.hashCode(fleetId());
hashCode = 31 * hashCode + Objects.hashCode(activeServerProcessCount());
hashCode = 31 * hashCode + Objects.hashCode(activeGameSessionCount());
hashCode = 31 * hashCode + Objects.hashCode(currentPlayerSessionCount());
hashCode = 31 * hashCode + Objects.hashCode(maximumPlayerSessionCount());
return hashCode;
}
@Override
public boolean equals(Object obj) {
return equalsBySdkFields(obj);
}
@Override
public boolean equalsBySdkFields(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof FleetUtilization)) {
return false;
}
FleetUtilization other = (FleetUtilization) obj;
return Objects.equals(fleetId(), other.fleetId())
&& Objects.equals(activeServerProcessCount(), other.activeServerProcessCount())
&& Objects.equals(activeGameSessionCount(), other.activeGameSessionCount())
&& Objects.equals(currentPlayerSessionCount(), other.currentPlayerSessionCount())
&& Objects.equals(maximumPlayerSessionCount(), other.maximumPlayerSessionCount());
}
/**
* Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be
* redacted from this string using a placeholder value.
*/
@Override
public String toString() {
return ToString.builder("FleetUtilization").add("FleetId", fleetId())
.add("ActiveServerProcessCount", activeServerProcessCount())
.add("ActiveGameSessionCount", activeGameSessionCount())
.add("CurrentPlayerSessionCount", currentPlayerSessionCount())
.add("MaximumPlayerSessionCount", maximumPlayerSessionCount()).build();
}
public Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "FleetId":
return Optional.ofNullable(clazz.cast(fleetId()));
case "ActiveServerProcessCount":
return Optional.ofNullable(clazz.cast(activeServerProcessCount()));
case "ActiveGameSessionCount":
return Optional.ofNullable(clazz.cast(activeGameSessionCount()));
case "CurrentPlayerSessionCount":
return Optional.ofNullable(clazz.cast(currentPlayerSessionCount()));
case "MaximumPlayerSessionCount":
return Optional.ofNullable(clazz.cast(maximumPlayerSessionCount()));
default:
return Optional.empty();
}
}
@Override
public List> sdkFields() {
return SDK_FIELDS;
}
private static Function
© 2015 - 2025 Weber Informatics LLC | Privacy Policy