getComplianceDetailsByResource method

Future<GetComplianceDetailsByResourceResponse> getComplianceDetailsByResource({
  1. List<ComplianceType>? complianceTypes,
  2. String? nextToken,
  3. String? resourceEvaluationId,
  4. String? resourceId,
  5. String? resourceType,
})

Returns the evaluation results for the specified Amazon Web Services resource. The results indicate which Config rules were used to evaluate the resource, when each rule was last invoked, and whether the resource complies with each rule.

May throw InvalidParameterValueException.

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 nextToken : The nextToken string returned on a previous page that you use to get the next page of results in a paginated response.

Parameter resourceEvaluationId : The unique ID of Amazon Web Services resource execution for which you want to retrieve evaluation results.

Parameter resourceId : The ID of the Amazon Web Services resource for which you want compliance information.

Parameter resourceType : The type of the Amazon Web Services resource for which you want compliance information.

Implementation

Future<GetComplianceDetailsByResourceResponse>
    getComplianceDetailsByResource({
  List<ComplianceType>? complianceTypes,
  String? nextToken,
  String? resourceEvaluationId,
  String? resourceId,
  String? resourceType,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'StarlingDoveService.GetComplianceDetailsByResource'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      if (complianceTypes != null)
        'ComplianceTypes': complianceTypes.map((e) => e.value).toList(),
      if (nextToken != null) 'NextToken': nextToken,
      if (resourceEvaluationId != null)
        'ResourceEvaluationId': resourceEvaluationId,
      if (resourceId != null) 'ResourceId': resourceId,
      if (resourceType != null) 'ResourceType': resourceType,
    },
  );

  return GetComplianceDetailsByResourceResponse.fromJson(jsonResponse.body);
}