-
Notifications
You must be signed in to change notification settings - Fork 5
/
TypeKubernetesProtectionSourceEnum.go
78 lines (68 loc) · 2.34 KB
/
TypeKubernetesProtectionSourceEnum.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
// Copyright 2019 Cohesity Inc.
package models
import(
"encoding/json"
)
/**
* Type definition for TypeKubernetesProtectionSourceEnum enum
*/
type TypeKubernetesProtectionSourceEnum int
/**
* Value collection for TypeKubernetesProtectionSourceEnum enum
*/
const (
TypeKubernetesProtectionSource_KCLUSTER TypeKubernetesProtectionSourceEnum = 1 + iota
TypeKubernetesProtectionSource_KNAMESPACE
TypeKubernetesProtectionSource_KSERVICE
)
func (r TypeKubernetesProtectionSourceEnum) MarshalJSON() ([]byte, error) {
s := TypeKubernetesProtectionSourceEnumToValue(r)
return json.Marshal(s)
}
func (r *TypeKubernetesProtectionSourceEnum) UnmarshalJSON(data []byte) error {
var s string
json.Unmarshal(data, &s)
v := TypeKubernetesProtectionSourceEnumFromValue(s)
*r = v
return nil
}
/**
* Converts TypeKubernetesProtectionSourceEnum to its string representation
*/
func TypeKubernetesProtectionSourceEnumToValue(typeKubernetesProtectionSourceEnum TypeKubernetesProtectionSourceEnum) string {
switch typeKubernetesProtectionSourceEnum {
case TypeKubernetesProtectionSource_KCLUSTER:
return "kCluster"
case TypeKubernetesProtectionSource_KNAMESPACE:
return "kNamespace"
case TypeKubernetesProtectionSource_KSERVICE:
return "kService"
default:
return "kCluster"
}
}
/**
* Converts TypeKubernetesProtectionSourceEnum Array to its string Array representation
*/
func TypeKubernetesProtectionSourceEnumArrayToValue(typeKubernetesProtectionSourceEnum []TypeKubernetesProtectionSourceEnum) []string {
convArray := make([]string,len( typeKubernetesProtectionSourceEnum))
for i:=0; i<len(typeKubernetesProtectionSourceEnum);i++ {
convArray[i] = TypeKubernetesProtectionSourceEnumToValue(typeKubernetesProtectionSourceEnum[i])
}
return convArray
}
/**
* Converts given value to its enum representation
*/
func TypeKubernetesProtectionSourceEnumFromValue(value string) TypeKubernetesProtectionSourceEnum {
switch value {
case "kCluster":
return TypeKubernetesProtectionSource_KCLUSTER
case "kNamespace":
return TypeKubernetesProtectionSource_KNAMESPACE
case "kService":
return TypeKubernetesProtectionSource_KSERVICE
default:
return TypeKubernetesProtectionSource_KCLUSTER
}
}