*: update kube vendor to v1.7.4
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
This commit is contained in:
parent
c67859731f
commit
d56bf090ce
1032 changed files with 273965 additions and 40081 deletions
24
vendor/k8s.io/apimachinery/pkg/fields/selector.go
generated
vendored
24
vendor/k8s.io/apimachinery/pkg/fields/selector.go
generated
vendored
|
@ -40,6 +40,8 @@ type Selector interface {
|
|||
|
||||
// Transform returns a new copy of the selector after TransformFunc has been
|
||||
// applied to the entire selector, or an error if fn returns an error.
|
||||
// If for a given requirement both field and value are transformed to empty
|
||||
// string, the requirement is skipped.
|
||||
Transform(fn TransformFunc) (Selector, error)
|
||||
|
||||
// Requirements converts this interface to Requirements to expose
|
||||
|
@ -79,6 +81,9 @@ func (t *hasTerm) Transform(fn TransformFunc) (Selector, error) {
|
|||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if len(field) == 0 && len(value) == 0 {
|
||||
return Everything(), nil
|
||||
}
|
||||
return &hasTerm{field, value}, nil
|
||||
}
|
||||
|
||||
|
@ -115,6 +120,9 @@ func (t *notHasTerm) Transform(fn TransformFunc) (Selector, error) {
|
|||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if len(field) == 0 && len(value) == 0 {
|
||||
return Everything(), nil
|
||||
}
|
||||
return ¬HasTerm{field, value}, nil
|
||||
}
|
||||
|
||||
|
@ -169,13 +177,15 @@ func (t andTerm) RequiresExactMatch(field string) (string, bool) {
|
|||
}
|
||||
|
||||
func (t andTerm) Transform(fn TransformFunc) (Selector, error) {
|
||||
next := make([]Selector, len([]Selector(t)))
|
||||
for i, s := range []Selector(t) {
|
||||
next := make([]Selector, 0, len([]Selector(t)))
|
||||
for _, s := range []Selector(t) {
|
||||
n, err := s.Transform(fn)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
next[i] = n
|
||||
if !n.Empty() {
|
||||
next = append(next, n)
|
||||
}
|
||||
}
|
||||
return andTerm(next), nil
|
||||
}
|
||||
|
@ -222,7 +232,7 @@ var valueEscaper = strings.NewReplacer(
|
|||
`=`, `\=`,
|
||||
)
|
||||
|
||||
// Escapes an arbitrary literal string for use as a fieldSelector value
|
||||
// EscapeValue escapes an arbitrary literal string for use as a fieldSelector value
|
||||
func EscapeValue(s string) string {
|
||||
return valueEscaper.Replace(s)
|
||||
}
|
||||
|
@ -245,7 +255,7 @@ func (i UnescapedRune) Error() string {
|
|||
return fmt.Sprintf("invalid field selector: unescaped character in value: %v", i.r)
|
||||
}
|
||||
|
||||
// Unescapes a fieldSelector value and returns the original literal value.
|
||||
// UnescapeValue unescapes a fieldSelector value and returns the original literal value.
|
||||
// May return the original string if it contains no escaped or special characters.
|
||||
func UnescapeValue(s string) (string, error) {
|
||||
// if there's no escaping or special characters, just return to avoid allocation
|
||||
|
@ -307,12 +317,12 @@ func ParseSelector(selector string) (Selector, error) {
|
|||
})
|
||||
}
|
||||
|
||||
// Parses the selector and runs them through the given TransformFunc.
|
||||
// ParseAndTransformSelector parses the selector and runs them through the given TransformFunc.
|
||||
func ParseAndTransformSelector(selector string, fn TransformFunc) (Selector, error) {
|
||||
return parseSelector(selector, fn)
|
||||
}
|
||||
|
||||
// Function to transform selectors.
|
||||
// TransformFunc transforms selectors.
|
||||
type TransformFunc func(field, value string) (newField, newValue string, err error)
|
||||
|
||||
// splitTerms returns the comma-separated terms contained in the given fieldSelector.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue