describeScalingPolicies method

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

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 (StopFleetActions). This operation does not affect the status of the scaling policies, which remains ACTIVE. To see whether a fleet's scaling policies are in force or suspended, call DescribeFleetAttributes and check the stopped actions.

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

Parameter fleetId : A unique identifier for a fleet to retrieve scaling policies for. 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 nextToken : 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? nextToken,
  ScalingStatusType? statusFilter,
}) async {
  ArgumentError.checkNotNull(fleetId, 'fleetId');
  _s.validateNumRange(
    'limit',
    limit,
    1,
    1152921504606846976,
  );
  _s.validateStringLength(
    'nextToken',
    nextToken,
    1,
    1024,
  );
  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 (nextToken != null) 'NextToken': nextToken,
      if (statusFilter != null) 'StatusFilter': statusFilter.toValue(),
    },
  );

  return DescribeScalingPoliciesOutput.fromJson(jsonResponse.body);
}