-
Notifications
You must be signed in to change notification settings - Fork 5
/
QosTypeEnum.go
executable file
·73 lines (63 loc) · 1.48 KB
/
QosTypeEnum.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
// Copyright 2019 Cohesity Inc.
package models
import(
"encoding/json"
)
/**
* Type definition for QosTypeEnum enum
*/
type QosTypeEnum int
/**
* Value collection for QosTypeEnum enum
*/
const (
QosType_KBACKUPHDD QosTypeEnum = 1 + iota
QosType_KBACKUPSSD
)
func (r QosTypeEnum) MarshalJSON() ([]byte, error) {
s := QosTypeEnumToValue(r)
return json.Marshal(s)
}
func (r *QosTypeEnum) UnmarshalJSON(data []byte) error {
var s string
json.Unmarshal(data, &s)
v := QosTypeEnumFromValue(s)
*r = v
return nil
}
/**
* Converts QosTypeEnum to its string representation
*/
func QosTypeEnumToValue(qosTypeEnum QosTypeEnum) string {
switch qosTypeEnum {
case QosType_KBACKUPHDD:
return "kBackupHDD"
case QosType_KBACKUPSSD:
return "kBackupSSD"
default:
return "kBackupHDD"
}
}
/**
* Converts QosTypeEnum Array to its string Array representation
*/
func QosTypeEnumArrayToValue(qosTypeEnum []QosTypeEnum) []string {
convArray := make([]string,len( qosTypeEnum))
for i:=0; i<len(qosTypeEnum);i++ {
convArray[i] = QosTypeEnumToValue(qosTypeEnum[i])
}
return convArray
}
/**
* Converts given value to its enum representation
*/
func QosTypeEnumFromValue(value string) QosTypeEnum {
switch value {
case "kBackupHDD":
return QosType_KBACKUPHDD
case "kBackupSSD":
return QosType_KBACKUPSSD
default:
return QosType_KBACKUPHDD
}
}