Skip to content

Commit abfc2e4

Browse files
Scott WareScott Ware
Scott Ware
authored and
Scott Ware
committed
Updated documentation
1 parent f465d3d commit abfc2e4

File tree

8 files changed

+74
-74
lines changed

8 files changed

+74
-74
lines changed

address.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ func (p *PaloAlto) AddressGroups(devicegroup ...string) (*AddressGroups, error)
147147
return &groups, nil
148148
}
149149

150-
// CreateAddress will add a new address object to the device. Addrtype should be one of: ip, range, or fqdn. If creating an address
150+
// CreateAddress will add a new address object to the device. Addrtype should be one of ip, range, or fqdn. If creating an address
151151
// object on a Panorama device, specify the device-group as the last parameter.
152152
func (p *PaloAlto) CreateAddress(name, addrtype, address, description string, devicegroup ...string) error {
153153
var xmlBody string

network.go

+17-15
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ type ProxyID struct {
4848
}
4949

5050
// CreateLayer3Interface adds a new layer-3 interface or sub-interface to the device. If adding a sub-interface,
51-
// be sure to append the VLAN tag to the interface name like so: ethernet1/1.700. You must specify the subnet mask in
52-
// CIDR notation when specifying the IP address, i.e.: 1.1.1.1/32.
51+
// be sure to append the VLAN tag to the interface name (e.g. ethernet1/1.700). You must also specify the subnet mask in
52+
// CIDR notation when specifying the IP address.
5353
func (p *PaloAlto) CreateLayer3Interface(ifname, ipaddress string, comment ...string) error {
5454
var xmlBody string
5555
var reqError requestError
@@ -91,11 +91,11 @@ func (p *PaloAlto) CreateLayer3Interface(ifname, ipaddress string, comment ...st
9191
return nil
9292
}
9393

94-
// CreateInterface creates the given interface type specified in the "iftype" parameter: tap, vwire, layer2, layer3, vlan,
95-
// loopback or tunnel. If adding a sub-interface, be sure to append the VLAN tag to the interface name like so: ethernet1/1.700.
94+
// CreateInterface creates the given interface type specified in the `iftype`` parameter (e.g. tap, vwire, layer2, layer3, vlan,
95+
// loopback or tunnel). If adding a sub-interface, be sure to append the VLAN tag to the interface name (e.g. ethernet1/1.700).
9696
// The (optional) ipaddr parameter allows you to assign an IP address to a layer 3/vlan/loopback or tunnel interface, or an
97-
// IP classifier to a virtual-wire sub-interface. You do not need to specify the ipaddr parameter on a "tap" or "layer2" interface type.
98-
// Note that you must specify the subnet mask in CIDR notation when including an IP address, i.e.: 1.1.1.1/24.
97+
// IP classifier to a virtual-wire sub-interface. You do not need to specify the ipaddr parameter on a tap or layer2 interface type.
98+
// Note that you must specify the subnet mask in CIDR notation when including an IP address.
9999
func (p *PaloAlto) CreateInterface(iftype, ifname, comment string, ipaddr ...string) error {
100100
var xmlBody string
101101
var xpath string
@@ -257,7 +257,7 @@ func (p *PaloAlto) CreateInterface(iftype, ifname, comment string, ipaddr ...str
257257
}
258258

259259
// DeleteInterface removes an interface or sub-interface from the device. You must specify the interface
260-
// type in the iftype parameter: tap, vwire, layer2, layer3, vlan, loopback or tunnel.
260+
// type in the iftype parameter (e.g. tap, vwire, layer2, layer3, vlan, loopback or tunnel).
261261
func (p *PaloAlto) DeleteInterface(iftype, ifname string) error {
262262
var reqError requestError
263263
var xpath string
@@ -326,8 +326,8 @@ func (p *PaloAlto) DeleteInterface(iftype, ifname string) error {
326326
return nil
327327
}
328328

329-
// CreateZone will add a new zone to the device. Zonetype must be one of: tap, vwire, layer2, layer3. If
330-
// you wish to enable user-id on the zone, specify "true" for the userid parameter, "false" if not.
329+
// CreateZone will add a new zone to the device. Zonetype must be one of tap, vwire, layer2, layer3. If
330+
// you wish to enable user-id on the zone, specify true for the userid parameter, false if not.
331331
func (p *PaloAlto) CreateZone(name, zonetype string, userid bool) error {
332332
var xmlBody string
333333
var reqError requestError
@@ -394,8 +394,8 @@ func (p *PaloAlto) DeleteZone(name string) error {
394394
return nil
395395
}
396396

397-
// AddInterfaceToZone adds an interface or interfaces to the given zone. zonetype must be one of: tap, vwire, layer2, layer3.
398-
// Separate multiple interfaces using a comma, i.e.: "ethernet1/2, ethernet1/3"
397+
// AddInterfaceToZone adds an interface or interfaces to the given zone. Zonetype must be one of tap, vwire, layer2, layer3.
398+
// Separate multiple interfaces using a comma (e.g. "ethernet1/2, ethernet1/3").
399399
func (p *PaloAlto) AddInterfaceToZone(name, zonetype, ifname string) error {
400400
var xmlBody string
401401
var reqError requestError
@@ -542,7 +542,7 @@ func (p *PaloAlto) DeleteVirtualRouter(vr string) error {
542542
}
543543

544544
// AddInterfaceToVirtualRouter will add an interface or interfaces to the given virtual-router. Separate multiple
545-
// interfaces using a comma, i.e.: "ethernet1/2, ethernet1/3"
545+
// interfaces using a comma (e.g. "ethernet1/2, ethernet1/3").
546546
func (p *PaloAlto) AddInterfaceToVirtualRouter(vr, ifname string) error {
547547
var xmlBody string
548548
var reqError requestError
@@ -602,7 +602,7 @@ func (p *PaloAlto) RemoveInterfaceFromVirtualRouter(vr, ifname string) error {
602602
}
603603

604604
// CreateStaticRoute adds a new static route to a given virtual-router. For the destination, you must
605-
// include the mask, i.e. "192.168.0.0/24" or "0.0.0.0/0." For nexthop, you can also specify an interface
605+
// include the mask (e.g. "192.168.0.0/24" or "0.0.0.0/0"). For nexthop, you can also specify an interface
606606
// instead of an IP address. You can optionally specify a metric for the route (default metric is 10).
607607
func (p *PaloAlto) CreateStaticRoute(vr, name, destination, nexthop string, metric ...int) error {
608608
var xmlBody string
@@ -705,7 +705,7 @@ func (p *PaloAlto) CreateVlan(name string, vlaninterface ...string) error {
705705
}
706706

707707
// AddInterfaceToVlan will add an interface or interfaces to the given vlan. Separate multiple
708-
// interfaces using a comma, i.e.: "ethernet1/2, ethernet1/3"
708+
// interfaces using a comma (e.g. "ethernet1/2, ethernet1/3").
709709
func (p *PaloAlto) AddInterfaceToVlan(vlan, ifname string) error {
710710
var xmlBody string
711711
var reqError requestError
@@ -847,7 +847,9 @@ func (p *PaloAlto) DeleteVwire(name string) error {
847847

848848
// ARPTable will gather all of the ARP entires on the device. Without any parameters, it will return all ARP entries.
849849
// You can specify an interface name for the option parameter if you choose to only view the ARP entries for that specific
850-
// interface (i.e. "ethernet1/1.200" or "ethernet1/21"). Status codes are as follows: s - static, c - complete, e - expiring, i - incomplete.
850+
// interface (e.g. "ethernet1/1.200" or "ethernet1/21"). Status codes are as follows:
851+
//
852+
// s - static, c - complete, e - expiring, i - incomplete.
851853
func (p *PaloAlto) ARPTable(option ...string) (*ARPTable, error) {
852854
var arpTable ARPTable
853855
command := "<show><arp><entry name = 'all'/></arp></show>"

objects.go

+38-43
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ type CustomURL struct {
2626
}
2727

2828
// Recurrance contains the information for external dynamic lists when it comes to how often they are downloaded. Method
29-
// must be one of: five-minute, hourly, daily, weekly, monthly. DayOfWeek is the name of the day, such as "tuesday." DayOfMonth
29+
// must be one of five-minute, hourly, daily, weekly, monthly. DayOfWeek is the name of the day, such as "tuesday." DayOfMonth
3030
// is specified as a number, ranging from 1-31. Hour must be in 23-hour format, such as "03" for 3 am. The hourly and five-minute
3131
// methods do not require any additional fields. DayOfWeek and DayOfMonth both require the Hour field as well.
3232
type Recurrance struct {
@@ -177,7 +177,7 @@ func (p *PaloAlto) URLCategory(devicegroup ...string) (*URLCategory, error) {
177177
}
178178

179179
// CreateURLCategory creates a custom URL category to be used in a policy. When specifying multiple URL's, use a
180-
// []string variable for the url parameter (i.e. members := []string{"www.*.com", "*.somesite.net"}). If creating a
180+
// []string variable for the url parameter (e.g. members := []string{"www.*.com", "*.somesite.net"}). If creating a
181181
// URL category on a Panorama device, specify the device-group as the last parameter.
182182
func (p *PaloAlto) CreateURLCategory(name string, urls []string, description string, devicegroup ...string) error {
183183
var xpath string
@@ -225,7 +225,7 @@ func (p *PaloAlto) CreateURLCategory(name string, urls []string, description str
225225
return nil
226226
}
227227

228-
// EditURLCategory adds or removes URL's from the given custom URL category. Action must be "add" or "remove." If editing
228+
// EditURLCategory adds or removes URL's from the given custom URL category. Action must be add or remove If editing
229229
// a URL category on a Panorama device, specify the device-group as the last parameter.
230230
func (p *PaloAlto) EditURLCategory(action, url, name string, devicegroup ...string) error {
231231
var xpath string
@@ -337,8 +337,8 @@ func (p *PaloAlto) DeleteURLCategory(name string, devicegroup ...string) error {
337337
return nil
338338
}
339339

340-
// EditGroup will add or remove objects from the specified group type (i.e., "address" or "service"). Action must be
341-
// "add" or "remove." If editing a group on a Panorama device, specify the device-group as the last parameter.
340+
// EditGroup will add or remove objects from the specified group type (e.g., "address" or "service"). Action must be
341+
// add or remove. If editing a group on a Panorama device, specify the device-group as the last parameter.
342342
func (p *PaloAlto) EditGroup(objecttype, action, object, group string, devicegroup ...string) error {
343343
var xmlBody string
344344
var xpath string
@@ -430,8 +430,11 @@ func (p *PaloAlto) EditGroup(objecttype, action, object, group string, devicegro
430430
}
431431

432432
// RenameObject will rename the given object from oldname to the newname. You can rename the following
433-
// object types: address, address-groups, service, service-groups, tags. If renaming objects on a
434-
// Panorama device, specify the device-group as the last parameter.
433+
// object types:
434+
//
435+
// address, address-groups, service, service-groups, tags.
436+
//
437+
// If renaming objects on a Panorama device, specify the device-group as the last parameter.
435438
func (p *PaloAlto) RenameObject(oldname, newname string, devicegroup ...string) error {
436439
var xpath string
437440
var reqError requestError
@@ -769,9 +772,13 @@ func (p *PaloAlto) RenameObject(oldname, newname string, devicegroup ...string)
769772
return nil
770773
}
771774

772-
// CreateExternalDynamicList will create an external dynamic list on the device. Listtype must be one of: ip, domain, or url. Configuring the
773-
// recurrance requires you to use the Recurrance struct when passing the configuration for this parameter - please see the documentation for that struct.
774-
// If creating an EDL on a Panorama device, specify the device-group as the last parameter.
775+
// CreateExternalDynamicList will create an external dynamic list on the device. Listtype must be one of:
776+
//
777+
// ip, domain, or url
778+
//
779+
// Configuring the recurrance requires you to use the `Recurrance` struct when passing the configuration for this
780+
// parameter - please see the documentation for that struct. If creating an EDL on a Panorama device, specify
781+
// the device-group as the last parameter.
775782
func (p *PaloAlto) CreateExternalDynamicList(listtype string, name string, url string, recurrance *Recurrance, devicegroup ...string) error {
776783
var xpath string
777784
var reqError requestError
@@ -925,9 +932,12 @@ func (p *PaloAlto) Tags(devicegroup ...string) (*Tags, error) {
925932

926933
}
927934

928-
// CreateTag will add a new tag to the device. You can use the following colors: Red, Green, Blue, Yellow, Copper,
929-
// Orange, Purple, Gray, Light Green, Cyan, Light Gray, Blue Gray, Lime, Black, Gold, Brown. If creating a tag on a
930-
// Panorama device, specify the device-group as the last parameter.
935+
// CreateTag will add a new tag to the device. You can use the following colors:
936+
//
937+
// Red, Green, Blue, Yellow, Copper, Orange, Purple, Gray, Light Green, Cyan, Light Gray,
938+
// Blue Gray, Lime, Black, Gold, Brown.
939+
//
940+
// If creating a tag on a Panorama device, specify the device-group as the last parameter.
931941
func (p *PaloAlto) CreateTag(name, color, comments string, devicegroup ...string) error {
932942
var xmlBody string
933943
var xpath string
@@ -1767,7 +1777,7 @@ func (p *PaloAlto) SecurityProfileGroups() (*SecurityGroups, error) {
17671777
}
17681778

17691779
// ApplyLogForwardingProfile will apply a Log Forwarding profile to every rule in the policy for the given device-group.
1770-
// If you wish to apply it to a single rule, instead of every rule in the policy, you can optionally specify the rule name as the last parameter.
1780+
// If you wish to apply it to a single rule, instead of every rule in the policy, you can (optionally) specify the rule name as the last parameter.
17711781
// For policies with a large number of rules, this process may take a few minutes to complete.
17721782
func (p *PaloAlto) ApplyLogForwardingProfile(logprofile, devicegroup string, rule ...string) error {
17731783
if p.DeviceType != "panorama" {
@@ -1919,10 +1929,14 @@ func (p *PaloAlto) ApplyLogForwardingProfile(logprofile, devicegroup string, rul
19191929
return nil
19201930
}
19211931

1922-
// ApplySecurityProfile will apply the following security profiles: URL Filtering, File-Blocking, Antivirus, Anti-Spyware, Vulnerability, Wildfire
1923-
// to every rule in the policy for the given device-group. If you wish to apply it to a single rule, instead of every
1924-
// rule in the policy, you can optionally specify the rule name as the last parameter. You can also specify a security group profile instead of individual profiles.
1925-
// This is done by ONLY populating the "Group" field in the SecurityProfiles struct. For policies with a large number of rules,
1932+
// ApplySecurityProfile will apply the following security profiles to every rule in teh policy for the given
1933+
// device-group:
1934+
//
1935+
// URL Filtering, File-Blocking, Antivirus, Anti-Spyware, Vulnerability, Wildfire
1936+
//
1937+
// If you wish to apply it to a single rule, instead of every rule in the policy, you can (optionally) specify
1938+
// the rule name as the last parameter. You can also specify a security group profile instead of individual profiles.
1939+
// This is done by ONLY populating the Group field in the SecurityProfiles struct. For policies with a large number of rules,
19261940
// this process may take a few minutes to complete.
19271941
func (p *PaloAlto) ApplySecurityProfile(secprofiles *SecurityProfiles, devicegroup string, rule ...string) error {
19281942
if p.DeviceType != "panorama" {
@@ -2251,27 +2265,12 @@ func (p *PaloAlto) ApplySecurityProfile(secprofiles *SecurityProfiles, devicegro
22512265
}
22522266

22532267
// CreateObjectsFromCsv takes a CSV file and creates the given address or service objects, and
2254-
// address or service groups defined within. See https://github.com/scottdware/go-panos#creating-objects-from-a-csv-file
2255-
// for more detailed examples.
2256-
//
2257-
// The format of the CSV file must follow this layout:
2268+
// address or service groups defined within. The format of the CSV file must follow this layout:
22582269
//
22592270
// name,type,value,description (optional),tag (optional),device-group
22602271
//
2261-
// For the type column, you can specify: 'ip', 'range', 'fqdn' for address objects, and 'tcp' or 'udp' for service
2262-
// objects. For address group objects, you must specify either 'static' or 'dynamic'. And for service groups,
2263-
// you must specify 'service'. The description and tag columns are optional, so just leave them blank if you do not
2264-
// need them.
2265-
//
2266-
// If you are creating an address group, then the value field must contain the following:
2267-
//
2268-
// For a static address group: list of members to add separated by a space, i.e.: ip-host1 ip-net1 fqdn-example.com
2269-
// For a dynamic address group: the criteria (tags) to match on, i.e.: web-servers or db-servers and linux
2270-
//
2271-
// If you are creating a service group, then the value field must contain a list of service objects to add, separated by a space.
2272-
//
2273-
// If any of the objects you are creating need to be shared objects, then specify the word "shared" in the device-group (last)
2274-
// column.
2272+
// See https://github.com/scottdware/go-panos#creating-objects-from-a-csv-file
2273+
// for complete documentation and examples.
22752274
func (p *PaloAlto) CreateObjectsFromCsv(file string) error {
22762275
c, err := easycsv.Open(file)
22772276
if err != nil {
@@ -2455,16 +2454,12 @@ func (p *PaloAlto) CreateObjectsFromCsv(file string) error {
24552454
}
24562455

24572456
// ModifyGroupsFromCsv takes a CSV file and modifies the given address or service groups with the
2458-
// specified action. See https://github.com/scottdware/go-panos#modifying-object-groups-from-a-csv-file
2459-
// for more detailed examples.
2460-
//
2461-
// The format of the CSV file must follow this layout:
2457+
// specified action. The format of the CSV file must follow this layout:
24622458
//
24632459
// grouptype,action,object-name,group-name,device-group
24642460
//
2465-
// For the grouptype column, you must specify 'address' or 'service'. Action must be either 'add' or 'remove'.
2466-
//
2467-
// If modifying groups on a Panorama device, specify the device-group column in the CSV file.
2461+
// See https://github.com/scottdware/go-panos#modifying-object-groups-from-a-csv-file
2462+
// for complete documentation and examples.
24682463
func (p *PaloAlto) ModifyGroupsFromCsv(file string) error {
24692464
c, err := easycsv.Open(file)
24702465
if err != nil {

panorama.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ func (p *PaloAlto) Devices() (*Devices, error) {
108108
}
109109

110110
// DeviceGroups returns information about all of the device-groups in Panorama, and what devices are
111-
// linked to them, along with their information. You can optionally specify a specific device-group
111+
// linked to them, along with detailed information about each device. You can (optionally) specify a specific device-group
112112
// if you wish.
113113
func (p *PaloAlto) DeviceGroups(devicegroup ...string) (*DeviceGroups, error) {
114114
var devices DeviceGroups

0 commit comments

Comments
 (0)