listServiceStates method

Future<ListServiceStatesOutput> listServiceStates({
  1. required DateTime endTime,
  2. required DateTime startTime,
  3. List<AttributeFilter>? attributeFilters,
  4. String? awsAccountId,
  5. bool? includeLinkedAccounts,
  6. int? maxResults,
  7. String? nextToken,
})

Returns information about the last deployment and other change states of services. This API provides visibility into recent changes that may have affected service performance, helping with troubleshooting and change correlation.

May throw ThrottlingException. May throw ValidationException.

Parameter endTime : The end of the time period to retrieve service state information for. When used in a raw HTTP Query API, it is formatted as epoch time in seconds. For example, 1698778057.

Parameter startTime : The start of the time period to retrieve service state information for. When used in a raw HTTP Query API, it is formatted as epoch time in seconds. For example, 1698778057.

Parameter attributeFilters : A list of attribute filters to narrow down the services. You can filter by platform, environment, or other service attributes.

Parameter awsAccountId : The Amazon Web Services account ID to filter service states by. Use this to limit results to services from a specific account.

Parameter includeLinkedAccounts : If you are using this operation in a monitoring account, specify true to include service states from source accounts in the returned data.

Parameter maxResults : The maximum number of service states to return in one operation. If you omit this parameter, the default of 20 is used.

Parameter nextToken : Include this value, if it was returned by the previous operation, to get the next set of service states.

Implementation

Future<ListServiceStatesOutput> listServiceStates({
  required DateTime endTime,
  required DateTime startTime,
  List<AttributeFilter>? attributeFilters,
  String? awsAccountId,
  bool? includeLinkedAccounts,
  int? maxResults,
  String? nextToken,
}) async {
  _s.validateNumRange(
    'maxResults',
    maxResults,
    0,
    250,
  );
  final $payload = <String, dynamic>{
    'EndTime': unixTimestampToJson(endTime),
    'StartTime': unixTimestampToJson(startTime),
    if (attributeFilters != null) 'AttributeFilters': attributeFilters,
    if (awsAccountId != null) 'AwsAccountId': awsAccountId,
    if (includeLinkedAccounts != null)
      'IncludeLinkedAccounts': includeLinkedAccounts,
    if (maxResults != null) 'MaxResults': maxResults,
    if (nextToken != null) 'NextToken': nextToken,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri: '/service/states',
    exceptionFnMap: _exceptionFns,
  );
  return ListServiceStatesOutput.fromJson(response);
}