Skip to content

Commit

Permalink
change type of enum PolicyEnforcementMode from int to string
Browse files Browse the repository at this point in the history
then it will same style as Logic and DecisionStrategy
  • Loading branch information
yue-wen committed Oct 29, 2021
1 parent 7401dd2 commit c99afa5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
10 changes: 5 additions & 5 deletions models.go
Original file line number Diff line number Diff line change
Expand Up @@ -476,13 +476,13 @@ type AdapterConfiguration struct {
}

// PolicyEnforcementMode is an enum type for PolicyEnforcementMode of ResourceServerRepresentation
type PolicyEnforcementMode int
type PolicyEnforcementMode string

// PolicyEnforcementMode values
const (
ENFORCING PolicyEnforcementMode = iota
PERMISSIVE
DISABLED
var (
ENFORCING = PolicyEnforcementModeP("ENFORCING")
PERMISSIVE = PolicyEnforcementModeP("PERMISSIVE")
DISABLED = PolicyEnforcementModeP("DISABLED")
)

// Logic is an enum type for policy logic
Expand Down
7 changes: 6 additions & 1 deletion utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,16 @@ func DecisionStrategyP(value DecisionStrategy) *DecisionStrategy {
return &value
}

// LogicP returns a pointer for a LogicP value
// LogicP returns a pointer for a Logic value
func LogicP(value Logic) *Logic {
return &value
}

// PolicyEnforcementModeP returns a pointer for a PolicyEnforcementMode value
func PolicyEnforcementModeP(value PolicyEnforcementMode) *PolicyEnforcementMode {
return &value
}

// PStringSlice converts a pointer to []string or returns ampty slice if nill value
func PStringSlice(value *[]string) []string {
if value == nil {
Expand Down

0 comments on commit c99afa5

Please sign in to comment.