Documentation ¶
Index ¶
- func NewKeyNotStringError(key interface{}) error
- func NewRequiredKeyNotFoundError(key string, path []string) error
- func NewUnknownFormatError(format string) error
- func NewUnknownKeyError(key string) error
- func NewUnknownSchemaError(key string) error
- func NewUnknownTypeError(t interface{}) error
- func NewWrongTypeError(k, expectedType string, v interface{}) error
- func NewYamlPathError(path []string, value interface{}, err error) error
- type APIKeyer
- type AdditionalProperties
- type GroupVersionKind
- type Initializers
- type Input
- type Items
- type KeyNotStringError
- type Kind
- type Loader
- type Metadata
- type Property
- type RequiredKeyNotFoundError
- type Resolver
- type Schema
- type Swagger
- type UnknownFormatError
- type UnknownKeyError
- type UnknownSchemaError
- type UnknownTypeError
- type Validator
- type WrongTypeError
- type YamlPathError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewKeyNotStringError ¶
func NewKeyNotStringError(key interface{}) error
func NewRequiredKeyNotFoundError ¶
NewRequiredKeyNotFoundError returns a new RequiredKeyNotFoundError
func NewUnknownFormatError ¶
func NewUnknownKeyError ¶
func NewUnknownSchemaError ¶
NewUnknownSchemaError returns an UnknownSchemaError.
func NewUnknownTypeError ¶
func NewUnknownTypeError(t interface{}) error
NewUnknownTypeError returns a new UnknownTypeError
func NewWrongTypeError ¶
func NewYamlPathError ¶
Types ¶
type APIKeyer ¶
type APIKeyer struct {
// contains filtered or unexported fields
}
APIKeyer can look up a schema key given the apiVersion and the kind.
func NewAPIKeyer ¶
NewAPIKeyer returns an APIKeyer that finds keys with a common prefix.
type AdditionalProperties ¶
type AdditionalProperties struct { // Type will almost always be a string Type string }
AdditionalProperties define the type found in objects. Kubernetes only uses string:string dicts, but this might break on more advanced use cases.
type GroupVersionKind ¶
type GroupVersionKind struct { // Group is the group such as v1, apps, etc. Group string // Kind is the type of object such as Deployment or Pod. Kind string // Version is the API version such as v1, v1alpha3, v1beta2. Version string }
GroupVersionKind is the gvk of kubernetes schema.
type Initializers ¶
type Initializers struct { // Description is a description of the initializers. Description string // Type is the type of initializers, this is always an array. Type string // Items are the actual list of initializers. Items *Items // TODO(chuckha) Can probably remove these two PatchMergeKey string `json:"x-kubernetes-patch-merge-key"` PatchStrategy string `json:"x-kubernetes-patch-strategy"` }
Initializers are things that will run before a pod can start running. This is only used in two places, the object metadata and the initializersConfiguration object. See: https://kubernetes.io/docs/reference/access-authn-authz/extensible-admission-controllers/#how-are-initializers-triggered
type Items ¶
type Items struct { // Description is a description of the array of items. Description string // Type is the type of item in the array. Type string // Reference is the reference to the schema type of items stored in this array. Reference string `json:"$ref"` // Items can be an array of arrays of arrays of ... Items *Items }
Items are the array of items when the type is "array".
type KeyNotStringError ¶
type KeyNotStringError struct {
// contains filtered or unexported fields
}
func (*KeyNotStringError) Error ¶
func (k *KeyNotStringError) Error() string
type Kind ¶
type Kind struct { // Description describes what kind is, it's an resource in the API. Description string // Type is always a string in the Kind object. Type string }
Kind is the kind we all know and love from ObjectMeta.
type Loader ¶
type Loader struct{}
Loader defines a struct that can read data from a stream into an internal type.
type Metadata ¶
type Metadata struct { // Description descries what metadata is. Description string // Reference is the key to the metadata schema. Reference string `json:"$ref"` }
Metadata is a reference to the shared metadata schema.
type Property ¶
type Property struct { // Description is the description of the property being defined. Description string // Type is a basic type like string, object, integer or array. Type string // Format is a sub type, such as string could be `byte` or integer could be `int64`. Format string // Items is required for array types. This tells us what types are inside the array. Items *Items // AdditionalProperties is an optional field for object types defining what kind of key/value pairs will be found on the object. // TODO(chuckha) make this a pointer type AdditionalProperties AdditionalProperties // Reference is a reference to another schema in our list of definitions. Reference string `json:"$ref"` }
Property is a single property, or field, of a schema.
type RequiredKeyNotFoundError ¶
type RequiredKeyNotFoundError struct {
// contains filtered or unexported fields
}
RequiredKeyNotFoundError is an error representing a required schema key that is missing
func (*RequiredKeyNotFoundError) Error ¶
func (r *RequiredKeyNotFoundError) Error() string
Error implements the error interface
func (*RequiredKeyNotFoundError) MarshalJSON ¶
func (r *RequiredKeyNotFoundError) MarshalJSON() ([]byte, error)
MarshalJSON extracts the error since error is an interface
type Resolver ¶
type Resolver struct {
// contains filtered or unexported fields
}
Resolver looks up a schema based on the schema key.
func NewResolver ¶
NewResolver loads a swagger file, keeps track of the version and returns an instantiated resolver.
type Schema ¶
type Schema struct { // Description is the description of the object that conforms to this schema. Description string // Required lists the required fields of this object. Required []string // Properties Properties map[string]*Property // Initializers are optional. TODO(chuckha) what are these actually? Initializers *Initializers // Kind is an optional field that describes the kind of object inside a list type Kind *Kind // Metadata is an optional field that contains a reference to some other schema. Metadata *Metadata // GVK is the GroupVersionKind from kubernetes. GVK []*GroupVersionKind `json:"x-kubernetes-group-version-kind"` // Type is when the object is actually a type rename of a builtin (type X string) Type string // Format is the format of the type when Type is "string" Format string }
Schema is a swagger schema. I'm sure there's a real definition somewhere but this gets everything this program needs.
type UnknownFormatError ¶
type UnknownFormatError struct {
Format string
}
func (*UnknownFormatError) Error ¶
func (u *UnknownFormatError) Error() string
type UnknownKeyError ¶
type UnknownKeyError struct {
// contains filtered or unexported fields
}
func (*UnknownKeyError) Error ¶
func (u *UnknownKeyError) Error() string
type UnknownSchemaError ¶
type UnknownSchemaError struct {
// contains filtered or unexported fields
}
UnknownSchemaError means the resolver could not find the requested schema.
func (*UnknownSchemaError) Error ¶
func (u *UnknownSchemaError) Error() string
Error implements error interface.
func (*UnknownSchemaError) MarshalJSON ¶
func (u *UnknownSchemaError) MarshalJSON() ([]byte, error)
MarshalJSON is used for the json.Marshal call.
type UnknownTypeError ¶
type UnknownTypeError struct {
// contains filtered or unexported fields
}
UnknownTypeError represents an unknown type in a value. Examples are when the schema expects a string but gets an integer.
func (*UnknownTypeError) Error ¶
func (u *UnknownTypeError) Error() string
Error implements the error interface
type Validator ¶
type Validator struct {
// contains filtered or unexported fields
}
Validator knows enough to be able to validate a YAML document.
func NewValidator ¶
func NewValidator(resolver resolver) *Validator
NewValidator returns an instantiated validator.
type WrongTypeError ¶
type WrongTypeError struct {
// contains filtered or unexported fields
}
func (*WrongTypeError) Error ¶
func (w *WrongTypeError) Error() string
type YamlPathError ¶
func (*YamlPathError) Error ¶
func (y *YamlPathError) Error() string
func (*YamlPathError) MarshalJSON ¶
func (y *YamlPathError) MarshalJSON() ([]byte, error)
MarshalJSON extracts the error since error is an interface