Skip to content

Commit

Permalink
add push validation
Browse files Browse the repository at this point in the history
  • Loading branch information
pimielowski committed Oct 26, 2023
1 parent e8ae9dd commit 4258f9a
Showing 1 changed file with 23 additions and 7 deletions.
30 changes: 23 additions & 7 deletions commit/pano.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package commit

import (
"encoding/xml"

"github.com/PaloAltoNetworks/pango/util"
)

Expand Down Expand Up @@ -116,6 +115,8 @@ type PanoramaCommitAll struct {
Description string
IncludeTemplate bool
ForceTemplateValues bool
ValidateOnly bool
Admins []string
Devices []string
}

Expand All @@ -139,26 +140,38 @@ func (o PanoramaCommitAll) Element() interface{} {
Description: o.Description,
IncludeTemplate: util.YesNo(o.IncludeTemplate),
ForceTemplateValues: util.YesNo(o.ForceTemplateValues),
ValidateOnly: util.YesNo(o.ValidateOnly),
},
}
if len(o.Admins) > 0 {
ans.DeviceGroup.Admins = util.StrToMem(o.Admins)
}
case TypeTemplate:
ans = panoCommitAll{
Template: &pcaTemplate{
Name: o.Name,
Description: o.Description,
ForceTemplateValues: util.YesNo(o.ForceTemplateValues),
Devices: util.StrToMem(o.Devices),
ValidateOnly: util.YesNo(o.ValidateOnly),
},
}
if len(o.Admins) > 0 {
ans.Template.Admins = util.StrToMem(o.Admins)
}
case TypeTemplateStack:
ans = panoCommitAll{
TemplateStack: &pcaTemplate{
Name: o.Name,
Description: o.Description,
ForceTemplateValues: util.YesNo(o.ForceTemplateValues),
Devices: util.StrToMem(o.Devices),
ValidateOnly: util.YesNo(o.ValidateOnly),
},
}
if len(o.Admins) > 0 {
ans.TemplateStack.Admins = util.StrToMem(o.Admins)
}
case TypeLogCollectorGroup:
ans = panoCommitAll{
LogCollectorGroup: &pcaLogCollectorGroup{
Expand All @@ -181,7 +194,6 @@ func (o PanoramaCommitAll) Element() interface{} {
},
}
}

return ans
}

Expand All @@ -195,10 +207,12 @@ type panoCommitAll struct {
}

type pcaDeviceGroup struct {
DgInfo pcaDgInfo `xml:"device-group"`
Description string `xml:"description,omitempty"`
IncludeTemplate string `xml:"include-template"`
ForceTemplateValues string `xml:"force-template-values"`
DgInfo pcaDgInfo `xml:"device-group"`
Admins *util.MemberType `xml:"admin,omitempty"`
Description string `xml:"description,omitempty"`
IncludeTemplate string `xml:"include-template"`
ForceTemplateValues string `xml:"force-template-values"`
ValidateOnly string `xml:"validate-only"`
}

type pcaDgInfo struct {
Expand All @@ -211,10 +225,12 @@ type pcaDgInfoEntry struct {
}

type pcaTemplate struct {
Devices *util.MemberType `xml:"device"`
Admins *util.MemberType `xml:"admin,omitempty"`
Name string `xml:"name"`
Description string `xml:"description,omitempty"`
Devices *util.MemberType `xml:"device"`
ForceTemplateValues string `xml:"force-template-values"`
ValidateOnly string `xml:"validate-only"`
}

type pcaLogCollectorGroup struct {
Expand Down

0 comments on commit 4258f9a

Please sign in to comment.