summaryrefslogtreecommitdiffhomepage
path: root/internal/pkg/table/policy.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/pkg/table/policy.go')
-rw-r--r--internal/pkg/table/policy.go10
1 files changed, 8 insertions, 2 deletions
diff --git a/internal/pkg/table/policy.go b/internal/pkg/table/policy.go
index 23c2110c..1f5be006 100644
--- a/internal/pkg/table/policy.go
+++ b/internal/pkg/table/policy.go
@@ -3566,12 +3566,15 @@ func (r *RoutingPolicy) ReplaceDefinedSet(a DefinedSet) (err error) {
return err
}
-func (r *RoutingPolicy) GetStatement() []*config.Statement {
+func (r *RoutingPolicy) GetStatement(name string) []*config.Statement {
r.mu.RLock()
defer r.mu.RUnlock()
l := make([]*config.Statement, 0, len(r.statementMap))
for _, st := range r.statementMap {
+ if name != "" && name != st.Name {
+ continue
+ }
l = append(l, st.ToConfig())
}
return l
@@ -3638,11 +3641,14 @@ func (r *RoutingPolicy) ReplaceStatement(st *Statement) (err error) {
return err
}
-func (r *RoutingPolicy) GetAllPolicy() []*config.PolicyDefinition {
+func (r *RoutingPolicy) GetPolicy(name string) []*config.PolicyDefinition {
r.mu.RLock()
var ps Policies
for _, p := range r.policyMap {
+ if name != "" && name != p.Name {
+ continue
+ }
ps = append(ps, p)
}
r.mu.RUnlock()