-
Notifications
You must be signed in to change notification settings - Fork 9
/
data_source_volcengine_listeners.go
230 lines (225 loc) · 6.99 KB
/
data_source_volcengine_listeners.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
218
219
220
221
222
223
224
225
226
227
228
229
230
package listener
import (
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/helper/validation"
ve "github.com/volcengine/terraform-provider-volcengine/common"
)
func DataSourceVolcengineListeners() *schema.Resource {
return &schema.Resource{
Read: dataSourceVolcengineListenersRead,
Schema: map[string]*schema.Schema{
"ids": {
Type: schema.TypeSet,
Optional: true,
Elem: &schema.Schema{
Type: schema.TypeString,
},
Set: schema.HashString,
Description: "A list of Listener IDs.",
},
"name_regex": {
Type: schema.TypeString,
Optional: true,
ValidateFunc: validation.StringIsValidRegExp,
Description: "A Name Regex of Listener.",
},
"output_file": {
Type: schema.TypeString,
Optional: true,
Description: "File name where to save data source results.",
},
"total_count": {
Type: schema.TypeInt,
Computed: true,
Description: "The total count of Listener query.",
},
"load_balancer_id": {
Type: schema.TypeString,
Optional: true,
Description: "The id of the Clb.",
},
"listener_name": {
Type: schema.TypeString,
Optional: true,
Description: "The name of the Listener.",
},
"listeners": {
Description: "The collection of Listener query.",
Type: schema.TypeList,
Computed: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"id": {
Type: schema.TypeString,
Computed: true, // tf中不支持写值
Description: "The ID of the Listener.",
},
"create_time": {
Type: schema.TypeString,
Computed: true,
Description: "The create time of the Listener.",
},
"update_time": {
Type: schema.TypeString,
Computed: true,
Description: "The update time of the Listener.",
},
"listener_id": {
Type: schema.TypeString,
Computed: true,
Description: "The ID of the Listener.",
},
"listener_name": {
Type: schema.TypeString,
Computed: true,
Description: "The name of the Listener.",
},
"acl_status": {
Type: schema.TypeString,
Computed: true,
Description: "The acl status of the Listener.",
},
"acl_type": {
Type: schema.TypeString,
Computed: true,
Description: "The acl type of the Listener.",
},
"acl_ids": {
Type: schema.TypeSet,
Elem: &schema.Schema{
Type: schema.TypeString,
},
Set: schema.HashString,
Computed: true,
Description: "The acl ID list to which the Listener is bound.",
},
"protocol": {
Type: schema.TypeString,
Computed: true,
Description: "The protocol of the Listener.",
},
"port": {
Type: schema.TypeInt,
Computed: true,
Description: "The port receiving request of the Listener.",
},
"status": {
Type: schema.TypeString,
Computed: true,
Description: "The status of the Listener.",
},
"enabled": {
Type: schema.TypeString,
Computed: true,
Description: "The enable status of the Listener.",
},
"server_group_id": {
Type: schema.TypeString,
Computed: true,
Description: "The ID of the backend server group which is associated with the Listener.",
},
"certificate_id": {
Type: schema.TypeString,
Computed: true,
Description: "The ID of the certificate which is associated with the Listener.",
},
"health_check_enabled": {
Type: schema.TypeString,
Computed: true,
Description: "The enable status of health check function.",
},
"health_check_interval": {
Type: schema.TypeInt,
Computed: true,
Description: "The interval executing health check.",
},
"health_check_timeout": {
Type: schema.TypeInt,
Computed: true,
Description: "The response timeout of health check.",
},
"health_check_healthy_threshold": {
Type: schema.TypeInt,
Computed: true,
Description: "The healthy threshold of health check.",
},
"health_check_un_healthy_threshold": {
Type: schema.TypeInt,
Computed: true,
Description: "The unhealthy threshold of health check.",
},
"health_check_method": {
Type: schema.TypeString,
Computed: true,
Description: "The method of health check.",
},
"health_check_uri": {
Type: schema.TypeString,
Computed: true,
Description: "The uri of health check.",
},
"health_check_domain": {
Type: schema.TypeString,
Computed: true,
Description: "The domain of health check.",
},
"health_check_http_code": {
Type: schema.TypeString,
Computed: true,
Description: "The normal http status code of health check.",
},
"health_check_udp_request": {
Type: schema.TypeString,
Computed: true,
Description: "A request string to perform a health check.",
},
"health_check_udp_expect": {
Type: schema.TypeString,
Computed: true,
Description: "The expected response string for the health check.",
},
"bandwidth": {
Type: schema.TypeInt,
Computed: true,
Description: "The bandwidth of the Listener. Unit: Mbps.",
},
"proxy_protocol_type": {
Type: schema.TypeString,
Computed: true,
Description: "Whether to enable proxy protocol.",
},
"persistence_type": {
Type: schema.TypeString,
Computed: true,
Description: "The persistence type of the Listener.",
},
"persistence_timeout": {
Type: schema.TypeInt,
Computed: true,
Description: "The persistence timeout of the Listener.",
},
"cookie": {
Type: schema.TypeString,
Computed: true,
Description: "The name of the cookie for session persistence configured on the backend server.",
},
"connection_drain_enabled": {
Type: schema.TypeString,
Computed: true,
Description: "Whether to enable connection drain of the Listener.",
},
"connection_drain_timeout": {
Type: schema.TypeInt,
Computed: true,
Description: "The connection drain timeout of the Listener.",
},
},
},
},
},
}
}
func dataSourceVolcengineListenersRead(d *schema.ResourceData, meta interface{}) error {
listenerService := NewListenerService(meta.(*ve.SdkClient))
return ve.DefaultDispatcher().Data(listenerService, d, DataSourceVolcengineListeners())
}