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 #2810

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:47.056901",
"spec_repo_commit": "48a734bf"
"regenerated": "2024-12-02 15:32:34.141926",
"spec_repo_commit": "df351555"
},
"v2": {
"apigentools_version": "1.6.6",
"regenerated": "2024-12-02 14:34:47.076082",
"spec_repo_commit": "48a734bf"
"regenerated": "2024-12-02 15:32:34.161360",
"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 @@ -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 the start date for the suppression rule. After this date, it starts 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.
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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
}
Expand Down Expand Up @@ -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"`
Expand All @@ -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
}
Expand All @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 the start date for the suppression rule. After this date, it starts 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
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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
}
Expand All @@ -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 {
Expand All @@ -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
}
Expand All @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 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.
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.
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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
}
Expand All @@ -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"`
}{}
Expand All @@ -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
}
Expand All @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
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
@@ -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:
Expand All @@ -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: ''
Expand All @@ -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
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2024-05-20T17:07:12.131Z
2024-11-27T15:24:35.169Z
Loading