listComplianceStatus method

Future<ListComplianceStatusResponse> listComplianceStatus({
  1. required String policyId,
  2. int? maxResults,
  3. String? nextToken,
})

Returns an array of PolicyComplianceStatus objects. Use PolicyComplianceStatus to get a summary of which member accounts are protected by the specified policy.

May throw ResourceNotFoundException. May throw InternalErrorException.

Parameter policyId : The ID of the AWS Firewall Manager policy that you want the details for.

Parameter maxResults : Specifies the number of PolicyComplianceStatus objects that you want AWS Firewall Manager to return for this request. If you have more PolicyComplianceStatus objects than the number that you specify for MaxResults, the response includes a NextToken value that you can use to get another batch of PolicyComplianceStatus objects.

Parameter nextToken : If you specify a value for MaxResults and you have more PolicyComplianceStatus objects than the number that you specify for MaxResults, AWS Firewall Manager returns a NextToken value in the response that allows you to list another group of PolicyComplianceStatus objects. For the second and subsequent ListComplianceStatus requests, specify the value of NextToken from the previous response to get information about another batch of PolicyComplianceStatus objects.

Implementation

Future<ListComplianceStatusResponse> listComplianceStatus({
  required String policyId,
  int? maxResults,
  String? nextToken,
}) async {
  ArgumentError.checkNotNull(policyId, 'policyId');
  _s.validateStringLength(
    'policyId',
    policyId,
    36,
    36,
    isRequired: true,
  );
  _s.validateNumRange(
    'maxResults',
    maxResults,
    1,
    100,
  );
  _s.validateStringLength(
    'nextToken',
    nextToken,
    1,
    4096,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'AWSFMS_20180101.ListComplianceStatus'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'PolicyId': policyId,
      if (maxResults != null) 'MaxResults': maxResults,
      if (nextToken != null) 'NextToken': nextToken,
    },
  );

  return ListComplianceStatusResponse.fromJson(jsonResponse.body);
}