getAggregateComplianceDetailsByConfigRule method

Future<GetAggregateComplianceDetailsByConfigRuleResponse> getAggregateComplianceDetailsByConfigRule({
  1. required String accountId,
  2. required String awsRegion,
  3. required String configRuleName,
  4. required String configurationAggregatorName,
  5. ComplianceType? complianceType,
  6. int? limit,
  7. String? nextToken,
})

Returns the evaluation results for the specified AWS Config rule for a specific resource in a 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 ValidationException. May throw InvalidLimitException. May throw InvalidNextTokenException. May throw NoSuchConfigurationAggregatorException.

Parameter accountId : The 12-digit account ID of the source account.

Parameter awsRegion : The source region from where the data is aggregated.

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

Parameter configurationAggregatorName : The name of the configuration aggregator.

Parameter complianceType : The resource compliance status.

Parameter limit : The maximum number of evaluation results returned on each page. The default is 50. 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<GetAggregateComplianceDetailsByConfigRuleResponse>
    getAggregateComplianceDetailsByConfigRule({
  required String accountId,
  required String awsRegion,
  required String configRuleName,
  required String configurationAggregatorName,
  ComplianceType? complianceType,
  int? limit,
  String? nextToken,
}) async {
  ArgumentError.checkNotNull(accountId, 'accountId');
  ArgumentError.checkNotNull(awsRegion, 'awsRegion');
  _s.validateStringLength(
    'awsRegion',
    awsRegion,
    1,
    64,
    isRequired: true,
  );
  ArgumentError.checkNotNull(configRuleName, 'configRuleName');
  _s.validateStringLength(
    'configRuleName',
    configRuleName,
    1,
    128,
    isRequired: true,
  );
  ArgumentError.checkNotNull(
      configurationAggregatorName, 'configurationAggregatorName');
  _s.validateStringLength(
    'configurationAggregatorName',
    configurationAggregatorName,
    1,
    256,
    isRequired: true,
  );
  _s.validateNumRange(
    'limit',
    limit,
    0,
    100,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target':
        'StarlingDoveService.GetAggregateComplianceDetailsByConfigRule'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'AccountId': accountId,
      'AwsRegion': awsRegion,
      'ConfigRuleName': configRuleName,
      'ConfigurationAggregatorName': configurationAggregatorName,
      if (complianceType != null) 'ComplianceType': complianceType.toValue(),
      if (limit != null) 'Limit': limit,
      if (nextToken != null) 'NextToken': nextToken,
    },
  );

  return GetAggregateComplianceDetailsByConfigRuleResponse.fromJson(
      jsonResponse.body);
}