This API works with the following fleet types: EC2, Anywhere
Updates a fleet's mutable attributes, such as game session protection and resource creation limits.
To update fleet attributes, specify the fleet ID and the property values that you want to change. If successful, Amazon GameLift Servers returns the identifiers for the updated fleet.
A managed fleet's runtime environment, which depends on the fleet's Amazon Machine Image (AMI) version, can't be updated. You must create a new fleet. As a best practice, we recommend replacing your managed fleets every 30 days to maintain a secure and up-to-date runtime environment for your hosted game servers. For guidance, see Security best practices for Amazon GameLift Servers.
Learn more
Setting up Amazon GameLift Servers fleets
Parameters:
-
fleet_id
(Optional[FleetIdOrArn], default:
None
)
–
A unique identifier for the fleet to update attribute metadata for. You can use either the fleet ID or ARN value.
-
name
(Optional[NonZeroAndMaxString], default:
None
)
–
A descriptive label that is associated with a fleet. Fleet names do not need to be unique.
-
description
(Optional[NonZeroAndMaxString], default:
None
)
–
A human-readable description of a fleet.
-
new_game_session_protection_policy
(Optional[ProtectionPolicy], default:
None
)
–
The game session protection policy to apply to all new game sessions created in this fleet. Game sessions that already exist are not affected. You can set protection for individual game sessions using UpdateGameSession .
-
NoProtection -- The game session can be terminated during a scale-down event.
-
FullProtection -- If the game session is in an ACTIVE status, it cannot be terminated during a scale-down event.
-
resource_creation_limit_policy
(Optional[ResourceCreationLimitPolicy], default:
None
)
–
Policy settings that limit the number of game sessions an individual player can create over a span of time.
-
metric_groups
(Optional[MetricGroupList], default:
None
)
–
The name of a metric group to add this fleet to. Use a metric group in Amazon CloudWatch to aggregate the metrics from multiple fleets. Provide an existing metric group name, or create a new metric group by providing a new name. A fleet can only be in one metric group at a time.
-
anywhere_configuration
(Optional[AnywhereConfiguration], default:
None
)
–
Amazon GameLift Servers Anywhere configuration options.
Raises:
-
ConflictException
–
The requested operation would cause a conflict with the current state of a service resource associated with the request. Resolve the conflict before retrying this request.
-
InternalServiceException
–
The service encountered an unrecoverable internal failure while processing the request. Clients can retry such requests immediately or after a waiting period.
-
InvalidFleetStatusException
–
The requested operation would cause a conflict with the current state of a resource associated with the request and/or the fleet. 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.
-
UnknownServiceError
–
The service returned an error code this client does not model.
Source code in docs_src/capo_gamelift/_services/async_game_lift.py
| async def update_fleet_attributes(
self,
*,
config_overrides: Optional[AsyncGameLiftClientConfig] = None,
fleet_id: Optional["capo_gamelift.types.fleet_id_or_arn.FleetIdOrArn"] = None,
name: Optional[
"capo_gamelift.types.non_zero_and_max_string.NonZeroAndMaxString"
] = None,
description: Optional[
"capo_gamelift.types.non_zero_and_max_string.NonZeroAndMaxString"
] = None,
new_game_session_protection_policy: Optional[
"capo_gamelift.types.protection_policy.ProtectionPolicy"
] = None,
resource_creation_limit_policy: Optional[
"capo_gamelift.types.resource_creation_limit_policy.ResourceCreationLimitPolicy"
] = None,
metric_groups: Optional[
"capo_gamelift.types.metric_group_list.MetricGroupList"
] = None,
anywhere_configuration: Optional[
"capo_gamelift.types.anywhere_configuration.AnywhereConfiguration"
] = None,
) -> (
"capo_gamelift.types.update_fleet_attributes_output.UpdateFleetAttributesOutput"
):
"""<p> <b>This API works with the following fleet types:</b> EC2, Anywhere</p> <p>Updates a fleet's mutable attributes, such as game session protection and resource creation limits.</p> <p>To update fleet attributes, specify the fleet ID and the property values that you want to change. If successful, Amazon GameLift Servers returns the identifiers for the updated fleet.</p> <note> <p>A managed fleet's runtime environment, which depends on the fleet's Amazon Machine Image (AMI) version, can't be updated. You must create a new fleet. As a best practice, we recommend replacing your managed fleets every 30 days to maintain a secure and up-to-date runtime environment for your hosted game servers. For guidance, see <a href="https://docs.aws.amazon.com/gameliftservers/latest/developerguide/security-best-practices.html"> Security best practices for Amazon GameLift Servers</a>.</p> </note> <p> <b>Learn more</b> </p> <p> <a href="https://docs.aws.amazon.com/gamelift/latest/developerguide/fleets-intro.html">Setting up Amazon GameLift Servers fleets</a> </p>
Args:
fleet_id: <p>A unique identifier for the fleet to update attribute metadata for. You can use either the fleet ID or ARN value.</p>
name: <p>A descriptive label that is associated with a fleet. Fleet names do not need to be unique.</p>
description: <p>A human-readable description of a fleet.</p>
new_game_session_protection_policy: <p>The game session protection policy to apply to all new game sessions created in this fleet. Game sessions that already exist are not affected. You can set protection for individual game sessions using <a href="https://docs.aws.amazon.com/gamelift/latest/apireference/API_UpdateGameSession.html">UpdateGameSession</a> .</p> <ul> <li> <p> <b>NoProtection</b> -- The game session can be terminated during a scale-down event.</p> </li> <li> <p> <b>FullProtection</b> -- If the game session is in an <code>ACTIVE</code> status, it cannot be terminated during a scale-down event.</p> </li> </ul>
resource_creation_limit_policy: <p>Policy settings that limit the number of game sessions an individual player can create over a span of time. </p>
metric_groups: <p>The name of a metric group to add this fleet to. Use a metric group in Amazon CloudWatch to aggregate the metrics from multiple fleets. Provide an existing metric group name, or create a new metric group by providing a new name. A fleet can only be in one metric group at a time.</p>
anywhere_configuration: <p>Amazon GameLift Servers Anywhere configuration options.</p>
Raises:
capo_gamelift.errors.conflict_exception.ConflictException: <p>The requested operation would cause a conflict with the current state of a service resource associated with the request. Resolve the conflict before retrying this request.</p> <p></p>
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_fleet_status_exception.InvalidFleetStatusException: <p>The requested operation would cause a conflict with the current state of a resource associated with the request and/or the fleet. 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.UnknownServiceError: The service returned an error code this client does not model.
"""
async def _handler(
req: "AsyncOperationRequest[capo_gamelift.types.update_fleet_attributes_input.UpdateFleetAttributesInput]",
) -> AsyncOperationResponse[
"capo_gamelift.types.update_fleet_attributes_output.UpdateFleetAttributesOutput"
]:
import capo_gamelift._operations.game_lift.update_fleet_attributes
(
output,
http_response,
) = await capo_gamelift._operations.game_lift.update_fleet_attributes.async_update_fleet_attributes(
req.options, req.input
)
return AsyncOperationResponse(output=output, response=http_response)
interceptors_, options_ = self.operation_options(
config_overrides, OperationLogging("UpdateFleetAttributes")
)
input_: capo_gamelift.types.update_fleet_attributes_input.UpdateFleetAttributesInput = {}
if fleet_id is not None:
input_["fleet_id"] = fleet_id
if name is not None:
input_["name"] = name
if description is not None:
input_["description"] = description
if new_game_session_protection_policy is not None:
input_["new_game_session_protection_policy"] = (
new_game_session_protection_policy
)
if resource_creation_limit_policy is not None:
input_["resource_creation_limit_policy"] = resource_creation_limit_policy
if metric_groups is not None:
input_["metric_groups"] = metric_groups
if anywhere_configuration is not None:
input_["anywhere_configuration"] = anywhere_configuration
response = await aexecute_pipeline(
AsyncOperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
await response.response.aclose()
return response.output
|