listComplianceItems method

Future<ListComplianceItemsResult> listComplianceItems({
  1. List<ComplianceStringFilter>? filters,
  2. int? maxResults,
  3. String? nextToken,
  4. List<String>? resourceIds,
  5. List<String>? resourceTypes,
})

For a specified resource ID, this API action returns a list of compliance statuses for different resource types. Currently, you can only specify one resource ID per call. List results depend on the criteria specified in the filter.

May throw InvalidResourceType. May throw InvalidResourceId. May throw InternalServerError. May throw InvalidFilter. May throw InvalidNextToken.

Parameter filters : One or more compliance filters. Use a filter to return a more specific list of results.

Parameter maxResults : The maximum number of items to return for this call. The call also returns a token that you can specify in a subsequent call to get the next set of results.

Parameter nextToken : A token to start the list. Use this token to get the next set of results.

Parameter resourceIds : The ID for the resources from which to get compliance information. Currently, you can only specify one resource ID.

Parameter resourceTypes : The type of resource from which to get compliance information. Currently, the only supported resource type is ManagedInstance.

Implementation

Future<ListComplianceItemsResult> listComplianceItems({
  List<ComplianceStringFilter>? filters,
  int? maxResults,
  String? nextToken,
  List<String>? resourceIds,
  List<String>? resourceTypes,
}) async {
  _s.validateNumRange(
    'maxResults',
    maxResults,
    1,
    50,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'AmazonSSM.ListComplianceItems'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      if (filters != null) 'Filters': filters,
      if (maxResults != null) 'MaxResults': maxResults,
      if (nextToken != null) 'NextToken': nextToken,
      if (resourceIds != null) 'ResourceIds': resourceIds,
      if (resourceTypes != null) 'ResourceTypes': resourceTypes,
    },
  );

  return ListComplianceItemsResult.fromJson(jsonResponse.body);
}