-
Notifications
You must be signed in to change notification settings - Fork 5
/
Type21Enum.go
executable file
·77 lines (67 loc) · 1.57 KB
/
Type21Enum.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
package models
import(
"encoding/json"
)
/**
* Type definition for Type21Enum enum
*/
type Type21Enum int
/**
* Value collection for Type21Enum enum
*/
const (
Type21_KAZURE Type21Enum = 1 + iota
Type21_KAWS
Type21_KGCP
)
func (r Type21Enum) MarshalJSON() ([]byte, error) {
s := Type21EnumToValue(r)
return json.Marshal(s)
}
func (r *Type21Enum) UnmarshalJSON(data []byte) error {
var s string
json.Unmarshal(data, &s)
v := Type21EnumFromValue(s)
*r = v
return nil
}
/**
* Converts Type21Enum to its string representation
*/
func Type21EnumToValue(type21Enum Type21Enum) string {
switch type21Enum {
case Type21_KAZURE:
return "kAzure"
case Type21_KAWS:
return "kAws"
case Type21_KGCP:
return "kGcp"
default:
return "kAzure"
}
}
/**
* Converts Type21Enum Array to its string Array representation
*/
func Type21EnumArrayToValue(type21Enum []Type21Enum) []string {
convArray := make([]string,len( type21Enum))
for i:=0; i<len(type21Enum);i++ {
convArray[i] = Type21EnumToValue(type21Enum[i])
}
return convArray
}
/**
* Converts given value to its enum representation
*/
func Type21EnumFromValue(value string) Type21Enum {
switch value {
case "kAzure":
return Type21_KAZURE
case "kAws":
return Type21_KAWS
case "kGcp":
return Type21_KGCP
default:
return Type21_KAZURE
}
}