-
Notifications
You must be signed in to change notification settings - Fork 40
/
constants.go
49 lines (42 loc) · 1.36 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
package tableserviceproperties
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 AllowedMethods string
const (
AllowedMethodsDELETE AllowedMethods = "DELETE"
AllowedMethodsGET AllowedMethods = "GET"
AllowedMethodsHEAD AllowedMethods = "HEAD"
AllowedMethodsMERGE AllowedMethods = "MERGE"
AllowedMethodsOPTIONS AllowedMethods = "OPTIONS"
AllowedMethodsPOST AllowedMethods = "POST"
AllowedMethodsPUT AllowedMethods = "PUT"
)
func PossibleValuesForAllowedMethods() []string {
return []string{
string(AllowedMethodsDELETE),
string(AllowedMethodsGET),
string(AllowedMethodsHEAD),
string(AllowedMethodsMERGE),
string(AllowedMethodsOPTIONS),
string(AllowedMethodsPOST),
string(AllowedMethodsPUT),
}
}
func parseAllowedMethods(input string) (*AllowedMethods, error) {
vals := map[string]AllowedMethods{
"delete": AllowedMethodsDELETE,
"get": AllowedMethodsGET,
"head": AllowedMethodsHEAD,
"merge": AllowedMethodsMERGE,
"options": AllowedMethodsOPTIONS,
"post": AllowedMethodsPOST,
"put": AllowedMethodsPUT,
}
if v, ok := vals[strings.ToLower(input)]; ok {
return &v, nil
}
// otherwise presume it's an undefined value and best-effort it
out := AllowedMethods(input)
return &out, nil
}