/
resource_visibility_packet_capture_global_templates_template_trigger_sys_obj_stats_change_slb_imap_proxy.go
323 lines (313 loc) · 16 KB
/
resource_visibility_packet_capture_global_templates_template_trigger_sys_obj_stats_change_slb_imap_proxy.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
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
package thunder
import (
"context"
edpt "github.com/a10networks/terraform-provider-thunder/thunder/axapi/endpoint"
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
)
func resourceVisibilityPacketCaptureGlobalTemplatesTemplateTriggerSysObjStatsChangeSlbImapProxy() *schema.Resource {
return &schema.Resource{
Description: "`thunder_visibility_packet_capture_global_templates_template_trigger_sys_obj_stats_change_slb_imap_proxy`: Configure triggers for slb.imap-proxy object\n\n__PLACEHOLDER__",
CreateContext: resourceVisibilityPacketCaptureGlobalTemplatesTemplateTriggerSysObjStatsChangeSlbImapProxyCreate,
UpdateContext: resourceVisibilityPacketCaptureGlobalTemplatesTemplateTriggerSysObjStatsChangeSlbImapProxyUpdate,
ReadContext: resourceVisibilityPacketCaptureGlobalTemplatesTemplateTriggerSysObjStatsChangeSlbImapProxyRead,
DeleteContext: resourceVisibilityPacketCaptureGlobalTemplatesTemplateTriggerSysObjStatsChangeSlbImapProxyDelete,
Schema: map[string]*schema.Schema{
"trigger_stats_inc": {
Type: schema.TypeList, MaxItems: 1, Optional: true, Description: "",
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"svrsel_fail": {
Type: schema.TypeInt, Optional: true, Default: 0, Description: "Enable automatic packet-capture for Server selection failure",
},
"no_route": {
Type: schema.TypeInt, Optional: true, Default: 0, Description: "Enable automatic packet-capture for no route failure",
},
"snat_fail": {
Type: schema.TypeInt, Optional: true, Default: 0, Description: "Enable automatic packet-capture for source nat failure",
},
"line_too_long": {
Type: schema.TypeInt, Optional: true, Default: 0, Description: "Enable automatic packet-capture for line too long",
},
"invalid_start_line": {
Type: schema.TypeInt, Optional: true, Default: 0, Description: "Enable automatic packet-capture for invalid start line",
},
"cant_find_pasv": {
Type: schema.TypeInt, Optional: true, Default: 0, Description: "Enable automatic packet-capture for cant find pasv",
},
"smp_create_fail": {
Type: schema.TypeInt, Optional: true, Default: 0, Description: "Enable automatic packet-capture for smp create fail",
},
"data_server_conn_fail": {
Type: schema.TypeInt, Optional: true, Default: 0, Description: "Enable automatic packet-capture for data svr conn fail",
},
"data_send_fail": {
Type: schema.TypeInt, Optional: true, Default: 0, Description: "Enable automatic packet-capture for data send fail",
},
"cant_find_epsv": {
Type: schema.TypeInt, Optional: true, Default: 0, Description: "Enable automatic packet-capture for cant find epsv",
},
"auth_unsupported": {
Type: schema.TypeInt, Optional: true, Default: 0, Description: "Enable automatic packet-capture for Unsupported auth",
},
"unsupported_pbsz_value": {
Type: schema.TypeInt, Optional: true, Default: 0, Description: "Enable automatic packet-capture for Unsupported PBSZ",
},
"unsupported_prot_value": {
Type: schema.TypeInt, Optional: true, Default: 0, Description: "Enable automatic packet-capture for Unsupported PROT",
},
"bad_sequence": {
Type: schema.TypeInt, Optional: true, Default: 0, Description: "Enable automatic packet-capture for Bad Sequence",
},
"rsv_persist_conn_fail": {
Type: schema.TypeInt, Optional: true, Default: 0, Description: "Enable automatic packet-capture for Serv Sel Persist fail",
},
"smp_v6_fail": {
Type: schema.TypeInt, Optional: true, Default: 0, Description: "Enable automatic packet-capture for Serv Sel SMPv6 fail",
},
"smp_v4_fail": {
Type: schema.TypeInt, Optional: true, Default: 0, Description: "Enable automatic packet-capture for Serv Sel SMPv4 fail",
},
"insert_tuple_fail": {
Type: schema.TypeInt, Optional: true, Default: 0, Description: "Enable automatic packet-capture for Serv Sel insert tuple fail",
},
"cl_est_err": {
Type: schema.TypeInt, Optional: true, Default: 0, Description: "Enable automatic packet-capture for Client EST state erro",
},
"ser_connecting_err": {
Type: schema.TypeInt, Optional: true, Default: 0, Description: "Enable automatic packet-capture for Serv CTNG state error",
},
"server_response_err": {
Type: schema.TypeInt, Optional: true, Default: 0, Description: "Enable automatic packet-capture for Serv RESP state error",
},
"cl_request_err": {
Type: schema.TypeInt, Optional: true, Default: 0, Description: "Enable automatic packet-capture for Client RQ state error",
},
"uuid": {
Type: schema.TypeString, Optional: true, Computed: true, Description: "uuid of the object",
},
},
},
},
"trigger_stats_rate": {
Type: schema.TypeList, MaxItems: 1, Optional: true, Description: "",
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"threshold_exceeded_by": {
Type: schema.TypeInt, Optional: true, Default: 5, Description: "Set the threshold to the number of times greater than the previous duration to start the capture, default is 5",
},
"duration": {
Type: schema.TypeInt, Optional: true, Default: 60, Description: "Time in seconds to look for the anomaly, default is 60",
},
"svrsel_fail": {
Type: schema.TypeInt, Optional: true, Default: 0, Description: "Enable automatic packet-capture for Server selection failure",
},
"no_route": {
Type: schema.TypeInt, Optional: true, Default: 0, Description: "Enable automatic packet-capture for no route failure",
},
"snat_fail": {
Type: schema.TypeInt, Optional: true, Default: 0, Description: "Enable automatic packet-capture for source nat failure",
},
"line_too_long": {
Type: schema.TypeInt, Optional: true, Default: 0, Description: "Enable automatic packet-capture for line too long",
},
"invalid_start_line": {
Type: schema.TypeInt, Optional: true, Default: 0, Description: "Enable automatic packet-capture for invalid start line",
},
"cant_find_pasv": {
Type: schema.TypeInt, Optional: true, Default: 0, Description: "Enable automatic packet-capture for cant find pasv",
},
"smp_create_fail": {
Type: schema.TypeInt, Optional: true, Default: 0, Description: "Enable automatic packet-capture for smp create fail",
},
"data_server_conn_fail": {
Type: schema.TypeInt, Optional: true, Default: 0, Description: "Enable automatic packet-capture for data svr conn fail",
},
"data_send_fail": {
Type: schema.TypeInt, Optional: true, Default: 0, Description: "Enable automatic packet-capture for data send fail",
},
"cant_find_epsv": {
Type: schema.TypeInt, Optional: true, Default: 0, Description: "Enable automatic packet-capture for cant find epsv",
},
"auth_unsupported": {
Type: schema.TypeInt, Optional: true, Default: 0, Description: "Enable automatic packet-capture for Unsupported auth",
},
"unsupported_pbsz_value": {
Type: schema.TypeInt, Optional: true, Default: 0, Description: "Enable automatic packet-capture for Unsupported PBSZ",
},
"unsupported_prot_value": {
Type: schema.TypeInt, Optional: true, Default: 0, Description: "Enable automatic packet-capture for Unsupported PROT",
},
"bad_sequence": {
Type: schema.TypeInt, Optional: true, Default: 0, Description: "Enable automatic packet-capture for Bad Sequence",
},
"rsv_persist_conn_fail": {
Type: schema.TypeInt, Optional: true, Default: 0, Description: "Enable automatic packet-capture for Serv Sel Persist fail",
},
"smp_v6_fail": {
Type: schema.TypeInt, Optional: true, Default: 0, Description: "Enable automatic packet-capture for Serv Sel SMPv6 fail",
},
"smp_v4_fail": {
Type: schema.TypeInt, Optional: true, Default: 0, Description: "Enable automatic packet-capture for Serv Sel SMPv4 fail",
},
"insert_tuple_fail": {
Type: schema.TypeInt, Optional: true, Default: 0, Description: "Enable automatic packet-capture for Serv Sel insert tuple fail",
},
"cl_est_err": {
Type: schema.TypeInt, Optional: true, Default: 0, Description: "Enable automatic packet-capture for Client EST state erro",
},
"ser_connecting_err": {
Type: schema.TypeInt, Optional: true, Default: 0, Description: "Enable automatic packet-capture for Serv CTNG state error",
},
"server_response_err": {
Type: schema.TypeInt, Optional: true, Default: 0, Description: "Enable automatic packet-capture for Serv RESP state error",
},
"cl_request_err": {
Type: schema.TypeInt, Optional: true, Default: 0, Description: "Enable automatic packet-capture for Client RQ state error",
},
"uuid": {
Type: schema.TypeString, Optional: true, Computed: true, Description: "uuid of the object",
},
},
},
},
"uuid": {
Type: schema.TypeString, Optional: true, Computed: true, Description: "uuid of the object",
},
"name": {
Type: schema.TypeString, Required: true, Description: "Name",
},
},
}
}
func resourceVisibilityPacketCaptureGlobalTemplatesTemplateTriggerSysObjStatsChangeSlbImapProxyCreate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics {
client := meta.(Thunder)
logger := client.log
logger.Println("resourceVisibilityPacketCaptureGlobalTemplatesTemplateTriggerSysObjStatsChangeSlbImapProxyCreate()")
var diags diag.Diagnostics
if client.Host != "" {
obj := dataToEndpointVisibilityPacketCaptureGlobalTemplatesTemplateTriggerSysObjStatsChangeSlbImapProxy(d)
d.SetId(obj.GetId())
err := obj.Post(client.Token, client.Host, logger)
if err != nil {
return diag.FromErr(err)
}
return resourceVisibilityPacketCaptureGlobalTemplatesTemplateTriggerSysObjStatsChangeSlbImapProxyRead(ctx, d, meta)
}
return diags
}
func resourceVisibilityPacketCaptureGlobalTemplatesTemplateTriggerSysObjStatsChangeSlbImapProxyUpdate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics {
client := meta.(Thunder)
logger := client.log
logger.Println("resourceVisibilityPacketCaptureGlobalTemplatesTemplateTriggerSysObjStatsChangeSlbImapProxyUpdate()")
var diags diag.Diagnostics
if client.Host != "" {
obj := dataToEndpointVisibilityPacketCaptureGlobalTemplatesTemplateTriggerSysObjStatsChangeSlbImapProxy(d)
err := obj.Put(client.Token, client.Host, logger)
if err != nil {
return diag.FromErr(err)
}
return resourceVisibilityPacketCaptureGlobalTemplatesTemplateTriggerSysObjStatsChangeSlbImapProxyRead(ctx, d, meta)
}
return diags
}
func resourceVisibilityPacketCaptureGlobalTemplatesTemplateTriggerSysObjStatsChangeSlbImapProxyDelete(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics {
client := meta.(Thunder)
logger := client.log
logger.Println("resourceVisibilityPacketCaptureGlobalTemplatesTemplateTriggerSysObjStatsChangeSlbImapProxyDelete()")
var diags diag.Diagnostics
if client.Host != "" {
obj := dataToEndpointVisibilityPacketCaptureGlobalTemplatesTemplateTriggerSysObjStatsChangeSlbImapProxy(d)
err := obj.Delete(client.Token, client.Host, d.Id(), logger)
if err != nil {
return diag.FromErr(err)
}
}
return diags
}
func resourceVisibilityPacketCaptureGlobalTemplatesTemplateTriggerSysObjStatsChangeSlbImapProxyRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics {
client := meta.(Thunder)
logger := client.log
logger.Println("resourceVisibilityPacketCaptureGlobalTemplatesTemplateTriggerSysObjStatsChangeSlbImapProxyRead()")
var diags diag.Diagnostics
if client.Host != "" {
obj := dataToEndpointVisibilityPacketCaptureGlobalTemplatesTemplateTriggerSysObjStatsChangeSlbImapProxy(d)
err := obj.Get(client.Token, client.Host, d.Id(), logger)
if err != nil {
return diag.FromErr(err)
}
}
return diags
}
func getObjectVisibilityPacketCaptureGlobalTemplatesTemplateTriggerSysObjStatsChangeSlbImapProxyTriggerStatsInc2043(d []interface{}) edpt.VisibilityPacketCaptureGlobalTemplatesTemplateTriggerSysObjStatsChangeSlbImapProxyTriggerStatsInc2043 {
count1 := len(d)
var ret edpt.VisibilityPacketCaptureGlobalTemplatesTemplateTriggerSysObjStatsChangeSlbImapProxyTriggerStatsInc2043
if count1 > 0 {
in := d[0].(map[string]interface{})
ret.Svrsel_fail = in["svrsel_fail"].(int)
ret.No_route = in["no_route"].(int)
ret.Snat_fail = in["snat_fail"].(int)
ret.Line_too_long = in["line_too_long"].(int)
ret.Invalid_start_line = in["invalid_start_line"].(int)
ret.Cant_find_pasv = in["cant_find_pasv"].(int)
ret.Smp_create_fail = in["smp_create_fail"].(int)
ret.Data_server_conn_fail = in["data_server_conn_fail"].(int)
ret.Data_send_fail = in["data_send_fail"].(int)
ret.Cant_find_epsv = in["cant_find_epsv"].(int)
ret.Auth_unsupported = in["auth_unsupported"].(int)
ret.Unsupported_pbsz_value = in["unsupported_pbsz_value"].(int)
ret.Unsupported_prot_value = in["unsupported_prot_value"].(int)
ret.Bad_sequence = in["bad_sequence"].(int)
ret.Rsv_persist_conn_fail = in["rsv_persist_conn_fail"].(int)
ret.Smp_v6_fail = in["smp_v6_fail"].(int)
ret.Smp_v4_fail = in["smp_v4_fail"].(int)
ret.Insert_tuple_fail = in["insert_tuple_fail"].(int)
ret.Cl_est_err = in["cl_est_err"].(int)
ret.Ser_connecting_err = in["ser_connecting_err"].(int)
ret.Server_response_err = in["server_response_err"].(int)
ret.Cl_request_err = in["cl_request_err"].(int)
//omit uuid
}
return ret
}
func getObjectVisibilityPacketCaptureGlobalTemplatesTemplateTriggerSysObjStatsChangeSlbImapProxyTriggerStatsRate2044(d []interface{}) edpt.VisibilityPacketCaptureGlobalTemplatesTemplateTriggerSysObjStatsChangeSlbImapProxyTriggerStatsRate2044 {
count1 := len(d)
var ret edpt.VisibilityPacketCaptureGlobalTemplatesTemplateTriggerSysObjStatsChangeSlbImapProxyTriggerStatsRate2044
if count1 > 0 {
in := d[0].(map[string]interface{})
ret.ThresholdExceededBy = in["threshold_exceeded_by"].(int)
ret.Duration = in["duration"].(int)
ret.Svrsel_fail = in["svrsel_fail"].(int)
ret.No_route = in["no_route"].(int)
ret.Snat_fail = in["snat_fail"].(int)
ret.Line_too_long = in["line_too_long"].(int)
ret.Invalid_start_line = in["invalid_start_line"].(int)
ret.Cant_find_pasv = in["cant_find_pasv"].(int)
ret.Smp_create_fail = in["smp_create_fail"].(int)
ret.Data_server_conn_fail = in["data_server_conn_fail"].(int)
ret.Data_send_fail = in["data_send_fail"].(int)
ret.Cant_find_epsv = in["cant_find_epsv"].(int)
ret.Auth_unsupported = in["auth_unsupported"].(int)
ret.Unsupported_pbsz_value = in["unsupported_pbsz_value"].(int)
ret.Unsupported_prot_value = in["unsupported_prot_value"].(int)
ret.Bad_sequence = in["bad_sequence"].(int)
ret.Rsv_persist_conn_fail = in["rsv_persist_conn_fail"].(int)
ret.Smp_v6_fail = in["smp_v6_fail"].(int)
ret.Smp_v4_fail = in["smp_v4_fail"].(int)
ret.Insert_tuple_fail = in["insert_tuple_fail"].(int)
ret.Cl_est_err = in["cl_est_err"].(int)
ret.Ser_connecting_err = in["ser_connecting_err"].(int)
ret.Server_response_err = in["server_response_err"].(int)
ret.Cl_request_err = in["cl_request_err"].(int)
//omit uuid
}
return ret
}
func dataToEndpointVisibilityPacketCaptureGlobalTemplatesTemplateTriggerSysObjStatsChangeSlbImapProxy(d *schema.ResourceData) edpt.VisibilityPacketCaptureGlobalTemplatesTemplateTriggerSysObjStatsChangeSlbImapProxy {
var ret edpt.VisibilityPacketCaptureGlobalTemplatesTemplateTriggerSysObjStatsChangeSlbImapProxy
ret.Inst.TriggerStatsInc = getObjectVisibilityPacketCaptureGlobalTemplatesTemplateTriggerSysObjStatsChangeSlbImapProxyTriggerStatsInc2043(d.Get("trigger_stats_inc").([]interface{}))
ret.Inst.TriggerStatsRate = getObjectVisibilityPacketCaptureGlobalTemplatesTemplateTriggerSysObjStatsChangeSlbImapProxyTriggerStatsRate2044(d.Get("trigger_stats_rate").([]interface{}))
//omit uuid
ret.Inst.Name = d.Get("name").(string)
return ret
}