forked from scottdware/go-bigip
-
Notifications
You must be signed in to change notification settings - Fork 36
/
ltm.go
4321 lines (3791 loc) · 156 KB
/
ltm.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
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*
Original work Copyright © 2015 Scott Ware
Modifications Copyright 2019 F5 Networks Inc
Licensed under the Apache 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 http://www.apache.org/licenses/LICENSE-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.
*/
package bigip
import (
"encoding/json"
"fmt"
"log"
"net/url"
"strings"
)
// ServerSSLProfiles
// Documentation: https://devcentral.f5.com/wiki/iControlREST.APIRef_tm_ltm_profile_server-ssl.ashx
// ServerSSLProfiles contains a list of every server-ssl profile on the BIG-IP system.
type ServerSSLProfiles struct {
ServerSSLProfiles []ServerSSLProfile `json:"items"`
}
// ServerSSLProfile contains information about each server-ssl profile. You can use all
// of these fields when modifying a server-ssl profile.
type ServerSSLProfile struct {
Name string `json:"name,omitempty"`
Partition string `json:"partition,omitempty"`
FullPath string `json:"fullPath,omitempty"`
Generation int `json:"generation,omitempty"`
AlertTimeout string `json:"alertTimeout,omitempty"`
Authenticate string `json:"authenticate,omitempty"`
AuthenticateDepth int `json:"authenticateDepth,omitempty"`
C3dCaCert string `json:"c3dCaCert,omitempty"`
C3dCaKey string `json:"c3dCaKey,omitempty"`
C3dCaPassphrase string `json:"c3dCaPassphrase,omitempty"`
C3dCertExtensionCustomOids []string `json:"c3dCertExtensionCustomOids,omitempty"`
C3dCertExtensionIncludes interface{} `json:"c3dCertExtensionIncludes,omitempty"`
C3dCertLifespan int `json:"c3dCertLifespan,omitempty"`
CaFile string `json:"caFile,omitempty"`
CacheSize int `json:"cacheSize,omitempty"`
CacheTimeout int `json:"cacheTimeout,omitempty"`
Cert string `json:"cert,omitempty"`
Chain string `json:"chain,omitempty"`
Ciphers string `json:"ciphers,omitempty"`
CipherGroup string `json:"cipherGroup,omitempty"`
DefaultsFrom string `json:"defaultsFrom,omitempty"`
ExpireCertResponseControl string `json:"expireCertResponseControl,omitempty"`
GenericAlert string `json:"genericAlert,omitempty"`
HandshakeTimeout string `json:"handshakeTimeout,omitempty"`
Key string `json:"key,omitempty"`
ModSslMethods string `json:"modSslMethods,omitempty"`
Mode string `json:"mode,omitempty"`
TmOptions interface{} `json:"tmOptions,omitempty"`
Passphrase string `json:"passphrase,omitempty"`
PeerCertMode string `json:"peerCertMode,omitempty"`
ProxyCaCert string `json:"proxyCaCert,omitempty"`
ProxyCaKey string `json:"proxyCaKey,omitempty"`
ProxySsl string `json:"proxySsl,omitempty"`
RenegotiatePeriod string `json:"renegotiatePeriod,omitempty"`
RenegotiateSize string `json:"renegotiateSize,omitempty"`
Renegotiation string `json:"renegotiation,omitempty"`
RetainCertificate string `json:"retainCertificate,omitempty"`
SecureRenegotiation string `json:"secureRenegotiation,omitempty"`
ServerName string `json:"serverName,omitempty"`
SessionMirroring string `json:"sessionMirroring,omitempty"`
SessionTicket string `json:"sessionTicket,omitempty"`
SniDefault string `json:"sniDefault,omitempty"`
SniRequire string `json:"sniRequire,omitempty"`
SslC3d string `json:"sslC3d,omitempty"`
SslForwardProxy string `json:"sslForwardProxy,omitempty"`
SslForwardProxyBypass string `json:"sslForwardProxyBypass,omitempty"`
SslSignHash string `json:"sslSignHash,omitempty"`
StrictResume string `json:"strictResume,omitempty"`
UncleanShutdown string `json:"uncleanShutdown,omitempty"`
UntrustedCertResponseControl string `json:"untrustedCertResponseControl,omitempty"`
}
// ClientSSLProfiles
// Documentation: https://devcentral.f5.com/wiki/iControlREST.APIRef_tm_ltm_profile_client-ssl.ashx
// ClientSSLProfiles contains a list of every client-ssl profile on the BIG-IP system.
type ClientSSLProfiles struct {
ClientSSLProfiles []ClientSSLProfile `json:"items"`
}
// ClientSSLProfile contains information about each client-ssl profile. You can use all
// of these fields when modifying a client-ssl profile.
type ClientSSLProfile struct {
Name string `json:"name,omitempty"`
Partition string `json:"partition,omitempty"`
FullPath string `json:"fullPath,omitempty"`
Generation int `json:"generation,omitempty"`
AlertTimeout string `json:"alertTimeout,omitempty"`
AllowNonSsl string `json:"allowNonSsl,omitempty"`
AllowExpiredCrl string `json:"allowExpiredCrl,omitempty"`
Authenticate string `json:"authenticate,omitempty"`
AuthenticateDepth int `json:"authenticateDepth,omitempty"`
C3dClientFallbackCert string `json:"c3dClientFallbackCert,omitempty"`
C3dDropUnknownOcspStatus string `json:"c3dDropUnknownOcspStatus,omitempty"`
C3dOcsp string `json:"c3dOcsp,omitempty"`
CaFile string `json:"caFile,omitempty"`
CacheSize int `json:"cacheSize,omitempty"`
CacheTimeout int `json:"cacheTimeout,omitempty"`
Cert string `json:"cert,omitempty"`
CertKeyChain []struct {
Name string `json:"name,omitempty"`
Cert string `json:"cert,omitempty"`
Chain string `json:"chain,omitempty"`
Key string `json:"key,omitempty"`
Passphrase string `json:"passphrase,omitempty"`
} `json:"certKeyChain,omitempty"`
CertExtensionIncludes []string `json:"certExtensionIncludes,omitempty"`
CertLifespan int `json:"certLifespan,omitempty"`
CertLookupByIpaddrPort string `json:"certLookupByIpaddrPort,omitempty"`
Chain string `json:"chain,omitempty"`
Ciphers string `json:"ciphers,omitempty"`
CipherGroup string `json:"cipherGroup,omitempty"`
ClientCertCa string `json:"clientCertCa,omitempty"`
CrlFile string `json:"crlFile,omitempty"`
DefaultsFrom string `json:"defaultsFrom,omitempty"`
ForwardProxyBypassDefaultAction string `json:"forwardProxyBypassDefaultAction,omitempty"`
GenericAlert string `json:"genericAlert,omitempty"`
HandshakeTimeout string `json:"handshakeTimeout,omitempty"`
InheritCertkeychain string `json:"inheritCertkeychain,omitempty"`
Key string `json:"key,omitempty"`
ModSslMethods string `json:"modSslMethods,omitempty"`
Mode string `json:"mode,omitempty"`
OcspStapling string `json:"ocspStapling,omitempty"`
TmOptions interface{} `json:"tmOptions,omitempty"`
Passphrase string `json:"passphrase,omitempty"`
PeerCertMode string `json:"peerCertMode,omitempty"`
ProxyCaCert string `json:"proxyCaCert,omitempty"`
ProxyCaKey string `json:"proxyCaKey,omitempty"`
ProxyCaPassphrase string `json:"proxyCaPassphrase,omitempty"`
ProxySsl string `json:"proxySsl,omitempty"`
ProxySslPassthrough string `json:"proxySslPassthrough,omitempty"`
RenegotiatePeriod string `json:"renegotiatePeriod,omitempty"`
RenegotiateSize string `json:"renegotiateSize,omitempty"`
Renegotiation string `json:"renegotiation,omitempty"`
RetainCertificate string `json:"retainCertificate,omitempty"`
SecureRenegotiation string `json:"secureRenegotiation,omitempty"`
ServerName string `json:"serverName,omitempty"`
SessionMirroring string `json:"sessionMirroring,omitempty"`
SessionTicket string `json:"sessionTicket,omitempty"`
SniDefault string `json:"sniDefault,omitempty"`
SniRequire string `json:"sniRequire,omitempty"`
SslC3d string `json:"sslC3d,omitempty"`
SslForwardProxy string `json:"sslForwardProxy,omitempty"`
SslForwardProxyBypass string `json:"sslForwardProxyBypass,omitempty"`
SslSignHash string `json:"sslSignHash,omitempty"`
StrictResume string `json:"strictResume,omitempty"`
UncleanShutdown string `json:"uncleanShutdown,omitempty"`
}
// Nodes contains a list of every node on the BIG-IP system.
type Nodes struct {
Nodes []Node `json:"items"`
}
// Node contains information about each individual node. You can use all
// of these fields when modifying a node.
type Node struct {
Name string `json:"name,omitempty"`
Partition string `json:"partition,omitempty"`
FullPath string `json:"fullPath,omitempty"`
Description string `json:"description,omitempty"`
Generation int `json:"generation,omitempty"`
Address string `json:"address,omitempty"`
ConnectionLimit int `json:"connectionLimit,omitempty"`
DynamicRatio int `json:"dynamicRatio,omitempty"`
Logging string `json:"logging,omitempty"`
Monitor string `json:"monitor,omitempty"`
RateLimit string `json:"rateLimit,omitempty"`
Ratio int `json:"ratio,omitempty"`
Session string `json:"session,omitempty"`
State string `json:"state,omitempty"`
FQDN struct {
AddressFamily string `json:"addressFamily,omitempty"`
AutoPopulate string `json:"autopopulate,omitempty"`
DownInterval int `json:"downInterval,omitempty"`
Interval string `json:"interval,omitempty"`
Name string `json:"tmName,omitempty"`
} `json:"fqdn,omitempty"`
}
type ExternalDG struct {
Name string `json:"name,omitempty"`
FullPath string `json:"fullPath,omitempty"`
ExternalFileName string `json:"externalFileName,omitempty"`
Type string `json:"type,omitempty"`
}
// DataGroups contains a list of data groups on the BIG-IP system.
type DataGroups struct {
DataGroups []DataGroup `json:"items"`
}
// DataGroups contains information about each data group.
type DataGroup struct {
Name string
Partition string
FullPath string
Generation int
Type string
Records []DataGroupRecord
}
type DataGroupRecord struct {
Name string `json:"name,omitempty"`
Data string `json:"data,omitempty"`
}
type dataGroupDTO struct {
Name string `json:"name,omitempty"`
Partition string `json:"partition,omitempty"`
FullPath string `json:"fullPath,omitempty"`
Generation int `json:"generation,omitempty"`
Type string `json:"type,omitempty"`
Records []DataGroupRecord `json:"records,omitempty"`
}
func (p *DataGroup) MarshalJSON() ([]byte, error) {
return json.Marshal(dataGroupDTO{
Name: p.Name,
Partition: p.Partition,
FullPath: p.FullPath,
Generation: p.Generation,
Type: p.Type,
Records: p.Records,
})
}
func (p *DataGroup) UnmarshalJSON(b []byte) error {
var dto dataGroupDTO
err := json.Unmarshal(b, &dto)
if err != nil {
return err
}
p.Name = dto.Name
p.Partition = dto.Partition
p.Type = dto.Type
p.FullPath = dto.FullPath
p.Generation = dto.Generation
p.Records = dto.Records
return nil
}
// SnatPools contains a list of every snatpool on the BIG-IP system.
type SnatPools struct {
SnatPools []SnatPool `json:"items"`
}
// SnatPool contains information about each individual snatpool. You can use all
// of these fields when modifying a snatpool.
type SnatPool struct {
Name string `json:"name,omitempty"`
Partition string `json:"partition,omitempty"`
FullPath string `json:"fullPath,omitempty"`
Generation int `json:"generation,omitempty"`
Members []string `json:"members,omitempty"`
}
// Pools contains a list of pools on the BIG-IP system.
type Pools struct {
Pools []Pool `json:"items"`
}
// Pool contains information about each pool. You can use all of these
// fields when modifying a pool.
type Pool struct {
Name string `json:"name,omitempty"`
Partition string `json:"partition,omitempty"`
FullPath string `json:"fullPath,omitempty"`
Description string `json:"description,omitempty"`
Generation int `json:"generation,omitempty"`
AllowNAT string `json:"allowNat,omitempty"`
AllowSNAT string `json:"allowSnat,omitempty"`
IgnorePersistedWeight string `json:"ignorePersistedWeight,omitempty"`
IPTOSToClient string `json:"ipTosToClient,omitempty"`
IPTOSToServer string `json:"ipTosToServer,omitempty"`
LinkQoSToClient string `json:"linkQosToClient,omitempty"`
LinkQoSToServer string `json:"linkQosToServer,omitempty"`
LoadBalancingMode string `json:"loadBalancingMode,omitempty"`
MinActiveMembers int `json:"minActiveMembers,omitempty"`
MinUpMembers int `json:"minUpMembers,omitempty"`
MinUpMembersAction string `json:"minUpMembersAction,omitempty"`
MinUpMembersChecking string `json:"minUpMembersChecking,omitempty"`
Monitor string `json:"monitor,omitempty"`
QueueDepthLimit int `json:"queueDepthLimit,omitempty"`
QueueOnConnectionLimit string `json:"queueOnConnectionLimit,omitempty"`
QueueTimeLimit int `json:"queueTimeLimit,omitempty"`
ReselectTries int `json:"reselectTries"`
ServiceDownAction string `json:"serviceDownAction,omitempty"`
SlowRampTime int `json:"slowRampTime"`
}
// Pool Members contains a list of pool members within a pool on the BIG-IP system.
type PoolMembers struct {
PoolMembers []PoolMember `json:"items"`
}
// poolMember is used only when adding members to a pool.
type poolMember struct {
Name string `json:"name"`
}
type PoolMemberFqdn struct {
Name string `json:"name"`
FQDN struct {
AddressFamily string `json:"addressFamily,omitempty"`
AutoPopulate string `json:"autopopulate,omitempty"`
DownInterval int `json:"downInterval,omitempty"`
Interval string `json:"interval,omitempty"`
Name string `json:"tmName,omitempty"`
} `json:"fqdn,omitempty"`
}
// poolMembers is used only when modifying members on a pool.
type poolMembers struct {
Members []PoolMember `json:"members"`
}
// Pool Member contains information about each individual member in a pool. You can use all
// of these fields when modifying a pool member.
type PoolMember struct {
Name string `json:"name,omitempty"`
Partition string `json:"partition,omitempty"`
FullPath string `json:"fullPath,omitempty"`
Generation int `json:"generation,omitempty"`
Address string `json:"address,omitempty"`
ConnectionLimit int `json:"connectionLimit,omitempty"`
DynamicRatio int `json:"dynamicRatio,omitempty"`
FQDN struct {
AddressFamily string `json:"addressFamily,omitempty"`
AutoPopulate string `json:"autopopulate,omitempty"`
DownInterval int `json:"downInterval,omitempty"`
Interval string `json:"interval,omitempty"`
Name string `json:"tmName,omitempty"`
} `json:"fqdn,omitempty"`
InheritProfile string `json:"inheritProfile,omitempty"`
Logging string `json:"logging,omitempty"`
Monitor string `json:"monitor,omitempty"`
PriorityGroup int `json:"priorityGroup,omitempty"`
RateLimit string `json:"rateLimit,omitempty"`
Ratio int `json:"ratio,omitempty"`
Session string `json:"session,omitempty"`
State string `json:"state,omitempty"`
}
// Pool transfer object so we can mask the bool data munging
type poolDTO struct {
Name string `json:"name,omitempty"`
Partition string `json:"partition,omitempty"`
FullPath string `json:"fullPath,omitempty"`
Description string `json:"description,omitempty"`
Generation int `json:"generation,omitempty"`
AllowNAT string `json:"allowNat,omitempty"`
AllowSNAT string `json:"allowSnat,omitempty"`
IgnorePersistedWeight string `json:"ignorePersistedWeight,omitempty" bool:"enabled"`
IPTOSToClient string `json:"ipTosToClient,omitempty"`
IPTOSToServer string `json:"ipTosToServer,omitempty"`
LinkQoSToClient string `json:"linkQosToClient,omitempty"`
LinkQoSToServer string `json:"linkQosToServer,omitempty"`
LoadBalancingMode string `json:"loadBalancingMode,omitempty"`
MinActiveMembers int `json:"minActiveMembers,omitempty"`
MinUpMembers int `json:"minUpMembers,omitempty"`
MinUpMembersAction string `json:"minUpMembersAction,omitempty"`
MinUpMembersChecking string `json:"minUpMembersChecking,omitempty"`
Monitor string `json:"monitor,omitempty"`
QueueDepthLimit int `json:"queueDepthLimit,omitempty"`
QueueOnConnectionLimit string `json:"queueOnConnectionLimit,omitempty"`
QueueTimeLimit int `json:"queueTimeLimit,omitempty"`
ReselectTries int `json:"reselectTries"`
ServiceDownAction string `json:"serviceDownAction,omitempty"`
SlowRampTime int `json:"slowRampTime"`
}
func (p *Pool) MarshalJSON() ([]byte, error) {
var dto poolDTO
marshal(&dto, p)
return json.Marshal(dto)
}
func (p *Pool) UnmarshalJSON(b []byte) error {
var dto poolDTO
err := json.Unmarshal(b, &dto)
if err != nil {
return err
}
return marshal(p, &dto)
}
// PersistenceProfiles contains of list of persistence profiles
type PersistenceProfiles struct {
PersistenceProfiles []PersistenceProfile `json:"items"`
}
// PersistenceProfile is a base for all persistence profiles
type PersistenceProfile struct {
AppService string `json:"appService,omitempty"`
DefaultsFrom string `json:"defaultsFrom,omitempty"`
Description string `json:"description,omitempty"`
FullPath string `json:"fullPath,omitempty"`
MatchAcrossPools string `json:"matchAcrossPools,omitempty"`
MatchAcrossServices string `json:"matchAcrossServices,omitempty"`
MatchAcrossVirtuals string `json:"matchAcrossVirtuals,omitempty"`
Method string `json:"method,omitempty"`
Mirror string `json:"mirror,omitempty"`
Mode string `json:"mode,omitempty"`
Name string `json:"name,omitempty"`
OverrideConnectionLimit string `json:"overrideConnectionLimit,omitempty"`
Partition string `json:"partition,omitempty"`
TmPartition string `json:"tmPartition,omitempty"`
Timeout string `json:"timeout,omitempty"`
}
// CookiePersistenceProfiles contains a list of all cookies profiles
type CookiePersistenceProfiles struct {
CookiePersistenceProfiles []CookiePersistenceProfile `json:"items"`
}
// CookiePersistenceProfile Defines a single cookie profile
type CookiePersistenceProfile struct {
PersistenceProfile
AlwaysSend string `json:"alwaysSend,omitempty"`
CookieEncryption string `json:"cookieEncryption,omitempty"`
CookieEncryptionPassphrase string `json:"cookieEncryptionPassphrase,omitempty"`
CookieName string `json:"cookieName,omitempty"`
Expiration string `json:"expiration,omitempty"`
HashLength int `json:"hashLength,omitempty"`
HashOffset int `json:"hashOffset,omitempty"`
HTTPOnly string `json:"httponly,omitempty"`
Method string `json:"method,omitempty"`
Secure string `json:"secure,omitempty"`
}
// DestAddrPersistenceProfiles contains a list of all dest-addr profiles
type DestAddrPersistenceProfiles struct {
DestAddrPersistenceProfiles []DestAddrPersistenceProfile `json:"items"`
}
// DestAddrPersistenceProfile Defines a single dest-addr profile
type DestAddrPersistenceProfile struct {
PersistenceProfile
HashAlgorithm string `json:"hashAlgorithm,omitempty"`
Mask string `json:"mask,omitempty"`
}
// HashPersistenceProfiles contains a list of all hash profiles
type HashPersistenceProfiles struct {
HashPersistenceProfiles []HashPersistenceProfile `json:"items"`
}
// HashPersistenceProfile Defines a single hash profile
type HashPersistenceProfile struct {
PersistenceProfile
HashAlgorithm string `json:"hashAlgorithm,omitempty"`
HashBufferLimit int `json:"hashBufferLimit,omitempty"`
HashEndPattern int `json:"hashEndPattern,omitempty"`
HashLength int `json:"hashLength,omitempty"`
HashOffset int `json:"hashOffset,omitempty"`
HashStartPattern int `json:"hashStartPattern,omitempty"`
}
// HostPersistenceProfiles contains a list of all host profiles
type HostPersistenceProfiles struct {
HostPersistenceProfiles []HostPersistenceProfile `json:"items"`
}
// HostPersistenceProfile Defines a single host profile
type HostPersistenceProfile struct {
PersistenceProfile
}
// MSRDPPersistenceProfiles contains a list of all msrdp profiles
type MSRDPPersistenceProfiles struct {
MSRDPPersistenceProfiles []MSRDPPersistenceProfile `json:"items"`
}
// MSRDPPersistenceProfile Defines a single msrdp profile
type MSRDPPersistenceProfile struct {
PersistenceProfile
HasSessionDir string `json:"hasSessionDir,omitempty"`
}
// SIPPersistenceProfiles contains a list of all sip profiles
type SIPPersistenceProfiles struct {
SIPPersistenceProfiles []SIPPersistenceProfile `json:"items"`
}
// SIPPersistenceProfile Defines a single sip profile
type SIPPersistenceProfile struct {
PersistenceProfile
SIPInfo string `json:"sipInfo,omitempty"`
}
// SourceAddrPersistenceProfiles contains a list of all source-addr profiles
type SourceAddrPersistenceProfiles struct {
SourceAddrPersistenceProfiles []SourceAddrPersistenceProfile `json:"items"`
}
// SourceAddrPersistenceProfile Defines a single source-addr profile
type SourceAddrPersistenceProfile struct {
PersistenceProfile
HashAlgorithm string `json:"hashAlgorithm,omitempty"`
MapProxies string `json:"mapProxies,omitempty"`
MapProxyAddress string `json:"mapProxyAddress,omitempty"`
MapProxyClass string `json:"mapProxyClass,omitempty"`
Mask string `json:"mask,omitempty"`
}
// SSLPersistenceProfiles contains a list of all ssl profiles
type SSLPersistenceProfiles struct {
SSLPersistenceProfiles []SSLPersistenceProfile `json:"items"`
}
// SSLPersistenceProfile Defines a single ssl profile
type SSLPersistenceProfile struct {
PersistenceProfile
}
// UniversalPersistenceProfiles contains a list of all universal profiles
type UniversalPersistenceProfiles struct {
SSLPersistenceProfiles []UniversalPersistenceProfile `json:"items"`
}
// UniversalPersistenceProfile Defines a single universal profile
type UniversalPersistenceProfile struct {
PersistenceProfile
Rule string `json:"rule,omitempty"`
}
// VirtualServers contains a list of all virtual servers on the BIG-IP system.
type VirtualServers struct {
VirtualServers []VirtualServer `json:"items"`
}
// VirtualServer contains information about each individual virtual server.
type VirtualServer struct {
Name string `json:"name,omitempty"`
Partition string `json:"partition,omitempty"`
FullPath string `json:"fullPath,omitempty"`
Generation int `json:"generation,omitempty"`
Description string `json:"description,omitempty"`
AddressStatus string `json:"addressStatus,omitempty"`
AutoLastHop string `json:"autoLastHop,omitempty"`
CMPEnabled string `json:"cmpEnabled,omitempty"`
ConnectionLimit int `json:"connectionLimit,omitempty"`
Destination string `json:"destination,omitempty"`
Enabled bool `json:"enabled,omitempty"`
Disabled bool `json:"disabled,omitempty"`
GTMScore int `json:"gtmScore,omitempty"`
FallbackPersistenceProfile string `json:"fallbackPersistence,omitempty"`
IPProtocol string `json:"ipProtocol,omitempty"`
Mask string `json:"mask,omitempty"`
Mirror string `json:"mirror,omitempty"`
MobileAppTunnel string `json:"mobileAppTunnel,omitempty"`
NAT64 string `json:"nat64,omitempty"`
Pool string `json:"pool"`
RateLimit string `json:"rateLimit,omitempty"`
RateLimitDestinationMask int `json:"rateLimitDstMask,omitempty"`
RateLimitMode string `json:"rateLimitMode,omitempty"`
RateLimitSourceMask int `json:"rateLimitSrcMask,omitempty"`
Source string `json:"source,omitempty"`
SourceAddressTranslation struct {
Type string `json:"type,omitempty"`
Pool string `json:"pool,omitempty"`
} `json:"sourceAddressTranslation,omitempty"`
SourcePort string `json:"sourcePort,omitempty"`
FwEnforcedPolicy string `json:"fwEnforcedPolicy,omitempty"`
SYNCookieStatus string `json:"synCookieStatus,omitempty"`
TranslateAddress string `json:"translateAddress,omitempty"`
TranslatePort string `json:"translatePort,omitempty"`
VlansEnabled bool `json:"vlansEnabled,omitempty"`
VlansDisabled bool `json:"vlansDisabled,omitempty"`
TrafficMatchingCriteria string `json:"trafficMatchingCriteria,omitempty"`
VSIndex int `json:"vsIndex,omitempty"`
Vlans []string `json:"vlans,omitempty"`
Rules []string `json:"rules,omitempty"`
SecurityLogProfiles []string `json:"securityLogProfiles,omitempty"`
PerFlowRequestAccessPolicy string `json:"perFlowRequestAccessPolicy,omitempty"`
PersistenceProfiles []Profile `json:"persist"`
Profiles []Profile `json:"profiles,omitempty"`
Policies []string `json:"policies"`
}
// VirtualAddresses contains a list of all virtual addresses on the BIG-IP system.
type VirtualAddresses struct {
VirtualAddresses []VirtualAddress `json:"items"`
}
// VirtualAddress contains information about each individual virtual address.
type VirtualAddress struct {
Name string
Partition string
FullPath string
Generation int
Address string
ARP bool
AutoDelete bool
ConnectionLimit int
Enabled bool
Floating bool
ICMPEcho string
InheritedTrafficGroup bool
Mask string
RouteAdvertisement string
ServerScope string
TrafficGroup string
Unit int
}
type virtualAddressDTO struct {
Name string `json:"name"`
Partition string `json:"partition,omitempty"`
FullPath string `json:"fullPath,omitempty"`
Generation int `json:"generation,omitempty"`
Address string `json:"address,omitempty"`
ARP string `json:"arp,omitempty" bool:"enabled"`
AutoDelete string `json:"autoDelete,omitempty" bool:"true"`
ConnectionLimit int `json:"connectionLimit,omitempty"`
Enabled string `json:"enabled,omitempty" bool:"yes"`
Floating string `json:"floating,omitempty" bool:"enabled"`
ICMPEcho string `json:"icmpEcho,omitempty"`
InheritedTrafficGroup string `json:"inheritedTrafficGroup,omitempty" bool:"yes"`
Mask string `json:"mask,omitempty"`
RouteAdvertisement string `json:"routeAdvertisement,omitempty"`
ServerScope string `json:"serverScope,omitempty"`
TrafficGroup string `json:"trafficGroup,omitempty"`
Unit int `json:"unit,omitempty"`
}
type Policies struct {
Policies []Policy `json:"items"`
}
type VirtualServerPolicies struct {
PolicyRef []VirtualServerPolicy `json:"items"`
}
type PolicyPublish struct {
Name string
Command string
}
type PolicyPublishDTO struct {
Name string `json:"name"`
Command string `json:"command"`
}
func (p *PolicyPublish) MarshalJSON() ([]byte, error) {
return json.Marshal(PolicyPublishDTO{
Name: p.Name,
Command: p.Command,
})
}
func (p *PolicyPublish) UnmarshalJSON(b []byte) error {
var dto PolicyPublishDTO
err := json.Unmarshal(b, &dto)
if err != nil {
return err
}
p.Name = dto.Name
p.Command = dto.Command
return nil
}
type Policy struct {
Name string
PublishCopy string
Partition string
Description string
FullPath string
Controls []string
Requires []string
Strategy string
Rules []PolicyRule
}
type policyDTO struct {
Name string `json:"name"`
PublishCopy string `json:"publishedCopy"`
Partition string `json:"partition,omitempty"`
Description string `json:"description"`
Controls []string `json:"controls,omitempty"`
Requires []string `json:"requires,omitempty"`
Strategy string `json:"strategy,omitempty"`
FullPath string `json:"fullPath,omitempty"`
Rules struct {
Items []PolicyRule `json:"items,omitempty"`
} `json:"rulesReference,omitempty"`
}
func (p *Policy) MarshalJSON() ([]byte, error) {
return json.Marshal(policyDTO{
Name: p.Name,
PublishCopy: p.PublishCopy,
Partition: p.Partition,
Controls: p.Controls,
Description: p.Description,
Requires: p.Requires,
Strategy: p.Strategy,
FullPath: p.FullPath,
Rules: struct {
Items []PolicyRule `json:"items,omitempty"`
}{Items: p.Rules},
})
}
func (p *Policy) UnmarshalJSON(b []byte) error {
var dto policyDTO
err := json.Unmarshal(b, &dto)
if err != nil {
return err
}
p.Name = dto.Name
p.PublishCopy = dto.PublishCopy
p.Partition = dto.Partition
p.Controls = dto.Controls
p.Requires = dto.Requires
p.Strategy = dto.Strategy
p.Description = dto.Description
p.Rules = dto.Rules.Items
p.FullPath = dto.FullPath
return nil
}
type VirtualServerPolicy struct {
Name string
Partition string
FullPath string
}
type VirtualServerPolicyDTO struct {
Name string `json:"name"`
Partition string `json:"partition,omitempty"`
FullPath string `json:"fullPath,omitempty"`
}
type PolicyRules struct {
Items []PolicyRule `json:"items,omitempty"`
}
type PolicyRule struct {
Name string
FullPath string
Ordinal int
Description string
Conditions []PolicyRuleCondition
Actions []PolicyRuleAction
}
type policyRuleDTO struct {
Name string `json:"name"`
Ordinal int `json:"ordinal"`
FullPath string `json:"fullPath,omitempty"`
Description string `json:"description,omitempty"`
Conditions struct {
Items []PolicyRuleCondition `json:"items,omitempty"`
} `json:"conditionsReference,omitempty"`
Actions struct {
Items []PolicyRuleAction `json:"items,omitempty"`
} `json:"actionsReference,omitempty"`
}
func (p *PolicyRule) MarshalJSON() ([]byte, error) {
return json.Marshal(policyRuleDTO{
Name: p.Name,
Ordinal: p.Ordinal,
FullPath: p.FullPath,
Description: p.Description,
Conditions: struct {
Items []PolicyRuleCondition `json:"items,omitempty"`
}{Items: p.Conditions},
Actions: struct {
Items []PolicyRuleAction `json:"items,omitempty"`
}{Items: p.Actions},
})
}
func (p *PolicyRule) UnmarshalJSON(b []byte) error {
var dto policyRuleDTO
err := json.Unmarshal(b, &dto)
if err != nil {
return err
}
p.Name = dto.Name
p.Ordinal = dto.Ordinal
p.Actions = dto.Actions.Items
p.Conditions = dto.Conditions.Items
p.FullPath = dto.FullPath
p.Description = dto.Description
return nil
}
type PolicyRuleActions struct {
Items []PolicyRuleAction `json:"items"`
}
type PolicyRuleAction struct {
Name string `json:"name,omitempty"`
AppService string `json:"appService,omitempty"`
Application string `json:"application,omitempty"`
Asm bool `json:"asm,omitempty"`
Avr bool `json:"avr,omitempty"`
Cache bool `json:"cache,omitempty"`
Carp bool `json:"carp,omitempty"`
Category string `json:"category,omitempty"`
Classify bool `json:"classify,omitempty"`
ClonePool string `json:"clonePool,omitempty"`
Code int `json:"code,omitempty"`
Compress bool `json:"compress,omitempty"`
Connection bool `json:"connection,omitempty"`
Content string `json:"content,omitempty"`
CookieHash bool `json:"cookieHash,omitempty"`
CookieInsert bool `json:"cookieInsert,omitempty"`
CookiePassive bool `json:"cookiePassive,omitempty"`
CookieRewrite bool `json:"cookieRewrite,omitempty"`
Decompress bool `json:"decompress,omitempty"`
Defer bool `json:"defer,omitempty"`
DestinationAddress bool `json:"destinationAddress,omitempty"`
Disable bool `json:"disable,omitempty"`
Domain string `json:"domain,omitempty"`
Enable bool `json:"enable,omitempty"`
Expiry string `json:"expiry,omitempty"`
ExpirySecs int `json:"expirySecs,omitempty"`
Expression string `json:"expression,omitempty"`
Extension string `json:"extension,omitempty"`
Facility string `json:"facility,omitempty"`
Forward bool `json:"forward,omitempty"`
FromProfile string `json:"fromProfile,omitempty"`
Hash bool `json:"hash,omitempty"`
Host string `json:"host,omitempty"`
Http bool `json:"http,omitempty"`
HttpBasicAuth bool `json:"httpBasicAuth,omitempty"`
HttpCookie bool `json:"httpCookie,omitempty"`
HttpHeader bool `json:"httpHeader,omitempty"`
HttpHost bool `json:"httpHost,omitempty"`
HttpReferer bool `json:"httpReferer,omitempty"`
HttpReply bool `json:"httpReply,omitempty"`
HttpSetCookie bool `json:"httpSetCookie,omitempty"`
HttpUri bool `json:"httpUri,omitempty"`
Ifile string `json:"ifile,omitempty"`
Insert bool `json:"insert,omitempty"`
InternalVirtual string `json:"internalVirtual,omitempty"`
IpAddress string `json:"ipAddress,omitempty"`
Key string `json:"key,omitempty"`
L7dos bool `json:"l7dos,omitempty"`
Length int `json:"length,omitempty"`
Location string `json:"location,omitempty"`
Log bool `json:"log,omitempty"`
LtmPolicy bool `json:"ltmPolicy,omitempty"`
Member string `json:"member,omitempty"`
Message string `json:"message,omitempty"`
TmName string `json:"tmName,omitempty"`
Netmask string `json:"netmask,omitempty"`
Nexthop string `json:"nexthop,omitempty"`
Node string `json:"node,omitempty"`
Offset int `json:"offset,omitempty"`
Path string `json:"path,omitempty"`
Pem bool `json:"pem,omitempty"`
Persist bool `json:"persist,omitempty"`
Pin bool `json:"pin,omitempty"`
Policy string `json:"policy,omitempty"`
Pool string `json:"pool,omitempty"`
Port int `json:"port,omitempty"`
Priority string `json:"priority,omitempty"`
Profile string `json:"profile,omitempty"`
Protocol string `json:"protocol,omitempty"`
QueryString string `json:"queryString,omitempty"`
Rateclass string `json:"rateclass,omitempty"`
Redirect bool `json:"redirect,omitempty"`
Remove bool `json:"remove,omitempty"`
Replace bool `json:"replace,omitempty"`
Request bool `json:"request,omitempty"`
RequestAdapt bool `json:"requestAdapt,omitempty"`
Reset bool `json:"reset,omitempty"`
Response bool `json:"response,omitempty"`
ResponseAdapt bool `json:"responseAdapt,omitempty"`
Scheme string `json:"scheme,omitempty"`
Script string `json:"script,omitempty"`
Select bool `json:"select,omitempty"`
ServerSsl bool `json:"serverSsl,omitempty"`
SetVariable bool `json:"setVariable,omitempty"`
Shutdown bool `json:"shutdown,omitempty"`
Snat string `json:"snat,omitempty"`
Snatpool string `json:"snatpool,omitempty"`
SourceAddress bool `json:"sourceAddress,omitempty"`
SslClientHello bool `json:"sslClientHello,omitempty"`
SslServerHandshake bool `json:"sslServerHandshake,omitempty"`
SslServerHello bool `json:"sslServerHello,omitempty"`
SslSessionId bool `json:"sslSessionId,omitempty"`
Status int `json:"status,omitempty"`
Tcl bool `json:"tcl,omitempty"`
TcpNagle bool `json:"tcpNagle,omitempty"`
Text string `json:"text,omitempty"`
Timeout int `json:"timeout,omitempty"`
Uie bool `json:"uie,omitempty"`
Universal bool `json:"universal,omitempty"`
Value string `json:"value,omitempty"`
Virtual string `json:"virtual,omitempty"`
Vlan string `json:"vlan,omitempty"`
VlanId int `json:"vlanId,omitempty"`
Wam bool `json:"wam,omitempty"`
Write bool `json:"write,omitempty"`
}
type PolicyRuleConditions struct {
Items []PolicyRuleCondition `json:"items"`
}
type PolicyRuleCondition struct {
Name string `json:"name,omitempty"`
Generation int `json:"generation,omitempty"`
Address bool `json:"address,omitempty"`
All bool `json:"all,omitempty"`
AppService string `json:"appService,omitempty"`
BrowserType bool `json:"browserType,omitempty"`
BrowserVersion bool `json:"browserVersion,omitempty"`
CaseInsensitive bool `json:"caseInsensitive,omitempty"`
CaseSensitive bool `json:"caseSensitive,omitempty"`
Cipher bool `json:"cipher,omitempty"`
CipherBits bool `json:"cipherBits,omitempty"`
ClientSsl bool `json:"clientSsl,omitempty"`
Code bool `json:"code,omitempty"`
CommonName bool `json:"commonName,omitempty"`
Contains bool `json:"contains,omitempty"`
Continent bool `json:"continent,omitempty"`
CountryCode bool `json:"countryCode,omitempty"`
CountryName bool `json:"countryName,omitempty"`
CpuUsage bool `json:"cpuUsage,omitempty"`
Datagroup string `json:"datagroup,omitempty"`
DeviceMake bool `json:"deviceMake,omitempty"`
DeviceModel bool `json:"deviceModel,omitempty"`
Domain bool `json:"domain,omitempty"`
EndsWith bool `json:"endsWith,omitempty"`
Equals bool `json:"equals,omitempty"`
Exists bool `json:"exists,omitempty"`
Expiry bool `json:"expiry,omitempty"`
Extension bool `json:"extension,omitempty"`
External bool `json:"external,omitempty"`
Geoip bool `json:"geoip,omitempty"`
Greater bool `json:"greater,omitempty"`
GreaterOrEqual bool `json:"greaterOrEqual,omitempty"`
Host bool `json:"host,omitempty"`
HttpBasicAuth bool `json:"httpBasicAuth,omitempty"`
HttpCookie bool `json:"httpCookie,omitempty"`
HttpHeader bool `json:"httpHeader,omitempty"`
HttpHost bool `json:"httpHost,omitempty"`
HttpMethod bool `json:"httpMethod,omitempty"`
HttpReferer bool `json:"httpReferer,omitempty"`
HttpSetCookie bool `json:"httpSetCookie,omitempty"`
HttpStatus bool `json:"httpStatus,omitempty"`
HttpUri bool `json:"httpUri,omitempty"`
HttpUserAgent bool `json:"httpUserAgent,omitempty"`
HttpVersion bool `json:"httpVersion,omitempty"`
Index int `json:"index,omitempty"`
Internal bool `json:"internal,omitempty"`
Isp bool `json:"isp,omitempty"`
Last_15secs bool `json:"last_15secs,omitempty"`
Last_1min bool `json:"last_1min,omitempty"`
Last_5mins bool `json:"last_5mins,omitempty"`
Less bool `json:"less,omitempty"`
LessOrEqual bool `json:"lessOrEqual,omitempty"`
Local bool `json:"local,omitempty"`
Major bool `json:"major,omitempty"`
Matches bool `json:"matches,omitempty"`
Minor bool `json:"minor,omitempty"`
Missing bool `json:"missing,omitempty"`
Mss bool `json:"mss,omitempty"`
TmName string `json:"tmName,omitempty"`
Not bool `json:"not,omitempty"`
Org bool `json:"org,omitempty"`
Password bool `json:"password,omitempty"`
Path bool `json:"path,omitempty"`
PathSegment bool `json:"pathSegment,omitempty"`
Port bool `json:"port,omitempty"`
Present bool `json:"present,omitempty"`
Protocol bool `json:"protocol,omitempty"`
QueryParameter bool `json:"queryParameter,omitempty"`
QueryString bool `json:"queryString,omitempty"`
RegionCode bool `json:"regionCode,omitempty"`
RegionName bool `json:"regionName,omitempty"`
Remote bool `json:"remote,omitempty"`
Request bool `json:"request,omitempty"`
ClientAccepted bool `json:"clientAccepted,omitempty"`
Response bool `json:"response,omitempty"`
RouteDomain bool `json:"routeDomain,omitempty"`
Rtt bool `json:"rtt,omitempty"`
Scheme bool `json:"scheme,omitempty"`
ServerName bool `json:"serverName,omitempty"`