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

Starting work on uuid based services #116

Closed
wants to merge 38 commits into from
Closed
Changes from 1 commit
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
36014e6
adding new errors for filtering
shinmog Mar 3, 2024
4c69b28
gofmt
shinmog Mar 3, 2024
262787c
gofmt
shinmog Mar 3, 2024
14a2e13
gofmt
shinmog Mar 3, 2024
a625f54
gofmt
shinmog Mar 3, 2024
27f614d
adding filtering support for listing functions
shinmog Mar 3, 2024
ec16add
adding filtering to the new address objects
shinmog Mar 3, 2024
9985522
tweaking filtering logic
shinmog Mar 4, 2024
dbacffb
adding slice support in preparation for splat support
shinmog Mar 4, 2024
f36f470
adding support for camel case names
shinmog Mar 4, 2024
83f9e36
remove the response tag from the returned value is present
shinmog Mar 5, 2024
e2780f7
adding static file inspection functionality
shinmog Mar 5, 2024
d88a8be
updating pango client interface
shinmog Mar 5, 2024
93cfd2a
adding static file inspection functions
shinmog Mar 5, 2024
8702999
adding setup function for terraform to invoke
shinmog Mar 5, 2024
1feeb67
adding DetailedVersion to generic xml parsing for schema loading
shinmog Mar 6, 2024
6f6fbda
adding generic xml handling unittests
shinmog Mar 6, 2024
fe037fd
handle show's different way of saying object not found
shinmog Mar 6, 2024
3be5cbb
updating local inspection setup function
shinmog Mar 6, 2024
7f6522d
removing this file; it is ./generic/xml.go now
shinmog Mar 7, 2024
868b89c
updating the pangoclient interface
shinmog Mar 8, 2024
c899c66
updating new client; adding missing functions and porting a number of…
shinmog Mar 8, 2024
2d1d505
updating "interface{}" to "any"
shinmog Mar 8, 2024
1a3bde7
adding commit xmlapi action
shinmog Mar 8, 2024
e0d6fa8
adding export xmlapi command
shinmog Mar 8, 2024
59ca893
adding import xmlapi command
shinmog Mar 8, 2024
c343c2a
adding log xmlapi command support
shinmog Mar 8, 2024
6382628
adding user-id xmlapi command support
shinmog Mar 8, 2024
96cac2d
adding the rest of the comparison functions
shinmog Mar 29, 2024
ebfc81c
adding uuid not specified error
shinmog Mar 29, 2024
e340534
adding uuid xpath function
shinmog Mar 29, 2024
daf5db2
updating export file function
shinmog Mar 29, 2024
0910303
renaming comparison function names
shinmog Mar 29, 2024
84f1be2
adding new error
shinmog Mar 29, 2024
fa1ad7d
adding utility functions to get pointers to basic types
shinmog Mar 29, 2024
218bca4
adding positioning support
shinmog Mar 29, 2024
a5279df
moving pointer functions to util
shinmog Mar 29, 2024
4c59261
add uuid service support
shinmog Apr 2, 2024
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
Prev Previous commit
Next Next commit
adding positioning support
  • Loading branch information
shinmog committed Mar 29, 2024
commit 218bca458e1f22df7117ef6240d2b38c7bcb1028
70 changes: 70 additions & 0 deletions rule/position.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
package rule

import (
"fmt"

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

type Position struct {
First *bool `json:"first,omitempty"`
Last *bool `json:"last,omitempty"`
SomewhereBefore *string `json:"somewhere_before,omitempty"`
DirectlyBefore *string `json:"directly_before,omitempty"`
SomewhereAfter *string `json:"somewhere_after,omitempty"`
DirectlyAfter *string `json:"directly_after,omitempty"`
}

func (o *Position) IsValid(removeEverythingElse bool) error {
count := 0

if o.First != nil && *o.First {
count++
}

if o.Last != nil && *o.Last {
count++
}

if o.SomewhereBefore != nil {
if removeEverythingElse {
return errors.RelativePositionWithRemoveEverythingElseError
}
if *o.SomewhereBefore != "" {
count++
}
}

if o.DirectlyBefore != nil {
if removeEverythingElse {
return errors.RelativePositionWithRemoveEverythingElseError
}
if *o.DirectlyBefore != "" {
count++
}
}

if o.SomewhereAfter != nil {
if removeEverythingElse {
return errors.RelativePositionWithRemoveEverythingElseError
}
if *o.SomewhereAfter != "" {
count++
}
}

if o.DirectlyAfter != nil {
if removeEverythingElse {
return errors.RelativePositionWithRemoveEverythingElseError
}
if *o.DirectlyAfter != "" {
count++
}
}

if count > 1 {
return fmt.Errorf("multiple positions specified: only one should be specified")
}

return nil
}