-
Notifications
You must be signed in to change notification settings - Fork 42
/
constants.go
127 lines (105 loc) · 3.07 KB
/
constants.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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
package subscriptions
import "strings"
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See NOTICE.txt in the project root for license information.
type AcceptOwnership string
const (
AcceptOwnershipCompleted AcceptOwnership = "Completed"
AcceptOwnershipExpired AcceptOwnership = "Expired"
AcceptOwnershipPending AcceptOwnership = "Pending"
)
func PossibleValuesForAcceptOwnership() []string {
return []string{
string(AcceptOwnershipCompleted),
string(AcceptOwnershipExpired),
string(AcceptOwnershipPending),
}
}
func parseAcceptOwnership(input string) (*AcceptOwnership, error) {
vals := map[string]AcceptOwnership{
"completed": AcceptOwnershipCompleted,
"expired": AcceptOwnershipExpired,
"pending": AcceptOwnershipPending,
}
if v, ok := vals[strings.ToLower(input)]; ok {
return &v, nil
}
// otherwise presume it's an undefined value and best-effort it
out := AcceptOwnership(input)
return &out, nil
}
type Provisioning string
const (
ProvisioningAccepted Provisioning = "Accepted"
ProvisioningPending Provisioning = "Pending"
ProvisioningSucceeded Provisioning = "Succeeded"
)
func PossibleValuesForProvisioning() []string {
return []string{
string(ProvisioningAccepted),
string(ProvisioningPending),
string(ProvisioningSucceeded),
}
}
func parseProvisioning(input string) (*Provisioning, error) {
vals := map[string]Provisioning{
"accepted": ProvisioningAccepted,
"pending": ProvisioningPending,
"succeeded": ProvisioningSucceeded,
}
if v, ok := vals[strings.ToLower(input)]; ok {
return &v, nil
}
// otherwise presume it's an undefined value and best-effort it
out := Provisioning(input)
return &out, nil
}
type ProvisioningState string
const (
ProvisioningStateAccepted ProvisioningState = "Accepted"
ProvisioningStateFailed ProvisioningState = "Failed"
ProvisioningStateSucceeded ProvisioningState = "Succeeded"
)
func PossibleValuesForProvisioningState() []string {
return []string{
string(ProvisioningStateAccepted),
string(ProvisioningStateFailed),
string(ProvisioningStateSucceeded),
}
}
func parseProvisioningState(input string) (*ProvisioningState, error) {
vals := map[string]ProvisioningState{
"accepted": ProvisioningStateAccepted,
"failed": ProvisioningStateFailed,
"succeeded": ProvisioningStateSucceeded,
}
if v, ok := vals[strings.ToLower(input)]; ok {
return &v, nil
}
// otherwise presume it's an undefined value and best-effort it
out := ProvisioningState(input)
return &out, nil
}
type Workload string
const (
WorkloadDevTest Workload = "DevTest"
WorkloadProduction Workload = "Production"
)
func PossibleValuesForWorkload() []string {
return []string{
string(WorkloadDevTest),
string(WorkloadProduction),
}
}
func parseWorkload(input string) (*Workload, error) {
vals := map[string]Workload{
"devtest": WorkloadDevTest,
"production": WorkloadProduction,
}
if v, ok := vals[strings.ToLower(input)]; ok {
return &v, nil
}
// otherwise presume it's an undefined value and best-effort it
out := Workload(input)
return &out, nil
}