schema

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultPriority = 1000 //update  json annotation for Order when changing this value

Variables

This section is empty.

Functions

func ComputeFlagName added in v0.3.0

func ComputeFlagName(name string) string

two logics: uniformize flag name and kebab case

func SortResourcesForApply added in v0.2.7

func SortResourcesForApply(catalog KindCatalog, resources []resource.Resource, debug bool)

func SortResourcesForDelete added in v0.2.7

func SortResourcesForDelete(catalog KindCatalog, resources []resource.Resource, debug bool)

Types

type ConsoleKindVersion added in v0.3.0

type ConsoleKindVersion struct {
	ListPath          string
	Name              string
	ParentPathParam   []string
	ListQueryParamter map[string]QueryParameterOption
	Order             int `json:1000` //same value DefaultPriority
}

func (*ConsoleKindVersion) GetListPath added in v0.3.0

func (c *ConsoleKindVersion) GetListPath() string

func (*ConsoleKindVersion) GetListQueryParamter added in v0.3.0

func (c *ConsoleKindVersion) GetListQueryParamter() map[string]QueryParameterOption

func (*ConsoleKindVersion) GetName added in v0.3.0

func (c *ConsoleKindVersion) GetName() string

func (*ConsoleKindVersion) GetOrder added in v0.3.0

func (c *ConsoleKindVersion) GetOrder() int

func (*ConsoleKindVersion) GetParentPathParam added in v0.3.0

func (c *ConsoleKindVersion) GetParentPathParam() []string

type GatewayKindVersion added in v0.3.0

type GatewayKindVersion struct {
	ListPath           string
	Name               string
	ParentPathParam    []string
	ListQueryParameter map[string]QueryParameterOption
	GetAvailable       bool
	Order              int `json:1000` //same value DefaultPriority
}

func (*GatewayKindVersion) GetListPath added in v0.3.0

func (g *GatewayKindVersion) GetListPath() string

func (*GatewayKindVersion) GetListQueryParamter added in v0.3.0

func (g *GatewayKindVersion) GetListQueryParamter() map[string]QueryParameterOption

func (*GatewayKindVersion) GetName added in v0.3.0

func (g *GatewayKindVersion) GetName() string

func (*GatewayKindVersion) GetOrder added in v0.3.0

func (g *GatewayKindVersion) GetOrder() int

func (*GatewayKindVersion) GetParentPathParam added in v0.3.0

func (g *GatewayKindVersion) GetParentPathParam() []string

type GetParameter added in v0.3.0

type GetParameter struct {
	Name      string
	Mandatory bool
}

type Kind

type Kind struct {
	Versions map[int]KindVersion
}

func NewKind

func NewKind(version int, kindVersion KindVersion) Kind

func (*Kind) AddVersion

func (kind *Kind) AddVersion(version int, kindVersion KindVersion) error

func (*Kind) ApplyPath

func (kind *Kind) ApplyPath(resource *resource.Resource) (string, error)

func (*Kind) DeletePath added in v0.2.7

func (kind *Kind) DeletePath(resource *resource.Resource) (string, error)

func (*Kind) DescribePath

func (kind *Kind) DescribePath(parentPathValues []string, name string) string

func (*Kind) GetLatestKindVersion

func (kind *Kind) GetLatestKindVersion() KindVersion

func (*Kind) GetListFlag added in v0.3.0

func (kind *Kind) GetListFlag() map[string]QueryParameterOption

func (*Kind) GetName

func (Kind *Kind) GetName() string

func (*Kind) GetParentFlag added in v0.3.0

func (kind *Kind) GetParentFlag() []string

func (*Kind) ListPath

func (kind *Kind) ListPath(parentPathValues []string) string

func (*Kind) MaxVersion

func (kind *Kind) MaxVersion() int

type KindCatalog

type KindCatalog = map[string]Kind

func ConsoleDefaultKind added in v0.3.0

func ConsoleDefaultKind() KindCatalog

func GatewayDefaultKind added in v0.3.0

func GatewayDefaultKind() KindCatalog

type KindGeneric added in v0.3.0

type KindGeneric[T KindVersion] struct {
	Versions map[int]T
}

type KindVersion

type KindVersion interface {
	GetListPath() string
	GetName() string
	GetParentPathParam() []string
	GetOrder() int
	GetListQueryParamter() map[string]QueryParameterOption
}

type QueryParameterOption added in v0.3.0

type QueryParameterOption struct {
	FlagName string
	Required bool
	Type     string
}

type Schema

type Schema struct {
	// contains filtered or unexported fields
}

func New

func New(schema []byte) (*Schema, error)

func (*Schema) GetConsoleKinds added in v0.3.0

func (s *Schema) GetConsoleKinds(strict bool) (map[string]Kind, error)

func (*Schema) GetGatewayKinds added in v0.3.0

func (s *Schema) GetGatewayKinds(strict bool) (map[string]Kind, error)

Jump to

Keyboard shortcuts

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