Documentation ¶
Index ¶
- func FormatKind(s string) string
- type APIObject
- type ArrayRenderer
- type Catalog
- func (c *Catalog) Checksum() string
- func (c *Catalog) Field(name string) (*Field, error)
- func (c *Catalog) Fields() ([]Field, error)
- func (c *Catalog) Resource(group, version, kind string) (*Type, error)
- func (c *Catalog) TypeByID(id string) (*Type, error)
- func (c *Catalog) Types() ([]Type, error)
- func (c *Catalog) TypesWithDescendant(definition string) ([]Type, error)
- func (c *Catalog) Version() string
- type CatalogOpt
- type Component
- type Description
- type Document
- type Extension
- type ExtractFn
- type Field
- func (f *Field) Codebase() string
- func (f *Field) Description() string
- func (f *Field) Group() string
- func (f *Field) Identifier() string
- func (f *Field) IsType() bool
- func (f *Field) Kind() string
- func (f *Field) Properties() map[string]Property
- func (f *Field) QualifiedGroup() string
- func (f *Field) Version() string
- type GenOpts
- type Group
- type ItemRenderer
- type Lib
- type LiteralField
- type LiteralFieldRenderer
- type Metadata
- type Object
- type ObjectRenderer
- type Property
- type ReferenceField
- type ReferenceRenderer
- type Type
- func (t *Type) Codebase() string
- func (t *Type) Description() string
- func (t *Type) Group() string
- func (t *Type) Identifier() string
- func (t *Type) IsType() bool
- func (t *Type) Kind() string
- func (t *Type) Properties() map[string]Property
- func (t *Type) QualifiedGroup() string
- func (t *Type) Version() string
- type UnknownDefinitionError
- type Version
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FormatKind ¶
FormatKind formats a string in kind format. i.e camel case with jsonnet keywords massaged.
Types ¶
type APIObject ¶
type APIObject struct {
// contains filtered or unexported fields
}
APIObject is an API object.
func NewAPIObject ¶
NewAPIObject creates an instance of APIObject.
func (*APIObject) Description ¶
Description is the description of this API object.
type ArrayRenderer ¶
type ArrayRenderer struct {
// contains filtered or unexported fields
}
ArrayRenderer renders arrays.
func NewArrayRenderer ¶
func NewArrayRenderer(f Property, parent string) *ArrayRenderer
NewArrayRenderer creates an instance of ArrayRenderer.
type Catalog ¶
type Catalog struct {
// contains filtered or unexported fields
}
Catalog is a catalog definitions
func NewCatalog ¶
NewCatalog creates an instance of Catalog.
func (*Catalog) Field ¶
Field returns a field by definition id. If the type cannot be found, it returns an error.
func (*Catalog) Resource ¶
Resource returns a resource by group, version, kind. If the field cannot be found, it returns an error
func (*Catalog) TypesWithDescendant ¶
TypesWithDescendant returns types who have the specified definition as a descendant. This list does not include List types (e.g. DeploymentList).
type CatalogOpt ¶
type CatalogOpt func(*Catalog)
CatalogOpt is an option for configuring Catalog.
func CatalogOptChecksum ¶
func CatalogOptChecksum(checksum string) CatalogOpt
CatalogOptChecksum is a Catalog option for setting the checksum of the swagger schema.
func CatalogOptExtractProperties ¶
func CatalogOptExtractProperties(fn ExtractFn) CatalogOpt
CatalogOptExtractProperties is a Catalog option for setting the property extractor.
func CatalogOptMaintainer ¶
func CatalogOptMaintainer(maintainer string) CatalogOpt
CatalogOptMaintainer is a Catalog option for setting the maintainer of the swagger schema.
func CatalogOptVersion ¶
func CatalogOptVersion(version string) CatalogOpt
CatalogOptChecksum is a Catalog option for setting the Kubernetes target Version
type Component ¶
Component is resource information provided in the k8s swagger schema which contains the group, kind, and version for a definition.
func NewComponent ¶
NewComponent extracts component information from a schema.
type Description ¶
Description is a description of a Kubernetes definition name.
func ParseDescription ¶
func ParseDescription(name string) (*Description, error)
ParseDescription takes a definition name and returns a Description.
func (*Description) Validate ¶
func (d *Description) Validate() error
Validate validates the Description. A description is valid if it has a version.
type Document ¶
type Document struct {
// contains filtered or unexported fields
}
Document represents a ksonnet lib document.
func NewDocument ¶
NewDocument creates an instance of Document.
func (*Document) HiddenGroups ¶
HiddenGroups returns an alphabetically sorted list of hidden groups.
type Extension ¶
type Extension struct {
// contains filtered or unexported fields
}
Extension represents a ksonnet lib extension document.
func NewExtension ¶
NewExtension creates an an instance of Extension.
type Field ¶
type Field struct {
// contains filtered or unexported fields
}
Field is a Kubernetes field.
func (*Field) Description ¶
Description is the description for this field.
func (*Field) Identifier ¶
Identifier is the identifier for this field.
func (*Field) Properties ¶
Properties are the properties for this field.
func (*Field) QualifiedGroup ¶
QualifiedGroup is the group for this field.
type GenOpts ¶
type GenOpts struct { Metadata // OpenAPI (swagger.json) spec of the API OpenAPI string // Optional regexp to only generate specific apiGroups Target *regexp.Regexp // Name of the generated library (e.g. Kubernetes, cert-manager, etc) Name string // Version of the targeted software (e.g. 1.17, 0.1, etc.) Version string // Maintainer of the generated library Maintainer string }
type Group ¶
type Group struct {
// contains filtered or unexported fields
}
Group is group of definitions.
func (*Group) AddResource ¶
AddResource adds a resource to a version.
type ItemRenderer ¶
type ItemRenderer struct {
// contains filtered or unexported fields
}
ItemRenderer renders items.
func NewItemRenderer ¶
func NewItemRenderer(f Property, parent string) *ItemRenderer
NewItemRenderer creates an instance of ItemRenderer.
type LiteralField ¶
type LiteralField struct {
// contains filtered or unexported fields
}
LiteralField is a literal field. (e.g. string, number, int, array)
func NewLiteralField ¶
func NewLiteralField(name, fieldType, description, ref string) *LiteralField
NewLiteralField creates an instance of LiteralField.
func (*LiteralField) Description ¶
func (f *LiteralField) Description() string
Description returns the description of the LiteralField.
func (*LiteralField) FieldType ¶
func (f *LiteralField) FieldType() string
FieldType returns the field type of the LiteralField.
func (*LiteralField) Name ¶
func (f *LiteralField) Name() string
Name returns the name of the LiteralField.
func (*LiteralField) Ref ¶
func (f *LiteralField) Ref() string
Ref returns the ref of the LiteralField.
type LiteralFieldRenderer ¶
type LiteralFieldRenderer struct {
// contains filtered or unexported fields
}
LiteralFieldRenderer renders a literal field.
func NewLiteralFieldRenderer ¶
func NewLiteralFieldRenderer(lf *LiteralField, parentName string) *LiteralFieldRenderer
NewLiteralFieldRenderer creates an instance of LiteralField.
type Metadata ¶
type Metadata struct { // Vendor of this build Vendor string // Version of the generator Version string }
Metadata holds meta information about the generator used for the build
type Object ¶
type Object interface { Kind() string Description() string IsType() bool Properties() map[string]Property Version() string Group() string Codebase() string QualifiedGroup() string Identifier() string }
Object is an object that can be turned into a node by APIObject.
type ObjectRenderer ¶
type ObjectRenderer struct {
// contains filtered or unexported fields
}
ObjectRenderer renders an object field.
func NewObjectRenderer ¶
func NewObjectRenderer(field Property, parent string) *ObjectRenderer
NewObjectRenderer creates an instance of ObjectRenderer
type ReferenceField ¶
type ReferenceField struct {
// contains filtered or unexported fields
}
ReferenceField is a reference field.
func NewReferenceField ¶
func NewReferenceField(name, description, ref string) *ReferenceField
NewReferenceField creates an instance of ReferenceField.
func (*ReferenceField) Description ¶
func (f *ReferenceField) Description() string
Description returns the description of the ReferenceField.
func (*ReferenceField) Name ¶
func (f *ReferenceField) Name() string
Name returns the name of the ReferenceField.
func (*ReferenceField) Ref ¶
func (f *ReferenceField) Ref() string
Ref returns the defintion this ReferenceField represents.
type ReferenceRenderer ¶
type ReferenceRenderer struct {
// contains filtered or unexported fields
}
ReferenceRenderer renders a reference field.
func NewReferenceRenderer ¶
func NewReferenceRenderer(rf *ReferenceField, tl typeLookup, parent string) *ReferenceRenderer
NewReferenceRenderer creates an instance of ReferenceRenderer.
type Type ¶
type Type struct {
// contains filtered or unexported fields
}
Type is a Kubernetes kind.
func NewType ¶
func NewType(identifier, description, codebase, group string, component Component, props map[string]Property) Type
NewType creates an instance of Type.
func (*Type) Description ¶
Description is description for this type
func (*Type) Properties ¶
Properties are the properties for this type.
func (*Type) QualifiedGroup ¶
QualifiedGroup is the group for this type
type UnknownDefinitionError ¶
type UnknownDefinitionError struct {
// contains filtered or unexported fields
}
UnknownDefinitionError is an error signifying an unknown definition.
func NewUnknownDefinitionError ¶
func NewUnknownDefinitionError(name string) *UnknownDefinitionError
NewUnknownDefinitionError creates an instance of UnknownDefinitionError.
func (*UnknownDefinitionError) Error ¶
func (e *UnknownDefinitionError) Error() string
type Version ¶
type Version struct {
// contains filtered or unexported fields
}
Version is an API version.
func NewVersion ¶
NewVersion creates an instance of Version.
func (*Version) APIObjects ¶
APIObjects returns a slice of APIObjects sorted by name.
func (*Version) AddResource ¶
AddResource adds a resource to the version.