Merge remote-tracking branch 'origin/main' into ds-apiserver-with-configs

This commit is contained in:
Ryan McKinley
2025-07-07 10:38:32 -07:00
787 changed files with 17267 additions and 5285 deletions
@@ -13,6 +13,7 @@ package dataquery
import (
json "encoding/json"
fmt "fmt"
)
type AzureMonitorQuery struct {
@@ -835,3 +836,58 @@ type StringOrBoolOrFloat64OrSelectableValue struct {
func NewStringOrBoolOrFloat64OrSelectableValue() *StringOrBoolOrFloat64OrSelectableValue {
return &StringOrBoolOrFloat64OrSelectableValue{}
}
// MarshalJSON implements a custom JSON marshalling logic to encode `StringOrBoolOrFloat64OrSelectableValue` as JSON.
func (resource StringOrBoolOrFloat64OrSelectableValue) MarshalJSON() ([]byte, error) {
if resource.String != nil {
return json.Marshal(resource.String)
}
if resource.Bool != nil {
return json.Marshal(resource.Bool)
}
if resource.Float64 != nil {
return json.Marshal(resource.Float64)
}
if resource.SelectableValue != nil {
return json.Marshal(resource.SelectableValue)
}
return []byte("null"), nil
}
// UnmarshalJSON implements a custom JSON unmarshalling logic to decode StringOrBoolOrFloat64OrSelectableValue from JSON.
func (resource *StringOrBoolOrFloat64OrSelectableValue) UnmarshalJSON(raw []byte) error {
if raw == nil {
return nil
}
fields := make(map[string]json.RawMessage)
if err := json.Unmarshal(raw, &fields); err != nil {
return err
}
if fields["String"] != nil {
if err := json.Unmarshal(fields["String"], &resource.String); err != nil {
return fmt.Errorf("error decoding field 'String': %w", err)
}
}
if fields["Bool"] != nil {
if err := json.Unmarshal(fields["Bool"], &resource.Bool); err != nil {
return fmt.Errorf("error decoding field 'Bool': %w", err)
}
}
if fields["Float64"] != nil {
if err := json.Unmarshal(fields["Float64"], &resource.Float64); err != nil {
return fmt.Errorf("error decoding field 'Float64': %w", err)
}
}
if fields["SelectableValue"] != nil {
if err := json.Unmarshal(fields["SelectableValue"], &resource.SelectableValue); err != nil {
return fmt.Errorf("error decoding field 'SelectableValue': %w", err)
}
}
return nil
}
@@ -211,6 +211,12 @@ func NewQueryEditorProperty() *QueryEditorProperty {
}
}
type QueryEditorPropertyType string
const (
QueryEditorPropertyTypeString QueryEditorPropertyType = "string"
)
type QueryEditorArrayExpression struct {
Type QueryEditorArrayExpressionType `json:"type"`
Expressions ArrayOfQueryEditorExpressionOrArrayOfQueryEditorArrayExpression `json:"expressions"`
@@ -279,12 +285,6 @@ func NewQueryEditorOperatorValueType() *QueryEditorOperatorValueType {
return NewStringOrBoolOrInt64OrArrayOfQueryEditorOperatorType()
}
type QueryEditorPropertyType string
const (
QueryEditorPropertyTypeString QueryEditorPropertyType = "string"
)
type LogsQueryLanguage string
const (
@@ -13,6 +13,7 @@ package dataquery
import (
json "encoding/json"
fmt "fmt"
)
type BucketAggregation = DateHistogramOrHistogramOrTermsOrFiltersOrGeoHashGridOrNested
@@ -1549,6 +1550,43 @@ func NewStringOrDataqueryInlineScript() *StringOrDataqueryInlineScript {
return &StringOrDataqueryInlineScript{}
}
// MarshalJSON implements a custom JSON marshalling logic to encode `StringOrDataqueryInlineScript` as JSON.
func (resource StringOrDataqueryInlineScript) MarshalJSON() ([]byte, error) {
if resource.String != nil {
return json.Marshal(resource.String)
}
if resource.DataqueryInlineScript != nil {
return json.Marshal(resource.DataqueryInlineScript)
}
return []byte("null"), nil
}
// UnmarshalJSON implements a custom JSON unmarshalling logic to decode StringOrDataqueryInlineScript from JSON.
func (resource *StringOrDataqueryInlineScript) UnmarshalJSON(raw []byte) error {
if raw == nil {
return nil
}
fields := make(map[string]json.RawMessage)
if err := json.Unmarshal(raw, &fields); err != nil {
return err
}
if fields["String"] != nil {
if err := json.Unmarshal(fields["String"], &resource.String); err != nil {
return fmt.Errorf("error decoding field 'String': %w", err)
}
}
if fields["DataqueryInlineScript"] != nil {
if err := json.Unmarshal(fields["DataqueryInlineScript"], &resource.DataqueryInlineScript); err != nil {
return fmt.Errorf("error decoding field 'DataqueryInlineScript': %w", err)
}
}
return nil
}
type BucketScriptOrCumulativeSumOrDerivativeOrSerialDiffOrRawDataOrRawDocumentOrUniqueCountOrPercentilesOrExtendedStatsOrMinOrMaxOrSumOrAverageOrMovingAverageOrMovingFunctionOrLogsOrRateOrTopMetrics struct {
BucketScript *BucketScript `json:"BucketScript,omitempty"`
CumulativeSum *CumulativeSum `json:"CumulativeSum,omitempty"`