/* * Copyright 2012-2017 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 com.amazonaws.services.gamelift.model; import java.io.Serializable; import javax.annotation.Generated; import com.amazonaws.protocol.StructuredPojo; import com.amazonaws.protocol.ProtocolMarshaller; /** * <p> * Properties describing a game session. * </p> * * @see <a href="http://docs.aws.amazon.com/goto/WebAPI/gamelift-2015-10-01/GameSession" target="_top">AWS API * Documentation</a> */ @Generated("com.amazonaws:aws-java-sdk-code-generator") public class GameSession implements Serializable, Cloneable, StructuredPojo { /** * <p> * Unique identifier for the game session. A game session ID has the following format: * <code>arn:aws:gamelift:<region>::gamesession/<fleet ID>/<custom ID string or idempotency token></code> * . * </p> */ private String gameSessionId; /** * <p> * Descriptive label that is associated with a game session. Session names do not need to be unique. * </p> */ private String name; /** * <p> * Unique identifier for a fleet the game session is running on. * </p> */ private String fleetId; /** * <p> * Time stamp indicating when this data object was created. Format is a number expressed in Unix time as * milliseconds (for example "1469498468.057"). * </p> */ private java.util.Date creationTime; /** * <p> * Time stamp indicating when this data object was terminated. Format is a number expressed in Unix time as * milliseconds (for example "1469498468.057"). * </p> */ private java.util.Date terminationTime; /** * <p> * Number of players currently in the game session. * </p> */ private Integer currentPlayerSessionCount; /** * <p> * Maximum number of players that can be connected simultaneously to the game session. * </p> */ private Integer maximumPlayerSessionCount; /** * <p> * Current status of the game session. A game session must have an <code>ACTIVE</code> status to have player * sessions. * </p> */ private String status; /** * <p> * Set of developer-defined properties for a game session. These properties are passed to the server process hosting * the game session. * </p> */ private java.util.List<GameProperty> gameProperties; /** * <p> * IP address of the game session. To connect to a Amazon GameLift game server, an app needs both the IP address and * port number. * </p> */ private String ipAddress; /** * <p> * Port number for the game session. To connect to a Amazon GameLift game server, an app needs both the IP address * and port number. * </p> */ private Integer port; /** * <p> * Indicates whether or not the game session is accepting new players. * </p> */ private String playerSessionCreationPolicy; /** * <p> * Unique identifier for a player. This ID is used to enforce a resource protection policy (if one exists), that * limits the number of game sessions a player can create. * </p> */ private String creatorId; /** * <p> * Unique identifier for the game session. A game session ID has the following format: * <code>arn:aws:gamelift:<region>::gamesession/<fleet ID>/<custom ID string or idempotency token></code> * . * </p> * * @param gameSessionId * Unique identifier for the game session. A game session ID has the following format: * <code>arn:aws:gamelift:<region>::gamesession/<fleet ID>/<custom ID string or idempotency token></code> * . */ public void setGameSessionId(String gameSessionId) { this.gameSessionId = gameSessionId; } /** * <p> * Unique identifier for the game session. A game session ID has the following format: * <code>arn:aws:gamelift:<region>::gamesession/<fleet ID>/<custom ID string or idempotency token></code> * . * </p> * * @return Unique identifier for the game session. A game session ID has the following format: * <code>arn:aws:gamelift:<region>::gamesession/<fleet ID>/<custom ID string or idempotency token></code> * . */ public String getGameSessionId() { return this.gameSessionId; } /** * <p> * Unique identifier for the game session. A game session ID has the following format: * <code>arn:aws:gamelift:<region>::gamesession/<fleet ID>/<custom ID string or idempotency token></code> * . * </p> * * @param gameSessionId * Unique identifier for the game session. A game session ID has the following format: * <code>arn:aws:gamelift:<region>::gamesession/<fleet ID>/<custom ID string or idempotency token></code> * . * @return Returns a reference to this object so that method calls can be chained together. */ public GameSession withGameSessionId(String gameSessionId) { setGameSessionId(gameSessionId); return this; } /** * <p> * Descriptive label that is associated with a game session. Session names do not need to be unique. * </p> * * @param name * Descriptive label that is associated with a game session. Session names do not need to be unique. */ public void setName(String name) { this.name = name; } /** * <p> * Descriptive label that is associated with a game session. Session names do not need to be unique. * </p> * * @return Descriptive label that is associated with a game session. Session names do not need to be unique. */ public String getName() { return this.name; } /** * <p> * Descriptive label that is associated with a game session. Session names do not need to be unique. * </p> * * @param name * Descriptive label that is associated with a game session. Session names do not need to be unique. * @return Returns a reference to this object so that method calls can be chained together. */ public GameSession withName(String name) { setName(name); return this; } /** * <p> * Unique identifier for a fleet the game session is running on. * </p> * * @param fleetId * Unique identifier for a fleet the game session is running on. */ public void setFleetId(String fleetId) { this.fleetId = fleetId; } /** * <p> * Unique identifier for a fleet the game session is running on. * </p> * * @return Unique identifier for a fleet the game session is running on. */ public String getFleetId() { return this.fleetId; } /** * <p> * Unique identifier for a fleet the game session is running on. * </p> * * @param fleetId * Unique identifier for a fleet the game session is running on. * @return Returns a reference to this object so that method calls can be chained together. */ public GameSession withFleetId(String fleetId) { setFleetId(fleetId); return this; } /** * <p> * Time stamp indicating when this data object was created. Format is a number expressed in Unix time as * milliseconds (for example "1469498468.057"). * </p> * * @param creationTime * Time stamp indicating when this data object was created. Format is a number expressed in Unix time as * milliseconds (for example "1469498468.057"). */ public void setCreationTime(java.util.Date creationTime) { this.creationTime = creationTime; } /** * <p> * Time stamp indicating when this data object was created. Format is a number expressed in Unix time as * milliseconds (for example "1469498468.057"). * </p> * * @return Time stamp indicating when this data object was created. Format is a number expressed in Unix time as * milliseconds (for example "1469498468.057"). */ public java.util.Date getCreationTime() { return this.creationTime; } /** * <p> * Time stamp indicating when this data object was created. Format is a number expressed in Unix time as * milliseconds (for example "1469498468.057"). * </p> * * @param creationTime * Time stamp indicating when this data object was created. Format is a number expressed in Unix time as * milliseconds (for example "1469498468.057"). * @return Returns a reference to this object so that method calls can be chained together. */ public GameSession withCreationTime(java.util.Date creationTime) { setCreationTime(creationTime); return this; } /** * <p> * Time stamp indicating when this data object was terminated. Format is a number expressed in Unix time as * milliseconds (for example "1469498468.057"). * </p> * * @param terminationTime * Time stamp indicating when this data object was terminated. Format is a number expressed in Unix time as * milliseconds (for example "1469498468.057"). */ public void setTerminationTime(java.util.Date terminationTime) { this.terminationTime = terminationTime; } /** * <p> * Time stamp indicating when this data object was terminated. Format is a number expressed in Unix time as * milliseconds (for example "1469498468.057"). * </p> * * @return Time stamp indicating when this data object was terminated. Format is a number expressed in Unix time as * milliseconds (for example "1469498468.057"). */ public java.util.Date getTerminationTime() { return this.terminationTime; } /** * <p> * Time stamp indicating when this data object was terminated. Format is a number expressed in Unix time as * milliseconds (for example "1469498468.057"). * </p> * * @param terminationTime * Time stamp indicating when this data object was terminated. Format is a number expressed in Unix time as * milliseconds (for example "1469498468.057"). * @return Returns a reference to this object so that method calls can be chained together. */ public GameSession withTerminationTime(java.util.Date terminationTime) { setTerminationTime(terminationTime); return this; } /** * <p> * Number of players currently in the game session. * </p> * * @param currentPlayerSessionCount * Number of players currently in the game session. */ public void setCurrentPlayerSessionCount(Integer currentPlayerSessionCount) { this.currentPlayerSessionCount = currentPlayerSessionCount; } /** * <p> * Number of players currently in the game session. * </p> * * @return Number of players currently in the game session. */ public Integer getCurrentPlayerSessionCount() { return this.currentPlayerSessionCount; } /** * <p> * Number of players currently in the game session. * </p> * * @param currentPlayerSessionCount * Number of players currently in the game session. * @return Returns a reference to this object so that method calls can be chained together. */ public GameSession withCurrentPlayerSessionCount(Integer currentPlayerSessionCount) { setCurrentPlayerSessionCount(currentPlayerSessionCount); return this; } /** * <p> * Maximum number of players that can be connected simultaneously to the game session. * </p> * * @param maximumPlayerSessionCount * Maximum number of players that can be connected simultaneously to the game session. */ public void setMaximumPlayerSessionCount(Integer maximumPlayerSessionCount) { this.maximumPlayerSessionCount = maximumPlayerSessionCount; } /** * <p> * Maximum number of players that can be connected simultaneously to the game session. * </p> * * @return Maximum number of players that can be connected simultaneously to the game session. */ public Integer getMaximumPlayerSessionCount() { return this.maximumPlayerSessionCount; } /** * <p> * Maximum number of players that can be connected simultaneously to the game session. * </p> * * @param maximumPlayerSessionCount * Maximum number of players that can be connected simultaneously to the game session. * @return Returns a reference to this object so that method calls can be chained together. */ public GameSession withMaximumPlayerSessionCount(Integer maximumPlayerSessionCount) { setMaximumPlayerSessionCount(maximumPlayerSessionCount); return this; } /** * <p> * Current status of the game session. A game session must have an <code>ACTIVE</code> status to have player * sessions. * </p> * * @param status * Current status of the game session. A game session must have an <code>ACTIVE</code> status to have player * sessions. * @see GameSessionStatus */ public void setStatus(String status) { this.status = status; } /** * <p> * Current status of the game session. A game session must have an <code>ACTIVE</code> status to have player * sessions. * </p> * * @return Current status of the game session. A game session must have an <code>ACTIVE</code> status to have player * sessions. * @see GameSessionStatus */ public String getStatus() { return this.status; } /** * <p> * Current status of the game session. A game session must have an <code>ACTIVE</code> status to have player * sessions. * </p> * * @param status * Current status of the game session. A game session must have an <code>ACTIVE</code> status to have player * sessions. * @return Returns a reference to this object so that method calls can be chained together. * @see GameSessionStatus */ public GameSession withStatus(String status) { setStatus(status); return this; } /** * <p> * Current status of the game session. A game session must have an <code>ACTIVE</code> status to have player * sessions. * </p> * * @param status * Current status of the game session. A game session must have an <code>ACTIVE</code> status to have player * sessions. * @see GameSessionStatus */ public void setStatus(GameSessionStatus status) { this.status = status.toString(); } /** * <p> * Current status of the game session. A game session must have an <code>ACTIVE</code> status to have player * sessions. * </p> * * @param status * Current status of the game session. A game session must have an <code>ACTIVE</code> status to have player * sessions. * @return Returns a reference to this object so that method calls can be chained together. * @see GameSessionStatus */ public GameSession withStatus(GameSessionStatus status) { setStatus(status); return this; } /** * <p> * Set of developer-defined properties for a game session. These properties are passed to the server process hosting * the game session. * </p> * * @return Set of developer-defined properties for a game session. These properties are passed to the server process * hosting the game session. */ public java.util.List<GameProperty> getGameProperties() { return gameProperties; } /** * <p> * Set of developer-defined properties for a game session. These properties are passed to the server process hosting * the game session. * </p> * * @param gameProperties * Set of developer-defined properties for a game session. These properties are passed to the server process * hosting the game session. */ public void setGameProperties(java.util.Collection<GameProperty> gameProperties) { if (gameProperties == null) { this.gameProperties = null; return; } this.gameProperties = new java.util.ArrayList<GameProperty>(gameProperties); } /** * <p> * Set of developer-defined properties for a game session. These properties are passed to the server process hosting * the game session. * </p> * <p> * <b>NOTE:</b> This method appends the values to the existing list (if any). Use * {@link #setGameProperties(java.util.Collection)} or {@link #withGameProperties(java.util.Collection)} if you want * to override the existing values. * </p> * * @param gameProperties * Set of developer-defined properties for a game session. These properties are passed to the server process * hosting the game session. * @return Returns a reference to this object so that method calls can be chained together. */ public GameSession withGameProperties(GameProperty... gameProperties) { if (this.gameProperties == null) { setGameProperties(new java.util.ArrayList<GameProperty>(gameProperties.length)); } for (GameProperty ele : gameProperties) { this.gameProperties.add(ele); } return this; } /** * <p> * Set of developer-defined properties for a game session. These properties are passed to the server process hosting * the game session. * </p> * * @param gameProperties * Set of developer-defined properties for a game session. These properties are passed to the server process * hosting the game session. * @return Returns a reference to this object so that method calls can be chained together. */ public GameSession withGameProperties(java.util.Collection<GameProperty> gameProperties) { setGameProperties(gameProperties); return this; } /** * <p> * IP address of the game session. To connect to a Amazon GameLift game server, an app needs both the IP address and * port number. * </p> * * @param ipAddress * IP address of the game session. To connect to a Amazon GameLift game server, an app needs both the IP * address and port number. */ public void setIpAddress(String ipAddress) { this.ipAddress = ipAddress; } /** * <p> * IP address of the game session. To connect to a Amazon GameLift game server, an app needs both the IP address and * port number. * </p> * * @return IP address of the game session. To connect to a Amazon GameLift game server, an app needs both the IP * address and port number. */ public String getIpAddress() { return this.ipAddress; } /** * <p> * IP address of the game session. To connect to a Amazon GameLift game server, an app needs both the IP address and * port number. * </p> * * @param ipAddress * IP address of the game session. To connect to a Amazon GameLift game server, an app needs both the IP * address and port number. * @return Returns a reference to this object so that method calls can be chained together. */ public GameSession withIpAddress(String ipAddress) { setIpAddress(ipAddress); return this; } /** * <p> * Port number for the game session. To connect to a Amazon GameLift game server, an app needs both the IP address * and port number. * </p> * * @param port * Port number for the game session. To connect to a Amazon GameLift game server, an app needs both the IP * address and port number. */ public void setPort(Integer port) { this.port = port; } /** * <p> * Port number for the game session. To connect to a Amazon GameLift game server, an app needs both the IP address * and port number. * </p> * * @return Port number for the game session. To connect to a Amazon GameLift game server, an app needs both the IP * address and port number. */ public Integer getPort() { return this.port; } /** * <p> * Port number for the game session. To connect to a Amazon GameLift game server, an app needs both the IP address * and port number. * </p> * * @param port * Port number for the game session. To connect to a Amazon GameLift game server, an app needs both the IP * address and port number. * @return Returns a reference to this object so that method calls can be chained together. */ public GameSession withPort(Integer port) { setPort(port); return this; } /** * <p> * Indicates whether or not the game session is accepting new players. * </p> * * @param playerSessionCreationPolicy * Indicates whether or not the game session is accepting new players. * @see PlayerSessionCreationPolicy */ public void setPlayerSessionCreationPolicy(String playerSessionCreationPolicy) { this.playerSessionCreationPolicy = playerSessionCreationPolicy; } /** * <p> * Indicates whether or not the game session is accepting new players. * </p> * * @return Indicates whether or not the game session is accepting new players. * @see PlayerSessionCreationPolicy */ public String getPlayerSessionCreationPolicy() { return this.playerSessionCreationPolicy; } /** * <p> * Indicates whether or not the game session is accepting new players. * </p> * * @param playerSessionCreationPolicy * Indicates whether or not the game session is accepting new players. * @return Returns a reference to this object so that method calls can be chained together. * @see PlayerSessionCreationPolicy */ public GameSession withPlayerSessionCreationPolicy(String playerSessionCreationPolicy) { setPlayerSessionCreationPolicy(playerSessionCreationPolicy); return this; } /** * <p> * Indicates whether or not the game session is accepting new players. * </p> * * @param playerSessionCreationPolicy * Indicates whether or not the game session is accepting new players. * @see PlayerSessionCreationPolicy */ public void setPlayerSessionCreationPolicy(PlayerSessionCreationPolicy playerSessionCreationPolicy) { this.playerSessionCreationPolicy = playerSessionCreationPolicy.toString(); } /** * <p> * Indicates whether or not the game session is accepting new players. * </p> * * @param playerSessionCreationPolicy * Indicates whether or not the game session is accepting new players. * @return Returns a reference to this object so that method calls can be chained together. * @see PlayerSessionCreationPolicy */ public GameSession withPlayerSessionCreationPolicy(PlayerSessionCreationPolicy playerSessionCreationPolicy) { setPlayerSessionCreationPolicy(playerSessionCreationPolicy); return this; } /** * <p> * Unique identifier for a player. This ID is used to enforce a resource protection policy (if one exists), that * limits the number of game sessions a player can create. * </p> * * @param creatorId * Unique identifier for a player. This ID is used to enforce a resource protection policy (if one exists), * that limits the number of game sessions a player can create. */ public void setCreatorId(String creatorId) { this.creatorId = creatorId; } /** * <p> * Unique identifier for a player. This ID is used to enforce a resource protection policy (if one exists), that * limits the number of game sessions a player can create. * </p> * * @return Unique identifier for a player. This ID is used to enforce a resource protection policy (if one exists), * that limits the number of game sessions a player can create. */ public String getCreatorId() { return this.creatorId; } /** * <p> * Unique identifier for a player. This ID is used to enforce a resource protection policy (if one exists), that * limits the number of game sessions a player can create. * </p> * * @param creatorId * Unique identifier for a player. This ID is used to enforce a resource protection policy (if one exists), * that limits the number of game sessions a player can create. * @return Returns a reference to this object so that method calls can be chained together. */ public GameSession withCreatorId(String creatorId) { setCreatorId(creatorId); return this; } /** * Returns a string representation of this object; useful for testing and debugging. * * @return A string representation of this object. * * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{"); if (getGameSessionId() != null) sb.append("GameSessionId: ").append(getGameSessionId()).append(","); if (getName() != null) sb.append("Name: ").append(getName()).append(","); if (getFleetId() != null) sb.append("FleetId: ").append(getFleetId()).append(","); if (getCreationTime() != null) sb.append("CreationTime: ").append(getCreationTime()).append(","); if (getTerminationTime() != null) sb.append("TerminationTime: ").append(getTerminationTime()).append(","); if (getCurrentPlayerSessionCount() != null) sb.append("CurrentPlayerSessionCount: ").append(getCurrentPlayerSessionCount()).append(","); if (getMaximumPlayerSessionCount() != null) sb.append("MaximumPlayerSessionCount: ").append(getMaximumPlayerSessionCount()).append(","); if (getStatus() != null) sb.append("Status: ").append(getStatus()).append(","); if (getGameProperties() != null) sb.append("GameProperties: ").append(getGameProperties()).append(","); if (getIpAddress() != null) sb.append("IpAddress: ").append(getIpAddress()).append(","); if (getPort() != null) sb.append("Port: ").append(getPort()).append(","); if (getPlayerSessionCreationPolicy() != null) sb.append("PlayerSessionCreationPolicy: ").append(getPlayerSessionCreationPolicy()).append(","); if (getCreatorId() != null) sb.append("CreatorId: ").append(getCreatorId()); sb.append("}"); return sb.toString(); } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof GameSession == false) return false; GameSession other = (GameSession) obj; if (other.getGameSessionId() == null ^ this.getGameSessionId() == null) return false; if (other.getGameSessionId() != null && other.getGameSessionId().equals(this.getGameSessionId()) == false) return false; if (other.getName() == null ^ this.getName() == null) return false; if (other.getName() != null && other.getName().equals(this.getName()) == false) return false; if (other.getFleetId() == null ^ this.getFleetId() == null) return false; if (other.getFleetId() != null && other.getFleetId().equals(this.getFleetId()) == false) return false; if (other.getCreationTime() == null ^ this.getCreationTime() == null) return false; if (other.getCreationTime() != null && other.getCreationTime().equals(this.getCreationTime()) == false) return false; if (other.getTerminationTime() == null ^ this.getTerminationTime() == null) return false; if (other.getTerminationTime() != null && other.getTerminationTime().equals(this.getTerminationTime()) == false) return false; if (other.getCurrentPlayerSessionCount() == null ^ this.getCurrentPlayerSessionCount() == null) return false; if (other.getCurrentPlayerSessionCount() != null && other.getCurrentPlayerSessionCount().equals(this.getCurrentPlayerSessionCount()) == false) return false; if (other.getMaximumPlayerSessionCount() == null ^ this.getMaximumPlayerSessionCount() == null) return false; if (other.getMaximumPlayerSessionCount() != null && other.getMaximumPlayerSessionCount().equals(this.getMaximumPlayerSessionCount()) == false) return false; if (other.getStatus() == null ^ this.getStatus() == null) return false; if (other.getStatus() != null && other.getStatus().equals(this.getStatus()) == false) return false; if (other.getGameProperties() == null ^ this.getGameProperties() == null) return false; if (other.getGameProperties() != null && other.getGameProperties().equals(this.getGameProperties()) == false) return false; if (other.getIpAddress() == null ^ this.getIpAddress() == null) return false; if (other.getIpAddress() != null && other.getIpAddress().equals(this.getIpAddress()) == false) return false; if (other.getPort() == null ^ this.getPort() == null) return false; if (other.getPort() != null && other.getPort().equals(this.getPort()) == false) return false; if (other.getPlayerSessionCreationPolicy() == null ^ this.getPlayerSessionCreationPolicy() == null) return false; if (other.getPlayerSessionCreationPolicy() != null && other.getPlayerSessionCreationPolicy().equals(this.getPlayerSessionCreationPolicy()) == false) return false; if (other.getCreatorId() == null ^ this.getCreatorId() == null) return false; if (other.getCreatorId() != null && other.getCreatorId().equals(this.getCreatorId()) == false) return false; return true; } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getGameSessionId() == null) ? 0 : getGameSessionId().hashCode()); hashCode = prime * hashCode + ((getName() == null) ? 0 : getName().hashCode()); hashCode = prime * hashCode + ((getFleetId() == null) ? 0 : getFleetId().hashCode()); hashCode = prime * hashCode + ((getCreationTime() == null) ? 0 : getCreationTime().hashCode()); hashCode = prime * hashCode + ((getTerminationTime() == null) ? 0 : getTerminationTime().hashCode()); hashCode = prime * hashCode + ((getCurrentPlayerSessionCount() == null) ? 0 : getCurrentPlayerSessionCount().hashCode()); hashCode = prime * hashCode + ((getMaximumPlayerSessionCount() == null) ? 0 : getMaximumPlayerSessionCount().hashCode()); hashCode = prime * hashCode + ((getStatus() == null) ? 0 : getStatus().hashCode()); hashCode = prime * hashCode + ((getGameProperties() == null) ? 0 : getGameProperties().hashCode()); hashCode = prime * hashCode + ((getIpAddress() == null) ? 0 : getIpAddress().hashCode()); hashCode = prime * hashCode + ((getPort() == null) ? 0 : getPort().hashCode()); hashCode = prime * hashCode + ((getPlayerSessionCreationPolicy() == null) ? 0 : getPlayerSessionCreationPolicy().hashCode()); hashCode = prime * hashCode + ((getCreatorId() == null) ? 0 : getCreatorId().hashCode()); return hashCode; } @Override public GameSession clone() { try { return (GameSession) super.clone(); } catch (CloneNotSupportedException e) { throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e); } } @com.amazonaws.annotation.SdkInternalApi @Override public void marshall(ProtocolMarshaller protocolMarshaller) { com.amazonaws.services.gamelift.model.transform.GameSessionMarshaller.getInstance().marshall(this, protocolMarshaller); } }