Documentation ¶
Overview ¶
Package util contains various shared structs and functions used across the pango package.
Index ¶
- Constants
- func AsBool(val string) bool
- func AsEntryXpath(vals []string) string
- func AsMemberXpath(vals []string) string
- func AsXpath(i interface{}) string
- func CleanRawXml(v string) string
- func DeviceGroupXpathPrefix(dg string) []string
- func EntToOneStr(e *EntryType) string
- func EntToStr(e *EntryType) []string
- func MemToOneStr(e *MemberType) string
- func MemToStr(e *MemberType) []string
- func TemplateXpathPrefix(tmpl, ts string) []string
- func VsysEntToMap(ve *VsysEntryType) map[string][]string
- func VsysXpathPrefix(vsys string) []string
- func YesNo(v bool) string
- type BasicJob
- type BulkElement
- type CdataText
- type Entry
- type EntryType
- type JobResponse
- type License
- type Lock
- type Member
- type MemberType
- type RawXml
- type Retriever
- type VsysEntry
- type VsysEntryType
- type XapiClient
Constants ¶
const ( Rulebase = "rulebase" PreRulebase = "pre-rulebase" PostRulebase = "post-rulebase" )
Rulebase constants for various policies.
const ( InterfaceImport = "interface" VirtualRouterImport = "virtual-router" VirtualWireImport = "virtual-wire" VlanImport = "vlan" )
Valid values to use for VsysImport() or VsysUnimport().
const ( MoveSkip = iota MoveBefore MoveDirectlyBefore MoveAfter MoveDirectlyAfter MoveTop MoveBottom )
These constants are valid move locations to pass to various movement functions (aka - policy management).
Variables ¶
This section is empty.
Functions ¶
func AsEntryXpath ¶
AsEntryXpath returns the given values as an entry xpath segment.
func AsMemberXpath ¶
AsMemberXpath returns the given values as a member xpath segment.
func AsXpath ¶
func AsXpath(i interface{}) string
AsXpath makes an xpath out of the given interface.
func CleanRawXml ¶
CleanRawXml removes extra XML attributes from RawXml objects without requiring us to have to parse everything.
func DeviceGroupXpathPrefix ¶ added in v0.2.0
DeviceGroupXpathPrefix returns a device group xpath prefix. If the device group is empty, then the default is "shared".
func EntToOneStr ¶
EntToOneStr normalizes an EntryType pointer for a max_items=1 XML node into a string.
func MemToOneStr ¶
func MemToOneStr(e *MemberType) string
MemToOneStr normalizes a MemberType pointer for a max_items=1 XML node into a string.
func MemToStr ¶
func MemToStr(e *MemberType) []string
MemToStr normalizes a MemberType pointer into a list of strings.
func TemplateXpathPrefix ¶
TemplateXpathPrefix returns the template xpath prefix of the given template name.
func VsysEntToMap ¶
func VsysEntToMap(ve *VsysEntryType) map[string][]string
VsysEntToMap normalizes a VsysEntryType pointer into a map.
func VsysXpathPrefix ¶ added in v0.2.0
VsysXpathPrefix returns a vsys xpath prefix.
Types ¶
type BasicJob ¶
type BasicJob struct { XMLName xml.Name `xml:"response"` Result string `xml:"result>job>result"` Progress uint `xml:"result>job>progress"` Details []string `xml:"result>job>details>line"` Devices []devJob `xml:"result>job>devices>entry"` }
BasicJob is a struct for parsing minimal information about a submitted job to PANOS.
type BulkElement ¶
BulkElement is a generic bulk container for bulk operations.
func (BulkElement) Config ¶
func (o BulkElement) Config() interface{}
Config returns an interface to be Marshaled.
type CdataText ¶
type CdataText struct {
Text string `xml:",cdata"`
}
CdataText is for getting CDATA contents of XML docs.
type EntryType ¶
type EntryType struct {
Entries []Entry `xml:"entry"`
}
EntryType defines an entry config node used for sending and receiving XML from PAN-OS.
func OneStrToEnt ¶
OneStrToEnt converts a string into an EntryType pointer for a max_items=1 XML node.
type JobResponse ¶
JobResponse parses a XML response that includes a job ID.
type License ¶
type License struct { XMLName xml.Name `xml:"entry"` Feature string `xml:"feature"` Description string `xml:"description"` Serial string `xml:"serial"` Issued string `xml:"issued"` Expires string `xml:"expires"` Expired string `xml:"expired"` AuthCode string `xml:"authcode"` }
License defines a license entry.
type Lock ¶
type Lock struct { XMLName xml.Name `xml:"entry"` Owner string `xml:"name,attr"` Name string `xml:"name"` Type string `xml:"type"` LoggedIn string `xml:"loggedin"` Comment CdataText `xml:"comment"` }
Lock represents either a config lock or a commit lock.
type MemberType ¶
type MemberType struct {
Members []Member `xml:"member"`
}
MemberType defines a member config node used for sending and receiving XML from PAN-OS.
func OneStrToMem ¶
func OneStrToMem(e string) *MemberType
OneStrToMem converts a string into a MemberType pointer for a max_items=1 XML node.
func StrToMem ¶
func StrToMem(e []string) *MemberType
StrToMem converts a list of strings into a MemberType pointer.
type RawXml ¶
type RawXml struct {
Text string `xml:",innerxml"`
}
RawXml is what allows the use of Edit commands on a XPATH without truncating any other child objects that may be attached to it.
type Retriever ¶
Retriever is a type that is intended to act as a stand-in for using either the Get or Show pango Client functions.
type VsysEntry ¶
type VsysEntry struct { XMLName xml.Name `xml:"entry"` Serial string `xml:"name,attr"` Vsys *EntryType `xml:"vsys"` }
VsysEntry defines the "vsys" xpath node under a VsysEntryType config node.
type VsysEntryType ¶
type VsysEntryType struct {
Entries []VsysEntry `xml:"entry"`
}
VsysEntryType defines an entry config node with vsys entries underneath.
func MapToVsysEnt ¶
func MapToVsysEnt(e map[string][]string) *VsysEntryType
MapToVsysEnt converts a map into a VsysEntryType pointer.
This struct is used for "Target" information on Panorama when dealing with various policies. Maps are unordered, but FWICT Panorama doesn't seem to order anything anyways when doing things in the GUI, so hopefully this is ok...?
type XapiClient ¶
type XapiClient interface { String() string Versioning() version.Number LogAction(string, ...interface{}) LogQuery(string, ...interface{}) LogOp(string, ...interface{}) LogUid(string, ...interface{}) Op(interface{}, string, interface{}, interface{}) ([]byte, error) Show(interface{}, interface{}, interface{}) ([]byte, error) Get(interface{}, interface{}, interface{}) ([]byte, error) Delete(interface{}, interface{}, interface{}) ([]byte, error) Set(interface{}, interface{}, interface{}, interface{}) ([]byte, error) Edit(interface{}, interface{}, interface{}, interface{}) ([]byte, error) Move(interface{}, string, string, interface{}, interface{}) ([]byte, error) Uid(interface{}, string, interface{}, interface{}) ([]byte, error) EntryListUsing(Retriever, []string) ([]string, error) MemberListUsing(Retriever, []string) ([]string, error) RequestPasswordHash(string) (string, error) VsysImport(string, string, string, string, []string) error VsysUnimport(string, string, string, []string) error WaitForJob(uint, interface{}) error Commit(string, []string, bool, bool, bool, bool) (uint, error) PositionFirstEntity(int, string, string, []string, []string) error }
XapiClient is the interface that describes an pango.Client.