-
Notifications
You must be signed in to change notification settings - Fork 54
/
model_synthetics_device_id.go
86 lines (75 loc) · 3.09 KB
/
model_synthetics_device_id.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
// 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"
)
// SyntheticsDeviceID The device ID.
type SyntheticsDeviceID string
// List of SyntheticsDeviceID.
const (
SYNTHETICSDEVICEID_LAPTOP_LARGE SyntheticsDeviceID = "laptop_large"
SYNTHETICSDEVICEID_TABLET SyntheticsDeviceID = "tablet"
SYNTHETICSDEVICEID_MOBILE_SMALL SyntheticsDeviceID = "mobile_small"
SYNTHETICSDEVICEID_CHROME_LAPTOP_LARGE SyntheticsDeviceID = "chrome.laptop_large"
SYNTHETICSDEVICEID_CHROME_TABLET SyntheticsDeviceID = "chrome.tablet"
SYNTHETICSDEVICEID_CHROME_MOBILE_SMALL SyntheticsDeviceID = "chrome.mobile_small"
SYNTHETICSDEVICEID_FIREFOX_LAPTOP_LARGE SyntheticsDeviceID = "firefox.laptop_large"
SYNTHETICSDEVICEID_FIREFOX_TABLET SyntheticsDeviceID = "firefox.tablet"
SYNTHETICSDEVICEID_FIREFOX_MOBILE_SMALL SyntheticsDeviceID = "firefox.mobile_small"
SYNTHETICSDEVICEID_EDGE_LAPTOP_LARGE SyntheticsDeviceID = "edge.laptop_large"
SYNTHETICSDEVICEID_EDGE_TABLET SyntheticsDeviceID = "edge.tablet"
SYNTHETICSDEVICEID_EDGE_MOBILE_SMALL SyntheticsDeviceID = "edge.mobile_small"
)
var allowedSyntheticsDeviceIDEnumValues = []SyntheticsDeviceID{
SYNTHETICSDEVICEID_LAPTOP_LARGE,
SYNTHETICSDEVICEID_TABLET,
SYNTHETICSDEVICEID_MOBILE_SMALL,
SYNTHETICSDEVICEID_CHROME_LAPTOP_LARGE,
SYNTHETICSDEVICEID_CHROME_TABLET,
SYNTHETICSDEVICEID_CHROME_MOBILE_SMALL,
SYNTHETICSDEVICEID_FIREFOX_LAPTOP_LARGE,
SYNTHETICSDEVICEID_FIREFOX_TABLET,
SYNTHETICSDEVICEID_FIREFOX_MOBILE_SMALL,
SYNTHETICSDEVICEID_EDGE_LAPTOP_LARGE,
SYNTHETICSDEVICEID_EDGE_TABLET,
SYNTHETICSDEVICEID_EDGE_MOBILE_SMALL,
}
// GetAllowedValues reeturns the list of possible values.
func (v *SyntheticsDeviceID) GetAllowedValues() []SyntheticsDeviceID {
return allowedSyntheticsDeviceIDEnumValues
}
// UnmarshalJSON deserializes the given payload.
func (v *SyntheticsDeviceID) UnmarshalJSON(src []byte) error {
var value string
err := datadog.Unmarshal(src, &value)
if err != nil {
return err
}
*v = SyntheticsDeviceID(value)
return nil
}
// NewSyntheticsDeviceIDFromValue returns a pointer to a valid SyntheticsDeviceID
// for the value passed as argument, or an error if the value passed is not allowed by the enum.
func NewSyntheticsDeviceIDFromValue(v string) (*SyntheticsDeviceID, error) {
ev := SyntheticsDeviceID(v)
if ev.IsValid() {
return &ev, nil
}
return nil, fmt.Errorf("invalid value '%v' for SyntheticsDeviceID: valid values are %v", v, allowedSyntheticsDeviceIDEnumValues)
}
// IsValid return true if the value is valid for the enum, false otherwise.
func (v SyntheticsDeviceID) IsValid() bool {
for _, existing := range allowedSyntheticsDeviceIDEnumValues {
if existing == v {
return true
}
}
return false
}
// Ptr returns reference to SyntheticsDeviceID value.
func (v SyntheticsDeviceID) Ptr() *SyntheticsDeviceID {
return &v
}