Documentation ¶
Overview ¶
Package pathexp provides a representation of path expressions; locations of secrets within the org/project/environment/service/identity/instance hierarchy supporting globs and alternation.
Grammar:
<pathexp> ::= "/" <org> "/" <project> "/" <environment> "/" <service> "/" <identity> "/" <instance> <org> ::= <literal> <project> ::= <literal> <environment> ::= <multiple> <service> ::= <multiple> <identity> ::= <multiple> <instance> ::= <multiple> <multiple> ::= <alternation> | <glob-or-literal> | <full-glob> <alternation> ::= "[" <alternation-body> "]" <alternation-body> ::= <glob-or-literal> | <glob-or-literal> "|" <alternation-body> <glob-or-literal> ::= <glob> | <literal> <glob> ::= <literal> "*" <literal> ::= [a-z0-9][a-z0-9\-\_]{0,63} <fullglob> ::= "*"
Index ¶
- type PathExp
- func (pe *PathExp) CompareSpecificity(other *PathExp) int
- func (pe *PathExp) Equal(other *PathExp) bool
- func (pe *PathExp) MarshalText() ([]byte, error)
- func (pe *PathExp) Org() string
- func (pe *PathExp) Project() string
- func (pe *PathExp) String() string
- func (pe *PathExp) UnmarshalText(b []byte) error
- func (pe *PathExp) WithInstance(instance string) (*PathExp, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PathExp ¶
type PathExp struct {
// contains filtered or unexported fields
}
PathExp is a path expression
func New ¶
New creates a new path expression from the given path segments It returns an error if any of the values fail to validate
func Parse ¶
Parse parses a string into a path expression. It returns an error if the string is not a valid path expression.
func (*PathExp) CompareSpecificity ¶
CompareSpecificity returns an int indicating if this PathExp is more specific than PathExp b.
PathExp A is more specific then PathExp B if, for each segment in the PathExp, A's segment is as specific or more specific than B's segment.
Segment specificity is, from most to least specific:
- <literal>
- <glob>
- <alternation>
- <fullglob>
It is assumed that the provided PathExps are not disjoint.
func (*PathExp) MarshalText ¶
MarshalText implements the encoding.TextMarshaler interface. This will be used in json encoding.
func (*PathExp) UnmarshalText ¶
UnmarshalText implements the encoding.TextUnmarshaler interface. This will be used in json decoding.