getAssessmentReport method

Future<GetAssessmentReportResponse> getAssessmentReport({
  1. required String assessmentRunArn,
  2. required ReportFileFormat reportFileFormat,
  3. required ReportType reportType,
})

Produces an assessment report that includes detailed and comprehensive results of a specified assessment run.

May throw InternalException. May throw InvalidInputException. May throw AccessDeniedException. May throw NoSuchEntityException. May throw AssessmentRunInProgressException. May throw UnsupportedFeatureException. May throw ServiceTemporarilyUnavailableException.

Parameter assessmentRunArn : The ARN that specifies the assessment run for which you want to generate a report.

Parameter reportFileFormat : Specifies the file format (html or pdf) of the assessment report that you want to generate.

Parameter reportType : Specifies the type of the assessment report that you want to generate. There are two types of assessment reports: a finding report and a full report. For more information, see Assessment Reports.

Implementation

Future<GetAssessmentReportResponse> getAssessmentReport({
  required String assessmentRunArn,
  required ReportFileFormat reportFileFormat,
  required ReportType reportType,
}) async {
  ArgumentError.checkNotNull(assessmentRunArn, 'assessmentRunArn');
  _s.validateStringLength(
    'assessmentRunArn',
    assessmentRunArn,
    1,
    300,
    isRequired: true,
  );
  ArgumentError.checkNotNull(reportFileFormat, 'reportFileFormat');
  ArgumentError.checkNotNull(reportType, 'reportType');
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'InspectorService.GetAssessmentReport'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'assessmentRunArn': assessmentRunArn,
      'reportFileFormat': reportFileFormat.toValue(),
      'reportType': reportType.toValue(),
    },
  );

  return GetAssessmentReportResponse.fromJson(jsonResponse.body);
}