describeScalingPolicies method

Future<DescribeScalingPoliciesOutput> describeScalingPolicies({
  1. required String fleetId,
  2. int? limit,
  3. String? location,
  4. String? nextToken,
  5. ScalingStatusType? statusFilter,
})

This API works with the following fleet types: EC2

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.

May throw InternalServiceException. May throw InvalidRequestException. May throw NotFoundException. May throw UnauthorizedException. May throw UnsupportedRegionException.

Parameter fleetId : A unique identifier for the fleet for which to retrieve scaling policies. You can use either the fleet ID or ARN value.

Parameter limit : The maximum number of results to return. Use this parameter with NextToken to get results as a set of sequential pages.

Parameter location : The fleet location. If you don't specify this value, the response contains the scaling policies of every location in the fleet.

Parameter nextToken : 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.

Parameter statusFilter : 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.

Implementation

Future<DescribeScalingPoliciesOutput> describeScalingPolicies({
  required String fleetId,
  int? limit,
  String? location,
  String? nextToken,
  ScalingStatusType? statusFilter,
}) async {
  _s.validateNumRange(
    'limit',
    limit,
    1,
    1152921504606846976,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'GameLift.DescribeScalingPolicies'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'FleetId': fleetId,
      if (limit != null) 'Limit': limit,
      if (location != null) 'Location': location,
      if (nextToken != null) 'NextToken': nextToken,
      if (statusFilter != null) 'StatusFilter': statusFilter.value,
    },
  );

  return DescribeScalingPoliciesOutput.fromJson(jsonResponse.body);
}