From c99afa5775ae54d4ef5dd0d8b34e7afe284f9907 Mon Sep 17 00:00:00 2001 From: yuewen Date: Fri, 29 Oct 2021 17:51:14 +0800 Subject: [PATCH] change type of enum PolicyEnforcementMode from int to string then it will same style as Logic and DecisionStrategy --- models.go | 10 +++++----- utils.go | 7 ++++++- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/models.go b/models.go index 1f6d85e8..f133cf34 100644 --- a/models.go +++ b/models.go @@ -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 diff --git a/utils.go b/utils.go index 4a0216b0..53bf8077 100644 --- a/utils.go +++ b/utils.go @@ -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 {