|
| 1 | +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. |
| 2 | +# This product includes software developed at Datadog (https://www.datadoghq.com/). |
| 3 | +# Copyright 2019-Present Datadog, Inc. |
| 4 | +from __future__ import annotations |
| 5 | + |
| 6 | +from typing import Union, TYPE_CHECKING |
| 7 | + |
| 8 | +from datadog_api_client.model_utils import ( |
| 9 | + ModelNormal, |
| 10 | + cached_property, |
| 11 | + unset, |
| 12 | + UnsetType, |
| 13 | +) |
| 14 | + |
| 15 | + |
| 16 | +if TYPE_CHECKING: |
| 17 | + from datadog_api_client.v2.model.security_monitoring_rule_anomaly_detection_options_bucket_duration import ( |
| 18 | + SecurityMonitoringRuleAnomalyDetectionOptionsBucketDuration, |
| 19 | + ) |
| 20 | + from datadog_api_client.v2.model.security_monitoring_rule_anomaly_detection_options_detection_tolerance import ( |
| 21 | + SecurityMonitoringRuleAnomalyDetectionOptionsDetectionTolerance, |
| 22 | + ) |
| 23 | + from datadog_api_client.v2.model.security_monitoring_rule_anomaly_detection_options_learning_duration import ( |
| 24 | + SecurityMonitoringRuleAnomalyDetectionOptionsLearningDuration, |
| 25 | + ) |
| 26 | + |
| 27 | + |
| 28 | +class SecurityMonitoringRuleAnomalyDetectionOptions(ModelNormal): |
| 29 | + validations = { |
| 30 | + "learning_period_baseline": { |
| 31 | + "inclusive_minimum": 0, |
| 32 | + }, |
| 33 | + } |
| 34 | + |
| 35 | + @cached_property |
| 36 | + def openapi_types(_): |
| 37 | + from datadog_api_client.v2.model.security_monitoring_rule_anomaly_detection_options_bucket_duration import ( |
| 38 | + SecurityMonitoringRuleAnomalyDetectionOptionsBucketDuration, |
| 39 | + ) |
| 40 | + from datadog_api_client.v2.model.security_monitoring_rule_anomaly_detection_options_detection_tolerance import ( |
| 41 | + SecurityMonitoringRuleAnomalyDetectionOptionsDetectionTolerance, |
| 42 | + ) |
| 43 | + from datadog_api_client.v2.model.security_monitoring_rule_anomaly_detection_options_learning_duration import ( |
| 44 | + SecurityMonitoringRuleAnomalyDetectionOptionsLearningDuration, |
| 45 | + ) |
| 46 | + |
| 47 | + return { |
| 48 | + "bucket_duration": (SecurityMonitoringRuleAnomalyDetectionOptionsBucketDuration,), |
| 49 | + "detection_tolerance": (SecurityMonitoringRuleAnomalyDetectionOptionsDetectionTolerance,), |
| 50 | + "learning_duration": (SecurityMonitoringRuleAnomalyDetectionOptionsLearningDuration,), |
| 51 | + "learning_period_baseline": (int,), |
| 52 | + } |
| 53 | + |
| 54 | + attribute_map = { |
| 55 | + "bucket_duration": "bucketDuration", |
| 56 | + "detection_tolerance": "detectionTolerance", |
| 57 | + "learning_duration": "learningDuration", |
| 58 | + "learning_period_baseline": "learningPeriodBaseline", |
| 59 | + } |
| 60 | + |
| 61 | + def __init__( |
| 62 | + self_, |
| 63 | + bucket_duration: Union[SecurityMonitoringRuleAnomalyDetectionOptionsBucketDuration, UnsetType] = unset, |
| 64 | + detection_tolerance: Union[SecurityMonitoringRuleAnomalyDetectionOptionsDetectionTolerance, UnsetType] = unset, |
| 65 | + learning_duration: Union[SecurityMonitoringRuleAnomalyDetectionOptionsLearningDuration, UnsetType] = unset, |
| 66 | + learning_period_baseline: Union[int, UnsetType] = unset, |
| 67 | + **kwargs, |
| 68 | + ): |
| 69 | + """ |
| 70 | + Options on anomaly detection method. |
| 71 | +
|
| 72 | + :param bucket_duration: Duration in seconds of the time buckets used to aggregate events matched by the rule. |
| 73 | + Must be greater than or equal to 300. |
| 74 | + :type bucket_duration: SecurityMonitoringRuleAnomalyDetectionOptionsBucketDuration, optional |
| 75 | +
|
| 76 | + :param detection_tolerance: An optional parameter that sets how permissive anomaly detection is. |
| 77 | + Higher values require higher deviations before triggering a signal. |
| 78 | + :type detection_tolerance: SecurityMonitoringRuleAnomalyDetectionOptionsDetectionTolerance, optional |
| 79 | +
|
| 80 | + :param learning_duration: Learning duration in hours. Anomaly detection waits for at least this amount of historical data before it starts evaluating. |
| 81 | + :type learning_duration: SecurityMonitoringRuleAnomalyDetectionOptionsLearningDuration, optional |
| 82 | +
|
| 83 | + :param learning_period_baseline: An optional override baseline to apply while the rule is in the learning period. Must be greater than or equal to 0. |
| 84 | + :type learning_period_baseline: int, optional |
| 85 | + """ |
| 86 | + if bucket_duration is not unset: |
| 87 | + kwargs["bucket_duration"] = bucket_duration |
| 88 | + if detection_tolerance is not unset: |
| 89 | + kwargs["detection_tolerance"] = detection_tolerance |
| 90 | + if learning_duration is not unset: |
| 91 | + kwargs["learning_duration"] = learning_duration |
| 92 | + if learning_period_baseline is not unset: |
| 93 | + kwargs["learning_period_baseline"] = learning_period_baseline |
| 94 | + super().__init__(kwargs) |
0 commit comments