model

package
v0.0.0-...-3832929 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 24, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ListMetaID   = "io.k8s.apimachinery.pkg.apis.meta.v1.ListMeta"
	ObjectMetaID = "io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta"
)

Short handles for longer types

Variables

This section is empty.

Functions

func CamelLower

func CamelLower(s string) string

CamelLower returns the string with the word lowercased.

func Load

func Load(definitions *swagger.Definitions, prefix string) map[string]Group

Load parses swagger definitions into the data model

Types

type Constructor

type Constructor struct {
	Help string `json:"help"`
	// Args are the arguments this constructor takes.
	// Generated constructors only have one argument, `name`
	Args []Parameter `json:"args"`
}

Constructor creates new objects

type Group

type Group map[string]Version

Group represents a group, like "core" or "apps"

type IDs

type IDs map[string]map[string]string

IDs represents a group name -> group mapping constructed by

type Kind

type Kind struct {
	Help string `json:"help"`

	Kind    string `json:"kind"`
	Group   string `json:"group"`
	Version string `json:"version"`

	// constructor
	New *Constructor `json:"new"`

	// modifiers
	Modifiers modifiers `json:"modifiers,omitempty"`

	// Cluster or Namespaced scope, ignored if unset
	Scope *string
}

Kind represents both actual Kinds ("Deployment", "Version"), but also other parts of the API, like "Container" or "ServicePort".

func (Kind) APIVersion

func (k Kind) APIVersion() string

APIVersion constructs the full api path for a group

type Modifier

type Modifier struct {
	Help string `json:"help"`

	// Arg is the name of the functions argument
	Arg Parameter `json:"arg"`
	// Target is the jsonpath to the field that is modified
	Target string `json:"target"`

	// Type is the type of the modified value
	Type swagger.Type `json:"type"`
}

Modifier is a function that returns a patch to modify the value at `Target`

type Object

type Object struct {
	Help   string    `json:"help"`
	Fields modifiers `json:"fields"`
}

Object is the logical group for Modifiers that target fields of a nested object

type Parameter

type Parameter struct {
	Key     string      `json:"key"`
	Default interface{} `json:"default"`
}

Parameter is a function argument, with an optional default value

func (Parameter) String

func (p Parameter) String() string

type Version

type Version struct {
	APIVersion string
	Kinds      map[string]Kind
}

Version represents a specific version of the API, like "apps/v1" or "core/v1"

func (Version) MarshalJSON

func (v Version) MarshalJSON() ([]byte, error)

MarshalJSON marsals wraps json.Marshal and adds the `_apiVersion` field

func (*Version) UnmarshalJSON

func (v *Version) UnmarshalJSON(d []byte) error

UnmarshalJSON wraps json.Unmarshal and decodes the "private" `_apiVersion` field

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL