/
api_resources_pools.go
58 lines (50 loc) · 1.28 KB
/
api_resources_pools.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
package apstra
import "fmt"
type PoolStatus int
type poolStatus string
const (
PoolStatusUnused = PoolStatus(iota)
PoolStatusInUse
PoolStatusDeleting
PoolStatusCreating
PoolStatusUnknown = "unknown redundancy protocol '%s'"
poolStatusUnused = poolStatus("not_in_use")
poolStatusInUse = poolStatus("in_use")
poolStatusDeleting = poolStatus("marked_for_deletion")
poolStatusCreating = poolStatus("creation_in_progress")
poolStatusUnknown = "unknown redundancy protocol '%d'"
)
func (o PoolStatus) Int() int {
return int(o)
}
func (o PoolStatus) String() string {
switch o {
case PoolStatusUnused:
return string(poolStatusUnused)
case PoolStatusInUse:
return string(poolStatusInUse)
case PoolStatusDeleting:
return string(poolStatusDeleting)
case PoolStatusCreating:
return string(poolStatusCreating)
default:
return fmt.Sprintf(poolStatusUnknown, o)
}
}
func (o poolStatus) string() string {
return string(o)
}
func (o poolStatus) parse() (int, error) {
switch o {
case poolStatusUnused:
return int(PoolStatusUnused), nil
case poolStatusInUse:
return int(PoolStatusInUse), nil
case poolStatusDeleting:
return int(PoolStatusDeleting), nil
case poolStatusCreating:
return int(PoolStatusCreating), nil
default:
return 0, fmt.Errorf(PoolStatusUnknown, o)
}
}