forked from aliyun/terraform-provider-alicloud
-
Notifications
You must be signed in to change notification settings - Fork 0
/
extension_ots.go
91 lines (79 loc) · 1.69 KB
/
extension_ots.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
79
80
81
82
83
84
85
86
87
88
89
90
91
package alicloud
type PrimaryKeyTypeString string
const (
IntegerType = PrimaryKeyTypeString("Integer")
StringType = PrimaryKeyTypeString("String")
BinaryType = PrimaryKeyTypeString("Binary")
)
type InstanceAccessedByType string
const (
AnyNetwork = InstanceAccessedByType("Any")
VpcOnly = InstanceAccessedByType("Vpc")
VpcOrConsole = InstanceAccessedByType("ConsoleOrVpc")
)
type OtsInstanceType string
const (
OtsCapacity = OtsInstanceType("Capacity")
OtsHighPerformance = OtsInstanceType("HighPerformance")
)
func convertInstanceAccessedBy(accessed InstanceAccessedByType) string {
switch accessed {
case VpcOnly:
return "VPC"
case VpcOrConsole:
return "VPC_CONSOLE"
default:
return "NORMAL"
}
}
func convertInstanceAccessedByRevert(network string) InstanceAccessedByType {
switch network {
case "VPC":
return VpcOnly
case "VPC_CONSOLE":
return VpcOrConsole
default:
return AnyNetwork
}
}
func convertInstanceType(instanceType OtsInstanceType) string {
switch instanceType {
case OtsHighPerformance:
return "SSD"
default:
return "HYBRID"
}
}
func convertInstanceTypeRevert(instanceType string) OtsInstanceType {
switch instanceType {
case "SSD":
return OtsHighPerformance
default:
return OtsCapacity
}
}
// OTS instance total status: S_RUNNING = 1, S_DISABLED = 2, S_DELETING = 3
func convertOtsInstanceStatus(status Status) int {
switch status {
case Running:
return 1
case DisabledStatus:
return 2
case Deleting:
return 3
default:
return -1
}
}
func convertOtsInstanceStatusConvert(status int) Status {
switch status {
case 1:
return Running
case 2:
return DisabledStatus
case 3:
return Deleting
default:
return ""
}
}