updateAnswer method

Future<UpdateAnswerOutput> updateAnswer({
  1. required String lensAlias,
  2. required String questionId,
  3. required String workloadId,
  4. Map<String, ChoiceUpdate>? choiceUpdates,
  5. bool? isApplicable,
  6. String? notes,
  7. AnswerReason? reason,
  8. List<String>? selectedChoices,
})

Update the answer to a specific question in a workload review.

May throw AccessDeniedException. May throw ConflictException. May throw InternalServerException. May throw ResourceNotFoundException. May throw ThrottlingException. May throw ValidationException.

Parameter choiceUpdates : A list of choices to update on a question in your workload. The String key corresponds to the choice ID to be updated.

Parameter reason : The reason why a question is not applicable to your workload.

Implementation

Future<UpdateAnswerOutput> updateAnswer({
  required String lensAlias,
  required String questionId,
  required String workloadId,
  Map<String, ChoiceUpdate>? choiceUpdates,
  bool? isApplicable,
  String? notes,
  AnswerReason? reason,
  List<String>? selectedChoices,
}) async {
  final $payload = <String, dynamic>{
    if (choiceUpdates != null) 'ChoiceUpdates': choiceUpdates,
    if (isApplicable != null) 'IsApplicable': isApplicable,
    if (notes != null) 'Notes': notes,
    if (reason != null) 'Reason': reason.value,
    if (selectedChoices != null) 'SelectedChoices': selectedChoices,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'PATCH',
    requestUri:
        '/workloads/${Uri.encodeComponent(workloadId)}/lensReviews/${Uri.encodeComponent(lensAlias)}/answers/${Uri.encodeComponent(questionId)}',
    exceptionFnMap: _exceptionFns,
  );
  return UpdateAnswerOutput.fromJson(response);
}