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

change type of enum PolicyEnforcementMode from int to string #315

Merged
merged 1 commit into from
Nov 17, 2021
Merged
Show file tree
Hide file tree
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
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