createInsight method

Future<CreateInsightResponse> createInsight({
  1. required AwsSecurityFindingFilters filters,
  2. required String groupByAttribute,
  3. required String name,
})

Creates a custom insight in Security Hub. An insight is a consolidation of findings that relate to a security issue that requires attention or remediation.

To group the related findings in the insight, use the GroupByAttribute.

May throw InternalException. May throw InvalidInputException. May throw LimitExceededException. May throw InvalidAccessException. May throw ResourceConflictException.

Parameter filters : One or more attributes used to filter the findings included in the insight. The insight only includes findings that match the criteria defined in the filters.

Parameter groupByAttribute : The attribute used to group the findings for the insight. The grouping attribute identifies the type of item that the insight applies to. For example, if an insight is grouped by resource identifier, then the insight produces a list of resource identifiers.

Parameter name : The name of the custom insight to create.

Implementation

Future<CreateInsightResponse> createInsight({
  required AwsSecurityFindingFilters filters,
  required String groupByAttribute,
  required String name,
}) async {
  ArgumentError.checkNotNull(filters, 'filters');
  ArgumentError.checkNotNull(groupByAttribute, 'groupByAttribute');
  ArgumentError.checkNotNull(name, 'name');
  final $payload = <String, dynamic>{
    'Filters': filters,
    'GroupByAttribute': groupByAttribute,
    'Name': name,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri: '/insights',
    exceptionFnMap: _exceptionFns,
  );
  return CreateInsightResponse.fromJson(response);
}