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 AWS Config rule. The results indicate which AWS resources were evaluated by the rule, when each resource was last evaluated, and whether each resource complies with the rule.

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

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

Parameter complianceTypes : Filters the results by compliance.

The allowed values are COMPLIANT, NON_COMPLIANT, and NOT_APPLICABLE.

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, AWS 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 {
  ArgumentError.checkNotNull(configRuleName, 'configRuleName');
  _s.validateStringLength(
    'configRuleName',
    configRuleName,
    1,
    64,
    isRequired: true,
  );
  _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.toValue()).toList(),
      if (limit != null) 'Limit': limit,
      if (nextToken != null) 'NextToken': nextToken,
    },
  );

  return GetComplianceDetailsByConfigRuleResponse.fromJson(jsonResponse.body);
}