This API works with the following fleet types: EC2, Container
Retrieves all scaling policies applied to a fleet.
To get a fleet's scaling policies, specify the fleet ID. You can filter this request by policy status, such as to retrieve only active scaling policies. Use the pagination parameters to retrieve results as a set of sequential pages. If successful, set of ScalingPolicy objects is returned for the fleet.
A fleet may have all of its scaling policies suspended. This operation does not affect the status of the scaling policies, which remains ACTIVE.
Parameters:
-
fleet_id
(Optional[FleetIdOrArn], default:
None
)
–
A unique identifier for the fleet for which to retrieve scaling policies. You can use either the fleet ID or ARN value.
-
status_filter
(Optional[ScalingStatusType], default:
None
)
–
Scaling policy status to filter results on. A scaling policy is only in force when in an ACTIVE status.
-
ACTIVE -- The scaling policy is currently in force.
-
UPDATEREQUESTED -- A request to update the scaling policy has been received.
-
UPDATING -- A change is being made to the scaling policy.
-
DELETEREQUESTED -- A request to delete the scaling policy has been received.
-
DELETING -- The scaling policy is being deleted.
-
DELETED -- The scaling policy has been deleted.
-
ERROR -- An error occurred in creating the policy. It should be removed and recreated.
-
limit
(Optional[PositiveInteger], default:
None
)
–
The maximum number of results to return. Use this parameter with NextToken to get results as a set of sequential pages.
-
next_token
(Optional[NonZeroAndMaxString], default:
None
)
–
A token that indicates the start of the next sequential page of results. Use the token that is returned with a previous call to this operation. To start at the beginning of the result set, do not specify a value.
-
location
(Optional[LocationStringModel], default:
None
)
–
The fleet location. If you don't specify this value, the response contains the scaling policies of every location in the fleet.
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.
-
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 describe_scaling_policies(
self,
*,
config_overrides: Optional[GameLiftClientConfig] = None,
fleet_id: Optional["capo_gamelift.types.fleet_id_or_arn.FleetIdOrArn"] = None,
status_filter: Optional[
"capo_gamelift.types.scaling_status_type.ScalingStatusType"
] = None,
limit: Optional["capo_gamelift.types.positive_integer.PositiveInteger"] = None,
next_token: Optional[
"capo_gamelift.types.non_zero_and_max_string.NonZeroAndMaxString"
] = None,
location: Optional[
"capo_gamelift.types.location_string_model.LocationStringModel"
] = None,
) -> "capo_gamelift.types.describe_scaling_policies_output.DescribeScalingPoliciesOutput":
"""<p> <b>This API works with the following fleet types:</b> EC2, Container</p> <p>Retrieves all scaling policies applied to a fleet.</p> <p>To get a fleet's scaling policies, specify the fleet ID. You can filter this request by policy status, such as to retrieve only active scaling policies. Use the pagination parameters to retrieve results as a set of sequential pages. If successful, set of <code>ScalingPolicy</code> objects is returned for the fleet.</p> <p>A fleet may have all of its scaling policies suspended. This operation does not affect the status of the scaling policies, which remains ACTIVE.</p>
Args:
fleet_id: <p>A unique identifier for the fleet for which to retrieve scaling policies. You can use either the fleet ID or ARN value.</p>
status_filter: <p>Scaling policy status to filter results on. A scaling policy is only in force when in an <code>ACTIVE</code> status.</p> <ul> <li> <p> <b>ACTIVE</b> -- The scaling policy is currently in force.</p> </li> <li> <p> <b>UPDATEREQUESTED</b> -- A request to update the scaling policy has been received.</p> </li> <li> <p> <b>UPDATING</b> -- A change is being made to the scaling policy.</p> </li> <li> <p> <b>DELETEREQUESTED</b> -- A request to delete the scaling policy has been received.</p> </li> <li> <p> <b>DELETING</b> -- The scaling policy is being deleted.</p> </li> <li> <p> <b>DELETED</b> -- The scaling policy has been deleted.</p> </li> <li> <p> <b>ERROR</b> -- An error occurred in creating the policy. It should be removed and recreated.</p> </li> </ul>
limit: <p>The maximum number of results to return. Use this parameter with <code>NextToken</code> to get results as a set of sequential pages.</p>
next_token: <p>A token that indicates the start of the next sequential page of results. Use the token that is returned with a previous call to this operation. To start at the beginning of the result set, do not specify a value.</p>
location: <p> The fleet location. If you don't specify this value, the response contains the scaling policies of every location in the fleet. </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.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.describe_scaling_policies_input.DescribeScalingPoliciesInput]",
) -> OperationResponse[
"capo_gamelift.types.describe_scaling_policies_output.DescribeScalingPoliciesOutput"
]:
import capo_gamelift._operations.game_lift.describe_scaling_policies
output, http_response = (
capo_gamelift._operations.game_lift.describe_scaling_policies.describe_scaling_policies(
req.options, req.input
)
)
return OperationResponse(output=output, response=http_response)
interceptors_, options_ = self.operation_options(
config_overrides, OperationLogging("DescribeScalingPolicies")
)
input_: capo_gamelift.types.describe_scaling_policies_input.DescribeScalingPoliciesInput = {}
if fleet_id is not None:
input_["fleet_id"] = fleet_id
if status_filter is not None:
input_["status_filter"] = status_filter
if limit is not None:
input_["limit"] = limit
if next_token is not None:
input_["next_token"] = next_token
if location is not None:
input_["location"] = location
response = execute_pipeline(
OperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
response.response.close()
return response.output
|