This API works with the following fleet types: EC2 (FleetIQ)
Updates information about a registered game server to help Amazon GameLift Servers FleetIQ track game server availability. This operation is called by a game server process that is running on an instance in a game server group.
Use this operation to update the following types of game server information. You can make all three types of updates in the same request:
-
To update the game server's utilization status from AVAILABLE (when the game server is available to be claimed) to UTILIZED (when the game server is currently hosting games). Identify the game server and game server group and specify the new utilization status. You can't change the status from UTILIZED to AVAILABLE .
-
To report health status, identify the game server and game server group and set health check to HEALTHY. If a game server does not report health status for a certain length of time, the game server is no longer considered healthy. As a result, it will be eventually deregistered from the game server group to avoid affecting utilization metrics. The best practice is to report health every 60 seconds.
-
To change game server metadata, provide updated game server data.
Once a game server is successfully updated, the relevant statuses and timestamps are updated.
Learn more
Amazon GameLift Servers FleetIQ Guide
Parameters:
-
game_server_group_name
(Optional[GameServerGroupNameOrArn], default:
None
)
–
A unique identifier for the game server group where the game server is running.
-
game_server_id
(Optional[GameServerId], default:
None
)
–
A custom string that uniquely identifies the game server to update.
-
game_server_data
(Optional[GameServerData], default:
None
)
–
A set of custom game server properties, formatted as a single string value. This data is passed to a game client or service when it requests information on game servers.
-
utilization_status
(Optional[GameServerUtilizationStatus], default:
None
)
–
Indicates if the game server is available or is currently hosting gameplay. You can update a game server status from AVAILABLE to UTILIZED, but you can't change the status from UTILIZED to AVAILABLE.
-
health_check
(Optional[GameServerHealthCheck], default:
None
)
–
Indicates health status of the game server. A request that includes this parameter updates the game server's LastHealthCheckTime timestamp.
Raises:
-
InternalServiceException
–
The service encountered an unrecoverable internal failure while processing the request. Clients can retry such requests immediately or after a waiting period.
-
InvalidRequestException
–
One or more parameter values in the request are invalid. Correct the invalid parameter values 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.
-
UnknownServiceError
–
The service returned an error code this client does not model.
Source code in docs_src/capo_gamelift/_services/game_lift.py
| def update_game_server(
self,
*,
config_overrides: Optional[GameLiftClientConfig] = None,
game_server_group_name: Optional[
"capo_gamelift.types.game_server_group_name_or_arn.GameServerGroupNameOrArn"
] = None,
game_server_id: Optional[
"capo_gamelift.types.game_server_id.GameServerId"
] = None,
game_server_data: Optional[
"capo_gamelift.types.game_server_data.GameServerData"
] = None,
utilization_status: Optional[
"capo_gamelift.types.game_server_utilization_status.GameServerUtilizationStatus"
] = None,
health_check: Optional[
"capo_gamelift.types.game_server_health_check.GameServerHealthCheck"
] = None,
) -> "capo_gamelift.types.update_game_server_output.UpdateGameServerOutput":
"""<p> <b>This API works with the following fleet types:</b> EC2 (FleetIQ)</p> <p>Updates information about a registered game server to help Amazon GameLift Servers FleetIQ track game server availability. This operation is called by a game server process that is running on an instance in a game server group. </p> <p>Use this operation to update the following types of game server information. You can make all three types of updates in the same request:</p> <ul> <li> <p>To update the game server's utilization status from <code>AVAILABLE</code> (when the game server is available to be claimed) to <code>UTILIZED</code> (when the game server is currently hosting games). Identify the game server and game server group and specify the new utilization status. You can't change the status from <code>UTILIZED</code> to <code>AVAILABLE</code> .</p> </li> <li> <p>To report health status, identify the game server and game server group and set health check to <code>HEALTHY</code>. If a game server does not report health status for a certain length of time, the game server is no longer considered healthy. As a result, it will be eventually deregistered from the game server group to avoid affecting utilization metrics. The best practice is to report health every 60 seconds.</p> </li> <li> <p>To change game server metadata, provide updated game server data.</p> </li> </ul> <p>Once a game server is successfully updated, the relevant statuses and timestamps are updated.</p> <p> <b>Learn more</b> </p> <p> <a href="https://docs.aws.amazon.com/gamelift/latest/fleetiqguide/gsg-intro.html">Amazon GameLift Servers FleetIQ Guide</a> </p>
Args:
game_server_group_name: <p>A unique identifier for the game server group where the game server is running.</p>
game_server_id: <p>A custom string that uniquely identifies the game server to update.</p>
game_server_data: <p>A set of custom game server properties, formatted as a single string value. This data is passed to a game client or service when it requests information on game servers. </p>
utilization_status: <p>Indicates if the game server is available or is currently hosting gameplay. You can update a game server status from <code>AVAILABLE</code> to <code>UTILIZED</code>, but you can't change the status from <code>UTILIZED</code> to <code>AVAILABLE</code>.</p>
health_check: <p>Indicates health status of the game server. A request that includes this parameter updates the game server's <i>LastHealthCheckTime</i> timestamp. </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_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.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.UnknownServiceError: The service returned an error code this client does not model.
"""
def _handler(
req: "OperationRequest[capo_gamelift.types.update_game_server_input.UpdateGameServerInput]",
) -> OperationResponse[
"capo_gamelift.types.update_game_server_output.UpdateGameServerOutput"
]:
import capo_gamelift._operations.game_lift.update_game_server
output, http_response = (
capo_gamelift._operations.game_lift.update_game_server.update_game_server(
req.options, req.input
)
)
return OperationResponse(output=output, response=http_response)
def _redact_input(
input_: "capo_gamelift.types.update_game_server_input.UpdateGameServerInput",
) -> dict[str, Any]:
import capo_gamelift.types.update_game_server_input
return capo_gamelift.types.update_game_server_input.redact_sensitive(input_)
def _redact_output(
output: "capo_gamelift.types.update_game_server_output.UpdateGameServerOutput",
) -> dict[str, Any]:
import capo_gamelift.types.update_game_server_output
return capo_gamelift.types.update_game_server_output.redact_sensitive(
output
)
interceptors_, options_ = self.operation_options(
config_overrides,
OperationLogging(
"UpdateGameServer",
redact_input=_redact_input,
redact_output=_redact_output,
),
)
input_: capo_gamelift.types.update_game_server_input.UpdateGameServerInput = {}
if game_server_group_name is not None:
input_["game_server_group_name"] = game_server_group_name
if game_server_id is not None:
input_["game_server_id"] = game_server_id
if game_server_data is not None:
input_["game_server_data"] = game_server_data
if utilization_status is not None:
input_["utilization_status"] = utilization_status
if health_check is not None:
input_["health_check"] = health_check
response = execute_pipeline(
OperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
response.response.close()
return response.output
|