Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add push validation #2

Merged
merged 1 commit into from
Oct 26, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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