Skip to content

Commit

Permalink
Add num_flex_logs_retention_days field to logs_indexes api spec (#2645
Browse files Browse the repository at this point in the history
)

Co-authored-by: ci.datadog-api-spec <[email protected]>
Co-authored-by: api-clients-generation-pipeline[bot] <54105614+api-clients-generation-pipeline[bot]@users.noreply.github.com>
  • Loading branch information
api-clients-generation-pipeline[bot] and ci.datadog-api-spec authored Aug 27, 2024
1 parent 82108a5 commit 62d1d10
Show file tree
Hide file tree
Showing 7 changed files with 142 additions and 29 deletions.
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-08-26 18:14:54.086270",
"spec_repo_commit": "0857d88a"
"regenerated": "2024-08-27 12:12:27.114116",
"spec_repo_commit": "09daef2e"
},
"v2": {
"apigentools_version": "1.6.6",
"regenerated": "2024-08-26 18:14:54.105234",
"spec_repo_commit": "0857d88a"
"regenerated": "2024-08-27 12:12:27.132612",
"spec_repo_commit": "09daef2e"
}
}
}
54 changes: 44 additions & 10 deletions .generator/schemas/v1/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5576,11 +5576,27 @@ components:
description: The name of the index.
example: main
type: string
num_flex_logs_retention_days:
description: 'The total number of days logs are stored in Standard and Flex
Tier before being deleted from the index.

If Standard Tier is enabled on this index, logs are first retained in
Standard Tier for the number of days specified through `num_retention_days`,

and then stored in Flex Tier until the number of days specified in `num_flex_logs_retention_days`
is reached.

The available values depend on retention plans specified in your organization''s
contract/subscriptions.'
example: 360
format: int64
type: integer
num_retention_days:
description: 'The number of days before logs are deleted from this index.
Available values depend on
description: 'The number of days logs are stored in Standard Tier before
aging into the Flex Tier or being deleted from the index.

retention plans specified in your organization''s contract/subscriptions.'
The available values depend on retention plans specified in your organization''s
contract/subscriptions.'
example: 15
format: int64
type: integer
Expand Down Expand Up @@ -5639,17 +5655,35 @@ components:
type: array
filter:
$ref: '#/components/schemas/LogsFilter'
num_retention_days:
description: 'The number of days before logs are deleted from this index.
Available values depend on
num_flex_logs_retention_days:
description: 'The total number of days logs are stored in Standard and Flex
Tier before being deleted from the index.

If Standard Tier is enabled on this index, logs are first retained in
Standard Tier for the number of days specified through `num_retention_days`,

retention plans specified in your organization''s contract/subscriptions.
and then stored in Flex Tier until the number of days specified in `num_flex_logs_retention_days`
is reached.

The available values depend on retention plans specified in your organization''s
contract/subscriptions.


**Note**: Changing this value affects all logs already in this index.
It may also affect billing.'
example: 360
format: int64
type: integer
num_retention_days:
description: 'The number of days logs are stored in Standard Tier before
aging into the Flex Tier or being deleted from the index.

The available values depend on retention plans specified in your organization''s
contract/subscriptions.

**Note:** Changing the retention for an index adjusts the length of retention
for all logs

already in this index. It may also affect billing.'
**Note**: Changing this value affects all logs already in this index.
It may also affect billing.'
example: 15
format: int64
type: integer
Expand Down
44 changes: 41 additions & 3 deletions api/datadogV1/model_logs_index.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,13 @@ type LogsIndex struct {
IsRateLimited *bool `json:"is_rate_limited,omitempty"`
// The name of the index.
Name string `json:"name"`
// The number of days before logs are deleted from this index. Available values depend on
// retention plans specified in your organization's contract/subscriptions.
// The total number of days logs are stored in Standard and Flex Tier before being deleted from the index.
// If Standard Tier is enabled on this index, logs are first retained in Standard Tier for the number of days specified through `num_retention_days`,
// and then stored in Flex Tier until the number of days specified in `num_flex_logs_retention_days` is reached.
// The available values depend on retention plans specified in your organization's contract/subscriptions.
NumFlexLogsRetentionDays *int64 `json:"num_flex_logs_retention_days,omitempty"`
// The number of days logs are stored in Standard Tier before aging into the Flex Tier or being deleted from the index.
// The available values depend on retention plans specified in your organization's contract/subscriptions.
NumRetentionDays *int64 `json:"num_retention_days,omitempty"`
// UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct
UnparsedObject map[string]interface{} `json:"-"`
Expand Down Expand Up @@ -242,6 +247,34 @@ func (o *LogsIndex) SetName(v string) {
o.Name = v
}

// GetNumFlexLogsRetentionDays returns the NumFlexLogsRetentionDays field value if set, zero value otherwise.
func (o *LogsIndex) GetNumFlexLogsRetentionDays() int64 {
if o == nil || o.NumFlexLogsRetentionDays == nil {
var ret int64
return ret
}
return *o.NumFlexLogsRetentionDays
}

// GetNumFlexLogsRetentionDaysOk returns a tuple with the NumFlexLogsRetentionDays field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *LogsIndex) GetNumFlexLogsRetentionDaysOk() (*int64, bool) {
if o == nil || o.NumFlexLogsRetentionDays == nil {
return nil, false
}
return o.NumFlexLogsRetentionDays, true
}

// HasNumFlexLogsRetentionDays returns a boolean if a field has been set.
func (o *LogsIndex) HasNumFlexLogsRetentionDays() bool {
return o != nil && o.NumFlexLogsRetentionDays != nil
}

// SetNumFlexLogsRetentionDays gets a reference to the given int64 and assigns it to the NumFlexLogsRetentionDays field.
func (o *LogsIndex) SetNumFlexLogsRetentionDays(v int64) {
o.NumFlexLogsRetentionDays = &v
}

// GetNumRetentionDays returns the NumRetentionDays field value if set, zero value otherwise.
func (o *LogsIndex) GetNumRetentionDays() int64 {
if o == nil || o.NumRetentionDays == nil {
Expand Down Expand Up @@ -293,6 +326,9 @@ func (o LogsIndex) MarshalJSON() ([]byte, error) {
toSerialize["is_rate_limited"] = o.IsRateLimited
}
toSerialize["name"] = o.Name
if o.NumFlexLogsRetentionDays != nil {
toSerialize["num_flex_logs_retention_days"] = o.NumFlexLogsRetentionDays
}
if o.NumRetentionDays != nil {
toSerialize["num_retention_days"] = o.NumRetentionDays
}
Expand All @@ -313,6 +349,7 @@ func (o *LogsIndex) UnmarshalJSON(bytes []byte) (err error) {
Filter *LogsFilter `json:"filter"`
IsRateLimited *bool `json:"is_rate_limited,omitempty"`
Name *string `json:"name"`
NumFlexLogsRetentionDays *int64 `json:"num_flex_logs_retention_days,omitempty"`
NumRetentionDays *int64 `json:"num_retention_days,omitempty"`
}{}
if err = datadog.Unmarshal(bytes, &all); err != nil {
Expand All @@ -326,7 +363,7 @@ func (o *LogsIndex) UnmarshalJSON(bytes []byte) (err error) {
}
additionalProperties := make(map[string]interface{})
if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil {
datadog.DeleteKeys(additionalProperties, &[]string{"daily_limit", "daily_limit_reset", "daily_limit_warning_threshold_percentage", "exclusion_filters", "filter", "is_rate_limited", "name", "num_retention_days"})
datadog.DeleteKeys(additionalProperties, &[]string{"daily_limit", "daily_limit_reset", "daily_limit_warning_threshold_percentage", "exclusion_filters", "filter", "is_rate_limited", "name", "num_flex_logs_retention_days", "num_retention_days"})
} else {
return err
}
Expand All @@ -345,6 +382,7 @@ func (o *LogsIndex) UnmarshalJSON(bytes []byte) (err error) {
o.Filter = *all.Filter
o.IsRateLimited = all.IsRateLimited
o.Name = *all.Name
o.NumFlexLogsRetentionDays = all.NumFlexLogsRetentionDays
o.NumRetentionDays = all.NumRetentionDays

if len(additionalProperties) > 0 {
Expand Down
49 changes: 44 additions & 5 deletions api/datadogV1/model_logs_index_update_request.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,17 @@ type LogsIndexUpdateRequest struct {
ExclusionFilters []LogsExclusion `json:"exclusion_filters,omitempty"`
// Filter for logs.
Filter LogsFilter `json:"filter"`
// The number of days before logs are deleted from this index. Available values depend on
// retention plans specified in your organization's contract/subscriptions.
// The total number of days logs are stored in Standard and Flex Tier before being deleted from the index.
// If Standard Tier is enabled on this index, logs are first retained in Standard Tier for the number of days specified through `num_retention_days`,
// and then stored in Flex Tier until the number of days specified in `num_flex_logs_retention_days` is reached.
// The available values depend on retention plans specified in your organization's contract/subscriptions.
//
// **Note:** Changing the retention for an index adjusts the length of retention for all logs
// already in this index. It may also affect billing.
// **Note**: Changing this value affects all logs already in this index. It may also affect billing.
NumFlexLogsRetentionDays *int64 `json:"num_flex_logs_retention_days,omitempty"`
// The number of days logs are stored in Standard Tier before aging into the Flex Tier or being deleted from the index.
// The available values depend on retention plans specified in your organization's contract/subscriptions.
//
// **Note**: Changing this value affects all logs already in this index. It may also affect billing.
NumRetentionDays *int64 `json:"num_retention_days,omitempty"`
// UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct
UnparsedObject map[string]interface{} `json:"-"`
Expand Down Expand Up @@ -220,6 +226,34 @@ func (o *LogsIndexUpdateRequest) SetFilter(v LogsFilter) {
o.Filter = v
}

// GetNumFlexLogsRetentionDays returns the NumFlexLogsRetentionDays field value if set, zero value otherwise.
func (o *LogsIndexUpdateRequest) GetNumFlexLogsRetentionDays() int64 {
if o == nil || o.NumFlexLogsRetentionDays == nil {
var ret int64
return ret
}
return *o.NumFlexLogsRetentionDays
}

// GetNumFlexLogsRetentionDaysOk returns a tuple with the NumFlexLogsRetentionDays field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *LogsIndexUpdateRequest) GetNumFlexLogsRetentionDaysOk() (*int64, bool) {
if o == nil || o.NumFlexLogsRetentionDays == nil {
return nil, false
}
return o.NumFlexLogsRetentionDays, true
}

// HasNumFlexLogsRetentionDays returns a boolean if a field has been set.
func (o *LogsIndexUpdateRequest) HasNumFlexLogsRetentionDays() bool {
return o != nil && o.NumFlexLogsRetentionDays != nil
}

// SetNumFlexLogsRetentionDays gets a reference to the given int64 and assigns it to the NumFlexLogsRetentionDays field.
func (o *LogsIndexUpdateRequest) SetNumFlexLogsRetentionDays(v int64) {
o.NumFlexLogsRetentionDays = &v
}

// GetNumRetentionDays returns the NumRetentionDays field value if set, zero value otherwise.
func (o *LogsIndexUpdateRequest) GetNumRetentionDays() int64 {
if o == nil || o.NumRetentionDays == nil {
Expand Down Expand Up @@ -270,6 +304,9 @@ func (o LogsIndexUpdateRequest) MarshalJSON() ([]byte, error) {
toSerialize["exclusion_filters"] = o.ExclusionFilters
}
toSerialize["filter"] = o.Filter
if o.NumFlexLogsRetentionDays != nil {
toSerialize["num_flex_logs_retention_days"] = o.NumFlexLogsRetentionDays
}
if o.NumRetentionDays != nil {
toSerialize["num_retention_days"] = o.NumRetentionDays
}
Expand All @@ -289,6 +326,7 @@ func (o *LogsIndexUpdateRequest) UnmarshalJSON(bytes []byte) (err error) {
DisableDailyLimit *bool `json:"disable_daily_limit,omitempty"`
ExclusionFilters []LogsExclusion `json:"exclusion_filters,omitempty"`
Filter *LogsFilter `json:"filter"`
NumFlexLogsRetentionDays *int64 `json:"num_flex_logs_retention_days,omitempty"`
NumRetentionDays *int64 `json:"num_retention_days,omitempty"`
}{}
if err = datadog.Unmarshal(bytes, &all); err != nil {
Expand All @@ -299,7 +337,7 @@ func (o *LogsIndexUpdateRequest) UnmarshalJSON(bytes []byte) (err error) {
}
additionalProperties := make(map[string]interface{})
if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil {
datadog.DeleteKeys(additionalProperties, &[]string{"daily_limit", "daily_limit_reset", "daily_limit_warning_threshold_percentage", "disable_daily_limit", "exclusion_filters", "filter", "num_retention_days"})
datadog.DeleteKeys(additionalProperties, &[]string{"daily_limit", "daily_limit_reset", "daily_limit_warning_threshold_percentage", "disable_daily_limit", "exclusion_filters", "filter", "num_flex_logs_retention_days", "num_retention_days"})
} else {
return err
}
Expand All @@ -317,6 +355,7 @@ func (o *LogsIndexUpdateRequest) UnmarshalJSON(bytes []byte) (err error) {
hasInvalidField = true
}
o.Filter = *all.Filter
o.NumFlexLogsRetentionDays = all.NumFlexLogsRetentionDays
o.NumRetentionDays = all.NumRetentionDays

if len(additionalProperties) > 0 {
Expand Down
5 changes: 3 additions & 2 deletions examples/v1/logs-indexes/CreateLogsIndex.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,9 @@ func main() {
Filter: datadogV1.LogsFilter{
Query: datadog.PtrString("source:python"),
},
Name: "main",
NumRetentionDays: datadog.PtrInt64(15),
Name: "main",
NumFlexLogsRetentionDays: datadog.PtrInt64(360),
NumRetentionDays: datadog.PtrInt64(15),
}
ctx := datadog.NewDefaultContext(context.Background())
configuration := datadog.NewConfiguration()
Expand Down
3 changes: 2 additions & 1 deletion examples/v1/logs-indexes/UpdateLogsIndex.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ func main() {
Filter: datadogV1.LogsFilter{
Query: datadog.PtrString("source:python"),
},
NumRetentionDays: datadog.PtrInt64(15),
NumFlexLogsRetentionDays: datadog.PtrInt64(360),
NumRetentionDays: datadog.PtrInt64(15),
}
ctx := datadog.NewDefaultContext(context.Background())
configuration := datadog.NewConfiguration()
Expand Down
8 changes: 4 additions & 4 deletions tests/scenarios/features/v1/logs_indexes.feature
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ Feature: Logs Indexes
@generated @skip @team:DataDog/logs-backend
Scenario: Create an index returns "Invalid Parameter Error" response
Given new "CreateLogsIndex" request
And body with value {"daily_limit": 300000000, "daily_limit_reset": {"reset_time": "14:00", "reset_utc_offset": "+02:00"}, "daily_limit_warning_threshold_percentage": 70, "exclusion_filters": [{"filter": {"query": "*", "sample_rate": 1.0}, "name": "payment"}], "filter": {"query": "source:python"}, "name": "main", "num_retention_days": 15}
And body with value {"daily_limit": 300000000, "daily_limit_reset": {"reset_time": "14:00", "reset_utc_offset": "+02:00"}, "daily_limit_warning_threshold_percentage": 70, "exclusion_filters": [{"filter": {"query": "*", "sample_rate": 1.0}, "name": "payment"}], "filter": {"query": "source:python"}, "name": "main", "num_flex_logs_retention_days": 360, "num_retention_days": 15}
When the request is sent
Then the response status is 400 Invalid Parameter Error

@generated @skip @team:DataDog/logs-backend
Scenario: Create an index returns "OK" response
Given new "CreateLogsIndex" request
And body with value {"daily_limit": 300000000, "daily_limit_reset": {"reset_time": "14:00", "reset_utc_offset": "+02:00"}, "daily_limit_warning_threshold_percentage": 70, "exclusion_filters": [{"filter": {"query": "*", "sample_rate": 1.0}, "name": "payment"}], "filter": {"query": "source:python"}, "name": "main", "num_retention_days": 15}
And body with value {"daily_limit": 300000000, "daily_limit_reset": {"reset_time": "14:00", "reset_utc_offset": "+02:00"}, "daily_limit_warning_threshold_percentage": 70, "exclusion_filters": [{"filter": {"query": "*", "sample_rate": 1.0}, "name": "payment"}], "filter": {"query": "source:python"}, "name": "main", "num_flex_logs_retention_days": 360, "num_retention_days": 15}
When the request is sent
Then the response status is 200 OK

Expand Down Expand Up @@ -53,15 +53,15 @@ Feature: Logs Indexes
Scenario: Update an index returns "Invalid Parameter Error" response
Given new "UpdateLogsIndex" request
And request contains "name" parameter from "REPLACE.ME"
And body with value {"daily_limit": 300000000, "daily_limit_reset": {"reset_time": "14:00", "reset_utc_offset": "+02:00"}, "daily_limit_warning_threshold_percentage": 70, "disable_daily_limit": false, "exclusion_filters": [{"filter": {"query": "*", "sample_rate": 1.0}, "name": "payment"}], "filter": {"query": "source:python"}, "num_retention_days": 15}
And body with value {"daily_limit": 300000000, "daily_limit_reset": {"reset_time": "14:00", "reset_utc_offset": "+02:00"}, "daily_limit_warning_threshold_percentage": 70, "disable_daily_limit": false, "exclusion_filters": [{"filter": {"query": "*", "sample_rate": 1.0}, "name": "payment"}], "filter": {"query": "source:python"}, "num_flex_logs_retention_days": 360, "num_retention_days": 15}
When the request is sent
Then the response status is 400 Invalid Parameter Error

@generated @skip @team:DataDog/logs-backend
Scenario: Update an index returns "OK" response
Given new "UpdateLogsIndex" request
And request contains "name" parameter from "REPLACE.ME"
And body with value {"daily_limit": 300000000, "daily_limit_reset": {"reset_time": "14:00", "reset_utc_offset": "+02:00"}, "daily_limit_warning_threshold_percentage": 70, "disable_daily_limit": false, "exclusion_filters": [{"filter": {"query": "*", "sample_rate": 1.0}, "name": "payment"}], "filter": {"query": "source:python"}, "num_retention_days": 15}
And body with value {"daily_limit": 300000000, "daily_limit_reset": {"reset_time": "14:00", "reset_utc_offset": "+02:00"}, "daily_limit_warning_threshold_percentage": 70, "disable_daily_limit": false, "exclusion_filters": [{"filter": {"query": "*", "sample_rate": 1.0}, "name": "payment"}], "filter": {"query": "source:python"}, "num_flex_logs_retention_days": 360, "num_retention_days": 15}
When the request is sent
Then the response status is 200 OK

Expand Down

0 comments on commit 62d1d10

Please sign in to comment.