summaryrefslogtreecommitdiff
path: root/vendor/k8s.io/apimachinery/pkg/util/validation
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/k8s.io/apimachinery/pkg/util/validation')
-rw-r--r--vendor/k8s.io/apimachinery/pkg/util/validation/field/path.go23
1 files changed, 23 insertions, 0 deletions
diff --git a/vendor/k8s.io/apimachinery/pkg/util/validation/field/path.go b/vendor/k8s.io/apimachinery/pkg/util/validation/field/path.go
index f9be7ac33..daccb0589 100644
--- a/vendor/k8s.io/apimachinery/pkg/util/validation/field/path.go
+++ b/vendor/k8s.io/apimachinery/pkg/util/validation/field/path.go
@@ -22,6 +22,29 @@ import (
"strconv"
)
+type pathOptions struct {
+ path *Path
+}
+
+// PathOption modifies a pathOptions
+type PathOption func(o *pathOptions)
+
+// WithPath generates a PathOption
+func WithPath(p *Path) PathOption {
+ return func(o *pathOptions) {
+ o.path = p
+ }
+}
+
+// ToPath produces *Path from a set of PathOption
+func ToPath(opts ...PathOption) *Path {
+ c := &pathOptions{}
+ for _, opt := range opts {
+ opt(c)
+ }
+ return c.path
+}
+
// Path represents the path from some root to a particular field.
type Path struct {
name string // the name of this field or "" if this is an index