putEvaluations method

Future<PutEvaluationsResponse> putEvaluations({
  1. required String resultToken,
  2. List<Evaluation>? evaluations,
  3. bool? testMode,
})

Used by an AWS Lambda function to deliver evaluation results to AWS Config. This action is required in every AWS Lambda function that is invoked by an AWS Config rule.

May throw InvalidParameterValueException. May throw InvalidResultTokenException. May throw NoSuchConfigRuleException.

Parameter resultToken : An encrypted token that associates an evaluation with an AWS Config rule. Identifies the rule and the event that triggered the evaluation.

Parameter evaluations : The assessments that the AWS Lambda function performs. Each evaluation identifies an AWS resource and indicates whether it complies with the AWS Config rule that invokes the AWS Lambda function.

Parameter testMode : Use this parameter to specify a test run for PutEvaluations. You can verify whether your AWS Lambda function will deliver evaluation results to AWS Config. No updates occur to your existing evaluations, and evaluation results are not sent to AWS Config.

Implementation

Future<PutEvaluationsResponse> putEvaluations({
  required String resultToken,
  List<Evaluation>? evaluations,
  bool? testMode,
}) async {
  ArgumentError.checkNotNull(resultToken, 'resultToken');
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'StarlingDoveService.PutEvaluations'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'ResultToken': resultToken,
      if (evaluations != null) 'Evaluations': evaluations,
      if (testMode != null) 'TestMode': testMode,
    },
  );

  return PutEvaluationsResponse.fromJson(jsonResponse.body);
}