updateDetector method

Future<void> updateDetector({
  1. required String detectorId,
  2. DataSourceConfigurations? dataSources,
  3. bool? enable,
  4. List<DetectorFeatureConfiguration>? features,
  5. FindingPublishingFrequency? findingPublishingFrequency,
})

Updates the GuardDuty detector specified by the detector ID.

Specifying both EKS Runtime Monitoring (EKS_RUNTIME_MONITORING) and Runtime Monitoring (RUNTIME_MONITORING) will cause an error. You can add only one of these two features because Runtime Monitoring already includes the threat detection for Amazon EKS resources. For more information, see Runtime Monitoring.

There might be regional differences because some data sources might not be available in all the Amazon Web Services Regions where GuardDuty is presently supported. For more information, see Regions and endpoints.

May throw BadRequestException. May throw InternalServerErrorException.

Parameter detectorId : The unique ID of the detector to update.

To find the detectorId in the current Region, see the Settings page in the GuardDuty console, or run the ListDetectors API.

Parameter dataSources : Describes which data sources will be updated.

There might be regional differences because some data sources might not be available in all the Amazon Web Services Regions where GuardDuty is presently supported. For more information, see Regions and endpoints.

Parameter enable : Specifies whether the detector is enabled or not enabled.

Parameter features : Provides the features that will be updated for the detector.

Parameter findingPublishingFrequency : An enum value that specifies how frequently findings are exported, such as to CloudWatch Events.

Implementation

Future<void> updateDetector({
  required String detectorId,
  DataSourceConfigurations? dataSources,
  bool? enable,
  List<DetectorFeatureConfiguration>? features,
  FindingPublishingFrequency? findingPublishingFrequency,
}) async {
  final $payload = <String, dynamic>{
    if (dataSources != null) 'dataSources': dataSources,
    if (enable != null) 'enable': enable,
    if (features != null) 'features': features,
    if (findingPublishingFrequency != null)
      'findingPublishingFrequency': findingPublishingFrequency.value,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri: '/detector/${Uri.encodeComponent(detectorId)}',
    exceptionFnMap: _exceptionFns,
  );
}