Skip to content

Commit

Permalink
Regenerate client from commit 1ba2feb9 of spec repo
Browse files Browse the repository at this point in the history
  • Loading branch information
ci.datadog-api-spec committed Oct 18, 2022
1 parent 3b04e15 commit b008067
Show file tree
Hide file tree
Showing 6 changed files with 213 additions and 25 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.4",
"regenerated": "2022-10-14 14:06:52.995839",
"spec_repo_commit": "7eb6ca7a"
"regenerated": "2022-10-18 18:34:15.599691",
"spec_repo_commit": "1ba2feb9"
},
"v2": {
"apigentools_version": "1.6.4",
"regenerated": "2022-10-14 14:06:53.009989",
"spec_repo_commit": "7eb6ca7a"
"regenerated": "2022-10-18 18:34:15.616982",
"spec_repo_commit": "1ba2feb9"
}
}
}
20 changes: 20 additions & 0 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4606,6 +4606,8 @@ components:
description: The search query - following the log search syntax.
example: service:web* AND @http.status_code:[200 TO 299]
type: string
storage_tier:
$ref: '#/components/schemas/LogsStorageTier'
to:
default: now
description: The maximum time for the requested logs, supports date math
Expand Down Expand Up @@ -4685,6 +4687,17 @@ components:
x-enum-varnames:
- ASCENDING
- DESCENDING
LogsStorageTier:
default: indexes
description: Specifies storage type as indexes or online-archives
enum:
- indexes
- online-archives
example: indexes
type: string
x-enum-varnames:
- INDEXES
- ONLINE_ARCHIVES
LogsWarning:
description: A warning message indicating something that went wrong with the
query
Expand Down Expand Up @@ -12178,6 +12191,13 @@ paths:
schema:
format: date-time
type: string
- description: Specifies the storage type to be used
example: indexes
in: query
name: filter[storage_tier]
required: false
schema:
$ref: '#/components/schemas/LogsStorageTier'
- description: Order of logs in results.
in: query
name: sort
Expand Down
42 changes: 27 additions & 15 deletions api/datadogV2/api_logs.go
Original file line number Diff line number Diff line change
Expand Up @@ -365,25 +365,27 @@ func (a *LogsApi) listLogsExecute(r apiListLogsRequest) (LogsListResponse, *_net
}

type apiListLogsGetRequest struct {
ctx _context.Context
filterQuery *string
filterIndex *string
filterFrom *time.Time
filterTo *time.Time
sort *LogsSort
pageCursor *string
pageLimit *int32
ctx _context.Context
filterQuery *string
filterIndex *string
filterFrom *time.Time
filterTo *time.Time
filterStorageTier *LogsStorageTier
sort *LogsSort
pageCursor *string
pageLimit *int32
}

// ListLogsGetOptionalParameters holds optional parameters for ListLogsGet.
type ListLogsGetOptionalParameters struct {
FilterQuery *string
FilterIndex *string
FilterFrom *time.Time
FilterTo *time.Time
Sort *LogsSort
PageCursor *string
PageLimit *int32
FilterQuery *string
FilterIndex *string
FilterFrom *time.Time
FilterTo *time.Time
FilterStorageTier *LogsStorageTier
Sort *LogsSort
PageCursor *string
PageLimit *int32
}

// NewListLogsGetOptionalParameters creates an empty struct for parameters.
Expand Down Expand Up @@ -416,6 +418,12 @@ func (r *ListLogsGetOptionalParameters) WithFilterTo(filterTo time.Time) *ListLo
return r
}

// WithFilterStorageTier sets the corresponding parameter name and returns the struct.
func (r *ListLogsGetOptionalParameters) WithFilterStorageTier(filterStorageTier LogsStorageTier) *ListLogsGetOptionalParameters {
r.FilterStorageTier = &filterStorageTier
return r
}

// WithSort sets the corresponding parameter name and returns the struct.
func (r *ListLogsGetOptionalParameters) WithSort(sort LogsSort) *ListLogsGetOptionalParameters {
r.Sort = &sort
Expand Down Expand Up @@ -448,6 +456,7 @@ func (a *LogsApi) buildListLogsGetRequest(ctx _context.Context, o ...ListLogsGet
req.filterIndex = o[0].FilterIndex
req.filterFrom = o[0].FilterFrom
req.filterTo = o[0].FilterTo
req.filterStorageTier = o[0].FilterStorageTier
req.sort = o[0].Sort
req.pageCursor = o[0].PageCursor
req.pageLimit = o[0].PageLimit
Expand Down Expand Up @@ -568,6 +577,9 @@ func (a *LogsApi) listLogsGetExecute(r apiListLogsGetRequest) (LogsListResponse,
if r.filterTo != nil {
localVarQueryParams.Add("filter[to]", datadog.ParameterToString(*r.filterTo, ""))
}
if r.filterStorageTier != nil {
localVarQueryParams.Add("filter[storage_tier]", datadog.ParameterToString(*r.filterStorageTier, ""))
}
if r.sort != nil {
localVarQueryParams.Add("sort", datadog.ParameterToString(*r.sort, ""))
}
Expand Down
55 changes: 51 additions & 4 deletions api/datadogV2/model_logs_query_filter.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ type LogsQueryFilter struct {
Indexes []string `json:"indexes,omitempty"`
// The search query - following the log search syntax.
Query *string `json:"query,omitempty"`
// Specifies storage type as indexes or online-archives
StorageTier *LogsStorageTier `json:"storage_tier,omitempty"`
// The maximum time for the requested logs, supports date math and regular timestamps (milliseconds).
To *string `json:"to,omitempty"`
// UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct
Expand All @@ -33,6 +35,8 @@ func NewLogsQueryFilter() *LogsQueryFilter {
this.From = &from
var query string = "*"
this.Query = &query
var storageTier LogsStorageTier = LOGSSTORAGETIER_INDEXES
this.StorageTier = &storageTier
var to string = "now"
this.To = &to
return &this
Expand All @@ -47,6 +51,8 @@ func NewLogsQueryFilterWithDefaults() *LogsQueryFilter {
this.From = &from
var query string = "*"
this.Query = &query
var storageTier LogsStorageTier = LOGSSTORAGETIER_INDEXES
this.StorageTier = &storageTier
var to string = "now"
this.To = &to
return &this
Expand Down Expand Up @@ -136,6 +142,34 @@ func (o *LogsQueryFilter) SetQuery(v string) {
o.Query = &v
}

// GetStorageTier returns the StorageTier field value if set, zero value otherwise.
func (o *LogsQueryFilter) GetStorageTier() LogsStorageTier {
if o == nil || o.StorageTier == nil {
var ret LogsStorageTier
return ret
}
return *o.StorageTier
}

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

// HasStorageTier returns a boolean if a field has been set.
func (o *LogsQueryFilter) HasStorageTier() bool {
return o != nil && o.StorageTier != nil
}

// SetStorageTier gets a reference to the given LogsStorageTier and assigns it to the StorageTier field.
func (o *LogsQueryFilter) SetStorageTier(v LogsStorageTier) {
o.StorageTier = &v
}

// GetTo returns the To field value if set, zero value otherwise.
func (o *LogsQueryFilter) GetTo() string {
if o == nil || o.To == nil {
Expand Down Expand Up @@ -179,6 +213,9 @@ func (o LogsQueryFilter) MarshalJSON() ([]byte, error) {
if o.Query != nil {
toSerialize["query"] = o.Query
}
if o.StorageTier != nil {
toSerialize["storage_tier"] = o.StorageTier
}
if o.To != nil {
toSerialize["to"] = o.To
}
Expand All @@ -193,10 +230,11 @@ func (o LogsQueryFilter) MarshalJSON() ([]byte, error) {
func (o *LogsQueryFilter) UnmarshalJSON(bytes []byte) (err error) {
raw := map[string]interface{}{}
all := struct {
From *string `json:"from,omitempty"`
Indexes []string `json:"indexes,omitempty"`
Query *string `json:"query,omitempty"`
To *string `json:"to,omitempty"`
From *string `json:"from,omitempty"`
Indexes []string `json:"indexes,omitempty"`
Query *string `json:"query,omitempty"`
StorageTier *LogsStorageTier `json:"storage_tier,omitempty"`
To *string `json:"to,omitempty"`
}{}
err = json.Unmarshal(bytes, &all)
if err != nil {
Expand All @@ -207,9 +245,18 @@ func (o *LogsQueryFilter) UnmarshalJSON(bytes []byte) (err error) {
o.UnparsedObject = raw
return nil
}
if v := all.StorageTier; v != nil && !v.IsValid() {
err = json.Unmarshal(bytes, &raw)
if err != nil {
return err
}
o.UnparsedObject = raw
return nil
}
o.From = all.From
o.Indexes = all.Indexes
o.Query = all.Query
o.StorageTier = all.StorageTier
o.To = all.To
return nil
}
109 changes: 109 additions & 0 deletions api/datadogV2/model_logs_storage_tier.go
Original file line number Diff line number Diff line change
@@ -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 datadogV2

import (
"encoding/json"
"fmt"
)

// LogsStorageTier Specifies storage type as indexes or online-archives
type LogsStorageTier string

// List of LogsStorageTier.
const (
LOGSSTORAGETIER_INDEXES LogsStorageTier = "indexes"
LOGSSTORAGETIER_ONLINE_ARCHIVES LogsStorageTier = "online-archives"
)

var allowedLogsStorageTierEnumValues = []LogsStorageTier{
LOGSSTORAGETIER_INDEXES,
LOGSSTORAGETIER_ONLINE_ARCHIVES,
}

// GetAllowedValues reeturns the list of possible values.
func (v *LogsStorageTier) GetAllowedValues() []LogsStorageTier {
return allowedLogsStorageTierEnumValues
}

// UnmarshalJSON deserializes the given payload.
func (v *LogsStorageTier) UnmarshalJSON(src []byte) error {
var value string
err := json.Unmarshal(src, &value)
if err != nil {
return err
}
*v = LogsStorageTier(value)
return nil
}

// NewLogsStorageTierFromValue returns a pointer to a valid LogsStorageTier
// for the value passed as argument, or an error if the value passed is not allowed by the enum.
func NewLogsStorageTierFromValue(v string) (*LogsStorageTier, error) {
ev := LogsStorageTier(v)
if ev.IsValid() {
return &ev, nil
}
return nil, fmt.Errorf("invalid value '%v' for LogsStorageTier: valid values are %v", v, allowedLogsStorageTierEnumValues)
}

// IsValid return true if the value is valid for the enum, false otherwise.
func (v LogsStorageTier) IsValid() bool {
for _, existing := range allowedLogsStorageTierEnumValues {
if existing == v {
return true
}
}
return false
}

// Ptr returns reference to LogsStorageTier value.
func (v LogsStorageTier) Ptr() *LogsStorageTier {
return &v
}

// NullableLogsStorageTier handles when a null is used for LogsStorageTier.
type NullableLogsStorageTier struct {
value *LogsStorageTier
isSet bool
}

// Get returns the associated value.
func (v NullableLogsStorageTier) Get() *LogsStorageTier {
return v.value
}

// Set changes the value and indicates it's been called.
func (v *NullableLogsStorageTier) Set(val *LogsStorageTier) {
v.value = val
v.isSet = true
}

// IsSet returns whether Set has been called.
func (v NullableLogsStorageTier) IsSet() bool {
return v.isSet
}

// Unset sets the value to nil and resets the set flag.
func (v *NullableLogsStorageTier) Unset() {
v.value = nil
v.isSet = false
}

// NewNullableLogsStorageTier initializes the struct as if Set has been called.
func NewNullableLogsStorageTier(val *LogsStorageTier) *NullableLogsStorageTier {
return &NullableLogsStorageTier{value: val, isSet: true}
}

// MarshalJSON serializes the associated value.
func (v NullableLogsStorageTier) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}

// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called.
func (v *NullableLogsStorageTier) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}
4 changes: 2 additions & 2 deletions tests/scenarios/features/v2/logs.feature
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Feature: Logs
Scenario: Aggregate events returns "Bad Request" response
Given a valid "appKeyAuth" key in the system
And new "AggregateLogs" request
And body with value {"compute": [{"aggregation": "pc90", "interval": "5m", "metric": "@duration", "type": "total"}], "filter": {"from": "now-15m", "indexes": ["main", "web"], "query": "service:web* AND @http.status_code:[200 TO 299]", "to": "now"}, "group_by": [{"facet": "host", "histogram": {"interval": 10, "max": 100, "min": 50}, "limit": 10, "sort": {"aggregation": "count", "order": "asc"}, "total": false}], "options": {"timezone": "GMT"}, "page": {"cursor": "eyJzdGFydEF0IjoiQVFBQUFYS2tMS3pPbm40NGV3QUFBQUJCV0V0clRFdDZVbG8zY3pCRmNsbHJiVmxDWlEifQ=="}}
And body with value {"compute": [{"aggregation": "pc90", "interval": "5m", "metric": "@duration", "type": "total"}], "filter": {"from": "now-15m", "indexes": ["main", "web"], "query": "service:web* AND @http.status_code:[200 TO 299]", "storage_tier": "indexes", "to": "now"}, "group_by": [{"facet": "host", "histogram": {"interval": 10, "max": 100, "min": 50}, "limit": 10, "sort": {"aggregation": "count", "order": "asc"}, "total": false}], "options": {"timezone": "GMT"}, "page": {"cursor": "eyJzdGFydEF0IjoiQVFBQUFYS2tMS3pPbm40NGV3QUFBQUJCV0V0clRFdDZVbG8zY3pCRmNsbHJiVmxDWlEifQ=="}}
When the request is sent
Then the response status is 400 Bad Request

Expand Down Expand Up @@ -77,7 +77,7 @@ Feature: Logs
Scenario: Search logs returns "Bad Request" response
Given a valid "appKeyAuth" key in the system
And new "ListLogs" request
And body with value {"filter": {"from": "now-15m", "indexes": ["main", "web"], "query": "service:web* AND @http.status_code:[200 TO 299]", "to": "now"}, "options": {"timezone": "GMT"}, "page": {"cursor": "eyJzdGFydEF0IjoiQVFBQUFYS2tMS3pPbm40NGV3QUFBQUJCV0V0clRFdDZVbG8zY3pCRmNsbHJiVmxDWlEifQ==", "limit": 25}, "sort": "timestamp"}
And body with value {"filter": {"from": "now-15m", "indexes": ["main", "web"], "query": "service:web* AND @http.status_code:[200 TO 299]", "storage_tier": "indexes", "to": "now"}, "options": {"timezone": "GMT"}, "page": {"cursor": "eyJzdGFydEF0IjoiQVFBQUFYS2tMS3pPbm40NGV3QUFBQUJCV0V0clRFdDZVbG8zY3pCRmNsbHJiVmxDWlEifQ==", "limit": 25}, "sort": "timestamp"}
When the request is sent
Then the response status is 400 Bad Request

Expand Down

0 comments on commit b008067

Please sign in to comment.