putEvaluations method

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

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

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

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

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

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

Implementation

Future<PutEvaluationsResponse> putEvaluations({
  required String resultToken,
  List<Evaluation>? evaluations,
  bool? testMode,
}) async {
  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);
}