createAnalyzer method

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

Creates an analyzer for your account.

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

Parameter analyzerName : The name of the analyzer to create.

Parameter type : The type of analyzer to create. You can create only one analyzer per account per Region. You can create up to 5 analyzers per organization 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 configuration : Specifies the configuration of the analyzer. If the analyzer is an unused access analyzer, the specified scope of unused access is used for the configuration. If the analyzer is an internal access analyzer, the specified internal access analysis rules are used for the configuration.

Parameter tags : An array of key-value pairs to apply to the analyzer. You can use the set of Unicode letters, digits, whitespace, _, ., /, =, +, and -.

For the tag key, you can specify a value that is 1 to 128 characters in length and cannot be prefixed with aws:.

For the tag value, you can specify a value that is 0 to 256 characters in length.

Implementation

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