This API works with the following fleet types: EC2, Anywhere, Container
Cancels a game session placement that's in PENDING status. To stop a placement, provide the placement ID value.
Results
If successful, this operation removes the placement request from the queue and moves the GameSessionPlacement to CANCELLED status.
This operation results in an InvalidRequestException (400) error if a game session has already been created for this placement. You can clean up an unneeded game session by calling TerminateGameSession.
Parameters:
-
placement_id
(Optional[IdStringModel], default:
None
)
–
A unique identifier for a game session placement to stop.
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 stop_game_session_placement(
self,
*,
config_overrides: Optional[GameLiftClientConfig] = None,
placement_id: Optional[
"capo_gamelift.types.id_string_model.IdStringModel"
] = None,
) -> "capo_gamelift.types.stop_game_session_placement_output.StopGameSessionPlacementOutput":
"""<p> <b>This API works with the following fleet types:</b> EC2, Anywhere, Container</p> <p>Cancels a game session placement that's in <code>PENDING</code> status. To stop a placement, provide the placement ID value. </p> <p>Results</p> <p>If successful, this operation removes the placement request from the queue and moves the <code>GameSessionPlacement</code> to <code>CANCELLED</code> status.</p> <p>This operation results in an <code>InvalidRequestException</code> (400) error if a game session has already been created for this placement. You can clean up an unneeded game session by calling <a href="https://docs.aws.amazon.com/gamelift/latest/apireference/API_TerminateGameSession">TerminateGameSession</a>.</p>
Args:
placement_id: <p>A unique identifier for a game session placement to stop.</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.stop_game_session_placement_input.StopGameSessionPlacementInput]",
) -> OperationResponse[
"capo_gamelift.types.stop_game_session_placement_output.StopGameSessionPlacementOutput"
]:
import capo_gamelift._operations.game_lift.stop_game_session_placement
output, http_response = (
capo_gamelift._operations.game_lift.stop_game_session_placement.stop_game_session_placement(
req.options, req.input
)
)
return OperationResponse(output=output, response=http_response)
def _redact_output(
output: "capo_gamelift.types.stop_game_session_placement_output.StopGameSessionPlacementOutput",
) -> dict[str, Any]:
import capo_gamelift.types.stop_game_session_placement_output
return (
capo_gamelift.types.stop_game_session_placement_output.redact_sensitive(
output
)
)
interceptors_, options_ = self.operation_options(
config_overrides,
OperationLogging("StopGameSessionPlacement", redact_output=_redact_output),
)
input_: capo_gamelift.types.stop_game_session_placement_input.StopGameSessionPlacementInput = {}
if placement_id is not None:
input_["placement_id"] = placement_id
response = execute_pipeline(
OperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
response.response.close()
return response.output
|