-
Notifications
You must be signed in to change notification settings - Fork 533
/
extension_ots.go
217 lines (178 loc) · 5.8 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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
package alicloud
type PrimaryKeyTypeString string
const (
IntegerType = PrimaryKeyTypeString("Integer")
StringType = PrimaryKeyTypeString("String")
BinaryType = PrimaryKeyTypeString("Binary")
)
type DefinedColumnTypeString string
const (
DefinedColumnInteger = DefinedColumnTypeString("Integer")
DefinedColumnString = DefinedColumnTypeString("String")
DefinedColumnBinary = DefinedColumnTypeString("Binary")
DefinedColumnDouble = DefinedColumnTypeString("Double")
DefinedColumnBoolean = DefinedColumnTypeString("Boolean")
)
type InstanceAccessedByType string
const (
AnyNetwork = InstanceAccessedByType("Any")
VpcOnly = InstanceAccessedByType("Vpc")
VpcOrConsole = InstanceAccessedByType("ConsoleOrVpc")
)
type OtsInstanceType string
const (
OtsCapacity = OtsInstanceType("Capacity")
OtsHighPerformance = OtsInstanceType("HighPerformance")
)
type OtsNetworkType string
const (
VpcAccess = OtsNetworkType("VPC")
InternetAccess = OtsNetworkType("INTERNET")
ClassicAccess = OtsNetworkType("CLASSIC")
)
type OtsNetworkSource string
const (
TrustProxyAccess = OtsNetworkSource("TRUST_PROXY")
)
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
}
}
func toInstanceOuterStatus(otsInstanceInnerStatus string) Status {
switch otsInstanceInnerStatus {
case "normal":
return Running
case "forbidden":
return DisabledStatus
case "deleting":
return Deleting
default:
return Status(otsInstanceInnerStatus)
}
}
func toInstanceInnerStatus(instanceOuterStatus Status) string {
switch instanceOuterStatus {
case Running:
return "normal"
case DisabledStatus:
return "forbidden"
case Deleting:
return "deleting"
default:
return "INVALID"
}
}
type TunnelTypeString string
const (
BaseAndStreamTunnel = TunnelTypeString("BaseAndStream")
BaseDataTunnel = TunnelTypeString("BaseData")
StreamTunnel = TunnelTypeString("Stream")
)
type SseKeyTypeString string
const (
SseKMSService = SseKeyTypeString("SSE_KMS_SERVICE")
)
type SecondaryIndexTypeString string
const (
Local = SecondaryIndexTypeString("Local")
Global = SecondaryIndexTypeString("Global")
)
const (
SearchIndexTypeHolder = "Search"
)
type OtsSearchIndexSyncPhaseString string
const (
Full = OtsSearchIndexSyncPhaseString("Full")
Incr = OtsSearchIndexSyncPhaseString("Incr")
)
type SearchIndexFieldTypeString string
const (
OtsSearchTypeLong = SearchIndexFieldTypeString("Long")
OtsSearchTypeDouble = SearchIndexFieldTypeString("Double")
OtsSearchTypeBoolean = SearchIndexFieldTypeString("Boolean")
OtsSearchTypeKeyword = SearchIndexFieldTypeString("Keyword")
OtsSearchTypeText = SearchIndexFieldTypeString("Text")
OtsSearchTypeDate = SearchIndexFieldTypeString("Date")
OtsSearchTypeGeoPoint = SearchIndexFieldTypeString("GeoPoint")
OtsSearchTypeNested = SearchIndexFieldTypeString("Nested")
)
type SearchIndexAnalyzerTypeString string
const (
OtsSearchSingleWord = SearchIndexAnalyzerTypeString("SingleWord")
OtsSearchSplit = SearchIndexAnalyzerTypeString("Split")
OtsSearchMinWord = SearchIndexAnalyzerTypeString("MinWord")
OtsSearchMaxWord = SearchIndexAnalyzerTypeString("MaxWord")
OtsSearchFuzzy = SearchIndexAnalyzerTypeString("Fuzzy")
)
type SearchIndexOrderTypeString string
const (
OtsSearchSortOrderAsc = SearchIndexOrderTypeString("Asc")
OtsSearchSortOrderDesc = SearchIndexOrderTypeString("Desc")
)
type SearchIndexSortModeString string
const (
OtsSearchModeMin = SearchIndexSortModeString("Min")
OtsSearchModeMax = SearchIndexSortModeString("Max")
OtsSearchModeAvg = SearchIndexSortModeString("Avg")
)
type SearchIndexSortFieldTypeString string
const (
OtsSearchPrimaryKeySort = SearchIndexSortFieldTypeString("PrimaryKeySort")
OtsSearchFieldSort = SearchIndexSortFieldTypeString("FieldSort")
)
type RestOtsInstanceInfo struct {
InstanceStatus string `json:"InstanceStatus" xml:"InstanceStatus"`
InstanceSpecification string `json:"InstanceSpecification" xml:"InstanceSpecification"`
Timestamp string `json:"Timestamp" xml:"Timestamp"`
UserId string `json:"UserId" xml:"UserId"`
ResourceGroupId string `json:"ResourceGroupId" xml:"ResourceGroupId"`
InstanceName string `json:"InstanceName" xml:"InstanceName"`
CreateTime string `json:"CreateTime" xml:"CreateTime"`
Network string `json:"Network" xml:"Network"`
NetworkTypeACL []string `json:"NetworkTypeACL" xml:"NetworkTypeACL"`
NetworkSourceACL []string `json:"NetworkSourceACL" xml:"NetworkSourceACL"`
Policy string `json:"Policy" xml:"Policy"`
PolicyVersion int `json:"PolicyVersion" xml:"PolicyVersion"`
InstanceDescription string `json:"InstanceDescription" xml:"InstanceDescription"`
Quota RestOtsQuota `json:"Quota" xml:"Quota"`
Tags []RestOtsTagInfo `json:"Tags" xml:"Tags"`
}
type RestOtsQuota struct {
TableQuota int `json:"TableQuota" xml:"TableQuota"`
}
type RestOtsTagInfo struct {
Key string `json:"Key" xml:"Key"`
Value string `json:"Value" xml:"Value"`
}