From b42d413485b9e03176a2830f106a5028ad1718e3 Mon Sep 17 00:00:00 2001 From: "api-clients-generation-pipeline[bot]" <54105614+api-clients-generation-pipeline[bot]@users.noreply.github.com> Date: Mon, 20 Jun 2022 08:46:14 +0000 Subject: [PATCH] Regenerate client from commit 17f09b79 of spec repo (#1537) Co-authored-by: ci.datadog-api-spec Co-authored-by: api-clients-generation-pipeline[bot] <54105614+api-clients-generation-pipeline[bot]@users.noreply.github.com> --- .apigentools-info | 8 +- .generator/schemas/v2/openapi.yaml | 28 +++++ ...urity_monitoring_rule_new_value_options.go | 110 +++++++++++++++++- ..._rule_new_value_options_learning_method.go | 109 +++++++++++++++++ ...le_new_value_options_learning_threshold.go | 109 +++++++++++++++++ .../UpdateSecurityMonitoringRule.go | 6 +- .../features/v2/security_monitoring.feature | 6 +- 7 files changed, 365 insertions(+), 11 deletions(-) create mode 100644 api/v2/datadog/model_security_monitoring_rule_new_value_options_learning_method.go create mode 100644 api/v2/datadog/model_security_monitoring_rule_new_value_options_learning_threshold.go diff --git a/.apigentools-info b/.apigentools-info index 92bd66f8f5f..c016f288d3c 100644 --- a/.apigentools-info +++ b/.apigentools-info @@ -4,13 +4,13 @@ "spec_versions": { "v1": { "apigentools_version": "1.6.2", - "regenerated": "2022-06-17 19:27:08.019214", - "spec_repo_commit": "ba61a429" + "regenerated": "2022-06-20 06:54:31.141550", + "spec_repo_commit": "17f09b79" }, "v2": { "apigentools_version": "1.6.2", - "regenerated": "2022-06-17 19:27:08.034297", - "spec_repo_commit": "ba61a429" + "regenerated": "2022-06-20 06:54:31.154165", + "spec_repo_commit": "17f09b79" } } } \ No newline at end of file diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index fc9fcf40d06..21c9a345492 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -6469,6 +6469,10 @@ components: $ref: '#/components/schemas/SecurityMonitoringRuleNewValueOptionsForgetAfter' learningDuration: $ref: '#/components/schemas/SecurityMonitoringRuleNewValueOptionsLearningDuration' + learningMethod: + $ref: '#/components/schemas/SecurityMonitoringRuleNewValueOptionsLearningMethod' + learningThreshold: + $ref: '#/components/schemas/SecurityMonitoringRuleNewValueOptionsLearningThreshold' type: object SecurityMonitoringRuleNewValueOptionsForgetAfter: description: The duration in days after which a learned value is forgotten. @@ -6489,6 +6493,7 @@ components: - THREE_WEEKS - FOUR_WEEKS SecurityMonitoringRuleNewValueOptionsLearningDuration: + default: 0 description: 'The duration in days during which values are learned, and after which signals will be generated for values that @@ -6504,6 +6509,29 @@ components: - ZERO_DAYS - ONE_DAY - SEVEN_DAYS + SecurityMonitoringRuleNewValueOptionsLearningMethod: + default: duration + description: The learning method used to determine when signals should be generated + for values that weren't learned. + enum: + - duration + - threshold + type: string + x-enum-varnames: + - DURATION + - THRESHOLD + SecurityMonitoringRuleNewValueOptionsLearningThreshold: + default: 0 + description: A number of occurrences after which signals will be generated for + values that weren't learned. + enum: + - 0 + - 1 + format: int32 + type: integer + x-enum-varnames: + - ZERO_OCCURRENCES + - ONE_OCCURRENCE SecurityMonitoringRuleOptions: description: Options on rules. properties: diff --git a/api/v2/datadog/model_security_monitoring_rule_new_value_options.go b/api/v2/datadog/model_security_monitoring_rule_new_value_options.go index 38c906ceb02..57a0bd55702 100644 --- a/api/v2/datadog/model_security_monitoring_rule_new_value_options.go +++ b/api/v2/datadog/model_security_monitoring_rule_new_value_options.go @@ -15,6 +15,10 @@ type SecurityMonitoringRuleNewValueOptions struct { // The duration in days during which values are learned, and after which signals will be generated for values that // weren't learned. If set to 0, a signal will be generated for all new values after the first value is learned. LearningDuration *SecurityMonitoringRuleNewValueOptionsLearningDuration `json:"learningDuration,omitempty"` + // The learning method used to determine when signals should be generated for values that weren't learned. + LearningMethod *SecurityMonitoringRuleNewValueOptionsLearningMethod `json:"learningMethod,omitempty"` + // A number of occurrences after which signals will be generated for values that weren't learned. + LearningThreshold *SecurityMonitoringRuleNewValueOptionsLearningThreshold `json:"learningThreshold,omitempty"` // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct UnparsedObject map[string]interface{} `json:-` AdditionalProperties map[string]interface{} @@ -26,6 +30,12 @@ type SecurityMonitoringRuleNewValueOptions struct { // will change when the set of required properties is changed. func NewSecurityMonitoringRuleNewValueOptions() *SecurityMonitoringRuleNewValueOptions { this := SecurityMonitoringRuleNewValueOptions{} + var learningDuration SecurityMonitoringRuleNewValueOptionsLearningDuration = SECURITYMONITORINGRULENEWVALUEOPTIONSLEARNINGDURATION_ZERO_DAYS + this.LearningDuration = &learningDuration + var learningMethod SecurityMonitoringRuleNewValueOptionsLearningMethod = SECURITYMONITORINGRULENEWVALUEOPTIONSLEARNINGMETHOD_DURATION + this.LearningMethod = &learningMethod + var learningThreshold SecurityMonitoringRuleNewValueOptionsLearningThreshold = SECURITYMONITORINGRULENEWVALUEOPTIONSLEARNINGTHRESHOLD_ZERO_OCCURRENCES + this.LearningThreshold = &learningThreshold return &this } @@ -34,6 +44,12 @@ func NewSecurityMonitoringRuleNewValueOptions() *SecurityMonitoringRuleNewValueO // but it doesn't guarantee that properties required by API are set. func NewSecurityMonitoringRuleNewValueOptionsWithDefaults() *SecurityMonitoringRuleNewValueOptions { this := SecurityMonitoringRuleNewValueOptions{} + var learningDuration SecurityMonitoringRuleNewValueOptionsLearningDuration = SECURITYMONITORINGRULENEWVALUEOPTIONSLEARNINGDURATION_ZERO_DAYS + this.LearningDuration = &learningDuration + var learningMethod SecurityMonitoringRuleNewValueOptionsLearningMethod = SECURITYMONITORINGRULENEWVALUEOPTIONSLEARNINGMETHOD_DURATION + this.LearningMethod = &learningMethod + var learningThreshold SecurityMonitoringRuleNewValueOptionsLearningThreshold = SECURITYMONITORINGRULENEWVALUEOPTIONSLEARNINGTHRESHOLD_ZERO_OCCURRENCES + this.LearningThreshold = &learningThreshold return &this } @@ -101,6 +117,70 @@ func (o *SecurityMonitoringRuleNewValueOptions) SetLearningDuration(v SecurityMo o.LearningDuration = &v } +// GetLearningMethod returns the LearningMethod field value if set, zero value otherwise. +func (o *SecurityMonitoringRuleNewValueOptions) GetLearningMethod() SecurityMonitoringRuleNewValueOptionsLearningMethod { + if o == nil || o.LearningMethod == nil { + var ret SecurityMonitoringRuleNewValueOptionsLearningMethod + return ret + } + return *o.LearningMethod +} + +// GetLearningMethodOk returns a tuple with the LearningMethod field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringRuleNewValueOptions) GetLearningMethodOk() (*SecurityMonitoringRuleNewValueOptionsLearningMethod, bool) { + if o == nil || o.LearningMethod == nil { + return nil, false + } + return o.LearningMethod, true +} + +// HasLearningMethod returns a boolean if a field has been set. +func (o *SecurityMonitoringRuleNewValueOptions) HasLearningMethod() bool { + if o != nil && o.LearningMethod != nil { + return true + } + + return false +} + +// SetLearningMethod gets a reference to the given SecurityMonitoringRuleNewValueOptionsLearningMethod and assigns it to the LearningMethod field. +func (o *SecurityMonitoringRuleNewValueOptions) SetLearningMethod(v SecurityMonitoringRuleNewValueOptionsLearningMethod) { + o.LearningMethod = &v +} + +// GetLearningThreshold returns the LearningThreshold field value if set, zero value otherwise. +func (o *SecurityMonitoringRuleNewValueOptions) GetLearningThreshold() SecurityMonitoringRuleNewValueOptionsLearningThreshold { + if o == nil || o.LearningThreshold == nil { + var ret SecurityMonitoringRuleNewValueOptionsLearningThreshold + return ret + } + return *o.LearningThreshold +} + +// GetLearningThresholdOk returns a tuple with the LearningThreshold field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringRuleNewValueOptions) GetLearningThresholdOk() (*SecurityMonitoringRuleNewValueOptionsLearningThreshold, bool) { + if o == nil || o.LearningThreshold == nil { + return nil, false + } + return o.LearningThreshold, true +} + +// HasLearningThreshold returns a boolean if a field has been set. +func (o *SecurityMonitoringRuleNewValueOptions) HasLearningThreshold() bool { + if o != nil && o.LearningThreshold != nil { + return true + } + + return false +} + +// SetLearningThreshold gets a reference to the given SecurityMonitoringRuleNewValueOptionsLearningThreshold and assigns it to the LearningThreshold field. +func (o *SecurityMonitoringRuleNewValueOptions) SetLearningThreshold(v SecurityMonitoringRuleNewValueOptionsLearningThreshold) { + o.LearningThreshold = &v +} + // MarshalJSON serializes the struct using spec logic. func (o SecurityMonitoringRuleNewValueOptions) MarshalJSON() ([]byte, error) { toSerialize := map[string]interface{}{} @@ -113,6 +193,12 @@ func (o SecurityMonitoringRuleNewValueOptions) MarshalJSON() ([]byte, error) { if o.LearningDuration != nil { toSerialize["learningDuration"] = o.LearningDuration } + if o.LearningMethod != nil { + toSerialize["learningMethod"] = o.LearningMethod + } + if o.LearningThreshold != nil { + toSerialize["learningThreshold"] = o.LearningThreshold + } for key, value := range o.AdditionalProperties { toSerialize[key] = value @@ -124,8 +210,10 @@ func (o SecurityMonitoringRuleNewValueOptions) MarshalJSON() ([]byte, error) { func (o *SecurityMonitoringRuleNewValueOptions) UnmarshalJSON(bytes []byte) (err error) { raw := map[string]interface{}{} all := struct { - ForgetAfter *SecurityMonitoringRuleNewValueOptionsForgetAfter `json:"forgetAfter,omitempty"` - LearningDuration *SecurityMonitoringRuleNewValueOptionsLearningDuration `json:"learningDuration,omitempty"` + ForgetAfter *SecurityMonitoringRuleNewValueOptionsForgetAfter `json:"forgetAfter,omitempty"` + LearningDuration *SecurityMonitoringRuleNewValueOptionsLearningDuration `json:"learningDuration,omitempty"` + LearningMethod *SecurityMonitoringRuleNewValueOptionsLearningMethod `json:"learningMethod,omitempty"` + LearningThreshold *SecurityMonitoringRuleNewValueOptionsLearningThreshold `json:"learningThreshold,omitempty"` }{} err = json.Unmarshal(bytes, &all) if err != nil { @@ -152,7 +240,25 @@ func (o *SecurityMonitoringRuleNewValueOptions) UnmarshalJSON(bytes []byte) (err o.UnparsedObject = raw return nil } + if v := all.LearningMethod; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if v := all.LearningThreshold; v != nil && !v.IsValid() { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } o.ForgetAfter = all.ForgetAfter o.LearningDuration = all.LearningDuration + o.LearningMethod = all.LearningMethod + o.LearningThreshold = all.LearningThreshold return nil } diff --git a/api/v2/datadog/model_security_monitoring_rule_new_value_options_learning_method.go b/api/v2/datadog/model_security_monitoring_rule_new_value_options_learning_method.go new file mode 100644 index 00000000000..74a73006307 --- /dev/null +++ b/api/v2/datadog/model_security_monitoring_rule_new_value_options_learning_method.go @@ -0,0 +1,109 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadog + +import ( + "encoding/json" + "fmt" +) + +// SecurityMonitoringRuleNewValueOptionsLearningMethod The learning method used to determine when signals should be generated for values that weren't learned. +type SecurityMonitoringRuleNewValueOptionsLearningMethod string + +// List of SecurityMonitoringRuleNewValueOptionsLearningMethod. +const ( + SECURITYMONITORINGRULENEWVALUEOPTIONSLEARNINGMETHOD_DURATION SecurityMonitoringRuleNewValueOptionsLearningMethod = "duration" + SECURITYMONITORINGRULENEWVALUEOPTIONSLEARNINGMETHOD_THRESHOLD SecurityMonitoringRuleNewValueOptionsLearningMethod = "threshold" +) + +var allowedSecurityMonitoringRuleNewValueOptionsLearningMethodEnumValues = []SecurityMonitoringRuleNewValueOptionsLearningMethod{ + SECURITYMONITORINGRULENEWVALUEOPTIONSLEARNINGMETHOD_DURATION, + SECURITYMONITORINGRULENEWVALUEOPTIONSLEARNINGMETHOD_THRESHOLD, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *SecurityMonitoringRuleNewValueOptionsLearningMethod) GetAllowedValues() []SecurityMonitoringRuleNewValueOptionsLearningMethod { + return allowedSecurityMonitoringRuleNewValueOptionsLearningMethodEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *SecurityMonitoringRuleNewValueOptionsLearningMethod) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = SecurityMonitoringRuleNewValueOptionsLearningMethod(value) + return nil +} + +// NewSecurityMonitoringRuleNewValueOptionsLearningMethodFromValue returns a pointer to a valid SecurityMonitoringRuleNewValueOptionsLearningMethod +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewSecurityMonitoringRuleNewValueOptionsLearningMethodFromValue(v string) (*SecurityMonitoringRuleNewValueOptionsLearningMethod, error) { + ev := SecurityMonitoringRuleNewValueOptionsLearningMethod(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for SecurityMonitoringRuleNewValueOptionsLearningMethod: valid values are %v", v, allowedSecurityMonitoringRuleNewValueOptionsLearningMethodEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v SecurityMonitoringRuleNewValueOptionsLearningMethod) IsValid() bool { + for _, existing := range allowedSecurityMonitoringRuleNewValueOptionsLearningMethodEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to SecurityMonitoringRuleNewValueOptionsLearningMethod value. +func (v SecurityMonitoringRuleNewValueOptionsLearningMethod) Ptr() *SecurityMonitoringRuleNewValueOptionsLearningMethod { + return &v +} + +// NullableSecurityMonitoringRuleNewValueOptionsLearningMethod handles when a null is used for SecurityMonitoringRuleNewValueOptionsLearningMethod. +type NullableSecurityMonitoringRuleNewValueOptionsLearningMethod struct { + value *SecurityMonitoringRuleNewValueOptionsLearningMethod + isSet bool +} + +// Get returns the associated value. +func (v NullableSecurityMonitoringRuleNewValueOptionsLearningMethod) Get() *SecurityMonitoringRuleNewValueOptionsLearningMethod { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableSecurityMonitoringRuleNewValueOptionsLearningMethod) Set(val *SecurityMonitoringRuleNewValueOptionsLearningMethod) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableSecurityMonitoringRuleNewValueOptionsLearningMethod) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableSecurityMonitoringRuleNewValueOptionsLearningMethod) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableSecurityMonitoringRuleNewValueOptionsLearningMethod initializes the struct as if Set has been called. +func NewNullableSecurityMonitoringRuleNewValueOptionsLearningMethod(val *SecurityMonitoringRuleNewValueOptionsLearningMethod) *NullableSecurityMonitoringRuleNewValueOptionsLearningMethod { + return &NullableSecurityMonitoringRuleNewValueOptionsLearningMethod{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableSecurityMonitoringRuleNewValueOptionsLearningMethod) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableSecurityMonitoringRuleNewValueOptionsLearningMethod) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/api/v2/datadog/model_security_monitoring_rule_new_value_options_learning_threshold.go b/api/v2/datadog/model_security_monitoring_rule_new_value_options_learning_threshold.go new file mode 100644 index 00000000000..9eac735356d --- /dev/null +++ b/api/v2/datadog/model_security_monitoring_rule_new_value_options_learning_threshold.go @@ -0,0 +1,109 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadog + +import ( + "encoding/json" + "fmt" +) + +// SecurityMonitoringRuleNewValueOptionsLearningThreshold A number of occurrences after which signals will be generated for values that weren't learned. +type SecurityMonitoringRuleNewValueOptionsLearningThreshold int32 + +// List of SecurityMonitoringRuleNewValueOptionsLearningThreshold. +const ( + SECURITYMONITORINGRULENEWVALUEOPTIONSLEARNINGTHRESHOLD_ZERO_OCCURRENCES SecurityMonitoringRuleNewValueOptionsLearningThreshold = 0 + SECURITYMONITORINGRULENEWVALUEOPTIONSLEARNINGTHRESHOLD_ONE_OCCURRENCE SecurityMonitoringRuleNewValueOptionsLearningThreshold = 1 +) + +var allowedSecurityMonitoringRuleNewValueOptionsLearningThresholdEnumValues = []SecurityMonitoringRuleNewValueOptionsLearningThreshold{ + SECURITYMONITORINGRULENEWVALUEOPTIONSLEARNINGTHRESHOLD_ZERO_OCCURRENCES, + SECURITYMONITORINGRULENEWVALUEOPTIONSLEARNINGTHRESHOLD_ONE_OCCURRENCE, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *SecurityMonitoringRuleNewValueOptionsLearningThreshold) GetAllowedValues() []SecurityMonitoringRuleNewValueOptionsLearningThreshold { + return allowedSecurityMonitoringRuleNewValueOptionsLearningThresholdEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *SecurityMonitoringRuleNewValueOptionsLearningThreshold) UnmarshalJSON(src []byte) error { + var value int32 + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + *v = SecurityMonitoringRuleNewValueOptionsLearningThreshold(value) + return nil +} + +// NewSecurityMonitoringRuleNewValueOptionsLearningThresholdFromValue returns a pointer to a valid SecurityMonitoringRuleNewValueOptionsLearningThreshold +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewSecurityMonitoringRuleNewValueOptionsLearningThresholdFromValue(v int32) (*SecurityMonitoringRuleNewValueOptionsLearningThreshold, error) { + ev := SecurityMonitoringRuleNewValueOptionsLearningThreshold(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for SecurityMonitoringRuleNewValueOptionsLearningThreshold: valid values are %v", v, allowedSecurityMonitoringRuleNewValueOptionsLearningThresholdEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v SecurityMonitoringRuleNewValueOptionsLearningThreshold) IsValid() bool { + for _, existing := range allowedSecurityMonitoringRuleNewValueOptionsLearningThresholdEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to SecurityMonitoringRuleNewValueOptionsLearningThreshold value. +func (v SecurityMonitoringRuleNewValueOptionsLearningThreshold) Ptr() *SecurityMonitoringRuleNewValueOptionsLearningThreshold { + return &v +} + +// NullableSecurityMonitoringRuleNewValueOptionsLearningThreshold handles when a null is used for SecurityMonitoringRuleNewValueOptionsLearningThreshold. +type NullableSecurityMonitoringRuleNewValueOptionsLearningThreshold struct { + value *SecurityMonitoringRuleNewValueOptionsLearningThreshold + isSet bool +} + +// Get returns the associated value. +func (v NullableSecurityMonitoringRuleNewValueOptionsLearningThreshold) Get() *SecurityMonitoringRuleNewValueOptionsLearningThreshold { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableSecurityMonitoringRuleNewValueOptionsLearningThreshold) Set(val *SecurityMonitoringRuleNewValueOptionsLearningThreshold) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableSecurityMonitoringRuleNewValueOptionsLearningThreshold) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag. +func (v *NullableSecurityMonitoringRuleNewValueOptionsLearningThreshold) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableSecurityMonitoringRuleNewValueOptionsLearningThreshold initializes the struct as if Set has been called. +func NewNullableSecurityMonitoringRuleNewValueOptionsLearningThreshold(val *SecurityMonitoringRuleNewValueOptionsLearningThreshold) *NullableSecurityMonitoringRuleNewValueOptionsLearningThreshold { + return &NullableSecurityMonitoringRuleNewValueOptionsLearningThreshold{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableSecurityMonitoringRuleNewValueOptionsLearningThreshold) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableSecurityMonitoringRuleNewValueOptionsLearningThreshold) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/examples/v2/security-monitoring/UpdateSecurityMonitoringRule.go b/examples/v2/security-monitoring/UpdateSecurityMonitoringRule.go index 1dbca846fa4..88c48040683 100644 --- a/examples/v2/security-monitoring/UpdateSecurityMonitoringRule.go +++ b/examples/v2/security-monitoring/UpdateSecurityMonitoringRule.go @@ -35,8 +35,10 @@ func main() { KeepAlive: datadog.SECURITYMONITORINGRULEKEEPALIVE_ZERO_MINUTES.Ptr(), MaxSignalDuration: datadog.SECURITYMONITORINGRULEMAXSIGNALDURATION_ZERO_MINUTES.Ptr(), NewValueOptions: &datadog.SecurityMonitoringRuleNewValueOptions{ - ForgetAfter: datadog.SECURITYMONITORINGRULENEWVALUEOPTIONSFORGETAFTER_ONE_DAY.Ptr(), - LearningDuration: datadog.SECURITYMONITORINGRULENEWVALUEOPTIONSLEARNINGDURATION_ZERO_DAYS.Ptr(), + ForgetAfter: datadog.SECURITYMONITORINGRULENEWVALUEOPTIONSFORGETAFTER_ONE_DAY.Ptr(), + LearningDuration: datadog.SECURITYMONITORINGRULENEWVALUEOPTIONSLEARNINGDURATION_ZERO_DAYS.Ptr(), + LearningMethod: datadog.SECURITYMONITORINGRULENEWVALUEOPTIONSLEARNINGMETHOD_DURATION.Ptr(), + LearningThreshold: datadog.SECURITYMONITORINGRULENEWVALUEOPTIONSLEARNINGTHRESHOLD_ZERO_OCCURRENCES.Ptr(), }, }, Queries: []datadog.SecurityMonitoringRuleQuery{ diff --git a/tests/scenarios/features/v2/security_monitoring.feature b/tests/scenarios/features/v2/security_monitoring.feature index 32a2190932b..bb02cc0cac8 100644 --- a/tests/scenarios/features/v2/security_monitoring.feature +++ b/tests/scenarios/features/v2/security_monitoring.feature @@ -226,7 +226,7 @@ Feature: Security Monitoring Scenario: Update an existing rule returns "Bad Request" response Given new "UpdateSecurityMonitoringRule" request And request contains "rule_id" parameter from "REPLACE.ME" - And body with value {"cases": [{"notifications": [], "status": "critical"}], "filters": [{"action": "require"}], "hasExtendedTitle": true, "options": {"detectionMethod": "threshold", "evaluationWindow": 0, "hardcodedEvaluatorType": "log4shell", "impossibleTravelOptions": {"baselineUserLocations": true}, "keepAlive": 0, "maxSignalDuration": 0, "newValueOptions": {"forgetAfter": 1, "learningDuration": 0}}, "queries": [{"aggregation": "count", "distinctFields": [], "groupByFields": []}], "tags": [], "version": 1} + And body with value {"cases": [{"notifications": [], "status": "critical"}], "filters": [{"action": "require"}], "hasExtendedTitle": true, "options": {"detectionMethod": "threshold", "evaluationWindow": 0, "hardcodedEvaluatorType": "log4shell", "impossibleTravelOptions": {"baselineUserLocations": true}, "keepAlive": 0, "maxSignalDuration": 0, "newValueOptions": {"forgetAfter": 1, "learningDuration": 0, "learningMethod": "duration", "learningThreshold": 0}}, "queries": [{"aggregation": "count", "distinctFields": [], "groupByFields": []}], "tags": [], "version": 1} When the request is sent Then the response status is 400 Bad Request @@ -234,7 +234,7 @@ Feature: Security Monitoring Scenario: Update an existing rule returns "Not Found" response Given new "UpdateSecurityMonitoringRule" request And request contains "rule_id" parameter from "REPLACE.ME" - And body with value {"cases": [{"notifications": [], "status": "critical"}], "filters": [{"action": "require"}], "hasExtendedTitle": true, "options": {"detectionMethod": "threshold", "evaluationWindow": 0, "hardcodedEvaluatorType": "log4shell", "impossibleTravelOptions": {"baselineUserLocations": true}, "keepAlive": 0, "maxSignalDuration": 0, "newValueOptions": {"forgetAfter": 1, "learningDuration": 0}}, "queries": [{"aggregation": "count", "distinctFields": [], "groupByFields": []}], "tags": [], "version": 1} + And body with value {"cases": [{"notifications": [], "status": "critical"}], "filters": [{"action": "require"}], "hasExtendedTitle": true, "options": {"detectionMethod": "threshold", "evaluationWindow": 0, "hardcodedEvaluatorType": "log4shell", "impossibleTravelOptions": {"baselineUserLocations": true}, "keepAlive": 0, "maxSignalDuration": 0, "newValueOptions": {"forgetAfter": 1, "learningDuration": 0, "learningMethod": "duration", "learningThreshold": 0}}, "queries": [{"aggregation": "count", "distinctFields": [], "groupByFields": []}], "tags": [], "version": 1} When the request is sent Then the response status is 404 Not Found @@ -242,6 +242,6 @@ Feature: Security Monitoring Scenario: Update an existing rule returns "OK" response Given new "UpdateSecurityMonitoringRule" request And request contains "rule_id" parameter from "REPLACE.ME" - And body with value {"cases": [{"notifications": [], "status": "critical"}], "filters": [{"action": "require"}], "hasExtendedTitle": true, "options": {"detectionMethod": "threshold", "evaluationWindow": 0, "hardcodedEvaluatorType": "log4shell", "impossibleTravelOptions": {"baselineUserLocations": true}, "keepAlive": 0, "maxSignalDuration": 0, "newValueOptions": {"forgetAfter": 1, "learningDuration": 0}}, "queries": [{"aggregation": "count", "distinctFields": [], "groupByFields": []}], "tags": [], "version": 1} + And body with value {"cases": [{"notifications": [], "status": "critical"}], "filters": [{"action": "require"}], "hasExtendedTitle": true, "options": {"detectionMethod": "threshold", "evaluationWindow": 0, "hardcodedEvaluatorType": "log4shell", "impossibleTravelOptions": {"baselineUserLocations": true}, "keepAlive": 0, "maxSignalDuration": 0, "newValueOptions": {"forgetAfter": 1, "learningDuration": 0, "learningMethod": "duration", "learningThreshold": 0}}, "queries": [{"aggregation": "count", "distinctFields": [], "groupByFields": []}], "tags": [], "version": 1} When the request is sent Then the response status is 200 OK