createAnalyzer method

Future<CreateAnalyzerResponse> createAnalyzer({
  1. required String analyzerName,
  2. required Type type,
  3. List<InlineArchiveRule>? archiveRules,
  4. String? clientToken,
  5. Map<String, String>? tags,
})

Creates an analyzer for your account.

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

Parameter analyzerName : The name of the analyzer to create.

Parameter type : The type of analyzer to create. Only ACCOUNT analyzers are supported. You can create only one analyzer per account per Region.

Parameter archiveRules : Specifies the archive rules to add for the analyzer. Archive rules automatically archive findings that meet the criteria you define for the rule.

Parameter clientToken : A client token.

Parameter tags : The tags to apply to the analyzer.

Implementation

Future<CreateAnalyzerResponse> createAnalyzer({
  required String analyzerName,
  required Type type,
  List<InlineArchiveRule>? archiveRules,
  String? clientToken,
  Map<String, String>? tags,
}) async {
  ArgumentError.checkNotNull(analyzerName, 'analyzerName');
  _s.validateStringLength(
    'analyzerName',
    analyzerName,
    1,
    255,
    isRequired: true,
  );
  ArgumentError.checkNotNull(type, 'type');
  final $payload = <String, dynamic>{
    'analyzerName': analyzerName,
    'type': type.toValue(),
    if (archiveRules != null) 'archiveRules': archiveRules,
    'clientToken': clientToken ?? _s.generateIdempotencyToken(),
    if (tags != null) 'tags': tags,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'PUT',
    requestUri: '/analyzer',
    exceptionFnMap: _exceptionFns,
  );
  return CreateAnalyzerResponse.fromJson(response);
}