forked from fortinetdev/terraform-provider-fortios
/
data_source_system_csf.go
703 lines (586 loc) · 21 KB
/
data_source_system_csf.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
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
// Copyright 2020 Fortinet, Inc. All rights reserved.
// Author: Frank Shen (@frankshen01), Hongbin Lu (@fgtdev-hblu)
// Documentation:
// Frank Shen (@frankshen01), Hongbin Lu (@fgtdev-hblu),
// Xing Li (@lix-fortinet), Yue Wang (@yuew-ftnt), Yuffie Zhu (@yuffiezhu)
// Description: Add this FortiGate to a Security Fabric or set up a new Security Fabric on this FortiGate.
package fortios
import (
"fmt"
"log"
"strconv"
"strings"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation"
)
func dataSourceSystemCsf() *schema.Resource {
return &schema.Resource{
Read: dataSourceSystemCsfRead,
Schema: map[string]*schema.Schema{
"vdomparam": &schema.Schema{
Type: schema.TypeString,
Optional: true,
ForceNew: true,
},
"status": &schema.Schema{
Type: schema.TypeString,
Computed: true,
},
"upstream": &schema.Schema{
Type: schema.TypeString,
Computed: true,
},
"upstream_ip": &schema.Schema{
Type: schema.TypeString,
Computed: true,
},
"upstream_port": &schema.Schema{
Type: schema.TypeInt,
Computed: true,
},
"group_name": &schema.Schema{
Type: schema.TypeString,
Computed: true,
},
"group_password": &schema.Schema{
Type: schema.TypeString,
Sensitive: true,
Computed: true,
},
"accept_auth_by_cert": &schema.Schema{
Type: schema.TypeString,
Computed: true,
},
"log_unification": &schema.Schema{
Type: schema.TypeString,
Computed: true,
},
"configuration_sync": &schema.Schema{
Type: schema.TypeString,
Computed: true,
},
"fabric_object_unification": &schema.Schema{
Type: schema.TypeString,
Computed: true,
},
"saml_configuration_sync": &schema.Schema{
Type: schema.TypeString,
Computed: true,
},
"management_ip": &schema.Schema{
Type: schema.TypeString,
Computed: true,
},
"management_port": &schema.Schema{
Type: schema.TypeInt,
Computed: true,
},
"authorization_request_type": &schema.Schema{
Type: schema.TypeString,
Computed: true,
},
"certificate": &schema.Schema{
Type: schema.TypeString,
Computed: true,
},
"fabric_workers": &schema.Schema{
Type: schema.TypeInt,
Computed: true,
},
"downstream_access": &schema.Schema{
Type: schema.TypeString,
Computed: true,
},
"downstream_accprofile": &schema.Schema{
Type: schema.TypeString,
Computed: true,
},
"fixed_key": &schema.Schema{
Type: schema.TypeString,
Sensitive: true,
Computed: true,
},
"trusted_list": &schema.Schema{
Type: schema.TypeList,
Computed: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"name": &schema.Schema{
Type: schema.TypeString,
Computed: true,
},
"authorization_type": &schema.Schema{
Type: schema.TypeString,
Computed: true,
},
"serial": &schema.Schema{
Type: schema.TypeString,
Computed: true,
},
"certificate": &schema.Schema{
Type: schema.TypeString,
Computed: true,
},
"action": &schema.Schema{
Type: schema.TypeString,
Computed: true,
},
"ha_members": &schema.Schema{
Type: schema.TypeString,
Computed: true,
},
"downstream_authorization": &schema.Schema{
Type: schema.TypeString,
Computed: true,
},
},
},
},
"fabric_connector": &schema.Schema{
Type: schema.TypeList,
Computed: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"serial": &schema.Schema{
Type: schema.TypeString,
Computed: true,
},
"accprofile": &schema.Schema{
Type: schema.TypeString,
Computed: true,
},
"configuration_write_access": &schema.Schema{
Type: schema.TypeString,
Computed: true,
},
},
},
},
"forticloud_account_enforcement": &schema.Schema{
Type: schema.TypeString,
Computed: true,
},
"fabric_device": &schema.Schema{
Type: schema.TypeList,
Computed: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"name": &schema.Schema{
Type: schema.TypeString,
Computed: true,
},
"device_ip": &schema.Schema{
Type: schema.TypeString,
Computed: true,
},
"https_port": &schema.Schema{
Type: schema.TypeInt,
Computed: true,
},
"access_token": &schema.Schema{
Type: schema.TypeString,
Sensitive: true,
Computed: true,
},
"device_type": &schema.Schema{
Type: schema.TypeString,
Computed: true,
},
"login": &schema.Schema{
Type: schema.TypeString,
Computed: true,
},
"password": &schema.Schema{
Type: schema.TypeString,
Sensitive: true,
Computed: true,
},
},
},
},
},
}
}
func dataSourceSystemCsfRead(d *schema.ResourceData, m interface{}) error {
c := m.(*FortiClient).Client
c.Retries = 1
vdomparam := ""
if v, ok := d.GetOk("vdomparam"); ok {
if s, ok := v.(string); ok {
vdomparam = s
}
}
mkey := "SystemCsf"
o, err := c.ReadSystemCsf(mkey, vdomparam)
if err != nil {
return fmt.Errorf("Error describing SystemCsf: %v", err)
}
if o == nil {
d.SetId("")
return nil
}
err = dataSourceRefreshObjectSystemCsf(d, o)
if err != nil {
return fmt.Errorf("Error describing SystemCsf from API: %v", err)
}
d.SetId(mkey)
return nil
}
func dataSourceFlattenSystemCsfStatus(v interface{}, d *schema.ResourceData, pre string) interface{} {
return v
}
func dataSourceFlattenSystemCsfUpstream(v interface{}, d *schema.ResourceData, pre string) interface{} {
return v
}
func dataSourceFlattenSystemCsfUpstreamIp(v interface{}, d *schema.ResourceData, pre string) interface{} {
return v
}
func dataSourceFlattenSystemCsfUpstreamPort(v interface{}, d *schema.ResourceData, pre string) interface{} {
return v
}
func dataSourceFlattenSystemCsfGroupName(v interface{}, d *schema.ResourceData, pre string) interface{} {
return v
}
func dataSourceFlattenSystemCsfGroupPassword(v interface{}, d *schema.ResourceData, pre string) interface{} {
return v
}
func dataSourceFlattenSystemCsfAcceptAuthByCert(v interface{}, d *schema.ResourceData, pre string) interface{} {
return v
}
func dataSourceFlattenSystemCsfLogUnification(v interface{}, d *schema.ResourceData, pre string) interface{} {
return v
}
func dataSourceFlattenSystemCsfConfigurationSync(v interface{}, d *schema.ResourceData, pre string) interface{} {
return v
}
func dataSourceFlattenSystemCsfFabricObjectUnification(v interface{}, d *schema.ResourceData, pre string) interface{} {
return v
}
func dataSourceFlattenSystemCsfSamlConfigurationSync(v interface{}, d *schema.ResourceData, pre string) interface{} {
return v
}
func dataSourceFlattenSystemCsfManagementIp(v interface{}, d *schema.ResourceData, pre string) interface{} {
return v
}
func dataSourceFlattenSystemCsfManagementPort(v interface{}, d *schema.ResourceData, pre string) interface{} {
return v
}
func dataSourceFlattenSystemCsfAuthorizationRequestType(v interface{}, d *schema.ResourceData, pre string) interface{} {
return v
}
func dataSourceFlattenSystemCsfCertificate(v interface{}, d *schema.ResourceData, pre string) interface{} {
return v
}
func dataSourceFlattenSystemCsfFabricWorkers(v interface{}, d *schema.ResourceData, pre string) interface{} {
return v
}
func dataSourceFlattenSystemCsfDownstreamAccess(v interface{}, d *schema.ResourceData, pre string) interface{} {
return v
}
func dataSourceFlattenSystemCsfDownstreamAccprofile(v interface{}, d *schema.ResourceData, pre string) interface{} {
return v
}
func dataSourceFlattenSystemCsfFixedKey(v interface{}, d *schema.ResourceData, pre string) interface{} {
return v
}
func dataSourceFlattenSystemCsfTrustedList(v interface{}, d *schema.ResourceData, pre string) []map[string]interface{} {
if v == nil {
return nil
}
l := v.([]interface{})
if len(l) == 0 || l[0] == nil {
return nil
}
result := make([]map[string]interface{}, 0, len(l))
con := 0
for _, r := range l {
tmp := make(map[string]interface{})
i := r.(map[string]interface{})
pre_append := "" // table
pre_append = pre + "." + strconv.Itoa(con) + "." + "name"
if _, ok := i["name"]; ok {
tmp["name"] = dataSourceFlattenSystemCsfTrustedListName(i["name"], d, pre_append)
}
pre_append = pre + "." + strconv.Itoa(con) + "." + "authorization_type"
if _, ok := i["authorization-type"]; ok {
tmp["authorization_type"] = dataSourceFlattenSystemCsfTrustedListAuthorizationType(i["authorization-type"], d, pre_append)
}
pre_append = pre + "." + strconv.Itoa(con) + "." + "serial"
if _, ok := i["serial"]; ok {
tmp["serial"] = dataSourceFlattenSystemCsfTrustedListSerial(i["serial"], d, pre_append)
}
pre_append = pre + "." + strconv.Itoa(con) + "." + "certificate"
if _, ok := i["certificate"]; ok {
tmp["certificate"] = dataSourceFlattenSystemCsfTrustedListCertificate(i["certificate"], d, pre_append)
}
pre_append = pre + "." + strconv.Itoa(con) + "." + "action"
if _, ok := i["action"]; ok {
tmp["action"] = dataSourceFlattenSystemCsfTrustedListAction(i["action"], d, pre_append)
}
pre_append = pre + "." + strconv.Itoa(con) + "." + "ha_members"
if _, ok := i["ha-members"]; ok {
tmp["ha_members"] = dataSourceFlattenSystemCsfTrustedListHaMembers(i["ha-members"], d, pre_append)
}
pre_append = pre + "." + strconv.Itoa(con) + "." + "downstream_authorization"
if _, ok := i["downstream-authorization"]; ok {
tmp["downstream_authorization"] = dataSourceFlattenSystemCsfTrustedListDownstreamAuthorization(i["downstream-authorization"], d, pre_append)
}
result = append(result, tmp)
con += 1
}
return result
}
func dataSourceFlattenSystemCsfTrustedListName(v interface{}, d *schema.ResourceData, pre string) interface{} {
return v
}
func dataSourceFlattenSystemCsfTrustedListAuthorizationType(v interface{}, d *schema.ResourceData, pre string) interface{} {
return v
}
func dataSourceFlattenSystemCsfTrustedListSerial(v interface{}, d *schema.ResourceData, pre string) interface{} {
return v
}
func dataSourceFlattenSystemCsfTrustedListCertificate(v interface{}, d *schema.ResourceData, pre string) interface{} {
return v
}
func dataSourceFlattenSystemCsfTrustedListAction(v interface{}, d *schema.ResourceData, pre string) interface{} {
return v
}
func dataSourceFlattenSystemCsfTrustedListHaMembers(v interface{}, d *schema.ResourceData, pre string) interface{} {
return v
}
func dataSourceFlattenSystemCsfTrustedListDownstreamAuthorization(v interface{}, d *schema.ResourceData, pre string) interface{} {
return v
}
func dataSourceFlattenSystemCsfFabricConnector(v interface{}, d *schema.ResourceData, pre string) []map[string]interface{} {
if v == nil {
return nil
}
l := v.([]interface{})
if len(l) == 0 || l[0] == nil {
return nil
}
result := make([]map[string]interface{}, 0, len(l))
con := 0
for _, r := range l {
tmp := make(map[string]interface{})
i := r.(map[string]interface{})
pre_append := "" // table
pre_append = pre + "." + strconv.Itoa(con) + "." + "serial"
if _, ok := i["serial"]; ok {
tmp["serial"] = dataSourceFlattenSystemCsfFabricConnectorSerial(i["serial"], d, pre_append)
}
pre_append = pre + "." + strconv.Itoa(con) + "." + "accprofile"
if _, ok := i["accprofile"]; ok {
tmp["accprofile"] = dataSourceFlattenSystemCsfFabricConnectorAccprofile(i["accprofile"], d, pre_append)
}
pre_append = pre + "." + strconv.Itoa(con) + "." + "configuration_write_access"
if _, ok := i["configuration-write-access"]; ok {
tmp["configuration_write_access"] = dataSourceFlattenSystemCsfFabricConnectorConfigurationWriteAccess(i["configuration-write-access"], d, pre_append)
}
result = append(result, tmp)
con += 1
}
return result
}
func dataSourceFlattenSystemCsfFabricConnectorSerial(v interface{}, d *schema.ResourceData, pre string) interface{} {
return v
}
func dataSourceFlattenSystemCsfFabricConnectorAccprofile(v interface{}, d *schema.ResourceData, pre string) interface{} {
return v
}
func dataSourceFlattenSystemCsfFabricConnectorConfigurationWriteAccess(v interface{}, d *schema.ResourceData, pre string) interface{} {
return v
}
func dataSourceFlattenSystemCsfForticloudAccountEnforcement(v interface{}, d *schema.ResourceData, pre string) interface{} {
return v
}
func dataSourceFlattenSystemCsfFabricDevice(v interface{}, d *schema.ResourceData, pre string) []map[string]interface{} {
if v == nil {
return nil
}
l := v.([]interface{})
if len(l) == 0 || l[0] == nil {
return nil
}
result := make([]map[string]interface{}, 0, len(l))
con := 0
for _, r := range l {
tmp := make(map[string]interface{})
i := r.(map[string]interface{})
pre_append := "" // table
pre_append = pre + "." + strconv.Itoa(con) + "." + "name"
if _, ok := i["name"]; ok {
tmp["name"] = dataSourceFlattenSystemCsfFabricDeviceName(i["name"], d, pre_append)
}
pre_append = pre + "." + strconv.Itoa(con) + "." + "device_ip"
if _, ok := i["device-ip"]; ok {
tmp["device_ip"] = dataSourceFlattenSystemCsfFabricDeviceDeviceIp(i["device-ip"], d, pre_append)
}
pre_append = pre + "." + strconv.Itoa(con) + "." + "https_port"
if _, ok := i["https-port"]; ok {
tmp["https_port"] = dataSourceFlattenSystemCsfFabricDeviceHttpsPort(i["https-port"], d, pre_append)
}
pre_append = pre + "." + strconv.Itoa(con) + "." + "access_token"
if _, ok := i["access-token"]; ok {
tmp["access_token"] = dataSourceFlattenSystemCsfFabricDeviceAccessToken(i["access-token"], d, pre_append)
c := d.Get(pre_append).(string)
if c != "" {
tmp["access_token"] = c
}
}
pre_append = pre + "." + strconv.Itoa(con) + "." + "device_type"
if _, ok := i["device-type"]; ok {
tmp["device_type"] = dataSourceFlattenSystemCsfFabricDeviceDeviceType(i["device-type"], d, pre_append)
}
pre_append = pre + "." + strconv.Itoa(con) + "." + "login"
if _, ok := i["login"]; ok {
tmp["login"] = dataSourceFlattenSystemCsfFabricDeviceLogin(i["login"], d, pre_append)
}
pre_append = pre + "." + strconv.Itoa(con) + "." + "password"
if _, ok := i["password"]; ok {
tmp["password"] = dataSourceFlattenSystemCsfFabricDevicePassword(i["password"], d, pre_append)
c := d.Get(pre_append).(string)
if c != "" {
tmp["password"] = c
}
}
result = append(result, tmp)
con += 1
}
return result
}
func dataSourceFlattenSystemCsfFabricDeviceName(v interface{}, d *schema.ResourceData, pre string) interface{} {
return v
}
func dataSourceFlattenSystemCsfFabricDeviceDeviceIp(v interface{}, d *schema.ResourceData, pre string) interface{} {
return v
}
func dataSourceFlattenSystemCsfFabricDeviceHttpsPort(v interface{}, d *schema.ResourceData, pre string) interface{} {
return v
}
func dataSourceFlattenSystemCsfFabricDeviceAccessToken(v interface{}, d *schema.ResourceData, pre string) interface{} {
return v
}
func dataSourceFlattenSystemCsfFabricDeviceDeviceType(v interface{}, d *schema.ResourceData, pre string) interface{} {
return v
}
func dataSourceFlattenSystemCsfFabricDeviceLogin(v interface{}, d *schema.ResourceData, pre string) interface{} {
return v
}
func dataSourceFlattenSystemCsfFabricDevicePassword(v interface{}, d *schema.ResourceData, pre string) interface{} {
return v
}
func dataSourceRefreshObjectSystemCsf(d *schema.ResourceData, o map[string]interface{}) error {
var err error
if err = d.Set("status", dataSourceFlattenSystemCsfStatus(o["status"], d, "status")); err != nil {
if !fortiAPIPatch(o["status"]) {
return fmt.Errorf("Error reading status: %v", err)
}
}
if err = d.Set("upstream", dataSourceFlattenSystemCsfUpstream(o["upstream"], d, "upstream")); err != nil {
if !fortiAPIPatch(o["upstream"]) {
return fmt.Errorf("Error reading upstream: %v", err)
}
}
if err = d.Set("upstream_ip", dataSourceFlattenSystemCsfUpstreamIp(o["upstream-ip"], d, "upstream_ip")); err != nil {
if !fortiAPIPatch(o["upstream-ip"]) {
return fmt.Errorf("Error reading upstream_ip: %v", err)
}
}
if err = d.Set("upstream_port", dataSourceFlattenSystemCsfUpstreamPort(o["upstream-port"], d, "upstream_port")); err != nil {
if !fortiAPIPatch(o["upstream-port"]) {
return fmt.Errorf("Error reading upstream_port: %v", err)
}
}
if err = d.Set("group_name", dataSourceFlattenSystemCsfGroupName(o["group-name"], d, "group_name")); err != nil {
if !fortiAPIPatch(o["group-name"]) {
return fmt.Errorf("Error reading group_name: %v", err)
}
}
if err = d.Set("accept_auth_by_cert", dataSourceFlattenSystemCsfAcceptAuthByCert(o["accept-auth-by-cert"], d, "accept_auth_by_cert")); err != nil {
if !fortiAPIPatch(o["accept-auth-by-cert"]) {
return fmt.Errorf("Error reading accept_auth_by_cert: %v", err)
}
}
if err = d.Set("log_unification", dataSourceFlattenSystemCsfLogUnification(o["log-unification"], d, "log_unification")); err != nil {
if !fortiAPIPatch(o["log-unification"]) {
return fmt.Errorf("Error reading log_unification: %v", err)
}
}
if err = d.Set("configuration_sync", dataSourceFlattenSystemCsfConfigurationSync(o["configuration-sync"], d, "configuration_sync")); err != nil {
if !fortiAPIPatch(o["configuration-sync"]) {
return fmt.Errorf("Error reading configuration_sync: %v", err)
}
}
if err = d.Set("fabric_object_unification", dataSourceFlattenSystemCsfFabricObjectUnification(o["fabric-object-unification"], d, "fabric_object_unification")); err != nil {
if !fortiAPIPatch(o["fabric-object-unification"]) {
return fmt.Errorf("Error reading fabric_object_unification: %v", err)
}
}
if err = d.Set("saml_configuration_sync", dataSourceFlattenSystemCsfSamlConfigurationSync(o["saml-configuration-sync"], d, "saml_configuration_sync")); err != nil {
if !fortiAPIPatch(o["saml-configuration-sync"]) {
return fmt.Errorf("Error reading saml_configuration_sync: %v", err)
}
}
if err = d.Set("management_ip", dataSourceFlattenSystemCsfManagementIp(o["management-ip"], d, "management_ip")); err != nil {
if !fortiAPIPatch(o["management-ip"]) {
return fmt.Errorf("Error reading management_ip: %v", err)
}
}
if err = d.Set("management_port", dataSourceFlattenSystemCsfManagementPort(o["management-port"], d, "management_port")); err != nil {
if !fortiAPIPatch(o["management-port"]) {
return fmt.Errorf("Error reading management_port: %v", err)
}
}
if err = d.Set("authorization_request_type", dataSourceFlattenSystemCsfAuthorizationRequestType(o["authorization-request-type"], d, "authorization_request_type")); err != nil {
if !fortiAPIPatch(o["authorization-request-type"]) {
return fmt.Errorf("Error reading authorization_request_type: %v", err)
}
}
if err = d.Set("certificate", dataSourceFlattenSystemCsfCertificate(o["certificate"], d, "certificate")); err != nil {
if !fortiAPIPatch(o["certificate"]) {
return fmt.Errorf("Error reading certificate: %v", err)
}
}
if err = d.Set("fabric_workers", dataSourceFlattenSystemCsfFabricWorkers(o["fabric-workers"], d, "fabric_workers")); err != nil {
if !fortiAPIPatch(o["fabric-workers"]) {
return fmt.Errorf("Error reading fabric_workers: %v", err)
}
}
if err = d.Set("downstream_access", dataSourceFlattenSystemCsfDownstreamAccess(o["downstream-access"], d, "downstream_access")); err != nil {
if !fortiAPIPatch(o["downstream-access"]) {
return fmt.Errorf("Error reading downstream_access: %v", err)
}
}
if err = d.Set("downstream_accprofile", dataSourceFlattenSystemCsfDownstreamAccprofile(o["downstream-accprofile"], d, "downstream_accprofile")); err != nil {
if !fortiAPIPatch(o["downstream-accprofile"]) {
return fmt.Errorf("Error reading downstream_accprofile: %v", err)
}
}
if err = d.Set("trusted_list", dataSourceFlattenSystemCsfTrustedList(o["trusted-list"], d, "trusted_list")); err != nil {
if !fortiAPIPatch(o["trusted-list"]) {
return fmt.Errorf("Error reading trusted_list: %v", err)
}
}
if err = d.Set("fabric_connector", dataSourceFlattenSystemCsfFabricConnector(o["fabric-connector"], d, "fabric_connector")); err != nil {
if !fortiAPIPatch(o["fabric-connector"]) {
return fmt.Errorf("Error reading fabric_connector: %v", err)
}
}
if err = d.Set("forticloud_account_enforcement", dataSourceFlattenSystemCsfForticloudAccountEnforcement(o["forticloud-account-enforcement"], d, "forticloud_account_enforcement")); err != nil {
if !fortiAPIPatch(o["forticloud-account-enforcement"]) {
return fmt.Errorf("Error reading forticloud_account_enforcement: %v", err)
}
}
if err = d.Set("fabric_device", dataSourceFlattenSystemCsfFabricDevice(o["fabric-device"], d, "fabric_device")); err != nil {
if !fortiAPIPatch(o["fabric-device"]) {
return fmt.Errorf("Error reading fabric_device: %v", err)
}
}
return nil
}
func dataSourceFlattenSystemCsfFortiTestDebug(d *schema.ResourceData, fosdebugsn int, fosdebugbeg int, fosdebugend int) {
log.Printf(strconv.Itoa(fosdebugsn))
e := validation.IntBetween(fosdebugbeg, fosdebugend)
log.Printf("ER List: %v, %v", strings.Split("FortiOS Ver", " "), e)
}