This API works with the following fleet types: EC2 (server SDK 5.x or later), Container
Retrieves connection details for game clients to connect to game sessions.
Player gateway benefits: DDoS protection with negligible impact to latency.
To enable player gateway on your fleet, set PlayerGatewayMode to ENABLED or REQUIRED when calling CreateFleet or CreateContainerFleet.
How to use: After creating a game session and adding players, call this operation with the game session ID and player IDs. When player gateway is enabled, the response includes connection endpoints and player gateway tokens that your game clients can use to connect to the game session through player gateway. To learn more about player gateway integration, see DDoS protection with Amazon GameLift Servers player gateway.
When player gateway is disabled or in locations where player gateway is not supported, this operation returns game server connection information without player gateway tokens, so that your game clients directly connect to the game server endpoint.
Parameters:
-
game_session_id
(Optional[ArnStringModel], default:
None
)
–
An identifier for the game session that is unique across all regions for which to retrieve player connection details. The value is always a full ARN in the following format: For Home Region game session - arn:aws:gamelift:::gamesession//. For Remote Location game session - arn:aws:gamelift:::gamesession///.
-
player_ids
(Optional[PlayerIdList], default:
None
)
–
List of unique identifiers for players. Connection details are returned for each player in this list.
Raises:
-
InternalServiceException
–
The service encountered an unrecoverable internal failure while processing the request. Clients can retry such requests immediately or after a waiting period.
-
InvalidGameSessionStatusException
–
The requested operation would cause a conflict with the current state of a resource associated with the request and/or the game instance. Resolve the conflict before retrying.
-
InvalidRequestException
–
One or more parameter values in the request are invalid. Correct the invalid parameter values before retrying.
-
LimitExceededException
–
The requested operation would cause the resource to exceed the allowed service limit. Resolve the issue before retrying.
-
NotFoundException
–
The requested resource was not found. The resource was either not created yet or deleted.
-
UnauthorizedException
–
The client failed authentication. Clients should not retry such requests.
-
UnsupportedRegionException
–
The requested operation is not supported in the Region specified.
-
UnknownServiceError
–
The service returned an error code this client does not model.
Source code in docs_src/capo_gamelift/_services/game_lift.py
| def get_player_connection_details(
self,
*,
config_overrides: Optional[GameLiftClientConfig] = None,
game_session_id: Optional[
"capo_gamelift.types.arn_string_model.ArnStringModel"
] = None,
player_ids: Optional["capo_gamelift.types.player_id_list.PlayerIdList"] = None,
) -> "capo_gamelift.types.get_player_connection_details_output.GetPlayerConnectionDetailsOutput":
"""<p> <b>This API works with the following fleet types:</b> EC2 (server SDK 5.x or later), Container</p> <p>Retrieves connection details for game clients to connect to game sessions. </p> <p> <b>Player gateway benefits:</b> DDoS protection with negligible impact to latency. </p> <p>To enable player gateway on your fleet, set <code>PlayerGatewayMode</code> to <code>ENABLED</code> or <code>REQUIRED</code> when calling <a href="https://docs.aws.amazon.com/gamelift/latest/apireference/API_CreateFleet.html">CreateFleet</a> or <a href="https://docs.aws.amazon.com/gamelift/latest/apireference/API_CreateContainerFleet.html">CreateContainerFleet</a>.</p> <p> <b>How to use:</b> After creating a game session and adding players, call this operation with the game session ID and player IDs. When player gateway is enabled, the response includes connection endpoints and player gateway tokens that your game clients can use to connect to the game session through player gateway. To learn more about player gateway integration, see <a href="https://docs.aws.amazon.com/gameliftservers/latest/developerguide/ddos-protection-intro.html">DDoS protection with Amazon GameLift Servers player gateway</a>.</p> <p>When player gateway is disabled or in locations where player gateway is not supported, this operation returns game server connection information without player gateway tokens, so that your game clients directly connect to the game server endpoint.</p>
Args:
game_session_id: <p>An identifier for the game session that is unique across all regions for which to retrieve player connection details. The value is always a full ARN in the following format: For Home Region game session - <code>arn:aws:gamelift:<home_region>::gamesession/<fleet ID>/<ID string></code>. For Remote Location game session - <code>arn:aws:gamelift:<home_region>::gamesession/<fleet ID>/<location>/<ID string></code>.</p>
player_ids: <p>List of unique identifiers for players. Connection details are returned for each player in this list.</p>
Raises:
capo_gamelift.errors.internal_service_exception.InternalServiceException: <p>The service encountered an unrecoverable internal failure while processing the request. Clients can retry such requests immediately or after a waiting period.</p>
capo_gamelift.errors.invalid_game_session_status_exception.InvalidGameSessionStatusException: <p>The requested operation would cause a conflict with the current state of a resource associated with the request and/or the game instance. Resolve the conflict before retrying.</p>
capo_gamelift.errors.invalid_request_exception.InvalidRequestException: <p>One or more parameter values in the request are invalid. Correct the invalid parameter values before retrying.</p>
capo_gamelift.errors.limit_exceeded_exception.LimitExceededException: <p>The requested operation would cause the resource to exceed the allowed service limit. Resolve the issue before retrying.</p>
capo_gamelift.errors.not_found_exception.NotFoundException: <p>The requested resource was not found. The resource was either not created yet or deleted.</p>
capo_gamelift.errors.unauthorized_exception.UnauthorizedException: <p>The client failed authentication. Clients should not retry such requests.</p>
capo_gamelift.errors.unsupported_region_exception.UnsupportedRegionException: <p>The requested operation is not supported in the Region specified.</p>
capo_gamelift.errors.UnknownServiceError: The service returned an error code this client does not model.
"""
def _handler(
req: "OperationRequest[capo_gamelift.types.get_player_connection_details_input.GetPlayerConnectionDetailsInput]",
) -> OperationResponse[
"capo_gamelift.types.get_player_connection_details_output.GetPlayerConnectionDetailsOutput"
]:
import capo_gamelift._operations.game_lift.get_player_connection_details
output, http_response = (
capo_gamelift._operations.game_lift.get_player_connection_details.get_player_connection_details(
req.options, req.input
)
)
return OperationResponse(output=output, response=http_response)
def _redact_input(
input_: "capo_gamelift.types.get_player_connection_details_input.GetPlayerConnectionDetailsInput",
) -> dict[str, Any]:
import capo_gamelift.types.get_player_connection_details_input
return capo_gamelift.types.get_player_connection_details_input.redact_sensitive(
input_
)
def _redact_output(
output: "capo_gamelift.types.get_player_connection_details_output.GetPlayerConnectionDetailsOutput",
) -> dict[str, Any]:
import capo_gamelift.types.get_player_connection_details_output
return capo_gamelift.types.get_player_connection_details_output.redact_sensitive(
output
)
interceptors_, options_ = self.operation_options(
config_overrides,
OperationLogging(
"GetPlayerConnectionDetails",
redact_input=_redact_input,
redact_output=_redact_output,
),
)
input_: capo_gamelift.types.get_player_connection_details_input.GetPlayerConnectionDetailsInput = {}
if game_session_id is not None:
input_["game_session_id"] = game_session_id
if player_ids is not None:
input_["player_ids"] = player_ids
response = execute_pipeline(
OperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
response.response.close()
return response.output
|