Documentation ¶
Overview ¶
Package namespace contains common workflows between most namespaces.
There are two main structs: Standard and Importable. A modern namespace should use one of these structs.
Index ¶
- func UnpackageXmlInto(b []byte, res interface{}) error
- type Common
- func (n *Common) AllFromPanosConfig(pather Pather, ans interface{}) error
- func (n *Common) FromPanosConfig(pather Pather, name string, ans Namer) error
- func (n *Common) Listing(cmd string, pather Pather, ans Namer) ([]string, error)
- func (n *Common) Object(cmd string, pather Pather, name string, ans interface{}) error
- func (n *Common) Objects(cmd string, pather Pather, ans interface{}) error
- type ImportSpecifier
- type Importable
- type MoveLister
- type MovePather
- type Namer
- type Pather
- type Plugin
- type PluginSpecifier
- type Policy
- func (n *Policy) AuditCommentHistory(pather Pather, rule, direction string, nlogs, skip int) ([]audit.Comment, error)
- func (n *Policy) CurrentAuditComment(pather Pather, rule string) (string, error)
- func (n *Policy) HitCount(base, vsys string, rules []string) ([]util.HitCount, error)
- func (n *Policy) SetAuditComment(pather Pather, rule, comment string) error
- type Specifier
- type Standard
- func (n *Standard) Delete(pather Pather, names []string, nErr error) error
- func (n *Standard) Edit(pather Pather, spec Specifier) error
- func (n *Standard) MoveGroup(pather Pather, lister MoveLister, movement int, rule string, grp []string) error
- func (n *Standard) Set(pather Pather, specs []Specifier) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func UnpackageXmlInto ¶
UnpackageXmlInto wraps XML content into a throw-away wrapper for further unmarshaling. This is basically for retrieving sub-object config from a parent's raw XML field mapping.
Types ¶
type Common ¶
type Common struct { Singular string Plural string Client util.XapiClient Predefined bool }
Common contains the shared methods every namespace has.
func (*Common) AllFromPanosConfig ¶ added in v0.7.0
AllFromPanosConfig returns multiple objects' config from the configuration retrieved from PAN-OS and stored in the client's config tree.
path is the xpath function. ans is an interface to unmarshal the found config into.
func (*Common) FromPanosConfig ¶ added in v0.7.0
FromPanosConfig returns a single object's config from the configuration retrieved from PAN-OS and stored in the client's config tree.
path is the xpath function. name is the name of the object to retrieve. ans is an interface to unmarshal the found config into.
func (*Common) Listing ¶
Listing returns a list of names.
cmd should be util.Get or util.Show. path is the xpath. ans is an interface to unmarshal the response into.
type ImportSpecifier ¶
ImportSpecifier is an object that has a Specify function given the current version number.
There are three items returned:
1) the unique name of this config element 2) the unique name to be used when importing; an empty string means "do not import" 3) a struct specific to this version PAN-OS representing the desired config
type Importable ¶
Importable is a namespace struct for config that is imported into a vsys.
The current list of importable config is as follows:
- interfaces
- virtual routers
- virtual wires
- vlans
The ImportPath param should be set to any of the valid Import constants in the util package.
func (*Importable) Delete ¶
Delete performs a DELETE to remove one or more objects.
As this is an importable config, first all objects are unimported, then all objects are deleted from the config.
func (*Importable) Edit ¶
func (n *Importable) Edit(tmpl, ts, vsys string, pather Pather, spec ImportSpecifier) error
Edit performs an EDIT to configure one object.
As this is an importable config, first the object is unimported, then the object is configured, and finally the object is imported, if applicable.
func (*Importable) Set ¶
func (n *Importable) Set(tmpl, ts, vsys string, pather Pather, specs []ImportSpecifier) error
Set performs a SET to configure one or more objects.
As this is an importable config, first all objects are unimported, then everything is configured, and finally the config is imported into the specified vsys.
type MoveLister ¶
MoveLister returns a list of current rules.
type Namer ¶
type Namer interface {
Names() []string
}
Namer returns the names of objects returned from PAN-OS.
type Plugin ¶ added in v0.6.0
type Plugin struct {
Common
}
Plugin is a namespace struct for config that exists in PAN-OS as a plugin.
type PluginSpecifier ¶ added in v0.6.0
PluginSpecifier is an object that has a Specify function given a list of plugins.
There are three items returned:
1) the unique name of this config element 2) a struct specific to this version PAN-OS representing the desired config 3) an error if there is a mismatch between the plugins installed and what is supported
type Policy ¶ added in v0.6.0
type Policy struct {
Standard
}
Policy is a namespace struct for config that is not imported into a vsys.
This struct contains additional operational state functions relevant for policy rules.
func (*Policy) AuditCommentHistory ¶ added in v0.6.0
func (n *Policy) AuditCommentHistory(pather Pather, rule, direction string, nlogs, skip int) ([]audit.Comment, error)
AuditCommentHistory retrieves a chunk of historical audit comment logs.
func (*Policy) CurrentAuditComment ¶ added in v0.6.0
CurrentAuditComment gets the uncommitted audit comment for the given rule.
type Specifier ¶
Specifier is an object that has a Specify function given the current version number.
There are two items returned:
1) the unique name of this config element 2) a struct specific to this version PAN-OS representing the desired config
type Standard ¶
type Standard struct {
Common
}
Standard is a namespace struct for config that is not imported into a vsys.
func (*Standard) MoveGroup ¶
func (n *Standard) MoveGroup(pather Pather, lister MoveLister, movement int, rule string, grp []string) error
MoveGroup places a logical group of objects in the desired location (rulebase objects).
The `movement` param should be one of the Move constants in the util package.
The `rule` param is the other rule the `movement` param is referencing. If this is an empty string, then the first rule in the group isn't moved anywhere, but all other rules will still be moved to be grouped with the first one.