getComplianceDetailsByResource method

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

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

May throw InvalidParameterValueException.

Parameter resourceId : The ID of the AWS resource for which you want compliance information.

Parameter resourceType : The type of the AWS resource for which you want compliance information.

Parameter complianceTypes : Filters the results by compliance.

The allowed values are COMPLIANT, NON_COMPLIANT, and NOT_APPLICABLE.

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<GetComplianceDetailsByResourceResponse>
    getComplianceDetailsByResource({
  required String resourceId,
  required String resourceType,
  List<ComplianceType>? complianceTypes,
  String? nextToken,
}) async {
  ArgumentError.checkNotNull(resourceId, 'resourceId');
  _s.validateStringLength(
    'resourceId',
    resourceId,
    1,
    768,
    isRequired: true,
  );
  ArgumentError.checkNotNull(resourceType, 'resourceType');
  _s.validateStringLength(
    'resourceType',
    resourceType,
    1,
    256,
    isRequired: true,
  );
  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: {
      'ResourceId': resourceId,
      'ResourceType': resourceType,
      if (complianceTypes != null)
        'ComplianceTypes': complianceTypes.map((e) => e.toValue()).toList(),
      if (nextToken != null) 'NextToken': nextToken,
    },
  );

  return GetComplianceDetailsByResourceResponse.fromJson(jsonResponse.body);
}