Skip to content

Commit

Permalink
Add tileDef sort attribute (#2494)
Browse files Browse the repository at this point in the history
Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
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 May 23, 2024
1 parent 5a720de commit d64078b
Show file tree
Hide file tree
Showing 30 changed files with 1,199 additions and 62 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-05-23 11:00:08.137912",
"spec_repo_commit": "b829bfa2"
"regenerated": "2024-05-23 18:14:56.569883",
"spec_repo_commit": "95a954a4"
},
"v2": {
"apigentools_version": "1.6.6",
"regenerated": "2024-05-23 11:00:08.169625",
"spec_repo_commit": "b829bfa2"
"regenerated": "2024-05-23 18:14:56.588860",
"spec_repo_commit": "95a954a4"
}
}
}
75 changes: 75 additions & 0 deletions .generator/schemas/v1/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3043,6 +3043,14 @@ components:
type: string
x-enum-varnames:
- METRIC
FormulaType:
description: Set the sort type to formula.
enum:
- formula
example: formula
type: string
x-enum-varnames:
- FORMULA
FreeTextWidgetDefinition:
description: Free text is a widget that allows you to add headings to your screenboard.
Commonly used to state the overall purpose of the dashboard. Only available
Expand Down Expand Up @@ -3411,6 +3419,8 @@ components:
$ref: '#/components/schemas/LogQueryDefinition'
security_query:
$ref: '#/components/schemas/LogQueryDefinition'
sort:
$ref: '#/components/schemas/WidgetSortBy'
type: object
GraphSnapshot:
description: Object representing a graph snapshot.
Expand All @@ -3431,6 +3441,14 @@ components:
example: https://app.datadoghq.com/s/f12345678/aaa-bbb-ccc
type: string
type: object
GroupType:
description: Set the sort type to group.
enum:
- group
example: group
type: string
x-enum-varnames:
- GROUP
GroupWidgetDefinition:
description: The groups widget allows you to keep similar graphs together on
your timeboard. Each group has a custom header, can hold one to many graphs,
Expand Down Expand Up @@ -16392,6 +16410,8 @@ components:
$ref: '#/components/schemas/LogQueryDefinition'
security_query:
$ref: '#/components/schemas/LogQueryDefinition'
sort:
$ref: '#/components/schemas/WidgetSortBy'
type: object
TagToHosts:
description: In this object, the key is the tag, the value is a list of host
Expand Down Expand Up @@ -16728,6 +16748,8 @@ components:
$ref: '#/components/schemas/LogQueryDefinition'
security_query:
$ref: '#/components/schemas/LogQueryDefinition'
sort:
$ref: '#/components/schemas/WidgetSortBy'
style:
$ref: '#/components/schemas/WidgetRequestStyle'
type: object
Expand Down Expand Up @@ -20939,6 +20961,24 @@ components:
order:
$ref: '#/components/schemas/QuerySortOrder'
type: object
WidgetFormulaSort:
description: The formula to sort the widget by.
properties:
index:
description: The index of the formula to sort by.
example: 0
format: int64
minimum: 0
type: integer
order:
$ref: '#/components/schemas/WidgetSort'
type:
$ref: '#/components/schemas/FormulaType'
required:
- type
- index
- order
type: object
WidgetFormulaStyle:
description: Styling options for widget formulas.
properties:
Expand All @@ -20953,6 +20993,22 @@ components:
format: int64
type: integer
type: object
WidgetGroupSort:
description: The group to sort the widget by.
properties:
name:
description: The name of the group.
example: group_name
type: string
order:
$ref: '#/components/schemas/WidgetSort'
type:
$ref: '#/components/schemas/GroupType'
required:
- type
- name
- order
type: object
WidgetGrouping:
description: The kind of grouping to use.
enum:
Expand Down Expand Up @@ -21328,6 +21384,25 @@ components:
x-enum-varnames:
- ASCENDING
- DESCENDING
WidgetSortBy:
description: The controls for sorting the widget.
properties:
count:
description: The number of items to limit the widget to.
format: int64
minimum: 0
type: integer
order_by:
description: The array of items to sort the widget by in order.
items:
$ref: '#/components/schemas/WidgetSortOrderBy'
type: array
type: object
WidgetSortOrderBy:
description: The item to sort the widget by.
oneOf:
- $ref: '#/components/schemas/WidgetFormulaSort'
- $ref: '#/components/schemas/WidgetGroupSort'
WidgetStyle:
description: Widget style definition.
properties:
Expand Down
64 changes: 64 additions & 0 deletions api/datadogV1/model_formula_type.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
// 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 datadogV1

import (
"fmt"

"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
)

// FormulaType Set the sort type to formula.
type FormulaType string

// List of FormulaType.
const (
FORMULATYPE_FORMULA FormulaType = "formula"
)

var allowedFormulaTypeEnumValues = []FormulaType{
FORMULATYPE_FORMULA,
}

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

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

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

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

// Ptr returns reference to FormulaType value.
func (v FormulaType) Ptr() *FormulaType {
return &v
}
40 changes: 39 additions & 1 deletion api/datadogV1/model_geomap_widget_request.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ type GeomapWidgetRequest struct {
RumQuery *LogQueryDefinition `json:"rum_query,omitempty"`
// The log query.
SecurityQuery *LogQueryDefinition `json:"security_query,omitempty"`
// The controls for sorting the widget.
Sort *WidgetSortBy `json:"sort,omitempty"`
// UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct
UnparsedObject map[string]interface{} `json:"-"`
AdditionalProperties map[string]interface{}
Expand Down Expand Up @@ -302,6 +304,34 @@ func (o *GeomapWidgetRequest) SetSecurityQuery(v LogQueryDefinition) {
o.SecurityQuery = &v
}

// GetSort returns the Sort field value if set, zero value otherwise.
func (o *GeomapWidgetRequest) GetSort() WidgetSortBy {
if o == nil || o.Sort == nil {
var ret WidgetSortBy
return ret
}
return *o.Sort
}

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

// HasSort returns a boolean if a field has been set.
func (o *GeomapWidgetRequest) HasSort() bool {
return o != nil && o.Sort != nil
}

// SetSort gets a reference to the given WidgetSortBy and assigns it to the Sort field.
func (o *GeomapWidgetRequest) SetSort(v WidgetSortBy) {
o.Sort = &v
}

// MarshalJSON serializes the struct using spec logic.
func (o GeomapWidgetRequest) MarshalJSON() ([]byte, error) {
toSerialize := map[string]interface{}{}
Expand Down Expand Up @@ -335,6 +365,9 @@ func (o GeomapWidgetRequest) MarshalJSON() ([]byte, error) {
if o.SecurityQuery != nil {
toSerialize["security_query"] = o.SecurityQuery
}
if o.Sort != nil {
toSerialize["sort"] = o.Sort
}

for key, value := range o.AdditionalProperties {
toSerialize[key] = value
Expand All @@ -354,13 +387,14 @@ func (o *GeomapWidgetRequest) UnmarshalJSON(bytes []byte) (err error) {
ResponseFormat *FormulaAndFunctionResponseFormat `json:"response_format,omitempty"`
RumQuery *LogQueryDefinition `json:"rum_query,omitempty"`
SecurityQuery *LogQueryDefinition `json:"security_query,omitempty"`
Sort *WidgetSortBy `json:"sort,omitempty"`
}{}
if err = datadog.Unmarshal(bytes, &all); err != nil {
return datadog.Unmarshal(bytes, &o.UnparsedObject)
}
additionalProperties := make(map[string]interface{})
if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil {
datadog.DeleteKeys(additionalProperties, &[]string{"columns", "formulas", "log_query", "q", "queries", "query", "response_format", "rum_query", "security_query"})
datadog.DeleteKeys(additionalProperties, &[]string{"columns", "formulas", "log_query", "q", "queries", "query", "response_format", "rum_query", "security_query", "sort"})
} else {
return err
}
Expand Down Expand Up @@ -391,6 +425,10 @@ func (o *GeomapWidgetRequest) UnmarshalJSON(bytes []byte) (err error) {
hasInvalidField = true
}
o.SecurityQuery = all.SecurityQuery
if all.Sort != nil && all.Sort.UnparsedObject != nil && o.UnparsedObject == nil {
hasInvalidField = true
}
o.Sort = all.Sort

if len(additionalProperties) > 0 {
o.AdditionalProperties = additionalProperties
Expand Down
64 changes: 64 additions & 0 deletions api/datadogV1/model_group_type.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
// 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 datadogV1

import (
"fmt"

"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
)

// GroupType Set the sort type to group.
type GroupType string

// List of GroupType.
const (
GROUPTYPE_GROUP GroupType = "group"
)

var allowedGroupTypeEnumValues = []GroupType{
GROUPTYPE_GROUP,
}

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

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

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

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

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

0 comments on commit d64078b

Please sign in to comment.