getComplianceDetailsByConfigRule method

Future<GetComplianceDetailsByConfigRuleResponse> getComplianceDetailsByConfigRule({
  1. required String configRuleName,
  2. List<ComplianceType>? complianceTypes,
  3. int? limit,
  4. String? nextToken,
})

Returns the evaluation results for the specified Config rule. The results indicate which Amazon Web Services resources were evaluated by the rule, when each resource was last evaluated, and whether each resource complies with the rule.

May throw InvalidNextTokenException. May throw InvalidParameterValueException. May throw NoSuchConfigRuleException.

Parameter configRuleName : The name of the Config rule for which you want compliance information.

Parameter complianceTypes : Filters the results by compliance.

INSUFFICIENT_DATA is a valid ComplianceType that is returned when an Config rule cannot be evaluated. However, INSUFFICIENT_DATA cannot be used as a ComplianceType for filtering results.

Parameter limit : The maximum number of evaluation results returned on each page. The default is 10. You cannot specify a number greater than 100. If you specify 0, Config uses the default.

Parameter nextToken : The nextToken string returned on a previous page that you use to get the next page of results in a paginated response.

Implementation

Future<GetComplianceDetailsByConfigRuleResponse>
    getComplianceDetailsByConfigRule({
  required String configRuleName,
  List<ComplianceType>? complianceTypes,
  int? limit,
  String? nextToken,
}) async {
  _s.validateNumRange(
    'limit',
    limit,
    0,
    100,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'StarlingDoveService.GetComplianceDetailsByConfigRule'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'ConfigRuleName': configRuleName,
      if (complianceTypes != null)
        'ComplianceTypes': complianceTypes.map((e) => e.value).toList(),
      if (limit != null) 'Limit': limit,
      if (nextToken != null) 'NextToken': nextToken,
    },
  );

  return GetComplianceDetailsByConfigRuleResponse.fromJson(jsonResponse.body);
}