/
data_source_sdwan_vpn_interface_ethernet_pppoe_feature_template.go
875 lines (854 loc) · 34.3 KB
/
data_source_sdwan_vpn_interface_ethernet_pppoe_feature_template.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
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
// Copyright © 2023 Cisco Systems, Inc. and its affiliates.
// All rights reserved.
//
// Licensed under the Mozilla Public License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://mozilla.org/MPL/2.0/
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// SPDX-License-Identifier: MPL-2.0
// Code generated by "gen/generator.go"; DO NOT EDIT.
package provider
import (
"context"
"fmt"
"net/url"
"github.com/CiscoDevNet/terraform-provider-sdwan/internal/provider/helpers"
"github.com/hashicorp/terraform-plugin-framework-validators/datasourcevalidator"
"github.com/hashicorp/terraform-plugin-framework/datasource"
"github.com/hashicorp/terraform-plugin-framework/datasource/schema"
"github.com/hashicorp/terraform-plugin-framework/path"
"github.com/hashicorp/terraform-plugin-framework/types"
"github.com/hashicorp/terraform-plugin-log/tflog"
"github.com/netascode/go-sdwan"
"github.com/tidwall/gjson"
)
// Ensure the implementation satisfies the expected interfaces.
var (
_ datasource.DataSource = &VPNInterfaceEthernetPPPoEFeatureTemplateDataSource{}
_ datasource.DataSourceWithConfigure = &VPNInterfaceEthernetPPPoEFeatureTemplateDataSource{}
)
func NewVPNInterfaceEthernetPPPoEFeatureTemplateDataSource() datasource.DataSource {
return &VPNInterfaceEthernetPPPoEFeatureTemplateDataSource{}
}
type VPNInterfaceEthernetPPPoEFeatureTemplateDataSource struct {
client *sdwan.Client
}
func (d *VPNInterfaceEthernetPPPoEFeatureTemplateDataSource) Metadata(_ context.Context, req datasource.MetadataRequest, resp *datasource.MetadataResponse) {
resp.TypeName = req.ProviderTypeName + "_vpn_interface_ethernet_pppoe_feature_template"
}
func (d *VPNInterfaceEthernetPPPoEFeatureTemplateDataSource) Schema(ctx context.Context, req datasource.SchemaRequest, resp *datasource.SchemaResponse) {
resp.Schema = schema.Schema{
// This description is used by the documentation generator and the language server.
MarkdownDescription: "This data source can read the VPN Interface Ethernet PPPoE feature template.",
Attributes: map[string]schema.Attribute{
"id": schema.StringAttribute{
MarkdownDescription: "The id of the feature template",
Optional: true,
Computed: true,
},
"version": schema.Int64Attribute{
MarkdownDescription: "The version of the feature template",
Computed: true,
},
"template_type": schema.StringAttribute{
MarkdownDescription: "The template type",
Computed: true,
},
"name": schema.StringAttribute{
MarkdownDescription: "The name of the feature template",
Optional: true,
Computed: true,
},
"description": schema.StringAttribute{
MarkdownDescription: "The description of the feature template",
Computed: true,
},
"device_types": schema.SetAttribute{
MarkdownDescription: "List of supported device types",
ElementType: types.StringType,
Computed: true,
},
"ethernet_interface_name": schema.StringAttribute{
MarkdownDescription: "Ethernet Interface/Sub Interface Name including sub interface number",
Computed: true,
},
"ethernet_interface_name_variable": schema.StringAttribute{
MarkdownDescription: helpers.NewAttributeDescription("Variable name").String,
Computed: true,
},
"shutdown": schema.BoolAttribute{
MarkdownDescription: "Administrative state",
Computed: true,
},
"shutdown_variable": schema.StringAttribute{
MarkdownDescription: helpers.NewAttributeDescription("Variable name").String,
Computed: true,
},
"interface_description": schema.StringAttribute{
MarkdownDescription: "Interface description",
Computed: true,
},
"interface_description_variable": schema.StringAttribute{
MarkdownDescription: helpers.NewAttributeDescription("Variable name").String,
Computed: true,
},
"encap": schema.Int64Attribute{
MarkdownDescription: "Encapsulation VLAN id",
Computed: true,
},
"encap_variable": schema.StringAttribute{
MarkdownDescription: helpers.NewAttributeDescription("Variable name").String,
Computed: true,
},
"dialer_pool_number": schema.Int64Attribute{
MarkdownDescription: "Dialer pool number",
Computed: true,
},
"dialer_pool_number_variable": schema.StringAttribute{
MarkdownDescription: helpers.NewAttributeDescription("Variable name").String,
Computed: true,
},
"ppp_maximum_payload": schema.Int64Attribute{
MarkdownDescription: "Maximum MRU to be negotiated during PPP LCP negotiation",
Computed: true,
},
"ppp_maximum_payload_variable": schema.StringAttribute{
MarkdownDescription: helpers.NewAttributeDescription("Variable name").String,
Computed: true,
},
"dialer_address_negotiated": schema.BoolAttribute{
MarkdownDescription: "Dialer IP Negotiated",
Computed: true,
},
"dialer_address_negotiated_variable": schema.StringAttribute{
MarkdownDescription: helpers.NewAttributeDescription("Variable name").String,
Computed: true,
},
"ip_directed_broadcast": schema.BoolAttribute{
MarkdownDescription: "IP Directed-Broadcast",
Computed: true,
},
"ip_directed_broadcast_variable": schema.StringAttribute{
MarkdownDescription: helpers.NewAttributeDescription("Variable name").String,
Computed: true,
},
"unnumbered_loopback_interface": schema.StringAttribute{
MarkdownDescription: "Dialer IP Unnumbered Loopback interface name",
Computed: true,
},
"unnumbered_loopback_interface_variable": schema.StringAttribute{
MarkdownDescription: helpers.NewAttributeDescription("Variable name").String,
Computed: true,
},
"ppp_authentication_protocol": schema.StringAttribute{
MarkdownDescription: "PPP Link Authentication Protocol",
Computed: true,
},
"ppp_authentication_protocol_variable": schema.StringAttribute{
MarkdownDescription: helpers.NewAttributeDescription("Variable name").String,
Computed: true,
},
"ppp_authentication_protocol_pap": schema.BoolAttribute{
MarkdownDescription: "PPP Authentication Protocol PAP",
Computed: true,
},
"chap_hostname": schema.StringAttribute{
MarkdownDescription: "CHAP Hostname",
Computed: true,
},
"chap_hostname_variable": schema.StringAttribute{
MarkdownDescription: helpers.NewAttributeDescription("Variable name").String,
Computed: true,
},
"chap_ppp_auth_password": schema.StringAttribute{
MarkdownDescription: "Specify ppp chap authentication Password",
Computed: true,
},
"chap_ppp_auth_password_variable": schema.StringAttribute{
MarkdownDescription: helpers.NewAttributeDescription("Variable name").String,
Computed: true,
},
"pap_username": schema.StringAttribute{
MarkdownDescription: "PAP outbound Sent Username",
Computed: true,
},
"pap_username_variable": schema.StringAttribute{
MarkdownDescription: helpers.NewAttributeDescription("Variable name").String,
Computed: true,
},
"pap_password": schema.BoolAttribute{
MarkdownDescription: "PAP outbound Password",
Computed: true,
},
"pap_ppp_auth_password": schema.StringAttribute{
MarkdownDescription: "Specify ppp pap authentication Password",
Computed: true,
},
"pap_ppp_auth_password_variable": schema.StringAttribute{
MarkdownDescription: helpers.NewAttributeDescription("Variable name").String,
Computed: true,
},
"ppp_authentication_type": schema.StringAttribute{
MarkdownDescription: "Authenticate remote on incoming call only",
Computed: true,
},
"enable_core_region": schema.BoolAttribute{
MarkdownDescription: "Enable core region",
Computed: true,
},
"core_region": schema.StringAttribute{
MarkdownDescription: "Enable core region",
Computed: true,
},
"core_region_variable": schema.StringAttribute{
MarkdownDescription: helpers.NewAttributeDescription("Variable name").String,
Computed: true,
},
"secondary_region": schema.StringAttribute{
MarkdownDescription: "Enable secondary region",
Computed: true,
},
"secondary_region_variable": schema.StringAttribute{
MarkdownDescription: helpers.NewAttributeDescription("Variable name").String,
Computed: true,
},
"tunnel_interface_encapsulations": schema.ListNestedAttribute{
MarkdownDescription: "Encapsulation for TLOC",
Computed: true,
NestedObject: schema.NestedAttributeObject{
Attributes: map[string]schema.Attribute{
"encapsulation": schema.StringAttribute{
MarkdownDescription: "Encapsulation",
Computed: true,
},
"preference": schema.Int64Attribute{
MarkdownDescription: "Set preference for TLOC",
Computed: true,
},
"preference_variable": schema.StringAttribute{
MarkdownDescription: helpers.NewAttributeDescription("Variable name").String,
Computed: true,
},
"weight": schema.Int64Attribute{
MarkdownDescription: "Set weight for TLOC",
Computed: true,
},
"weight_variable": schema.StringAttribute{
MarkdownDescription: helpers.NewAttributeDescription("Variable name").String,
Computed: true,
},
"optional": schema.BoolAttribute{
MarkdownDescription: "Indicates if list item is considered optional.",
Computed: true,
},
},
},
},
"tunnel_interface_groups": schema.SetAttribute{
MarkdownDescription: "List of groups",
ElementType: types.Int64Type,
Computed: true,
},
"tunnel_interface_groups_variable": schema.StringAttribute{
MarkdownDescription: helpers.NewAttributeDescription("Variable name").String,
Computed: true,
},
"tunnel_interface_border": schema.BoolAttribute{
MarkdownDescription: "Set TLOC as border TLOC",
Computed: true,
},
"tunnel_interface_border_variable": schema.StringAttribute{
MarkdownDescription: helpers.NewAttributeDescription("Variable name").String,
Computed: true,
},
"per_tunnel_qos": schema.BoolAttribute{
MarkdownDescription: "Per-tunnel Qos",
Computed: true,
},
"per_tunnel_qos_variable": schema.StringAttribute{
MarkdownDescription: helpers.NewAttributeDescription("Variable name").String,
Computed: true,
},
"per_tunnel_qos_aggregator": schema.BoolAttribute{
MarkdownDescription: "Per-tunnel QoS Aggregator",
Computed: true,
},
"per_tunnel_qos_aggregator_variable": schema.StringAttribute{
MarkdownDescription: helpers.NewAttributeDescription("Variable name").String,
Computed: true,
},
"tunnel_qos_mode": schema.StringAttribute{
MarkdownDescription: "Set tunnel QoS mode",
Computed: true,
},
"tunnel_qos_mode_variable": schema.StringAttribute{
MarkdownDescription: helpers.NewAttributeDescription("Variable name").String,
Computed: true,
},
"tunnel_interface_color": schema.StringAttribute{
MarkdownDescription: "Set color for TLOC",
Computed: true,
},
"tunnel_interface_color_variable": schema.StringAttribute{
MarkdownDescription: helpers.NewAttributeDescription("Variable name").String,
Computed: true,
},
"tunnel_interface_last_resort_circuit": schema.BoolAttribute{
MarkdownDescription: "Set TLOC as last resort",
Computed: true,
},
"tunnel_interface_last_resort_circuit_variable": schema.StringAttribute{
MarkdownDescription: helpers.NewAttributeDescription("Variable name").String,
Computed: true,
},
"tunnel_interface_low_bandwidth_link": schema.BoolAttribute{
MarkdownDescription: "Set the interface as a low-bandwidth circuit",
Computed: true,
},
"tunnel_interface_low_bandwidth_link_variable": schema.StringAttribute{
MarkdownDescription: helpers.NewAttributeDescription("Variable name").String,
Computed: true,
},
"tunnel_interface_tunnel_tcp_mss": schema.Int64Attribute{
MarkdownDescription: "Tunnel TCP MSS on SYN packets, in bytes",
Computed: true,
},
"tunnel_interface_tunnel_tcp_mss_variable": schema.StringAttribute{
MarkdownDescription: helpers.NewAttributeDescription("Variable name").String,
Computed: true,
},
"tunnel_interface_clear_dont_fragment": schema.BoolAttribute{
MarkdownDescription: "Enable clear dont fragment (Currently Only SDWAN Tunnel Interface)",
Computed: true,
},
"tunnel_interface_clear_dont_fragment_variable": schema.StringAttribute{
MarkdownDescription: helpers.NewAttributeDescription("Variable name").String,
Computed: true,
},
"tunnel_interface_network_broadcast": schema.BoolAttribute{
MarkdownDescription: "Accept and respond to network-prefix-directed broadcasts)",
Computed: true,
},
"tunnel_interface_network_broadcast_variable": schema.StringAttribute{
MarkdownDescription: helpers.NewAttributeDescription("Variable name").String,
Computed: true,
},
"tunnel_interface_max_control_connections": schema.Int64Attribute{
MarkdownDescription: "Set the maximum number of control connections for this TLOC",
Computed: true,
},
"tunnel_interface_max_control_connections_variable": schema.StringAttribute{
MarkdownDescription: helpers.NewAttributeDescription("Variable name").String,
Computed: true,
},
"tunnel_interface_control_connections": schema.BoolAttribute{
MarkdownDescription: "Allow Control Connection",
Computed: true,
},
"tunnel_interface_control_connections_variable": schema.StringAttribute{
MarkdownDescription: helpers.NewAttributeDescription("Variable name").String,
Computed: true,
},
"tunnel_interface_vbond_as_stun_server": schema.BoolAttribute{
MarkdownDescription: "Put this wan interface in STUN mode only",
Computed: true,
},
"tunnel_interface_vbond_as_stun_server_variable": schema.StringAttribute{
MarkdownDescription: helpers.NewAttributeDescription("Variable name").String,
Computed: true,
},
"tunnel_interface_exclude_controller_group_list": schema.SetAttribute{
MarkdownDescription: "Exclude the following controller groups defined in this list",
ElementType: types.Int64Type,
Computed: true,
},
"tunnel_interface_exclude_controller_group_list_variable": schema.StringAttribute{
MarkdownDescription: helpers.NewAttributeDescription("Variable name").String,
Computed: true,
},
"tunnel_interface_vmanage_connection_preference": schema.Int64Attribute{
MarkdownDescription: "Set interface preference for control connection to vManage <0..8>",
Computed: true,
},
"tunnel_interface_vmanage_connection_preference_variable": schema.StringAttribute{
MarkdownDescription: helpers.NewAttributeDescription("Variable name").String,
Computed: true,
},
"tunnel_interface_port_hop": schema.BoolAttribute{
MarkdownDescription: "Disallow port hopping on the tunnel interface",
Computed: true,
},
"tunnel_interface_port_hop_variable": schema.StringAttribute{
MarkdownDescription: helpers.NewAttributeDescription("Variable name").String,
Computed: true,
},
"tunnel_interface_color_restrict": schema.BoolAttribute{
MarkdownDescription: "Restrict this TLOC behavior",
Computed: true,
},
"tunnel_interface_carrier": schema.StringAttribute{
MarkdownDescription: "Set carrier for TLOC",
Computed: true,
},
"tunnel_interface_carrier_variable": schema.StringAttribute{
MarkdownDescription: helpers.NewAttributeDescription("Variable name").String,
Computed: true,
},
"tunnel_interface_nat_refresh_interval": schema.Int64Attribute{
MarkdownDescription: "Set time period of nat refresh packets <1...60> seconds",
Computed: true,
},
"tunnel_interface_nat_refresh_interval_variable": schema.StringAttribute{
MarkdownDescription: helpers.NewAttributeDescription("Variable name").String,
Computed: true,
},
"tunnel_interface_hello_interval": schema.Int64Attribute{
MarkdownDescription: "Set time period of control hello packets <100..600000> milli seconds",
Computed: true,
},
"tunnel_interface_hello_interval_variable": schema.StringAttribute{
MarkdownDescription: helpers.NewAttributeDescription("Variable name").String,
Computed: true,
},
"tunnel_interface_hello_tolerance": schema.Int64Attribute{
MarkdownDescription: "Set tolerance of control hello packets <12..6000> seconds",
Computed: true,
},
"tunnel_interface_hello_tolerance_variable": schema.StringAttribute{
MarkdownDescription: helpers.NewAttributeDescription("Variable name").String,
Computed: true,
},
"tunnel_interface_bind_loopback_tunnel": schema.StringAttribute{
MarkdownDescription: "Bind loopback tunnel interface to a physical interface",
Computed: true,
},
"tunnel_interface_bind_loopback_tunnel_variable": schema.StringAttribute{
MarkdownDescription: helpers.NewAttributeDescription("Variable name").String,
Computed: true,
},
"tunnel_interface_allow_all": schema.BoolAttribute{
MarkdownDescription: "Allow all traffic. Overrides all other allow-service options if allow-service all is set",
Computed: true,
},
"tunnel_interface_allow_all_variable": schema.StringAttribute{
MarkdownDescription: helpers.NewAttributeDescription("Variable name").String,
Computed: true,
},
"tunnel_interface_allow_bgp": schema.BoolAttribute{
MarkdownDescription: "Allow/deny BGP",
Computed: true,
},
"tunnel_interface_allow_bgp_variable": schema.StringAttribute{
MarkdownDescription: helpers.NewAttributeDescription("Variable name").String,
Computed: true,
},
"tunnel_interface_allow_dhcp": schema.BoolAttribute{
MarkdownDescription: "Allow/Deny DHCP",
Computed: true,
},
"tunnel_interface_allow_dhcp_variable": schema.StringAttribute{
MarkdownDescription: helpers.NewAttributeDescription("Variable name").String,
Computed: true,
},
"tunnel_interface_allow_dns": schema.BoolAttribute{
MarkdownDescription: "Allow/Deny DNS",
Computed: true,
},
"tunnel_interface_allow_dns_variable": schema.StringAttribute{
MarkdownDescription: helpers.NewAttributeDescription("Variable name").String,
Computed: true,
},
"tunnel_interface_allow_icmp": schema.BoolAttribute{
MarkdownDescription: "Allow/Deny ICMP",
Computed: true,
},
"tunnel_interface_allow_icmp_variable": schema.StringAttribute{
MarkdownDescription: helpers.NewAttributeDescription("Variable name").String,
Computed: true,
},
"tunnel_interface_allow_ssh": schema.BoolAttribute{
MarkdownDescription: "Allow/Deny SSH",
Computed: true,
},
"tunnel_interface_allow_ssh_variable": schema.StringAttribute{
MarkdownDescription: helpers.NewAttributeDescription("Variable name").String,
Computed: true,
},
"tunnel_interface_allow_ntp": schema.BoolAttribute{
MarkdownDescription: "Allow/Deny NTP",
Computed: true,
},
"tunnel_interface_allow_ntp_variable": schema.StringAttribute{
MarkdownDescription: helpers.NewAttributeDescription("Variable name").String,
Computed: true,
},
"tunnel_interface_allow_netconf": schema.BoolAttribute{
MarkdownDescription: "Allow/Deny NETCONF",
Computed: true,
},
"tunnel_interface_allow_netconf_variable": schema.StringAttribute{
MarkdownDescription: helpers.NewAttributeDescription("Variable name").String,
Computed: true,
},
"tunnel_interface_allow_ospf": schema.BoolAttribute{
MarkdownDescription: "Allow/Deny OSPF",
Computed: true,
},
"tunnel_interface_allow_ospf_variable": schema.StringAttribute{
MarkdownDescription: helpers.NewAttributeDescription("Variable name").String,
Computed: true,
},
"tunnel_interface_allow_stun": schema.BoolAttribute{
MarkdownDescription: "Allow/Deny STUN",
Computed: true,
},
"tunnel_interface_allow_stun_variable": schema.StringAttribute{
MarkdownDescription: helpers.NewAttributeDescription("Variable name").String,
Computed: true,
},
"tunnel_interface_allow_snmp": schema.BoolAttribute{
MarkdownDescription: "Allow/Deny SNMP",
Computed: true,
},
"tunnel_interface_allow_snmp_variable": schema.StringAttribute{
MarkdownDescription: helpers.NewAttributeDescription("Variable name").String,
Computed: true,
},
"tunnel_interface_allow_https": schema.BoolAttribute{
MarkdownDescription: "Allow/Deny Https",
Computed: true,
},
"tunnel_interface_allow_https_variable": schema.StringAttribute{
MarkdownDescription: helpers.NewAttributeDescription("Variable name").String,
Computed: true,
},
"nat": schema.BoolAttribute{
MarkdownDescription: "Network Address Translation on this interface",
Computed: true,
},
"nat_refresh_mode": schema.StringAttribute{
MarkdownDescription: "Set NAT refresh mode",
Computed: true,
},
"nat_refresh_mode_variable": schema.StringAttribute{
MarkdownDescription: helpers.NewAttributeDescription("Variable name").String,
Computed: true,
},
"nat_udp_timeout": schema.Int64Attribute{
MarkdownDescription: "Set NAT UDP session timeout, in minutes",
Computed: true,
},
"nat_udp_timeout_variable": schema.StringAttribute{
MarkdownDescription: helpers.NewAttributeDescription("Variable name").String,
Computed: true,
},
"nat_tcp_timeout": schema.Int64Attribute{
MarkdownDescription: "Set NAT TCP session timeout, in minutes",
Computed: true,
},
"nat_tcp_timeout_variable": schema.StringAttribute{
MarkdownDescription: helpers.NewAttributeDescription("Variable name").String,
Computed: true,
},
"nat_block_icmp_error": schema.BoolAttribute{
MarkdownDescription: "Block inbound ICMP error messages",
Computed: true,
},
"nat_block_icmp_error_variable": schema.StringAttribute{
MarkdownDescription: helpers.NewAttributeDescription("Variable name").String,
Computed: true,
},
"nat_response_to_ping": schema.BoolAttribute{
MarkdownDescription: "Respond to ping requests to NAT interface ip address from the public side",
Computed: true,
},
"nat_response_to_ping_variable": schema.StringAttribute{
MarkdownDescription: helpers.NewAttributeDescription("Variable name").String,
Computed: true,
},
"nat_port_forwards": schema.ListNestedAttribute{
MarkdownDescription: "Set port-forwarding rules for NAT on this interface",
Computed: true,
NestedObject: schema.NestedAttributeObject{
Attributes: map[string]schema.Attribute{
"port_start_range": schema.Int64Attribute{
MarkdownDescription: "Starting port of port range",
Computed: true,
},
"port_end_range": schema.Int64Attribute{
MarkdownDescription: "Ending port of port range",
Computed: true,
},
"protocol": schema.StringAttribute{
MarkdownDescription: "Layer 4 protocol to apply port forwarding to",
Computed: true,
},
"private_vpn": schema.Int64Attribute{
MarkdownDescription: "VPN in which private IP Address resides",
Computed: true,
},
"private_vpn_variable": schema.StringAttribute{
MarkdownDescription: helpers.NewAttributeDescription("Variable name").String,
Computed: true,
},
"private_ip_address": schema.StringAttribute{
MarkdownDescription: "Private IP Address to translate to",
Computed: true,
},
"private_ip_address_variable": schema.StringAttribute{
MarkdownDescription: helpers.NewAttributeDescription("Variable name").String,
Computed: true,
},
"optional": schema.BoolAttribute{
MarkdownDescription: "Indicates if list item is considered optional.",
Computed: true,
},
},
},
},
"qos_adaptive_period": schema.Int64Attribute{
MarkdownDescription: "Periodic timer for adaptive QoS in minutes",
Computed: true,
},
"qos_adaptive_period_variable": schema.StringAttribute{
MarkdownDescription: helpers.NewAttributeDescription("Variable name").String,
Computed: true,
},
"qos_adaptive_bandwidth_downstream": schema.Int64Attribute{
MarkdownDescription: "Adaptive QoS default downstream bandwidth",
Computed: true,
},
"qos_adaptive_bandwidth_downstream_variable": schema.StringAttribute{
MarkdownDescription: helpers.NewAttributeDescription("Variable name").String,
Computed: true,
},
"qos_adaptive_min_downstream": schema.Int64Attribute{
MarkdownDescription: "Downstream min bandwidth limit",
Computed: true,
},
"qos_adaptive_min_downstream_variable": schema.StringAttribute{
MarkdownDescription: helpers.NewAttributeDescription("Variable name").String,
Computed: true,
},
"qos_adaptive_max_downstream": schema.Int64Attribute{
MarkdownDescription: "Downstream max bandwidth limit",
Computed: true,
},
"qos_adaptive_max_downstream_variable": schema.StringAttribute{
MarkdownDescription: helpers.NewAttributeDescription("Variable name").String,
Computed: true,
},
"qos_adaptive_bandwidth_upstream": schema.Int64Attribute{
MarkdownDescription: "Adaptive QoS default upstream bandwidth",
Computed: true,
},
"qos_adaptive_bandwidth_upstream_variable": schema.StringAttribute{
MarkdownDescription: helpers.NewAttributeDescription("Variable name").String,
Computed: true,
},
"qos_adaptive_min_upstream": schema.Int64Attribute{
MarkdownDescription: "Upstream min bandwidth limit",
Computed: true,
},
"qos_adaptive_min_upstream_variable": schema.StringAttribute{
MarkdownDescription: helpers.NewAttributeDescription("Variable name").String,
Computed: true,
},
"qos_adaptive_max_upstream": schema.Int64Attribute{
MarkdownDescription: "Upstream max bandwidth limit",
Computed: true,
},
"qos_adaptive_max_upstream_variable": schema.StringAttribute{
MarkdownDescription: helpers.NewAttributeDescription("Variable name").String,
Computed: true,
},
"shaping_rate": schema.Int64Attribute{
MarkdownDescription: "1ge interfaces: [0..1000000]kbps; 10ge interfaces: [0..10000000]kbps",
Computed: true,
},
"shaping_rate_variable": schema.StringAttribute{
MarkdownDescription: helpers.NewAttributeDescription("Variable name").String,
Computed: true,
},
"qos_map": schema.StringAttribute{
MarkdownDescription: "Name of QoS map",
Computed: true,
},
"qos_map_variable": schema.StringAttribute{
MarkdownDescription: helpers.NewAttributeDescription("Variable name").String,
Computed: true,
},
"qos_map_vpn": schema.StringAttribute{
MarkdownDescription: "Name of VPN QoS map",
Computed: true,
},
"qos_map_vpn_variable": schema.StringAttribute{
MarkdownDescription: helpers.NewAttributeDescription("Variable name").String,
Computed: true,
},
"bandwidth_upstream": schema.Int64Attribute{
MarkdownDescription: "Interface upstream bandwidth capacity, in kbps",
Computed: true,
},
"bandwidth_upstream_variable": schema.StringAttribute{
MarkdownDescription: helpers.NewAttributeDescription("Variable name").String,
Computed: true,
},
"bandwidth_downstream": schema.Int64Attribute{
MarkdownDescription: "Interface downstream bandwidth capacity, in kbps",
Computed: true,
},
"bandwidth_downstream_variable": schema.StringAttribute{
MarkdownDescription: helpers.NewAttributeDescription("Variable name").String,
Computed: true,
},
"write_rule": schema.StringAttribute{
MarkdownDescription: "Name of rewrite rule",
Computed: true,
},
"write_rule_variable": schema.StringAttribute{
MarkdownDescription: helpers.NewAttributeDescription("Variable name").String,
Computed: true,
},
"access_lists": schema.ListNestedAttribute{
MarkdownDescription: "Apply ACL",
Computed: true,
NestedObject: schema.NestedAttributeObject{
Attributes: map[string]schema.Attribute{
"direction": schema.StringAttribute{
MarkdownDescription: "Direction",
Computed: true,
},
"acl_name": schema.StringAttribute{
MarkdownDescription: "Name of access list",
Computed: true,
},
"acl_name_variable": schema.StringAttribute{
MarkdownDescription: helpers.NewAttributeDescription("Variable name").String,
Computed: true,
},
"optional": schema.BoolAttribute{
MarkdownDescription: "Indicates if list item is considered optional.",
Computed: true,
},
},
},
},
"policers": schema.ListNestedAttribute{
MarkdownDescription: "Enable policer",
Computed: true,
NestedObject: schema.NestedAttributeObject{
Attributes: map[string]schema.Attribute{
"direction": schema.StringAttribute{
MarkdownDescription: "Direction",
Computed: true,
},
"policer_name": schema.StringAttribute{
MarkdownDescription: "Name of policer",
Computed: true,
},
"optional": schema.BoolAttribute{
MarkdownDescription: "Indicates if list item is considered optional.",
Computed: true,
},
},
},
},
"ip_mtu_for_dialer_interface": schema.Int64Attribute{
MarkdownDescription: "IP MTU <576..2000>, in bytes",
Computed: true,
},
"ip_mtu_for_dialer_interface_variable": schema.StringAttribute{
MarkdownDescription: helpers.NewAttributeDescription("Variable name").String,
Computed: true,
},
"dialer_tcp_mss": schema.Int64Attribute{
MarkdownDescription: "Dialer TCP MSS on SYN packets, in bytes",
Computed: true,
},
"dialer_tcp_mss_variable": schema.StringAttribute{
MarkdownDescription: helpers.NewAttributeDescription("Variable name").String,
Computed: true,
},
"tloc_extension": schema.StringAttribute{
MarkdownDescription: "Extends a local TLOC to a remote node only for vpn 0",
Computed: true,
},
"tloc_extension_variable": schema.StringAttribute{
MarkdownDescription: helpers.NewAttributeDescription("Variable name").String,
Computed: true,
},
"tracker": schema.SetAttribute{
MarkdownDescription: "Enable tracker for this interface",
ElementType: types.StringType,
Computed: true,
},
"tracker_variable": schema.StringAttribute{
MarkdownDescription: helpers.NewAttributeDescription("Variable name").String,
Computed: true,
},
},
}
}
func (d *VPNInterfaceEthernetPPPoEFeatureTemplateDataSource) ConfigValidators(ctx context.Context) []datasource.ConfigValidator {
return []datasource.ConfigValidator{
datasourcevalidator.ExactlyOneOf(
path.MatchRoot("id"),
path.MatchRoot("name"),
),
}
}
func (d *VPNInterfaceEthernetPPPoEFeatureTemplateDataSource) Configure(_ context.Context, req datasource.ConfigureRequest, _ *datasource.ConfigureResponse) {
if req.ProviderData == nil {
return
}
d.client = req.ProviderData.(*SdwanProviderData).Client
}
func (d *VPNInterfaceEthernetPPPoEFeatureTemplateDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) {
var config VPNInterfaceEthernetPPPoE
// Read config
diags := req.Config.Get(ctx, &config)
resp.Diagnostics.Append(diags...)
if resp.Diagnostics.HasError() {
return
}
tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Read", config.Id.String()))
if config.Id.IsNull() && !config.Name.IsNull() {
res, err := d.client.Get("/template/feature")
if err != nil {
resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve existing templates, got error: %s", err))
return
}
if value := res.Get("data"); len(value.Array()) > 0 {
value.ForEach(func(k, v gjson.Result) bool {
if config.Name.ValueString() == v.Get("templateName").String() {
config.Id = types.StringValue(v.Get("templateId").String())
tflog.Debug(ctx, fmt.Sprintf("%s: Found feature template with name '%v', id: %v", config.Id.String(), config.Name.ValueString(), config.Id.String()))
return false
}
return true
})
}
if config.Id.IsNull() {
resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to find feature template with name: %s", config.Name.ValueString()))
return
}
}
res, err := d.client.Get("/template/feature/object/" + url.QueryEscape(config.Id.ValueString()))
if err != nil {
resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve object, got error: %s", err))
return
}
config.fromBody(ctx, res)
tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", config.Name.ValueString()))
diags = resp.State.Set(ctx, &config)
resp.Diagnostics.Append(diags...)
}