forked from joeholley/supergloo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsecurity_rule.go
24 lines (20 loc) · 894 Bytes
/
security_rule.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package flagutils
import (
"github.com/solo-io/supergloo/cli/pkg/options"
"github.com/spf13/pflag"
)
func AddCreateSecurityRuleFlags(set *pflag.FlagSet, in *options.CreateSecurityRule) {
addSelectorFlags("source", "originating from", set, &in.SourceSelector)
addSelectorFlags("dest", "sent to", set, &in.DestinationSelector)
addTargetMeshFlags(set, &in.TargetMesh)
addAllowedMethodsFlag(set, in)
addAllowedPathsFlag(set, in)
}
func addAllowedMethodsFlag(set *pflag.FlagSet, in *options.CreateSecurityRule) {
set.StringSliceVar(&in.AllowedMethods, "allowed-methods", nil, "HTTP methods that are allowed for this rule. "+
"Leave empty to allow all paths")
}
func addAllowedPathsFlag(set *pflag.FlagSet, in *options.CreateSecurityRule) {
set.StringSliceVar(&in.AllowedPaths, "allowed-paths", nil, "HTTP paths that are allowed for this rule. "+
"Leave empty to allow all paths")
}