Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add start_date to suppression APIs #398

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .apigentools-info
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
"spec_versions": {
"v1": {
"apigentools_version": "1.6.6",
"regenerated": "2024-12-02 14:34:48.145379",
"spec_repo_commit": "48a734bf"
"regenerated": "2024-12-02 15:32:36.735857",
"spec_repo_commit": "df351555"
},
"v2": {
"apigentools_version": "1.6.6",
"regenerated": "2024-12-02 14:34:48.165088",
"spec_repo_commit": "48a734bf"
"regenerated": "2024-12-02 15:32:36.755099",
"spec_repo_commit": "df351555"
}
}
}
21 changes: 21 additions & 0 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 the start date for the
suppression rule. After this date, it starts 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
Expand Down Expand Up @@ -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 the start date for the
suppression rule. After this date, it starts 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
Expand Down Expand Up @@ -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 the start date for the
suppression rule. After this date, it starts 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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ async fn main() {
"This rule suppresses low-severity signals in staging environments.".to_string(),
)
.expiration_date(1638443471000)
.start_date(1637493071000)
.suppression_query("env:staging status:low".to_string()),
SecurityMonitoringSuppressionType::SUPPRESSIONS,
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ async fn main() {
.description(
"This rule suppresses low-severity signals in staging environments.".to_string(),
)
.expiration_date(1638443471000),
.expiration_date(1638443471000)
.start_date(1637493071000),
SecurityMonitoringSuppressionType::SUPPRESSIONS,
),
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ pub struct SecurityMonitoringSuppressionAttributes {
/// The rule query of the suppression rule, with the same syntax as the search bar for detection rules.
#[serde(rename = "rule_query")]
pub rule_query: Option<String>,
/// A Unix millisecond timestamp giving the start date for the suppression rule. After this date, it starts suppressing signals.
#[serde(rename = "start_date")]
pub start_date: Option<i64>,
/// 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.
#[serde(rename = "suppression_query")]
pub suppression_query: Option<String>,
Expand Down Expand Up @@ -69,6 +72,7 @@ impl SecurityMonitoringSuppressionAttributes {
expiration_date: None,
name: None,
rule_query: None,
start_date: None,
suppression_query: None,
update_date: None,
updater: None,
Expand Down Expand Up @@ -123,6 +127,11 @@ impl SecurityMonitoringSuppressionAttributes {
self
}

pub fn start_date(mut self, value: i64) -> Self {
self.start_date = Some(value);
self
}

pub fn suppression_query(mut self, value: String) -> Self {
self.suppression_query = Some(value);
self
Expand Down Expand Up @@ -184,6 +193,7 @@ impl<'de> Deserialize<'de> for SecurityMonitoringSuppressionAttributes {
let mut expiration_date: Option<i64> = None;
let mut name: Option<String> = None;
let mut rule_query: Option<String> = None;
let mut start_date: Option<i64> = None;
let mut suppression_query: Option<String> = None;
let mut update_date: Option<i64> = None;
let mut updater: Option<crate::datadogV2::model::SecurityMonitoringUser> = None;
Expand Down Expand Up @@ -254,6 +264,12 @@ impl<'de> Deserialize<'de> for SecurityMonitoringSuppressionAttributes {
}
rule_query = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
}
"start_date" => {
if v.is_null() {
continue;
}
start_date = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
}
"suppression_query" => {
if v.is_null() {
continue;
Expand Down Expand Up @@ -298,6 +314,7 @@ impl<'de> Deserialize<'de> for SecurityMonitoringSuppressionAttributes {
expiration_date,
name,
rule_query,
start_date,
suppression_query,
update_date,
updater,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ pub struct SecurityMonitoringSuppressionCreateAttributes {
/// The rule query of the suppression rule, with the same syntax as the search bar for detection rules.
#[serde(rename = "rule_query")]
pub rule_query: String,
/// A Unix millisecond timestamp giving the start date for the suppression rule. After this date, it starts suppressing signals.
#[serde(rename = "start_date")]
pub start_date: Option<i64>,
/// 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.
#[serde(rename = "suppression_query")]
pub suppression_query: Option<String>,
Expand All @@ -52,6 +55,7 @@ impl SecurityMonitoringSuppressionCreateAttributes {
expiration_date: None,
name,
rule_query,
start_date: None,
suppression_query: None,
additional_properties: std::collections::BTreeMap::new(),
_unparsed: false,
Expand All @@ -73,6 +77,11 @@ impl SecurityMonitoringSuppressionCreateAttributes {
self
}

pub fn start_date(mut self, value: i64) -> Self {
self.start_date = Some(value);
self
}

pub fn suppression_query(mut self, value: String) -> Self {
self.suppression_query = Some(value);
self
Expand Down Expand Up @@ -110,6 +119,7 @@ impl<'de> Deserialize<'de> for SecurityMonitoringSuppressionCreateAttributes {
let mut expiration_date: Option<i64> = None;
let mut name: Option<String> = None;
let mut rule_query: Option<String> = None;
let mut start_date: Option<i64> = None;
let mut suppression_query: Option<String> = None;
let mut additional_properties: std::collections::BTreeMap<
String,
Expand Down Expand Up @@ -149,6 +159,12 @@ impl<'de> Deserialize<'de> for SecurityMonitoringSuppressionCreateAttributes {
"rule_query" => {
rule_query = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
}
"start_date" => {
if v.is_null() {
continue;
}
start_date = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
}
"suppression_query" => {
if v.is_null() {
continue;
Expand All @@ -174,6 +190,7 @@ impl<'de> Deserialize<'de> for SecurityMonitoringSuppressionCreateAttributes {
expiration_date,
name,
rule_query,
start_date,
suppression_query,
additional_properties,
_unparsed,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,13 @@ pub struct SecurityMonitoringSuppressionUpdateAttributes {
/// The rule query of the suppression rule, with the same syntax as the search bar for detection rules.
#[serde(rename = "rule_query")]
pub rule_query: Option<String>,
/// A Unix millisecond timestamp giving the start date for the suppression rule. After this date, it starts suppressing signals. If unset, the start date of the suppression rule is left untouched. If set to `null`, the start date is removed.
#[serde(
rename = "start_date",
default,
with = "::serde_with::rust::double_option"
)]
pub start_date: Option<Option<i64>>,
/// 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.
#[serde(rename = "suppression_query")]
pub suppression_query: Option<String>,
Expand All @@ -55,6 +62,7 @@ impl SecurityMonitoringSuppressionUpdateAttributes {
expiration_date: None,
name: None,
rule_query: None,
start_date: None,
suppression_query: None,
version: None,
additional_properties: std::collections::BTreeMap::new(),
Expand Down Expand Up @@ -92,6 +100,11 @@ impl SecurityMonitoringSuppressionUpdateAttributes {
self
}

pub fn start_date(mut self, value: Option<i64>) -> Self {
self.start_date = Some(value);
self
}

pub fn suppression_query(mut self, value: String) -> Self {
self.suppression_query = Some(value);
self
Expand Down Expand Up @@ -140,6 +153,7 @@ impl<'de> Deserialize<'de> for SecurityMonitoringSuppressionUpdateAttributes {
let mut expiration_date: Option<Option<i64>> = None;
let mut name: Option<String> = None;
let mut rule_query: Option<String> = None;
let mut start_date: Option<Option<i64>> = None;
let mut suppression_query: Option<String> = None;
let mut version: Option<i32> = None;
let mut additional_properties: std::collections::BTreeMap<
Expand Down Expand Up @@ -186,6 +200,9 @@ impl<'de> Deserialize<'de> for SecurityMonitoringSuppressionUpdateAttributes {
}
rule_query = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
}
"start_date" => {
start_date = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
}
"suppression_query" => {
if v.is_null() {
continue;
Expand Down Expand Up @@ -214,6 +231,7 @@ impl<'de> Deserialize<'de> for SecurityMonitoringSuppressionUpdateAttributes {
expiration_date,
name,
rule_query,
start_date,
suppression_query,
version,
additional_properties,
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2024-05-20T17:07:03.155Z
2024-11-27T15:22:34.711Z
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
{
"request": {
"body": {
"string": "{\"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\"}}",
"string": "{\"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\"}}",
"encoding": null
},
"headers": {
Expand All @@ -19,20 +19,20 @@
},
"response": {
"body": {
"string": "{\"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\"}}\n",
"string": "{\"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}}}",
"encoding": null
},
"headers": {
"Content-Type": [
"application/json"
"application/vnd.api+json"
]
},
"status": {
"code": 200,
"message": "OK"
}
},
"recorded_at": "Mon, 20 May 2024 17:07:03 GMT"
"recorded_at": "Wed, 27 Nov 2024 15:22:34 GMT"
},
{
"request": {
Expand All @@ -43,24 +43,20 @@
]
},
"method": "delete",
"uri": "https://api.datadoghq.com/api/v2/security_monitoring/configuration/suppressions/8qj-mmz-zym"
"uri": "https://api.datadoghq.com/api/v2/security_monitoring/configuration/suppressions/ejv-ksi-r4j"
},
"response": {
"body": {
"string": "",
"encoding": null
},
"headers": {
"Content-Type": [
"text/html; charset=utf-8"
]
},
"headers": {},
"status": {
"code": 204,
"message": "No Content"
}
},
"recorded_at": "Mon, 20 May 2024 17:07:03 GMT"
"recorded_at": "Wed, 27 Nov 2024 15:22:34 GMT"
}
],
"recorded_with": "VCR 6.0.0"
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2024-05-20T17:07:12.131Z
2024-11-27T15:24:35.169Z
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
{
"request": {
"body": {
"string": "{\"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\"}}",
"string": "{\"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\"}}",
"encoding": null
},
"headers": {
Expand All @@ -19,20 +19,20 @@
},
"response": {
"body": {
"string": "{\"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\"}}\n",
"string": "{\"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}}}",
"encoding": null
},
"headers": {
"Content-Type": [
"application/json"
"application/vnd.api+json"
]
},
"status": {
"code": 200,
"message": "OK"
}
},
"recorded_at": "Mon, 20 May 2024 17:07:12 GMT"
"recorded_at": "Wed, 27 Nov 2024 15:24:35 GMT"
},
{
"request": {
Expand All @@ -43,24 +43,20 @@
]
},
"method": "delete",
"uri": "https://api.datadoghq.com/api/v2/security_monitoring/configuration/suppressions/i9m-nqb-ets"
"uri": "https://api.datadoghq.com/api/v2/security_monitoring/configuration/suppressions/rv5-3sh-tvp"
},
"response": {
"body": {
"string": "",
"encoding": null
},
"headers": {
"Content-Type": [
"text/html; charset=utf-8"
]
},
"headers": {},
"status": {
"code": 204,
"message": "No Content"
}
},
"recorded_at": "Mon, 20 May 2024 17:07:12 GMT"
"recorded_at": "Wed, 27 Nov 2024 15:24:35 GMT"
}
],
"recorded_with": "VCR 6.0.0"
Expand Down
Loading