Skip to content
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
78 changes: 78 additions & 0 deletions .generator/schemas/v1/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1530,6 +1530,72 @@ components:
- layout_type
- widgets
type: object
DashboardAvailableValuesEventsDataSource:
description: The events-based data source for the query.
enum:
- spans
- logs
- rum
example: spans
type: string
x-enum-varnames:
- SPANS
- LOGS
- RUM
DashboardAvailableValuesEventsQuery:
additionalProperties: false
description: Query for available values using an events-based data source (spans, logs, or rum).
properties:
data_source:
$ref: "#/components/schemas/DashboardAvailableValuesEventsDataSource"
group_by:
description: The fields to group by in the query.
items:
$ref: "#/components/schemas/DashboardAvailableValuesEventsQueryGroupByItems"
type: array
search:
$ref: "#/components/schemas/DashboardAvailableValuesEventsQuerySearch"
required:
- data_source
- search
- group_by
type: object
DashboardAvailableValuesEventsQueryGroupByItems:
additionalProperties: false
description: A field to group by in the available values query.
properties:
facet:
description: The facet to group by.
example: ""
type: string
required:
- facet
type: object
DashboardAvailableValuesEventsQuerySearch:
additionalProperties: false
description: The search filter for the query.
properties:
query:
description: The search query string.
example: ""
type: string
required:
- query
type: object
DashboardAvailableValuesMetricsQuery:
additionalProperties: false
description: Query for available values using the metrics data source.
properties:
data_source:
$ref: "#/components/schemas/FormulaAndFunctionMetricDataSource"
query:
description: The metrics query string.
example: ""
type: string
required:
- data_source
- query
type: object
DashboardBulkActionData:
description: Dashboard bulk action request data.
example: {"id": "123-abc-456", "type": "dashboard"}
Expand Down Expand Up @@ -1800,6 +1866,13 @@ components:
type: string
nullable: true
type: array
available_values_query:
$ref: "#/components/schemas/DashboardTemplateVariableAvailableValuesQuery"
data_source_mappings:
additionalProperties:
type: string
description: A mapping from data source type to the variable value to use for that data source.
type: object
default:
deprecated: true
description: (deprecated) The default value for the template variable on dashboard load. Cannot be used in conjunction with `defaults`.
Expand Down Expand Up @@ -1831,6 +1904,11 @@ components:
required:
- name
type: object
DashboardTemplateVariableAvailableValuesQuery:
description: A query that dynamically computes the list of values available for this template variable.
oneOf:
- $ref: "#/components/schemas/DashboardAvailableValuesEventsQuery"
- $ref: "#/components/schemas/DashboardAvailableValuesMetricsQuery"
DashboardTemplateVariablePreset:
description: Template variables saved views.
properties:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
// 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"
)

// DashboardAvailableValuesEventsDataSource The events-based data source for the query.
type DashboardAvailableValuesEventsDataSource string

// List of DashboardAvailableValuesEventsDataSource.
const (
DASHBOARDAVAILABLEVALUESEVENTSDATASOURCE_SPANS DashboardAvailableValuesEventsDataSource = "spans"
DASHBOARDAVAILABLEVALUESEVENTSDATASOURCE_LOGS DashboardAvailableValuesEventsDataSource = "logs"
DASHBOARDAVAILABLEVALUESEVENTSDATASOURCE_RUM DashboardAvailableValuesEventsDataSource = "rum"
)

var allowedDashboardAvailableValuesEventsDataSourceEnumValues = []DashboardAvailableValuesEventsDataSource{
DASHBOARDAVAILABLEVALUESEVENTSDATASOURCE_SPANS,
DASHBOARDAVAILABLEVALUESEVENTSDATASOURCE_LOGS,
DASHBOARDAVAILABLEVALUESEVENTSDATASOURCE_RUM,
}

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

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

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

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

// Ptr returns reference to DashboardAvailableValuesEventsDataSource value.
func (v DashboardAvailableValuesEventsDataSource) Ptr() *DashboardAvailableValuesEventsDataSource {
return &v
}
163 changes: 163 additions & 0 deletions api/datadogV1/model_dashboard_available_values_events_query.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,163 @@
// 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"
)

// DashboardAvailableValuesEventsQuery Query for available values using an events-based data source (spans, logs, or rum).
type DashboardAvailableValuesEventsQuery struct {
// The events-based data source for the query.
DataSource DashboardAvailableValuesEventsDataSource `json:"data_source"`
// The fields to group by in the query.
GroupBy []DashboardAvailableValuesEventsQueryGroupByItems `json:"group_by"`
// The search filter for the query.
Search DashboardAvailableValuesEventsQuerySearch `json:"search"`
// UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct
UnparsedObject map[string]interface{} `json:"-"`
}

// NewDashboardAvailableValuesEventsQuery instantiates a new DashboardAvailableValuesEventsQuery object.
// This constructor will assign default values to properties that have it defined,
// and makes sure properties required by API are set, but the set of arguments
// will change when the set of required properties is changed.
func NewDashboardAvailableValuesEventsQuery(dataSource DashboardAvailableValuesEventsDataSource, groupBy []DashboardAvailableValuesEventsQueryGroupByItems, search DashboardAvailableValuesEventsQuerySearch) *DashboardAvailableValuesEventsQuery {
this := DashboardAvailableValuesEventsQuery{}
this.DataSource = dataSource
this.GroupBy = groupBy
this.Search = search
return &this
}

// NewDashboardAvailableValuesEventsQueryWithDefaults instantiates a new DashboardAvailableValuesEventsQuery object.
// This constructor will only assign default values to properties that have it defined,
// but it doesn't guarantee that properties required by API are set.
func NewDashboardAvailableValuesEventsQueryWithDefaults() *DashboardAvailableValuesEventsQuery {
this := DashboardAvailableValuesEventsQuery{}
return &this
}

// GetDataSource returns the DataSource field value.
func (o *DashboardAvailableValuesEventsQuery) GetDataSource() DashboardAvailableValuesEventsDataSource {
if o == nil {
var ret DashboardAvailableValuesEventsDataSource
return ret
}
return o.DataSource
}

// GetDataSourceOk returns a tuple with the DataSource field value
// and a boolean to check if the value has been set.
func (o *DashboardAvailableValuesEventsQuery) GetDataSourceOk() (*DashboardAvailableValuesEventsDataSource, bool) {
if o == nil {
return nil, false
}
return &o.DataSource, true
}

// SetDataSource sets field value.
func (o *DashboardAvailableValuesEventsQuery) SetDataSource(v DashboardAvailableValuesEventsDataSource) {
o.DataSource = v
}

// GetGroupBy returns the GroupBy field value.
func (o *DashboardAvailableValuesEventsQuery) GetGroupBy() []DashboardAvailableValuesEventsQueryGroupByItems {
if o == nil {
var ret []DashboardAvailableValuesEventsQueryGroupByItems
return ret
}
return o.GroupBy
}

// GetGroupByOk returns a tuple with the GroupBy field value
// and a boolean to check if the value has been set.
func (o *DashboardAvailableValuesEventsQuery) GetGroupByOk() (*[]DashboardAvailableValuesEventsQueryGroupByItems, bool) {
if o == nil {
return nil, false
}
return &o.GroupBy, true
}

// SetGroupBy sets field value.
func (o *DashboardAvailableValuesEventsQuery) SetGroupBy(v []DashboardAvailableValuesEventsQueryGroupByItems) {
o.GroupBy = v
}

// GetSearch returns the Search field value.
func (o *DashboardAvailableValuesEventsQuery) GetSearch() DashboardAvailableValuesEventsQuerySearch {
if o == nil {
var ret DashboardAvailableValuesEventsQuerySearch
return ret
}
return o.Search
}

// GetSearchOk returns a tuple with the Search field value
// and a boolean to check if the value has been set.
func (o *DashboardAvailableValuesEventsQuery) GetSearchOk() (*DashboardAvailableValuesEventsQuerySearch, bool) {
if o == nil {
return nil, false
}
return &o.Search, true
}

// SetSearch sets field value.
func (o *DashboardAvailableValuesEventsQuery) SetSearch(v DashboardAvailableValuesEventsQuerySearch) {
o.Search = v
}

// MarshalJSON serializes the struct using spec logic.
func (o DashboardAvailableValuesEventsQuery) MarshalJSON() ([]byte, error) {
toSerialize := map[string]interface{}{}
if o.UnparsedObject != nil {
return datadog.Marshal(o.UnparsedObject)
}
toSerialize["data_source"] = o.DataSource
toSerialize["group_by"] = o.GroupBy
toSerialize["search"] = o.Search
return datadog.Marshal(toSerialize)
}

// UnmarshalJSON deserializes the given payload.
func (o *DashboardAvailableValuesEventsQuery) UnmarshalJSON(bytes []byte) (err error) {
all := struct {
DataSource *DashboardAvailableValuesEventsDataSource `json:"data_source"`
GroupBy *[]DashboardAvailableValuesEventsQueryGroupByItems `json:"group_by"`
Search *DashboardAvailableValuesEventsQuerySearch `json:"search"`
}{}
if err = datadog.Unmarshal(bytes, &all); err != nil {
return datadog.Unmarshal(bytes, &o.UnparsedObject)
}
if all.DataSource == nil {
return fmt.Errorf("required field data_source missing")
}
if all.GroupBy == nil {
return fmt.Errorf("required field group_by missing")
}
if all.Search == nil {
return fmt.Errorf("required field search missing")
}

hasInvalidField := false
if !all.DataSource.IsValid() {
hasInvalidField = true
} else {
o.DataSource = *all.DataSource
}
o.GroupBy = *all.GroupBy
if all.Search.UnparsedObject != nil && o.UnparsedObject == nil {
hasInvalidField = true
}
o.Search = *all.Search

if hasInvalidField {
return datadog.Unmarshal(bytes, &o.UnparsedObject)
}

return nil
}
Loading
Loading