diff --git a/.apigentools-info b/.apigentools-info index 0bf2ff11c35..00ba8bf5864 100644 --- a/.apigentools-info +++ b/.apigentools-info @@ -4,13 +4,13 @@ "spec_versions": { "v1": { "apigentools_version": "1.6.6", - "regenerated": "2024-11-27 13:09:00.363837", - "spec_repo_commit": "fd3dd4d0" + "regenerated": "2024-11-27 15:55:01.934031", + "spec_repo_commit": "608b015f" }, "v2": { "apigentools_version": "1.6.6", - "regenerated": "2024-11-27 13:09:00.383880", - "spec_repo_commit": "fd3dd4d0" + "regenerated": "2024-11-27 15:55:01.953702", + "spec_repo_commit": "608b015f" } } } \ No newline at end of file diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index dbd569affab..03de56c9795 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -22794,6 +22794,12 @@ components: as the search bar for detection rules. example: type:log_detection source:cloudtrail type: string + start_date: + description: A Unix millisecond timestamp giving a start date for the suppression + rule. After this date, it will start suppressing signals. + example: 1703187336000 + format: int64 + type: integer suppression_query: description: The suppression query of the suppression rule. If a signal matches this query, it is suppressed and not triggered. Same syntax as @@ -22849,6 +22855,12 @@ components: as the search bar for detection rules. example: type:log_detection source:cloudtrail type: string + start_date: + description: A Unix millisecond timestamp giving a start date for the suppression + rule. After this date, it will start suppressing signals. + example: 1703187336000 + format: int64 + type: integer suppression_query: description: The suppression query of the suppression rule. If a signal matches this query, it is suppressed and is not triggered. It uses the @@ -22935,6 +22947,15 @@ components: as the search bar for detection rules. example: type:log_detection source:cloudtrail type: string + start_date: + description: A Unix millisecond timestamp giving a start date for the suppression + rule. After this date, it will start suppressing signals. If unset, the + start date of the suppression rule is left untouched. If set to `null`, + the start date is removed. + example: 1703187336000 + format: int64 + nullable: true + type: integer suppression_query: description: The suppression query of the suppression rule. If a signal matches this query, it is suppressed and not triggered. Same syntax as diff --git a/api/datadogV2/model_security_monitoring_suppression_attributes.go b/api/datadogV2/model_security_monitoring_suppression_attributes.go index fac4b5b4109..1f8320e65f7 100644 --- a/api/datadogV2/model_security_monitoring_suppression_attributes.go +++ b/api/datadogV2/model_security_monitoring_suppression_attributes.go @@ -28,6 +28,8 @@ type SecurityMonitoringSuppressionAttributes struct { Name *string `json:"name,omitempty"` // The rule query of the suppression rule, with the same syntax as the search bar for detection rules. RuleQuery *string `json:"rule_query,omitempty"` + // A Unix millisecond timestamp giving a start date for the suppression rule. After this date, it will start suppressing signals. + StartDate *int64 `json:"start_date,omitempty"` // The suppression query of the suppression rule. If a signal matches this query, it is suppressed and not triggered. Same syntax as the queries to search signals in the signal explorer. SuppressionQuery *string `json:"suppression_query,omitempty"` // A Unix millisecond timestamp given the update date of the suppression rule. @@ -310,6 +312,34 @@ func (o *SecurityMonitoringSuppressionAttributes) SetRuleQuery(v string) { o.RuleQuery = &v } +// GetStartDate returns the StartDate field value if set, zero value otherwise. +func (o *SecurityMonitoringSuppressionAttributes) GetStartDate() int64 { + if o == nil || o.StartDate == nil { + var ret int64 + return ret + } + return *o.StartDate +} + +// GetStartDateOk returns a tuple with the StartDate field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringSuppressionAttributes) GetStartDateOk() (*int64, bool) { + if o == nil || o.StartDate == nil { + return nil, false + } + return o.StartDate, true +} + +// HasStartDate returns a boolean if a field has been set. +func (o *SecurityMonitoringSuppressionAttributes) HasStartDate() bool { + return o != nil && o.StartDate != nil +} + +// SetStartDate gets a reference to the given int64 and assigns it to the StartDate field. +func (o *SecurityMonitoringSuppressionAttributes) SetStartDate(v int64) { + o.StartDate = &v +} + // GetSuppressionQuery returns the SuppressionQuery field value if set, zero value otherwise. func (o *SecurityMonitoringSuppressionAttributes) GetSuppressionQuery() string { if o == nil || o.SuppressionQuery == nil { @@ -455,6 +485,9 @@ func (o SecurityMonitoringSuppressionAttributes) MarshalJSON() ([]byte, error) { if o.RuleQuery != nil { toSerialize["rule_query"] = o.RuleQuery } + if o.StartDate != nil { + toSerialize["start_date"] = o.StartDate + } if o.SuppressionQuery != nil { toSerialize["suppression_query"] = o.SuppressionQuery } @@ -486,6 +519,7 @@ func (o *SecurityMonitoringSuppressionAttributes) UnmarshalJSON(bytes []byte) (e ExpirationDate *int64 `json:"expiration_date,omitempty"` Name *string `json:"name,omitempty"` RuleQuery *string `json:"rule_query,omitempty"` + StartDate *int64 `json:"start_date,omitempty"` SuppressionQuery *string `json:"suppression_query,omitempty"` UpdateDate *int64 `json:"update_date,omitempty"` Updater *SecurityMonitoringUser `json:"updater,omitempty"` @@ -496,7 +530,7 @@ func (o *SecurityMonitoringSuppressionAttributes) UnmarshalJSON(bytes []byte) (e } additionalProperties := make(map[string]interface{}) if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { - datadog.DeleteKeys(additionalProperties, &[]string{"creation_date", "creator", "data_exclusion_query", "description", "editable", "enabled", "expiration_date", "name", "rule_query", "suppression_query", "update_date", "updater", "version"}) + datadog.DeleteKeys(additionalProperties, &[]string{"creation_date", "creator", "data_exclusion_query", "description", "editable", "enabled", "expiration_date", "name", "rule_query", "start_date", "suppression_query", "update_date", "updater", "version"}) } else { return err } @@ -514,6 +548,7 @@ func (o *SecurityMonitoringSuppressionAttributes) UnmarshalJSON(bytes []byte) (e o.ExpirationDate = all.ExpirationDate o.Name = all.Name o.RuleQuery = all.RuleQuery + o.StartDate = all.StartDate o.SuppressionQuery = all.SuppressionQuery o.UpdateDate = all.UpdateDate if all.Updater != nil && all.Updater.UnparsedObject != nil && o.UnparsedObject == nil { diff --git a/api/datadogV2/model_security_monitoring_suppression_create_attributes.go b/api/datadogV2/model_security_monitoring_suppression_create_attributes.go index b1ef667cfdc..74cb828ff3a 100644 --- a/api/datadogV2/model_security_monitoring_suppression_create_attributes.go +++ b/api/datadogV2/model_security_monitoring_suppression_create_attributes.go @@ -24,6 +24,8 @@ type SecurityMonitoringSuppressionCreateAttributes struct { Name string `json:"name"` // The rule query of the suppression rule, with the same syntax as the search bar for detection rules. RuleQuery string `json:"rule_query"` + // A Unix millisecond timestamp giving a start date for the suppression rule. After this date, it will start suppressing signals. + StartDate *int64 `json:"start_date,omitempty"` // The suppression query of the suppression rule. If a signal matches this query, it is suppressed and is not triggered. It uses the same syntax as the queries to search signals in the Signals Explorer. SuppressionQuery *string `json:"suppression_query,omitempty"` // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct @@ -204,6 +206,34 @@ func (o *SecurityMonitoringSuppressionCreateAttributes) SetRuleQuery(v string) { o.RuleQuery = v } +// GetStartDate returns the StartDate field value if set, zero value otherwise. +func (o *SecurityMonitoringSuppressionCreateAttributes) GetStartDate() int64 { + if o == nil || o.StartDate == nil { + var ret int64 + return ret + } + return *o.StartDate +} + +// GetStartDateOk returns a tuple with the StartDate field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringSuppressionCreateAttributes) GetStartDateOk() (*int64, bool) { + if o == nil || o.StartDate == nil { + return nil, false + } + return o.StartDate, true +} + +// HasStartDate returns a boolean if a field has been set. +func (o *SecurityMonitoringSuppressionCreateAttributes) HasStartDate() bool { + return o != nil && o.StartDate != nil +} + +// SetStartDate gets a reference to the given int64 and assigns it to the StartDate field. +func (o *SecurityMonitoringSuppressionCreateAttributes) SetStartDate(v int64) { + o.StartDate = &v +} + // GetSuppressionQuery returns the SuppressionQuery field value if set, zero value otherwise. func (o *SecurityMonitoringSuppressionCreateAttributes) GetSuppressionQuery() string { if o == nil || o.SuppressionQuery == nil { @@ -250,6 +280,9 @@ func (o SecurityMonitoringSuppressionCreateAttributes) MarshalJSON() ([]byte, er } toSerialize["name"] = o.Name toSerialize["rule_query"] = o.RuleQuery + if o.StartDate != nil { + toSerialize["start_date"] = o.StartDate + } if o.SuppressionQuery != nil { toSerialize["suppression_query"] = o.SuppressionQuery } @@ -269,6 +302,7 @@ func (o *SecurityMonitoringSuppressionCreateAttributes) UnmarshalJSON(bytes []by ExpirationDate *int64 `json:"expiration_date,omitempty"` Name *string `json:"name"` RuleQuery *string `json:"rule_query"` + StartDate *int64 `json:"start_date,omitempty"` SuppressionQuery *string `json:"suppression_query,omitempty"` }{} if err = datadog.Unmarshal(bytes, &all); err != nil { @@ -285,7 +319,7 @@ func (o *SecurityMonitoringSuppressionCreateAttributes) UnmarshalJSON(bytes []by } additionalProperties := make(map[string]interface{}) if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { - datadog.DeleteKeys(additionalProperties, &[]string{"data_exclusion_query", "description", "enabled", "expiration_date", "name", "rule_query", "suppression_query"}) + datadog.DeleteKeys(additionalProperties, &[]string{"data_exclusion_query", "description", "enabled", "expiration_date", "name", "rule_query", "start_date", "suppression_query"}) } else { return err } @@ -295,6 +329,7 @@ func (o *SecurityMonitoringSuppressionCreateAttributes) UnmarshalJSON(bytes []by o.ExpirationDate = all.ExpirationDate o.Name = *all.Name o.RuleQuery = *all.RuleQuery + o.StartDate = all.StartDate o.SuppressionQuery = all.SuppressionQuery if len(additionalProperties) > 0 { diff --git a/api/datadogV2/model_security_monitoring_suppression_update_attributes.go b/api/datadogV2/model_security_monitoring_suppression_update_attributes.go index dc771fd897b..8c1d9fbf1ea 100644 --- a/api/datadogV2/model_security_monitoring_suppression_update_attributes.go +++ b/api/datadogV2/model_security_monitoring_suppression_update_attributes.go @@ -22,6 +22,8 @@ type SecurityMonitoringSuppressionUpdateAttributes struct { Name *string `json:"name,omitempty"` // The rule query of the suppression rule, with the same syntax as the search bar for detection rules. RuleQuery *string `json:"rule_query,omitempty"` + // A Unix millisecond timestamp giving a start date for the suppression rule. After this date, it will start suppressing signals. If unset, the start date of the suppression rule is left untouched. If set to `null`, the start date is removed. + StartDate datadog.NullableInt64 `json:"start_date,omitempty"` // The suppression query of the suppression rule. If a signal matches this query, it is suppressed and not triggered. Same syntax as the queries to search signals in the signal explorer. SuppressionQuery *string `json:"suppression_query,omitempty"` // The current version of the suppression. This is optional, but it can help prevent concurrent modifications. @@ -227,6 +229,45 @@ func (o *SecurityMonitoringSuppressionUpdateAttributes) SetRuleQuery(v string) { o.RuleQuery = &v } +// GetStartDate returns the StartDate field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *SecurityMonitoringSuppressionUpdateAttributes) GetStartDate() int64 { + if o == nil || o.StartDate.Get() == nil { + var ret int64 + return ret + } + return *o.StartDate.Get() +} + +// GetStartDateOk returns a tuple with the StartDate field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned. +func (o *SecurityMonitoringSuppressionUpdateAttributes) GetStartDateOk() (*int64, bool) { + if o == nil { + return nil, false + } + return o.StartDate.Get(), o.StartDate.IsSet() +} + +// HasStartDate returns a boolean if a field has been set. +func (o *SecurityMonitoringSuppressionUpdateAttributes) HasStartDate() bool { + return o != nil && o.StartDate.IsSet() +} + +// SetStartDate gets a reference to the given datadog.NullableInt64 and assigns it to the StartDate field. +func (o *SecurityMonitoringSuppressionUpdateAttributes) SetStartDate(v int64) { + o.StartDate.Set(&v) +} + +// SetStartDateNil sets the value for StartDate to be an explicit nil. +func (o *SecurityMonitoringSuppressionUpdateAttributes) SetStartDateNil() { + o.StartDate.Set(nil) +} + +// UnsetStartDate ensures that no value is present for StartDate, not even an explicit nil. +func (o *SecurityMonitoringSuppressionUpdateAttributes) UnsetStartDate() { + o.StartDate.Unset() +} + // GetSuppressionQuery returns the SuppressionQuery field value if set, zero value otherwise. func (o *SecurityMonitoringSuppressionUpdateAttributes) GetSuppressionQuery() string { if o == nil || o.SuppressionQuery == nil { @@ -307,6 +348,9 @@ func (o SecurityMonitoringSuppressionUpdateAttributes) MarshalJSON() ([]byte, er if o.RuleQuery != nil { toSerialize["rule_query"] = o.RuleQuery } + if o.StartDate.IsSet() { + toSerialize["start_date"] = o.StartDate.Get() + } if o.SuppressionQuery != nil { toSerialize["suppression_query"] = o.SuppressionQuery } @@ -329,6 +373,7 @@ func (o *SecurityMonitoringSuppressionUpdateAttributes) UnmarshalJSON(bytes []by ExpirationDate datadog.NullableInt64 `json:"expiration_date,omitempty"` Name *string `json:"name,omitempty"` RuleQuery *string `json:"rule_query,omitempty"` + StartDate datadog.NullableInt64 `json:"start_date,omitempty"` SuppressionQuery *string `json:"suppression_query,omitempty"` Version *int32 `json:"version,omitempty"` }{} @@ -337,7 +382,7 @@ func (o *SecurityMonitoringSuppressionUpdateAttributes) UnmarshalJSON(bytes []by } additionalProperties := make(map[string]interface{}) if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { - datadog.DeleteKeys(additionalProperties, &[]string{"data_exclusion_query", "description", "enabled", "expiration_date", "name", "rule_query", "suppression_query", "version"}) + datadog.DeleteKeys(additionalProperties, &[]string{"data_exclusion_query", "description", "enabled", "expiration_date", "name", "rule_query", "start_date", "suppression_query", "version"}) } else { return err } @@ -347,6 +392,7 @@ func (o *SecurityMonitoringSuppressionUpdateAttributes) UnmarshalJSON(bytes []by o.ExpirationDate = all.ExpirationDate o.Name = all.Name o.RuleQuery = all.RuleQuery + o.StartDate = all.StartDate o.SuppressionQuery = all.SuppressionQuery o.Version = all.Version diff --git a/examples/v2/security-monitoring/CreateSecurityMonitoringSuppression.go b/examples/v2/security-monitoring/CreateSecurityMonitoringSuppression.go index e947282d517..2523a2ff58d 100644 --- a/examples/v2/security-monitoring/CreateSecurityMonitoringSuppression.go +++ b/examples/v2/security-monitoring/CreateSecurityMonitoringSuppression.go @@ -18,6 +18,7 @@ func main() { Attributes: datadogV2.SecurityMonitoringSuppressionCreateAttributes{ Description: datadog.PtrString("This rule suppresses low-severity signals in staging environments."), Enabled: true, + StartDate: datadog.PtrInt64(1637493071000), ExpirationDate: datadog.PtrInt64(1638443471000), Name: "Example-Security-Monitoring", RuleQuery: "type:log_detection source:cloudtrail", diff --git a/examples/v2/security-monitoring/CreateSecurityMonitoringSuppression_3192265332.go b/examples/v2/security-monitoring/CreateSecurityMonitoringSuppression_3192265332.go index 408315a0d34..5fc5458c744 100644 --- a/examples/v2/security-monitoring/CreateSecurityMonitoringSuppression_3192265332.go +++ b/examples/v2/security-monitoring/CreateSecurityMonitoringSuppression_3192265332.go @@ -18,6 +18,7 @@ func main() { Attributes: datadogV2.SecurityMonitoringSuppressionCreateAttributes{ Description: datadog.PtrString("This rule suppresses low-severity signals in staging environments."), Enabled: true, + StartDate: datadog.PtrInt64(1637493071000), ExpirationDate: datadog.PtrInt64(1638443471000), Name: "Example-Security-Monitoring", RuleQuery: "type:log_detection source:cloudtrail", diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Security_Monitoring/Scenario_Create_a_suppression_rule_returns_OK_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Security_Monitoring/Scenario_Create_a_suppression_rule_returns_OK_response.freeze index 5ff3562b5a8..28bfbcc2df0 100644 --- a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Security_Monitoring/Scenario_Create_a_suppression_rule_returns_OK_response.freeze +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Security_Monitoring/Scenario_Create_a_suppression_rule_returns_OK_response.freeze @@ -1 +1 @@ -2024-05-20T17:07:03.155Z \ No newline at end of file +2024-11-27T15:22:34.711Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Security_Monitoring/Scenario_Create_a_suppression_rule_returns_OK_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Security_Monitoring/Scenario_Create_a_suppression_rule_returns_OK_response.yaml index f61b4897573..20504f438e3 100644 --- a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Security_Monitoring/Scenario_Create_a_suppression_rule_returns_OK_response.yaml +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Security_Monitoring/Scenario_Create_a_suppression_rule_returns_OK_response.yaml @@ -1,7 +1,7 @@ interactions: - request: body: | - {"data":{"attributes":{"description":"This rule suppresses low-severity signals in staging environments.","enabled":true,"expiration_date":1718039223000,"name":"Test-Create_a_suppression_rule_returns_OK_response-1716224823","rule_query":"type:log_detection source:cloudtrail","suppression_query":"env:staging status:low"},"type":"suppressions"}} + {"data":{"attributes":{"description":"This rule suppresses low-severity signals in staging environments.","enabled":true,"expiration_date":1734535354000,"name":"Test-Create_a_suppression_rule_returns_OK_response-1732720954","rule_query":"type:log_detection source:cloudtrail","start_date":1733584954000,"suppression_query":"env:staging status:low"},"type":"suppressions"}} form: {} headers: Accept: @@ -12,16 +12,15 @@ interactions: method: POST url: https://api.datadoghq.com/api/v2/security_monitoring/configuration/suppressions response: - body: '{"data":{"id":"8qj-mmz-zym","attributes":{"name":"Test-Create_a_suppression_rule_returns_OK_response-1716224823","enabled":true,"description":"This - rule suppresses low-severity signals in staging environments.","rule_query":"type:log_detection - source:cloudtrail","suppression_query":"env:staging status:low","data_exclusion_query":"","expiration_date":1718039223000,"version":1,"creation_date":1716224823374,"update_date":1716224823374,"creator":{"name":null,"handle":"frog@datadoghq.com"},"updater":{"name":null,"handle":"frog@datadoghq.com"}},"type":"suppressions"}} - - ' + body: '{"data":{"id":"ejv-ksi-r4j","type":"suppressions","attributes":{"creation_date":1732720954868,"creator":{"handle":"frog@datadoghq.com","name":""},"data_exclusion_query":"","description":"This + rule suppresses low-severity signals in staging environments.","editable":true,"enabled":true,"expiration_date":1734535354000,"name":"Test-Create_a_suppression_rule_returns_OK_response-1732720954","rule_query":"type:log_detection + source:cloudtrail","start_date":1733584954000,"suppression_query":"env:staging + status:low","update_date":1732720954868,"updater":{"handle":"frog@datadoghq.com","name":""},"version":1}}}' code: 200 duration: 0ms headers: Content-Type: - - application/json + - application/vnd.api+json status: 200 OK - request: body: '' @@ -31,13 +30,11 @@ interactions: - '*/*' id: 1 method: DELETE - url: https://api.datadoghq.com/api/v2/security_monitoring/configuration/suppressions/8qj-mmz-zym + url: https://api.datadoghq.com/api/v2/security_monitoring/configuration/suppressions/ejv-ksi-r4j response: body: '' code: 204 duration: 0ms - headers: - Content-Type: - - text/html; charset=utf-8 + headers: {} status: 204 No Content version: 2 diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Security_Monitoring/Scenario_Create_a_suppression_rule_with_an_exclusion_query_returns_OK_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Security_Monitoring/Scenario_Create_a_suppression_rule_with_an_exclusion_query_returns_OK_response.freeze index c745e451305..73982716b61 100644 --- a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Security_Monitoring/Scenario_Create_a_suppression_rule_with_an_exclusion_query_returns_OK_response.freeze +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Security_Monitoring/Scenario_Create_a_suppression_rule_with_an_exclusion_query_returns_OK_response.freeze @@ -1 +1 @@ -2024-05-20T17:07:12.131Z \ No newline at end of file +2024-11-27T15:24:35.169Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Security_Monitoring/Scenario_Create_a_suppression_rule_with_an_exclusion_query_returns_OK_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Security_Monitoring/Scenario_Create_a_suppression_rule_with_an_exclusion_query_returns_OK_response.yaml index 06c8d150cc3..3c993b9b3e5 100644 --- a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Security_Monitoring/Scenario_Create_a_suppression_rule_with_an_exclusion_query_returns_OK_response.yaml +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Security_Monitoring/Scenario_Create_a_suppression_rule_with_an_exclusion_query_returns_OK_response.yaml @@ -1,7 +1,7 @@ interactions: - request: body: | - {"data":{"attributes":{"data_exclusion_query":"account_id:12345","description":"This rule suppresses low-severity signals in staging environments.","enabled":true,"expiration_date":1718039232000,"name":"Test-Create_a_suppression_rule_with_an_exclusion_query_returns_OK_response-1716224832","rule_query":"type:log_detection source:cloudtrail"},"type":"suppressions"}} + {"data":{"attributes":{"data_exclusion_query":"account_id:12345","description":"This rule suppresses low-severity signals in staging environments.","enabled":true,"expiration_date":1734535475000,"name":"Test-Create_a_suppression_rule_with_an_exclusion_query_returns_OK_response-1732721075","rule_query":"type:log_detection source:cloudtrail","start_date":1733585075000},"type":"suppressions"}} form: {} headers: Accept: @@ -12,16 +12,14 @@ interactions: method: POST url: https://api.datadoghq.com/api/v2/security_monitoring/configuration/suppressions response: - body: '{"data":{"id":"i9m-nqb-ets","attributes":{"name":"Test-Create_a_suppression_rule_with_an_exclusion_query_returns_OK_response-1716224832","enabled":true,"description":"This - rule suppresses low-severity signals in staging environments.","rule_query":"type:log_detection - source:cloudtrail","suppression_query":"","data_exclusion_query":"account_id:12345","expiration_date":1718039232000,"version":1,"creation_date":1716224832354,"update_date":1716224832355,"creator":{"name":null,"handle":"frog@datadoghq.com"},"updater":{"name":null,"handle":"frog@datadoghq.com"}},"type":"suppressions"}} - - ' + body: '{"data":{"id":"rv5-3sh-tvp","type":"suppressions","attributes":{"creation_date":1732721075298,"creator":{"handle":"frog@datadoghq.com","name":""},"data_exclusion_query":"account_id:12345","description":"This + rule suppresses low-severity signals in staging environments.","editable":true,"enabled":true,"expiration_date":1734535475000,"name":"Test-Create_a_suppression_rule_with_an_exclusion_query_returns_OK_response-1732721075","rule_query":"type:log_detection + source:cloudtrail","start_date":1733585075000,"suppression_query":"","update_date":1732721075298,"updater":{"handle":"frog@datadoghq.com","name":""},"version":1}}}' code: 200 duration: 0ms headers: Content-Type: - - application/json + - application/vnd.api+json status: 200 OK - request: body: '' @@ -31,13 +29,11 @@ interactions: - '*/*' id: 1 method: DELETE - url: https://api.datadoghq.com/api/v2/security_monitoring/configuration/suppressions/i9m-nqb-ets + url: https://api.datadoghq.com/api/v2/security_monitoring/configuration/suppressions/rv5-3sh-tvp response: body: '' code: 204 duration: 0ms - headers: - Content-Type: - - text/html; charset=utf-8 + headers: {} status: 204 No Content version: 2 diff --git a/tests/scenarios/features/v2/security_monitoring.feature b/tests/scenarios/features/v2/security_monitoring.feature index a2d77f04939..d3244a02a49 100644 --- a/tests/scenarios/features/v2/security_monitoring.feature +++ b/tests/scenarios/features/v2/security_monitoring.feature @@ -264,21 +264,21 @@ Feature: Security Monitoring @generated @skip @team:DataDog/k9-cloud-security-platform Scenario: Create a suppression rule returns "Bad Request" response Given new "CreateSecurityMonitoringSuppression" request - And body with value {"data": {"attributes": {"data_exclusion_query": "source:cloudtrail account_id:12345", "description": "This rule suppresses low-severity signals in staging environments.", "enabled": true, "expiration_date": 1703187336000, "name": "Custom suppression", "rule_query": "type:log_detection source:cloudtrail", "suppression_query": "env:staging status:low"}, "type": "suppressions"}} + And body with value {"data": {"attributes": {"data_exclusion_query": "source:cloudtrail account_id:12345", "description": "This rule suppresses low-severity signals in staging environments.", "enabled": true, "expiration_date": 1703187336000, "name": "Custom suppression", "rule_query": "type:log_detection source:cloudtrail", "start_date": 1703187336000, "suppression_query": "env:staging status:low"}, "type": "suppressions"}} When the request is sent Then the response status is 400 Bad Request @generated @skip @team:DataDog/k9-cloud-security-platform Scenario: Create a suppression rule returns "Conflict" response Given new "CreateSecurityMonitoringSuppression" request - And body with value {"data": {"attributes": {"data_exclusion_query": "source:cloudtrail account_id:12345", "description": "This rule suppresses low-severity signals in staging environments.", "enabled": true, "expiration_date": 1703187336000, "name": "Custom suppression", "rule_query": "type:log_detection source:cloudtrail", "suppression_query": "env:staging status:low"}, "type": "suppressions"}} + And body with value {"data": {"attributes": {"data_exclusion_query": "source:cloudtrail account_id:12345", "description": "This rule suppresses low-severity signals in staging environments.", "enabled": true, "expiration_date": 1703187336000, "name": "Custom suppression", "rule_query": "type:log_detection source:cloudtrail", "start_date": 1703187336000, "suppression_query": "env:staging status:low"}, "type": "suppressions"}} When the request is sent Then the response status is 409 Conflict @skip-validation @team:DataDog/k9-cloud-security-platform Scenario: Create a suppression rule returns "OK" response Given new "CreateSecurityMonitoringSuppression" request - And body with value {"data": {"attributes": {"description": "This rule suppresses low-severity signals in staging environments.", "enabled": true, "expiration_date": {{ timestamp('now + 21d') }}000, "name": "{{ unique }}", "rule_query": "type:log_detection source:cloudtrail", "suppression_query": "env:staging status:low"}, "type": "suppressions"}} + And body with value {"data": {"attributes": {"description": "This rule suppresses low-severity signals in staging environments.", "enabled": true, "start_date": {{ timestamp('now + 10d') }}000, "expiration_date": {{ timestamp('now + 21d') }}000, "name": "{{ unique }}", "rule_query": "type:log_detection source:cloudtrail", "suppression_query": "env:staging status:low"}, "type": "suppressions"}} When the request is sent Then the response status is 200 OK And the response "data.type" is equal to "suppressions" @@ -288,7 +288,7 @@ Feature: Security Monitoring @skip-validation @team:DataDog/k9-cloud-security-platform Scenario: Create a suppression rule with an exclusion query returns "OK" response Given new "CreateSecurityMonitoringSuppression" request - And body with value {"data": {"attributes": {"description": "This rule suppresses low-severity signals in staging environments.", "enabled": true, "expiration_date": {{ timestamp('now + 21d') }}000, "name": "{{ unique }}", "rule_query": "type:log_detection source:cloudtrail", "data_exclusion_query": "account_id:12345"}, "type": "suppressions"}} + And body with value {"data": {"attributes": {"description": "This rule suppresses low-severity signals in staging environments.", "enabled": true, "start_date": {{ timestamp('now + 10d') }}000, "expiration_date": {{ timestamp('now + 21d') }}000, "name": "{{ unique }}", "rule_query": "type:log_detection source:cloudtrail", "data_exclusion_query": "account_id:12345"}, "type": "suppressions"}} When the request is sent Then the response status is 200 OK And the response "data.type" is equal to "suppressions" @@ -815,7 +815,7 @@ Feature: Security Monitoring Scenario: Update a suppression rule returns "Bad Request" response Given new "UpdateSecurityMonitoringSuppression" request And request contains "suppression_id" parameter from "REPLACE.ME" - And body with value {"data": {"attributes": {"data_exclusion_query": "source:cloudtrail account_id:12345", "description": "This rule suppresses low-severity signals in staging environments.", "enabled": true, "expiration_date": 1703187336000, "name": "Custom suppression", "rule_query": "type:log_detection source:cloudtrail", "suppression_query": "env:staging status:low"}, "type": "suppressions"}} + And body with value {"data": {"attributes": {"data_exclusion_query": "source:cloudtrail account_id:12345", "description": "This rule suppresses low-severity signals in staging environments.", "enabled": true, "expiration_date": 1703187336000, "name": "Custom suppression", "rule_query": "type:log_detection source:cloudtrail", "start_date": 1703187336000, "suppression_query": "env:staging status:low"}, "type": "suppressions"}} When the request is sent Then the response status is 400 Bad Request @@ -823,7 +823,7 @@ Feature: Security Monitoring Scenario: Update a suppression rule returns "Concurrent Modification" response Given new "UpdateSecurityMonitoringSuppression" request And request contains "suppression_id" parameter from "REPLACE.ME" - And body with value {"data": {"attributes": {"data_exclusion_query": "source:cloudtrail account_id:12345", "description": "This rule suppresses low-severity signals in staging environments.", "enabled": true, "expiration_date": 1703187336000, "name": "Custom suppression", "rule_query": "type:log_detection source:cloudtrail", "suppression_query": "env:staging status:low"}, "type": "suppressions"}} + And body with value {"data": {"attributes": {"data_exclusion_query": "source:cloudtrail account_id:12345", "description": "This rule suppresses low-severity signals in staging environments.", "enabled": true, "expiration_date": 1703187336000, "name": "Custom suppression", "rule_query": "type:log_detection source:cloudtrail", "start_date": 1703187336000, "suppression_query": "env:staging status:low"}, "type": "suppressions"}} When the request is sent Then the response status is 409 Concurrent Modification @@ -831,7 +831,7 @@ Feature: Security Monitoring Scenario: Update a suppression rule returns "Not Found" response Given new "UpdateSecurityMonitoringSuppression" request And request contains "suppression_id" parameter from "REPLACE.ME" - And body with value {"data": {"attributes": {"data_exclusion_query": "source:cloudtrail account_id:12345", "description": "This rule suppresses low-severity signals in staging environments.", "enabled": true, "expiration_date": 1703187336000, "name": "Custom suppression", "rule_query": "type:log_detection source:cloudtrail", "suppression_query": "env:staging status:low"}, "type": "suppressions"}} + And body with value {"data": {"attributes": {"data_exclusion_query": "source:cloudtrail account_id:12345", "description": "This rule suppresses low-severity signals in staging environments.", "enabled": true, "expiration_date": 1703187336000, "name": "Custom suppression", "rule_query": "type:log_detection source:cloudtrail", "start_date": 1703187336000, "suppression_query": "env:staging status:low"}, "type": "suppressions"}} When the request is sent Then the response status is 404 Not Found