-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
- Loading branch information
1 parent
b511bd6
commit 3dae329
Showing
26 changed files
with
252 additions
and
108 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
// 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 ( | ||
"fmt" | ||
|
||
"github.com/goccy/go-json" | ||
) | ||
|
||
// WidgetLiveSpan The available timeframes depend on the widget you are using. | ||
type WidgetLiveSpan string | ||
|
||
// List of WidgetLiveSpan. | ||
const ( | ||
WIDGETLIVESPAN_PAST_ONE_MINUTE WidgetLiveSpan = "1m" | ||
WIDGETLIVESPAN_PAST_FIVE_MINUTES WidgetLiveSpan = "5m" | ||
WIDGETLIVESPAN_PAST_TEN_MINUTES WidgetLiveSpan = "10m" | ||
WIDGETLIVESPAN_PAST_FIFTEEN_MINUTES WidgetLiveSpan = "15m" | ||
WIDGETLIVESPAN_PAST_THIRTY_MINUTES WidgetLiveSpan = "30m" | ||
WIDGETLIVESPAN_PAST_ONE_HOUR WidgetLiveSpan = "1h" | ||
WIDGETLIVESPAN_PAST_FOUR_HOURS WidgetLiveSpan = "4h" | ||
WIDGETLIVESPAN_PAST_ONE_DAY WidgetLiveSpan = "1d" | ||
WIDGETLIVESPAN_PAST_TWO_DAYS WidgetLiveSpan = "2d" | ||
WIDGETLIVESPAN_PAST_ONE_WEEK WidgetLiveSpan = "1w" | ||
WIDGETLIVESPAN_PAST_ONE_MONTH WidgetLiveSpan = "1mo" | ||
WIDGETLIVESPAN_PAST_THREE_MONTHS WidgetLiveSpan = "3mo" | ||
WIDGETLIVESPAN_PAST_SIX_MONTHS WidgetLiveSpan = "6mo" | ||
WIDGETLIVESPAN_PAST_ONE_YEAR WidgetLiveSpan = "1y" | ||
WIDGETLIVESPAN_ALERT WidgetLiveSpan = "alert" | ||
) | ||
|
||
var allowedWidgetLiveSpanEnumValues = []WidgetLiveSpan{ | ||
WIDGETLIVESPAN_PAST_ONE_MINUTE, | ||
WIDGETLIVESPAN_PAST_FIVE_MINUTES, | ||
WIDGETLIVESPAN_PAST_TEN_MINUTES, | ||
WIDGETLIVESPAN_PAST_FIFTEEN_MINUTES, | ||
WIDGETLIVESPAN_PAST_THIRTY_MINUTES, | ||
WIDGETLIVESPAN_PAST_ONE_HOUR, | ||
WIDGETLIVESPAN_PAST_FOUR_HOURS, | ||
WIDGETLIVESPAN_PAST_ONE_DAY, | ||
WIDGETLIVESPAN_PAST_TWO_DAYS, | ||
WIDGETLIVESPAN_PAST_ONE_WEEK, | ||
WIDGETLIVESPAN_PAST_ONE_MONTH, | ||
WIDGETLIVESPAN_PAST_THREE_MONTHS, | ||
WIDGETLIVESPAN_PAST_SIX_MONTHS, | ||
WIDGETLIVESPAN_PAST_ONE_YEAR, | ||
WIDGETLIVESPAN_ALERT, | ||
} | ||
|
||
// GetAllowedValues reeturns the list of possible values. | ||
func (v *WidgetLiveSpan) GetAllowedValues() []WidgetLiveSpan { | ||
return allowedWidgetLiveSpanEnumValues | ||
} | ||
|
||
// UnmarshalJSON deserializes the given payload. | ||
func (v *WidgetLiveSpan) UnmarshalJSON(src []byte) error { | ||
var value string | ||
err := json.Unmarshal(src, &value) | ||
if err != nil { | ||
return err | ||
} | ||
*v = WidgetLiveSpan(value) | ||
return nil | ||
} | ||
|
||
// NewWidgetLiveSpanFromValue returns a pointer to a valid WidgetLiveSpan | ||
// for the value passed as argument, or an error if the value passed is not allowed by the enum. | ||
func NewWidgetLiveSpanFromValue(v string) (*WidgetLiveSpan, error) { | ||
ev := WidgetLiveSpan(v) | ||
if ev.IsValid() { | ||
return &ev, nil | ||
} | ||
return nil, fmt.Errorf("invalid value '%v' for WidgetLiveSpan: valid values are %v", v, allowedWidgetLiveSpanEnumValues) | ||
} | ||
|
||
// IsValid return true if the value is valid for the enum, false otherwise. | ||
func (v WidgetLiveSpan) IsValid() bool { | ||
for _, existing := range allowedWidgetLiveSpanEnumValues { | ||
if existing == v { | ||
return true | ||
} | ||
} | ||
return false | ||
} | ||
|
||
// Ptr returns reference to WidgetLiveSpan value. | ||
func (v WidgetLiveSpan) Ptr() *WidgetLiveSpan { | ||
return &v | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...narios/v1/Feature_Dashboards/Scenario_Create_a_new_dashboard_with_powerpack_widget.freeze
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
2023-10-11T18:44:47.026Z | ||
2023-10-24T18:32:08.933Z |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...Scenarios/v2/Feature_Powerpack/Scenario_Create_a_new_powerpack_returns_OK_response.freeze
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
2023-10-11T15:48:55.126Z | ||
2023-10-24T18:32:10.926Z |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...TestScenarios/v2/Feature_Powerpack/Scenario_Delete_a_powerpack_returns_OK_response.freeze
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
2023-10-11T15:48:55.488Z | ||
2023-10-24T18:32:12.418Z |
Oops, something went wrong.