com.amazonaws.services.gamelift.model.GameSessionConnectionInfo Maven / Gradle / Ivy
/*
* Copyright 2017-2022 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;
/**
*
* Connection information for a new game session that is created in response to a StartMatchmaking request. Once
* a match is made, the FlexMatch engine creates a new game session for it. This information, including the game session
* endpoint and player sessions for each player in the original matchmaking request, is added to the
* MatchmakingTicket, which can be retrieved by calling DescribeMatchmaking.
*
*
* @see AWS
* API Documentation
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class GameSessionConnectionInfo implements Serializable, Cloneable, StructuredPojo {
/**
*
* A unique identifier for the game session. Use the game session ID.
*
*/
private String gameSessionArn;
/**
*
* The IP address of the game session. To connect to a GameLift game server, an app needs both the IP address and
* port number.
*
*/
private String ipAddress;
/**
*
* The DNS identifier assigned to the instance that is running the game session. Values have the following format:
*
*
* -
*
* TLS-enabled fleets: <unique identifier>.<region identifier>.amazongamelift.com
.
*
*
* -
*
* Non-TLS-enabled fleets: ec2-<unique identifier>.compute.amazonaws.com
. (See Amazon EC2 Instance IP Addressing.)
*
*
*
*
* When connecting to a game session that is running on a TLS-enabled fleet, you must use the DNS name, not the IP
* address.
*
*/
private String dnsName;
/**
*
* The port number for the game session. To connect to a GameLift game server, an app needs both the IP address and
* port number.
*
*/
private Integer port;
/**
*
* A collection of player session IDs, one for each player ID that was included in the original matchmaking request.
*
*/
private java.util.List matchedPlayerSessions;
/**
*
* A unique identifier for the game session. Use the game session ID.
*
*
* @param gameSessionArn
* A unique identifier for the game session. Use the game session ID.
*/
public void setGameSessionArn(String gameSessionArn) {
this.gameSessionArn = gameSessionArn;
}
/**
*
* A unique identifier for the game session. Use the game session ID.
*
*
* @return A unique identifier for the game session. Use the game session ID.
*/
public String getGameSessionArn() {
return this.gameSessionArn;
}
/**
*
* A unique identifier for the game session. Use the game session ID.
*
*
* @param gameSessionArn
* A unique identifier for the game session. Use the game session ID.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public GameSessionConnectionInfo withGameSessionArn(String gameSessionArn) {
setGameSessionArn(gameSessionArn);
return this;
}
/**
*
* The IP address of the game session. To connect to a GameLift game server, an app needs both the IP address and
* port number.
*
*
* @param ipAddress
* The IP address of the game session. To connect to a GameLift game server, an app needs both the IP address
* and port number.
*/
public void setIpAddress(String ipAddress) {
this.ipAddress = ipAddress;
}
/**
*
* The IP address of the game session. To connect to a GameLift game server, an app needs both the IP address and
* port number.
*
*
* @return The IP address of the game session. To connect to a GameLift game server, an app needs both the IP
* address and port number.
*/
public String getIpAddress() {
return this.ipAddress;
}
/**
*
* The IP address of the game session. To connect to a GameLift game server, an app needs both the IP address and
* port number.
*
*
* @param ipAddress
* The IP address of the game session. To connect to a 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 GameSessionConnectionInfo withIpAddress(String ipAddress) {
setIpAddress(ipAddress);
return this;
}
/**
*
* The DNS identifier assigned to the instance that is running the game session. Values have the following format:
*
*
* -
*
* TLS-enabled fleets: <unique identifier>.<region identifier>.amazongamelift.com
.
*
*
* -
*
* Non-TLS-enabled fleets: ec2-<unique identifier>.compute.amazonaws.com
. (See Amazon EC2 Instance IP Addressing.)
*
*
*
*
* When connecting to a game session that is running on a TLS-enabled fleet, you must use the DNS name, not the IP
* address.
*
*
* @param dnsName
* The DNS identifier assigned to the instance that is running the game session. Values have the following
* format:
*
* -
*
* TLS-enabled fleets: <unique identifier>.<region identifier>.amazongamelift.com
.
*
*
* -
*
* Non-TLS-enabled fleets: ec2-<unique identifier>.compute.amazonaws.com
. (See Amazon EC2 Instance IP Addressing.)
*
*
*
*
* When connecting to a game session that is running on a TLS-enabled fleet, you must use the DNS name, not
* the IP address.
*/
public void setDnsName(String dnsName) {
this.dnsName = dnsName;
}
/**
*
* The DNS identifier assigned to the instance that is running the game session. Values have the following format:
*
*
* -
*
* TLS-enabled fleets: <unique identifier>.<region identifier>.amazongamelift.com
.
*
*
* -
*
* Non-TLS-enabled fleets: ec2-<unique identifier>.compute.amazonaws.com
. (See Amazon EC2 Instance IP Addressing.)
*
*
*
*
* When connecting to a game session that is running on a TLS-enabled fleet, you must use the DNS name, not the IP
* address.
*
*
* @return The DNS identifier assigned to the instance that is running the game session. Values have the following
* format:
*
* -
*
* TLS-enabled fleets: <unique identifier>.<region identifier>.amazongamelift.com
.
*
*
* -
*
* Non-TLS-enabled fleets: ec2-<unique identifier>.compute.amazonaws.com
. (See Amazon EC2 Instance IP Addressing.)
*
*
*
*
* When connecting to a game session that is running on a TLS-enabled fleet, you must use the DNS name, not
* the IP address.
*/
public String getDnsName() {
return this.dnsName;
}
/**
*
* The DNS identifier assigned to the instance that is running the game session. Values have the following format:
*
*
* -
*
* TLS-enabled fleets: <unique identifier>.<region identifier>.amazongamelift.com
.
*
*
* -
*
* Non-TLS-enabled fleets: ec2-<unique identifier>.compute.amazonaws.com
. (See Amazon EC2 Instance IP Addressing.)
*
*
*
*
* When connecting to a game session that is running on a TLS-enabled fleet, you must use the DNS name, not the IP
* address.
*
*
* @param dnsName
* The DNS identifier assigned to the instance that is running the game session. Values have the following
* format:
*
* -
*
* TLS-enabled fleets: <unique identifier>.<region identifier>.amazongamelift.com
.
*
*
* -
*
* Non-TLS-enabled fleets: ec2-<unique identifier>.compute.amazonaws.com
. (See Amazon EC2 Instance IP Addressing.)
*
*
*
*
* When connecting to a game session that is running on a TLS-enabled fleet, you must use the DNS name, not
* the IP address.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public GameSessionConnectionInfo withDnsName(String dnsName) {
setDnsName(dnsName);
return this;
}
/**
*
* The port number for the game session. To connect to a GameLift game server, an app needs both the IP address and
* port number.
*
*
* @param port
* The port number for the game session. To connect to a GameLift game server, an app needs both the IP
* address and port number.
*/
public void setPort(Integer port) {
this.port = port;
}
/**
*
* The port number for the game session. To connect to a GameLift game server, an app needs both the IP address and
* port number.
*
*
* @return The port number for the game session. To connect to a GameLift game server, an app needs both the IP
* address and port number.
*/
public Integer getPort() {
return this.port;
}
/**
*
* The port number for the game session. To connect to a GameLift game server, an app needs both the IP address and
* port number.
*
*
* @param port
* The port number for the game session. To connect to a 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 GameSessionConnectionInfo withPort(Integer port) {
setPort(port);
return this;
}
/**
*
* A collection of player session IDs, one for each player ID that was included in the original matchmaking request.
*
*
* @return A collection of player session IDs, one for each player ID that was included in the original matchmaking
* request.
*/
public java.util.List getMatchedPlayerSessions() {
return matchedPlayerSessions;
}
/**
*
* A collection of player session IDs, one for each player ID that was included in the original matchmaking request.
*
*
* @param matchedPlayerSessions
* A collection of player session IDs, one for each player ID that was included in the original matchmaking
* request.
*/
public void setMatchedPlayerSessions(java.util.Collection matchedPlayerSessions) {
if (matchedPlayerSessions == null) {
this.matchedPlayerSessions = null;
return;
}
this.matchedPlayerSessions = new java.util.ArrayList(matchedPlayerSessions);
}
/**
*
* A collection of player session IDs, one for each player ID that was included in the original matchmaking request.
*
*
* NOTE: This method appends the values to the existing list (if any). Use
* {@link #setMatchedPlayerSessions(java.util.Collection)} or
* {@link #withMatchedPlayerSessions(java.util.Collection)} if you want to override the existing values.
*
*
* @param matchedPlayerSessions
* A collection of player session IDs, one for each player ID that was included in the original matchmaking
* request.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public GameSessionConnectionInfo withMatchedPlayerSessions(MatchedPlayerSession... matchedPlayerSessions) {
if (this.matchedPlayerSessions == null) {
setMatchedPlayerSessions(new java.util.ArrayList(matchedPlayerSessions.length));
}
for (MatchedPlayerSession ele : matchedPlayerSessions) {
this.matchedPlayerSessions.add(ele);
}
return this;
}
/**
*
* A collection of player session IDs, one for each player ID that was included in the original matchmaking request.
*
*
* @param matchedPlayerSessions
* A collection of player session IDs, one for each player ID that was included in the original matchmaking
* request.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public GameSessionConnectionInfo withMatchedPlayerSessions(java.util.Collection matchedPlayerSessions) {
setMatchedPlayerSessions(matchedPlayerSessions);
return this;
}
/**
* 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.
*
* @return A string representation of this object.
*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("{");
if (getGameSessionArn() != null)
sb.append("GameSessionArn: ").append(getGameSessionArn()).append(",");
if (getIpAddress() != null)
sb.append("IpAddress: ").append(getIpAddress()).append(",");
if (getDnsName() != null)
sb.append("DnsName: ").append(getDnsName()).append(",");
if (getPort() != null)
sb.append("Port: ").append(getPort()).append(",");
if (getMatchedPlayerSessions() != null)
sb.append("MatchedPlayerSessions: ").append(getMatchedPlayerSessions());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof GameSessionConnectionInfo == false)
return false;
GameSessionConnectionInfo other = (GameSessionConnectionInfo) obj;
if (other.getGameSessionArn() == null ^ this.getGameSessionArn() == null)
return false;
if (other.getGameSessionArn() != null && other.getGameSessionArn().equals(this.getGameSessionArn()) == 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.getDnsName() == null ^ this.getDnsName() == null)
return false;
if (other.getDnsName() != null && other.getDnsName().equals(this.getDnsName()) == 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.getMatchedPlayerSessions() == null ^ this.getMatchedPlayerSessions() == null)
return false;
if (other.getMatchedPlayerSessions() != null && other.getMatchedPlayerSessions().equals(this.getMatchedPlayerSessions()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getGameSessionArn() == null) ? 0 : getGameSessionArn().hashCode());
hashCode = prime * hashCode + ((getIpAddress() == null) ? 0 : getIpAddress().hashCode());
hashCode = prime * hashCode + ((getDnsName() == null) ? 0 : getDnsName().hashCode());
hashCode = prime * hashCode + ((getPort() == null) ? 0 : getPort().hashCode());
hashCode = prime * hashCode + ((getMatchedPlayerSessions() == null) ? 0 : getMatchedPlayerSessions().hashCode());
return hashCode;
}
@Override
public GameSessionConnectionInfo clone() {
try {
return (GameSessionConnectionInfo) 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.GameSessionConnectionInfoMarshaller.getInstance().marshall(this, protocolMarshaller);
}
}