forked from esurdam/go-sophos
-
Notifications
You must be signed in to change notification settings - Fork 0
/
service.go
742 lines (603 loc) · 26.6 KB
/
service.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
package objects
import (
"fmt"
"github.com/esurdam/go-sophos"
)
// Service is a generated struct representing the Sophos Service Endpoint
// GET /api/nodes/service
type Service struct {
ServiceAh ServiceAh `json:"service_ah"`
ServiceAny ServiceAny `json:"service_any"`
ServiceEsp ServiceEsp `json:"service_esp"`
ServiceGroup ServiceGroup `json:"service_group"`
ServiceIcmp ServiceIcmp `json:"service_icmp"`
ServiceIcmpv6 ServiceIcmpv6 `json:"service_icmpv6"`
ServiceIp ServiceIp `json:"service_ip"`
ServiceTcp ServiceTcp `json:"service_tcp"`
ServiceTcpudp ServiceTcpudp `json:"service_tcpudp"`
ServiceUdp ServiceUdp `json:"service_udp"`
}
var _ sophos.Endpoint = &Service{}
var defsService = map[string]sophos.RestObject{
"ServiceAh": &ServiceAh{},
"ServiceAny": &ServiceAny{},
"ServiceEsp": &ServiceEsp{},
"ServiceGroup": &ServiceGroup{},
"ServiceIcmp": &ServiceIcmp{},
"ServiceIcmpv6": &ServiceIcmpv6{},
"ServiceIp": &ServiceIp{},
"ServiceTcp": &ServiceTcp{},
"ServiceTcpudp": &ServiceTcpudp{},
"ServiceUdp": &ServiceUdp{},
}
// RestObjects implements the sophos.Node interface and returns a map of Service's Objects
func (Service) RestObjects() map[string]sophos.RestObject { return defsService }
// GetPath implements sophos.RestGetter
func (*Service) GetPath() string { return "/api/nodes/service" }
// RefRequired implements sophos.RestGetter
func (*Service) RefRequired() (string, bool) { return "", false }
var defService = &sophos.Definition{Description: "service", Name: "service", Link: "/api/definitions/service"}
// Definition returns the /api/definitions struct of Service
func (Service) Definition() sophos.Definition { return *defService }
// ApiRoutes returns all known Service Paths
func (Service) ApiRoutes() []string {
return []string{
"/api/objects/service/ah/",
"/api/objects/service/ah/{ref}",
"/api/objects/service/ah/{ref}/usedby",
"/api/objects/service/any/",
"/api/objects/service/any/{ref}",
"/api/objects/service/any/{ref}/usedby",
"/api/objects/service/esp/",
"/api/objects/service/esp/{ref}",
"/api/objects/service/esp/{ref}/usedby",
"/api/objects/service/group/",
"/api/objects/service/group/{ref}",
"/api/objects/service/group/{ref}/usedby",
"/api/objects/service/icmp/",
"/api/objects/service/icmp/{ref}",
"/api/objects/service/icmp/{ref}/usedby",
"/api/objects/service/icmpv6/",
"/api/objects/service/icmpv6/{ref}",
"/api/objects/service/icmpv6/{ref}/usedby",
"/api/objects/service/ip/",
"/api/objects/service/ip/{ref}",
"/api/objects/service/ip/{ref}/usedby",
"/api/objects/service/tcp/",
"/api/objects/service/tcp/{ref}",
"/api/objects/service/tcp/{ref}/usedby",
"/api/objects/service/tcpudp/",
"/api/objects/service/tcpudp/{ref}",
"/api/objects/service/tcpudp/{ref}/usedby",
"/api/objects/service/udp/",
"/api/objects/service/udp/{ref}",
"/api/objects/service/udp/{ref}/usedby",
}
}
// References returns the Service's references. These strings serve no purpose other than to demonstrate which
// Reference keys are used for this Endpoint
func (Service) References() []string {
return []string{
"REF_ServiceAh",
"REF_ServiceAny",
"REF_ServiceEsp",
"REF_ServiceGroup",
"REF_ServiceIcmp",
"REF_ServiceIcmpv6",
"REF_ServiceIp",
"REF_ServiceTcp",
"REF_ServiceTcpudp",
"REF_ServiceUdp",
}
}
// ServiceAhs is an Sophos Endpoint subType and implements sophos.RestObject
type ServiceAhs []ServiceAh
// ServiceAh represents a UTM AH service
type ServiceAh struct {
Locked string `json:"_locked"`
ObjectType string `json:"_type"`
Reference string `json:"_ref"`
Name string `json:"name"`
SpiHigh int `json:"spi_high"`
SpiLow int `json:"spi_low"`
Comment string `json:"comment"`
}
var _ sophos.RestGetter = &ServiceAh{}
// GetPath implements sophos.RestObject and returns the ServiceAhs GET path
// Returns all available service/ah objects
func (*ServiceAhs) GetPath() string { return "/api/objects/service/ah/" }
// RefRequired implements sophos.RestObject
func (*ServiceAhs) RefRequired() (string, bool) { return "", false }
// GetPath implements sophos.RestObject and returns the ServiceAhs GET path
// Returns all available ah types
func (s *ServiceAh) GetPath() string { return fmt.Sprintf("/api/objects/service/ah/%s", s.Reference) }
// RefRequired implements sophos.RestObject
func (s *ServiceAh) RefRequired() (string, bool) { return s.Reference, true }
// DeletePath implements sophos.RestObject and returns the ServiceAh DELETE path
// Creates or updates the complete object ah
func (*ServiceAh) DeletePath(ref string) string {
return fmt.Sprintf("/api/objects/service/ah/%s", ref)
}
// PatchPath implements sophos.RestObject and returns the ServiceAh PATCH path
// Changes to parts of the object ah types
func (*ServiceAh) PatchPath(ref string) string {
return fmt.Sprintf("/api/objects/service/ah/%s", ref)
}
// PostPath implements sophos.RestObject and returns the ServiceAh POST path
// Create a new service/ah object
func (*ServiceAh) PostPath() string {
return "/api/objects/service/ah/"
}
// PutPath implements sophos.RestObject and returns the ServiceAh PUT path
// Creates or updates the complete object ah
func (*ServiceAh) PutPath(ref string) string {
return fmt.Sprintf("/api/objects/service/ah/%s", ref)
}
// UsedByPath implements sophos.RestObject
// Returns the objects and the nodes that use the object with the given ref
func (*ServiceAh) UsedByPath(ref string) string {
return fmt.Sprintf("/api/objects/service/ah/%s/usedby", ref)
}
// ServiceAnys is an Sophos Endpoint subType and implements sophos.RestObject
type ServiceAnys []ServiceAny
// ServiceAny is a generated Sophos object
type ServiceAny struct {
Locked string `json:"_locked"`
Reference string `json:"_ref"`
ObjectType string `json:"_type"`
Comment string `json:"comment"`
Name string `json:"name"`
}
var _ sophos.RestGetter = &ServiceAny{}
// GetPath implements sophos.RestObject and returns the ServiceAnys GET path
// Returns all available service/any objects
func (*ServiceAnys) GetPath() string { return "/api/objects/service/any/" }
// RefRequired implements sophos.RestObject
func (*ServiceAnys) RefRequired() (string, bool) { return "", false }
// GetPath implements sophos.RestObject and returns the ServiceAnys GET path
// Returns all available any types
func (s *ServiceAny) GetPath() string { return fmt.Sprintf("/api/objects/service/any/%s", s.Reference) }
// RefRequired implements sophos.RestObject
func (s *ServiceAny) RefRequired() (string, bool) { return s.Reference, true }
// DeletePath implements sophos.RestObject and returns the ServiceAny DELETE path
// Creates or updates the complete object any
func (*ServiceAny) DeletePath(ref string) string {
return fmt.Sprintf("/api/objects/service/any/%s", ref)
}
// PatchPath implements sophos.RestObject and returns the ServiceAny PATCH path
// Changes to parts of the object any types
func (*ServiceAny) PatchPath(ref string) string {
return fmt.Sprintf("/api/objects/service/any/%s", ref)
}
// PostPath implements sophos.RestObject and returns the ServiceAny POST path
// Create a new service/any object
func (*ServiceAny) PostPath() string {
return "/api/objects/service/any/"
}
// PutPath implements sophos.RestObject and returns the ServiceAny PUT path
// Creates or updates the complete object any
func (*ServiceAny) PutPath(ref string) string {
return fmt.Sprintf("/api/objects/service/any/%s", ref)
}
// UsedByPath implements sophos.RestObject
// Returns the objects and the nodes that use the object with the given ref
func (*ServiceAny) UsedByPath(ref string) string {
return fmt.Sprintf("/api/objects/service/any/%s/usedby", ref)
}
// GetType implements sophos.Object
func (s *ServiceAny) GetType() string { return s.ObjectType }
// ServiceEsps is an Sophos Endpoint subType and implements sophos.RestObject
type ServiceEsps []ServiceEsp
// ServiceEsp represents a UTM ESP service
type ServiceEsp struct {
Locked string `json:"_locked"`
ObjectType string `json:"_type"`
Reference string `json:"_ref"`
Comment string `json:"comment"`
Name string `json:"name"`
SpiHigh int `json:"spi_high"`
SpiLow int `json:"spi_low"`
}
var _ sophos.RestGetter = &ServiceEsp{}
// GetPath implements sophos.RestObject and returns the ServiceEsps GET path
// Returns all available service/esp objects
func (*ServiceEsps) GetPath() string { return "/api/objects/service/esp/" }
// RefRequired implements sophos.RestObject
func (*ServiceEsps) RefRequired() (string, bool) { return "", false }
// GetPath implements sophos.RestObject and returns the ServiceEsps GET path
// Returns all available esp types
func (s *ServiceEsp) GetPath() string { return fmt.Sprintf("/api/objects/service/esp/%s", s.Reference) }
// RefRequired implements sophos.RestObject
func (s *ServiceEsp) RefRequired() (string, bool) { return s.Reference, true }
// DeletePath implements sophos.RestObject and returns the ServiceEsp DELETE path
// Creates or updates the complete object esp
func (*ServiceEsp) DeletePath(ref string) string {
return fmt.Sprintf("/api/objects/service/esp/%s", ref)
}
// PatchPath implements sophos.RestObject and returns the ServiceEsp PATCH path
// Changes to parts of the object esp types
func (*ServiceEsp) PatchPath(ref string) string {
return fmt.Sprintf("/api/objects/service/esp/%s", ref)
}
// PostPath implements sophos.RestObject and returns the ServiceEsp POST path
// Create a new service/esp object
func (*ServiceEsp) PostPath() string {
return "/api/objects/service/esp/"
}
// PutPath implements sophos.RestObject and returns the ServiceEsp PUT path
// Creates or updates the complete object esp
func (*ServiceEsp) PutPath(ref string) string {
return fmt.Sprintf("/api/objects/service/esp/%s", ref)
}
// UsedByPath implements sophos.RestObject
// Returns the objects and the nodes that use the object with the given ref
func (*ServiceEsp) UsedByPath(ref string) string {
return fmt.Sprintf("/api/objects/service/esp/%s/usedby", ref)
}
// ServiceGroups is an Sophos Endpoint subType and implements sophos.RestObject
type ServiceGroups []ServiceGroup
// ServiceGroup is a generated Sophos object
type ServiceGroup struct {
Locked string `json:"_locked"`
Reference string `json:"_ref"`
ObjectType string `json:"_type"`
Comment string `json:"comment"`
Members []string `json:"members"`
Name string `json:"name"`
Types []string `json:"types"`
}
var _ sophos.RestGetter = &ServiceGroup{}
// GetPath implements sophos.RestObject and returns the ServiceGroups GET path
// Returns all available service/group objects
func (*ServiceGroups) GetPath() string { return "/api/objects/service/group/" }
// RefRequired implements sophos.RestObject
func (*ServiceGroups) RefRequired() (string, bool) { return "", false }
// GetPath implements sophos.RestObject and returns the ServiceGroups GET path
// Returns all available group types
func (s *ServiceGroup) GetPath() string {
return fmt.Sprintf("/api/objects/service/group/%s", s.Reference)
}
// RefRequired implements sophos.RestObject
func (s *ServiceGroup) RefRequired() (string, bool) { return s.Reference, true }
// DeletePath implements sophos.RestObject and returns the ServiceGroup DELETE path
// Creates or updates the complete object group
func (*ServiceGroup) DeletePath(ref string) string {
return fmt.Sprintf("/api/objects/service/group/%s", ref)
}
// PatchPath implements sophos.RestObject and returns the ServiceGroup PATCH path
// Changes to parts of the object group types
func (*ServiceGroup) PatchPath(ref string) string {
return fmt.Sprintf("/api/objects/service/group/%s", ref)
}
// PostPath implements sophos.RestObject and returns the ServiceGroup POST path
// Create a new service/group object
func (*ServiceGroup) PostPath() string {
return "/api/objects/service/group/"
}
// PutPath implements sophos.RestObject and returns the ServiceGroup PUT path
// Creates or updates the complete object group
func (*ServiceGroup) PutPath(ref string) string {
return fmt.Sprintf("/api/objects/service/group/%s", ref)
}
// UsedByPath implements sophos.RestObject
// Returns the objects and the nodes that use the object with the given ref
func (*ServiceGroup) UsedByPath(ref string) string {
return fmt.Sprintf("/api/objects/service/group/%s/usedby", ref)
}
// GetType implements sophos.Object
func (s *ServiceGroup) GetType() string { return s.ObjectType }
// ServiceIcmps is an Sophos Endpoint subType and implements sophos.RestObject
type ServiceIcmps []ServiceIcmp
// ServiceIcmp is a generated Sophos object
type ServiceIcmp struct {
Locked string `json:"_locked"`
Reference string `json:"_ref"`
ObjectType string `json:"_type"`
Code int64 `json:"code"`
Comment string `json:"comment"`
Name string `json:"name"`
Type int64 `json:"type"`
}
var _ sophos.RestGetter = &ServiceIcmp{}
// GetPath implements sophos.RestObject and returns the ServiceIcmps GET path
// Returns all available service/icmp objects
func (*ServiceIcmps) GetPath() string { return "/api/objects/service/icmp/" }
// RefRequired implements sophos.RestObject
func (*ServiceIcmps) RefRequired() (string, bool) { return "", false }
// GetPath implements sophos.RestObject and returns the ServiceIcmps GET path
// Returns all available icmp types
func (s *ServiceIcmp) GetPath() string {
return fmt.Sprintf("/api/objects/service/icmp/%s", s.Reference)
}
// RefRequired implements sophos.RestObject
func (s *ServiceIcmp) RefRequired() (string, bool) { return s.Reference, true }
// DeletePath implements sophos.RestObject and returns the ServiceIcmp DELETE path
// Creates or updates the complete object icmp
func (*ServiceIcmp) DeletePath(ref string) string {
return fmt.Sprintf("/api/objects/service/icmp/%s", ref)
}
// PatchPath implements sophos.RestObject and returns the ServiceIcmp PATCH path
// Changes to parts of the object icmp types
func (*ServiceIcmp) PatchPath(ref string) string {
return fmt.Sprintf("/api/objects/service/icmp/%s", ref)
}
// PostPath implements sophos.RestObject and returns the ServiceIcmp POST path
// Create a new service/icmp object
func (*ServiceIcmp) PostPath() string {
return "/api/objects/service/icmp/"
}
// PutPath implements sophos.RestObject and returns the ServiceIcmp PUT path
// Creates or updates the complete object icmp
func (*ServiceIcmp) PutPath(ref string) string {
return fmt.Sprintf("/api/objects/service/icmp/%s", ref)
}
// UsedByPath implements sophos.RestObject
// Returns the objects and the nodes that use the object with the given ref
func (*ServiceIcmp) UsedByPath(ref string) string {
return fmt.Sprintf("/api/objects/service/icmp/%s/usedby", ref)
}
// GetType implements sophos.Object
func (s *ServiceIcmp) GetType() string { return s.ObjectType }
// ServiceIcmpv6s is an Sophos Endpoint subType and implements sophos.RestObject
type ServiceIcmpv6s []ServiceIcmpv6
// ServiceIcmpv6 represents a UTM ICMPv6 service
type ServiceIcmpv6 struct {
Locked string `json:"_locked"`
ObjectType string `json:"_type"`
Reference string `json:"_ref"`
Code int `json:"code"`
Comment string `json:"comment"`
Name string `json:"name"`
Type int `json:"type"`
}
var _ sophos.RestGetter = &ServiceIcmpv6{}
// GetPath implements sophos.RestObject and returns the ServiceIcmpv6s GET path
// Returns all available service/icmpv6 objects
func (*ServiceIcmpv6s) GetPath() string { return "/api/objects/service/icmpv6/" }
// RefRequired implements sophos.RestObject
func (*ServiceIcmpv6s) RefRequired() (string, bool) { return "", false }
// GetPath implements sophos.RestObject and returns the ServiceIcmpv6s GET path
// Returns all available icmpv6 types
func (s *ServiceIcmpv6) GetPath() string {
return fmt.Sprintf("/api/objects/service/icmpv6/%s", s.Reference)
}
// RefRequired implements sophos.RestObject
func (s *ServiceIcmpv6) RefRequired() (string, bool) { return s.Reference, true }
// DeletePath implements sophos.RestObject and returns the ServiceIcmpv6 DELETE path
// Creates or updates the complete object icmpv6
func (*ServiceIcmpv6) DeletePath(ref string) string {
return fmt.Sprintf("/api/objects/service/icmpv6/%s", ref)
}
// PatchPath implements sophos.RestObject and returns the ServiceIcmpv6 PATCH path
// Changes to parts of the object icmpv6 types
func (*ServiceIcmpv6) PatchPath(ref string) string {
return fmt.Sprintf("/api/objects/service/icmpv6/%s", ref)
}
// PostPath implements sophos.RestObject and returns the ServiceIcmpv6 POST path
// Create a new service/icmpv6 object
func (*ServiceIcmpv6) PostPath() string {
return "/api/objects/service/icmpv6/"
}
// PutPath implements sophos.RestObject and returns the ServiceIcmpv6 PUT path
// Creates or updates the complete object icmpv6
func (*ServiceIcmpv6) PutPath(ref string) string {
return fmt.Sprintf("/api/objects/service/icmpv6/%s", ref)
}
// UsedByPath implements sophos.RestObject
// Returns the objects and the nodes that use the object with the given ref
func (*ServiceIcmpv6) UsedByPath(ref string) string {
return fmt.Sprintf("/api/objects/service/icmpv6/%s/usedby", ref)
}
// ServiceIps is an Sophos Endpoint subType and implements sophos.RestObject
type ServiceIps []ServiceIp
// ServiceIp is a generated Sophos object
type ServiceIp struct {
Locked string `json:"_locked"`
Reference string `json:"_ref"`
ObjectType string `json:"_type"`
Comment string `json:"comment"`
Name string `json:"name"`
Proto int64 `json:"proto"`
}
var _ sophos.RestGetter = &ServiceIp{}
// GetPath implements sophos.RestObject and returns the ServiceIps GET path
// Returns all available service/ip objects
func (*ServiceIps) GetPath() string { return "/api/objects/service/ip/" }
// RefRequired implements sophos.RestObject
func (*ServiceIps) RefRequired() (string, bool) { return "", false }
// GetPath implements sophos.RestObject and returns the ServiceIps GET path
// Returns all available ip types
func (s *ServiceIp) GetPath() string { return fmt.Sprintf("/api/objects/service/ip/%s", s.Reference) }
// RefRequired implements sophos.RestObject
func (s *ServiceIp) RefRequired() (string, bool) { return s.Reference, true }
// DeletePath implements sophos.RestObject and returns the ServiceIp DELETE path
// Creates or updates the complete object ip
func (*ServiceIp) DeletePath(ref string) string {
return fmt.Sprintf("/api/objects/service/ip/%s", ref)
}
// PatchPath implements sophos.RestObject and returns the ServiceIp PATCH path
// Changes to parts of the object ip types
func (*ServiceIp) PatchPath(ref string) string {
return fmt.Sprintf("/api/objects/service/ip/%s", ref)
}
// PostPath implements sophos.RestObject and returns the ServiceIp POST path
// Create a new service/ip object
func (*ServiceIp) PostPath() string {
return "/api/objects/service/ip/"
}
// PutPath implements sophos.RestObject and returns the ServiceIp PUT path
// Creates or updates the complete object ip
func (*ServiceIp) PutPath(ref string) string {
return fmt.Sprintf("/api/objects/service/ip/%s", ref)
}
// UsedByPath implements sophos.RestObject
// Returns the objects and the nodes that use the object with the given ref
func (*ServiceIp) UsedByPath(ref string) string {
return fmt.Sprintf("/api/objects/service/ip/%s/usedby", ref)
}
// GetType implements sophos.Object
func (s *ServiceIp) GetType() string { return s.ObjectType }
// ServiceTcps is an Sophos Endpoint subType and implements sophos.RestObject
type ServiceTcps []ServiceTcp
// ServiceTcp is a generated Sophos object
type ServiceTcp struct {
Locked string `json:"_locked"`
Reference string `json:"_ref"`
ObjectType string `json:"_type"`
AutoPfSvcDst string `json:"auto_pf_svc_dst"`
AutoPfSvcSrc string `json:"auto_pf_svc_src"`
Comment string `json:"comment"`
DstHigh int64 `json:"dst_high"`
DstLow int64 `json:"dst_low"`
Name string `json:"name"`
SrcHigh int64 `json:"src_high"`
SrcLow int64 `json:"src_low"`
}
var _ sophos.RestGetter = &ServiceTcp{}
// GetPath implements sophos.RestObject and returns the ServiceTcps GET path
// Returns all available service/tcp objects
func (*ServiceTcps) GetPath() string { return "/api/objects/service/tcp/" }
// RefRequired implements sophos.RestObject
func (*ServiceTcps) RefRequired() (string, bool) { return "", false }
// GetPath implements sophos.RestObject and returns the ServiceTcps GET path
// Returns all available tcp types
func (s *ServiceTcp) GetPath() string { return fmt.Sprintf("/api/objects/service/tcp/%s", s.Reference) }
// RefRequired implements sophos.RestObject
func (s *ServiceTcp) RefRequired() (string, bool) { return s.Reference, true }
// DeletePath implements sophos.RestObject and returns the ServiceTcp DELETE path
// Creates or updates the complete object tcp
func (*ServiceTcp) DeletePath(ref string) string {
return fmt.Sprintf("/api/objects/service/tcp/%s", ref)
}
// PatchPath implements sophos.RestObject and returns the ServiceTcp PATCH path
// Changes to parts of the object tcp types
func (*ServiceTcp) PatchPath(ref string) string {
return fmt.Sprintf("/api/objects/service/tcp/%s", ref)
}
// PostPath implements sophos.RestObject and returns the ServiceTcp POST path
// Create a new service/tcp object
func (*ServiceTcp) PostPath() string {
return "/api/objects/service/tcp/"
}
// PutPath implements sophos.RestObject and returns the ServiceTcp PUT path
// Creates or updates the complete object tcp
func (*ServiceTcp) PutPath(ref string) string {
return fmt.Sprintf("/api/objects/service/tcp/%s", ref)
}
// UsedByPath implements sophos.RestObject
// Returns the objects and the nodes that use the object with the given ref
func (*ServiceTcp) UsedByPath(ref string) string {
return fmt.Sprintf("/api/objects/service/tcp/%s/usedby", ref)
}
// GetType implements sophos.Object
func (s *ServiceTcp) GetType() string { return s.ObjectType }
// ServiceTcpudps is an Sophos Endpoint subType and implements sophos.RestObject
type ServiceTcpudps []ServiceTcpudp
// ServiceTcpudp is a generated Sophos object
type ServiceTcpudp struct {
Locked string `json:"_locked"`
Reference string `json:"_ref"`
ObjectType string `json:"_type"`
AutoPfSvcDst string `json:"auto_pf_svc_dst"`
AutoPfSvcSrc string `json:"auto_pf_svc_src"`
Comment string `json:"comment"`
DstHigh int64 `json:"dst_high"`
DstLow int64 `json:"dst_low"`
Name string `json:"name"`
SrcHigh int64 `json:"src_high"`
SrcLow int64 `json:"src_low"`
}
var _ sophos.RestGetter = &ServiceTcpudp{}
// GetPath implements sophos.RestObject and returns the ServiceTcpudps GET path
// Returns all available service/tcpudp objects
func (*ServiceTcpudps) GetPath() string { return "/api/objects/service/tcpudp/" }
// RefRequired implements sophos.RestObject
func (*ServiceTcpudps) RefRequired() (string, bool) { return "", false }
// GetPath implements sophos.RestObject and returns the ServiceTcpudps GET path
// Returns all available tcpudp types
func (s *ServiceTcpudp) GetPath() string {
return fmt.Sprintf("/api/objects/service/tcpudp/%s", s.Reference)
}
// RefRequired implements sophos.RestObject
func (s *ServiceTcpudp) RefRequired() (string, bool) { return s.Reference, true }
// DeletePath implements sophos.RestObject and returns the ServiceTcpudp DELETE path
// Creates or updates the complete object tcpudp
func (*ServiceTcpudp) DeletePath(ref string) string {
return fmt.Sprintf("/api/objects/service/tcpudp/%s", ref)
}
// PatchPath implements sophos.RestObject and returns the ServiceTcpudp PATCH path
// Changes to parts of the object tcpudp types
func (*ServiceTcpudp) PatchPath(ref string) string {
return fmt.Sprintf("/api/objects/service/tcpudp/%s", ref)
}
// PostPath implements sophos.RestObject and returns the ServiceTcpudp POST path
// Create a new service/tcpudp object
func (*ServiceTcpudp) PostPath() string {
return "/api/objects/service/tcpudp/"
}
// PutPath implements sophos.RestObject and returns the ServiceTcpudp PUT path
// Creates or updates the complete object tcpudp
func (*ServiceTcpudp) PutPath(ref string) string {
return fmt.Sprintf("/api/objects/service/tcpudp/%s", ref)
}
// UsedByPath implements sophos.RestObject
// Returns the objects and the nodes that use the object with the given ref
func (*ServiceTcpudp) UsedByPath(ref string) string {
return fmt.Sprintf("/api/objects/service/tcpudp/%s/usedby", ref)
}
// GetType implements sophos.Object
func (s *ServiceTcpudp) GetType() string { return s.ObjectType }
// ServiceUdps is an Sophos Endpoint subType and implements sophos.RestObject
type ServiceUdps []ServiceUdp
// ServiceUdp is a generated Sophos object
type ServiceUdp struct {
Locked string `json:"_locked"`
Reference string `json:"_ref"`
ObjectType string `json:"_type"`
AutoPfSvcDst string `json:"auto_pf_svc_dst"`
AutoPfSvcSrc string `json:"auto_pf_svc_src"`
Comment string `json:"comment"`
DstHigh int64 `json:"dst_high"`
DstLow int64 `json:"dst_low"`
Name string `json:"name"`
SrcHigh int64 `json:"src_high"`
SrcLow int64 `json:"src_low"`
}
var _ sophos.RestGetter = &ServiceUdp{}
// GetPath implements sophos.RestObject and returns the ServiceUdps GET path
// Returns all available service/udp objects
func (*ServiceUdps) GetPath() string { return "/api/objects/service/udp/" }
// RefRequired implements sophos.RestObject
func (*ServiceUdps) RefRequired() (string, bool) { return "", false }
// GetPath implements sophos.RestObject and returns the ServiceUdps GET path
// Returns all available udp types
func (s *ServiceUdp) GetPath() string { return fmt.Sprintf("/api/objects/service/udp/%s", s.Reference) }
// RefRequired implements sophos.RestObject
func (s *ServiceUdp) RefRequired() (string, bool) { return s.Reference, true }
// DeletePath implements sophos.RestObject and returns the ServiceUdp DELETE path
// Creates or updates the complete object udp
func (*ServiceUdp) DeletePath(ref string) string {
return fmt.Sprintf("/api/objects/service/udp/%s", ref)
}
// PatchPath implements sophos.RestObject and returns the ServiceUdp PATCH path
// Changes to parts of the object udp types
func (*ServiceUdp) PatchPath(ref string) string {
return fmt.Sprintf("/api/objects/service/udp/%s", ref)
}
// PostPath implements sophos.RestObject and returns the ServiceUdp POST path
// Create a new service/udp object
func (*ServiceUdp) PostPath() string {
return "/api/objects/service/udp/"
}
// PutPath implements sophos.RestObject and returns the ServiceUdp PUT path
// Creates or updates the complete object udp
func (*ServiceUdp) PutPath(ref string) string {
return fmt.Sprintf("/api/objects/service/udp/%s", ref)
}
// UsedByPath implements sophos.RestObject
// Returns the objects and the nodes that use the object with the given ref
func (*ServiceUdp) UsedByPath(ref string) string {
return fmt.Sprintf("/api/objects/service/udp/%s/usedby", ref)
}
// GetType implements sophos.Object
func (s *ServiceUdp) GetType() string { return s.ObjectType }