startAssessmentRun method

Future<StartAssessmentRunResponse> startAssessmentRun({
  1. required String assessmentTemplateArn,
  2. String? assessmentRunName,
})

Starts the assessment run specified by the ARN of the assessment template. For this API to function properly, you must not exceed the limit of running up to 500 concurrent agents per AWS account.

May throw InternalException. May throw InvalidInputException. May throw LimitExceededException. May throw AccessDeniedException. May throw NoSuchEntityException. May throw InvalidCrossAccountRoleException. May throw AgentsAlreadyRunningAssessmentException. May throw ServiceTemporarilyUnavailableException.

Parameter assessmentTemplateArn : The ARN of the assessment template of the assessment run that you want to start.

Parameter assessmentRunName : You can specify the name for the assessment run. The name must be unique for the assessment template whose ARN is used to start the assessment run.

Implementation

Future<StartAssessmentRunResponse> startAssessmentRun({
  required String assessmentTemplateArn,
  String? assessmentRunName,
}) async {
  ArgumentError.checkNotNull(assessmentTemplateArn, 'assessmentTemplateArn');
  _s.validateStringLength(
    'assessmentTemplateArn',
    assessmentTemplateArn,
    1,
    300,
    isRequired: true,
  );
  _s.validateStringLength(
    'assessmentRunName',
    assessmentRunName,
    1,
    140,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'InspectorService.StartAssessmentRun'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'assessmentTemplateArn': assessmentTemplateArn,
      if (assessmentRunName != null) 'assessmentRunName': assessmentRunName,
    },
  );

  return StartAssessmentRunResponse.fromJson(jsonResponse.body);
}