-
Notifications
You must be signed in to change notification settings - Fork 40
/
constants.go
204 lines (172 loc) · 5.67 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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
package crossregionrestore
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 CopyOptions string
const (
CopyOptionsCreateCopy CopyOptions = "CreateCopy"
CopyOptionsFailOnConflict CopyOptions = "FailOnConflict"
CopyOptionsInvalid CopyOptions = "Invalid"
CopyOptionsOverwrite CopyOptions = "Overwrite"
CopyOptionsSkip CopyOptions = "Skip"
)
func PossibleValuesForCopyOptions() []string {
return []string{
string(CopyOptionsCreateCopy),
string(CopyOptionsFailOnConflict),
string(CopyOptionsInvalid),
string(CopyOptionsOverwrite),
string(CopyOptionsSkip),
}
}
func parseCopyOptions(input string) (*CopyOptions, error) {
vals := map[string]CopyOptions{
"createcopy": CopyOptionsCreateCopy,
"failonconflict": CopyOptionsFailOnConflict,
"invalid": CopyOptionsInvalid,
"overwrite": CopyOptionsOverwrite,
"skip": CopyOptionsSkip,
}
if v, ok := vals[strings.ToLower(input)]; ok {
return &v, nil
}
// otherwise presume it's an undefined value and best-effort it
out := CopyOptions(input)
return &out, nil
}
type OverwriteOptions string
const (
OverwriteOptionsFailOnConflict OverwriteOptions = "FailOnConflict"
OverwriteOptionsInvalid OverwriteOptions = "Invalid"
OverwriteOptionsOverwrite OverwriteOptions = "Overwrite"
)
func PossibleValuesForOverwriteOptions() []string {
return []string{
string(OverwriteOptionsFailOnConflict),
string(OverwriteOptionsInvalid),
string(OverwriteOptionsOverwrite),
}
}
func parseOverwriteOptions(input string) (*OverwriteOptions, error) {
vals := map[string]OverwriteOptions{
"failonconflict": OverwriteOptionsFailOnConflict,
"invalid": OverwriteOptionsInvalid,
"overwrite": OverwriteOptionsOverwrite,
}
if v, ok := vals[strings.ToLower(input)]; ok {
return &v, nil
}
// otherwise presume it's an undefined value and best-effort it
out := OverwriteOptions(input)
return &out, nil
}
type RecoveryMode string
const (
RecoveryModeFileRecovery RecoveryMode = "FileRecovery"
RecoveryModeInvalid RecoveryMode = "Invalid"
RecoveryModeWorkloadRecovery RecoveryMode = "WorkloadRecovery"
)
func PossibleValuesForRecoveryMode() []string {
return []string{
string(RecoveryModeFileRecovery),
string(RecoveryModeInvalid),
string(RecoveryModeWorkloadRecovery),
}
}
func parseRecoveryMode(input string) (*RecoveryMode, error) {
vals := map[string]RecoveryMode{
"filerecovery": RecoveryModeFileRecovery,
"invalid": RecoveryModeInvalid,
"workloadrecovery": RecoveryModeWorkloadRecovery,
}
if v, ok := vals[strings.ToLower(input)]; ok {
return &v, nil
}
// otherwise presume it's an undefined value and best-effort it
out := RecoveryMode(input)
return &out, nil
}
type RecoveryType string
const (
RecoveryTypeAlternateLocation RecoveryType = "AlternateLocation"
RecoveryTypeInvalid RecoveryType = "Invalid"
RecoveryTypeOffline RecoveryType = "Offline"
RecoveryTypeOriginalLocation RecoveryType = "OriginalLocation"
RecoveryTypeRestoreDisks RecoveryType = "RestoreDisks"
)
func PossibleValuesForRecoveryType() []string {
return []string{
string(RecoveryTypeAlternateLocation),
string(RecoveryTypeInvalid),
string(RecoveryTypeOffline),
string(RecoveryTypeOriginalLocation),
string(RecoveryTypeRestoreDisks),
}
}
func parseRecoveryType(input string) (*RecoveryType, error) {
vals := map[string]RecoveryType{
"alternatelocation": RecoveryTypeAlternateLocation,
"invalid": RecoveryTypeInvalid,
"offline": RecoveryTypeOffline,
"originallocation": RecoveryTypeOriginalLocation,
"restoredisks": RecoveryTypeRestoreDisks,
}
if v, ok := vals[strings.ToLower(input)]; ok {
return &v, nil
}
// otherwise presume it's an undefined value and best-effort it
out := RecoveryType(input)
return &out, nil
}
type RestoreRequestType string
const (
RestoreRequestTypeFullShareRestore RestoreRequestType = "FullShareRestore"
RestoreRequestTypeInvalid RestoreRequestType = "Invalid"
RestoreRequestTypeItemLevelRestore RestoreRequestType = "ItemLevelRestore"
)
func PossibleValuesForRestoreRequestType() []string {
return []string{
string(RestoreRequestTypeFullShareRestore),
string(RestoreRequestTypeInvalid),
string(RestoreRequestTypeItemLevelRestore),
}
}
func parseRestoreRequestType(input string) (*RestoreRequestType, error) {
vals := map[string]RestoreRequestType{
"fullsharerestore": RestoreRequestTypeFullShareRestore,
"invalid": RestoreRequestTypeInvalid,
"itemlevelrestore": RestoreRequestTypeItemLevelRestore,
}
if v, ok := vals[strings.ToLower(input)]; ok {
return &v, nil
}
// otherwise presume it's an undefined value and best-effort it
out := RestoreRequestType(input)
return &out, nil
}
type SQLDataDirectoryType string
const (
SQLDataDirectoryTypeData SQLDataDirectoryType = "Data"
SQLDataDirectoryTypeInvalid SQLDataDirectoryType = "Invalid"
SQLDataDirectoryTypeLog SQLDataDirectoryType = "Log"
)
func PossibleValuesForSQLDataDirectoryType() []string {
return []string{
string(SQLDataDirectoryTypeData),
string(SQLDataDirectoryTypeInvalid),
string(SQLDataDirectoryTypeLog),
}
}
func parseSQLDataDirectoryType(input string) (*SQLDataDirectoryType, error) {
vals := map[string]SQLDataDirectoryType{
"data": SQLDataDirectoryTypeData,
"invalid": SQLDataDirectoryTypeInvalid,
"log": SQLDataDirectoryTypeLog,
}
if v, ok := vals[strings.ToLower(input)]; ok {
return &v, nil
}
// otherwise presume it's an undefined value and best-effort it
out := SQLDataDirectoryType(input)
return &out, nil
}