getExclusionsPreview method

Future<GetExclusionsPreviewResponse> getExclusionsPreview({
  1. required String assessmentTemplateArn,
  2. required String previewToken,
  3. Locale? locale,
  4. int? maxResults,
  5. String? nextToken,
})

Retrieves the exclusions preview (a list of ExclusionPreview objects) specified by the preview token. You can obtain the preview token by running the CreateExclusionsPreview API.

May throw InvalidInputException. May throw InternalException. May throw AccessDeniedException. May throw NoSuchEntityException.

Parameter assessmentTemplateArn : The ARN that specifies the assessment template for which the exclusions preview was requested.

Parameter previewToken : The unique identifier associated of the exclusions preview.

Parameter locale : The locale into which you want to translate the exclusion's title, description, and recommendation.

Parameter maxResults : You can use this parameter to indicate the maximum number of items you want in the response. The default value is 100. The maximum value is 500.

Parameter nextToken : You can use this parameter when paginating results. Set the value of this parameter to null on your first call to the GetExclusionsPreviewRequest action. Subsequent calls to the action fill nextToken in the request with the value of nextToken from the previous response to continue listing data.

Implementation

Future<GetExclusionsPreviewResponse> getExclusionsPreview({
  required String assessmentTemplateArn,
  required String previewToken,
  Locale? locale,
  int? maxResults,
  String? nextToken,
}) async {
  ArgumentError.checkNotNull(assessmentTemplateArn, 'assessmentTemplateArn');
  _s.validateStringLength(
    'assessmentTemplateArn',
    assessmentTemplateArn,
    1,
    300,
    isRequired: true,
  );
  ArgumentError.checkNotNull(previewToken, 'previewToken');
  _s.validateStringLength(
    'nextToken',
    nextToken,
    1,
    300,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'InspectorService.GetExclusionsPreview'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'assessmentTemplateArn': assessmentTemplateArn,
      'previewToken': previewToken,
      if (locale != null) 'locale': locale.toValue(),
      if (maxResults != null) 'maxResults': maxResults,
      if (nextToken != null) 'nextToken': nextToken,
    },
  );

  return GetExclusionsPreviewResponse.fromJson(jsonResponse.body);
}