schema

package
v0.6.3 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2025 License: Apache-2.0 Imports: 15 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 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 BackendType added in v0.4.0

type BackendType int
const (
	CONSOLE BackendType = iota
	GATEWAY
)

type Catalog added in v0.4.0

type Catalog struct {
	Kind KindCatalog
	Run  RunCatalog
}

func ConsoleDefaultCatalog added in v0.4.0

func ConsoleDefaultCatalog() *Catalog

func GatewayDefaultCatalog added in v0.4.0

func GatewayDefaultCatalog() *Catalog

func (*Catalog) Merge added in v0.4.0

func (catalog *Catalog) Merge(other *Catalog) Catalog

TODO: colision don't silently hide others

type CatalogGeneric added in v0.4.0

type CatalogGeneric[T KindVersion] struct {
	Kind map[string]kindGeneric[T]
	Run  RunCatalog
}

type ConsoleKindVersion added in v0.3.0

type ConsoleKindVersion struct {
	ListPath           string
	Name               string
	ParentPathParam    []string
	ParentQueryParam   []string
	ListQueryParameter map[string]FlagParameterOption
	ApplyExample       string
	Order              int `json:1000` //same value DefaultPriority
}

func (*ConsoleKindVersion) GetApplyExample added in v0.3.4

func (c *ConsoleKindVersion) GetApplyExample() string

func (*ConsoleKindVersion) GetListPath added in v0.3.0

func (c *ConsoleKindVersion) GetListPath() string

func (*ConsoleKindVersion) GetListQueryParameter added in v0.4.0

func (c *ConsoleKindVersion) GetListQueryParameter() map[string]FlagParameterOption

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

func (*ConsoleKindVersion) GetParentQueryParam added in v0.3.4

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

type FlagParameterOption added in v0.4.0

type FlagParameterOption struct {
	FlagName string
	Required bool
	Type     string
}

type GatewayKindVersion added in v0.3.0

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

func (*GatewayKindVersion) GetApplyExample added in v0.3.4

func (g *GatewayKindVersion) GetApplyExample() string

func (*GatewayKindVersion) GetListPath added in v0.3.0

func (g *GatewayKindVersion) GetListPath() string

func (*GatewayKindVersion) GetListQueryParameter added in v0.4.0

func (g *GatewayKindVersion) GetListQueryParameter() map[string]FlagParameterOption

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

func (*GatewayKindVersion) GetParentQueryParam added in v0.3.4

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

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) (QueryInfo, error)

func (*Kind) DeletePath added in v0.2.7

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

func (*Kind) DescribePath

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

func (*Kind) GetLatestKindVersion

func (kind *Kind) GetLatestKindVersion() KindVersion

func (*Kind) GetListFlag added in v0.3.0

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

func (*Kind) GetName

func (Kind *Kind) GetName() string

func (*Kind) GetParentFlag added in v0.3.0

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

func (*Kind) GetParentQueryFlag added in v0.3.4

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

func (*Kind) IsRootKind added in v0.5.0

func (kind *Kind) IsRootKind() bool

func (*Kind) ListPath

func (kind *Kind) ListPath(parentValues []string, parentQueryValues []string) QueryInfo

func (*Kind) MaxVersion

func (kind *Kind) MaxVersion() int

type KindCatalog

type KindCatalog = map[string]Kind

type KindVersion

type KindVersion interface {
	GetListPath() string
	GetName() string
	GetParentPathParam() []string
	GetParentQueryParam() []string
	GetOrder() int
	GetListQueryParameter() map[string]FlagParameterOption
	GetApplyExample() string
}

type OpenApiParser added in v0.4.0

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

func NewOpenApiParser added in v0.4.0

func NewOpenApiParser(schema []byte) (*OpenApiParser, error)

func (*OpenApiParser) GetConsoleCatalog added in v0.4.0

func (s *OpenApiParser) GetConsoleCatalog(strict bool) (*Catalog, error)

func (*OpenApiParser) GetConsoleKinds added in v0.4.0

func (s *OpenApiParser) GetConsoleKinds(strict bool) (KindCatalog, error)

func (*OpenApiParser) GetGatewayCatalog added in v0.4.0

func (s *OpenApiParser) GetGatewayCatalog(strict bool) (*Catalog, error)

func (*OpenApiParser) GetGatewayKinds added in v0.4.0

func (s *OpenApiParser) GetGatewayKinds(strict bool) (KindCatalog, error)

type QueryInfo added in v0.3.4

type QueryInfo struct {
	Path        string
	QueryParams []QueryParam
}

type QueryParam added in v0.3.4

type QueryParam struct {
	Name  string
	Value string
}

type Run added in v0.4.0

type Run struct {
	Path           string
	Name           string
	Doc            string
	QueryParameter map[string]FlagParameterOption
	PathParameter  []string
	BodyFields     map[string]FlagParameterOption
	Method         string

	BackendType BackendType `json:"-"`
}

func (*Run) BuildPath added in v0.4.0

func (c *Run) BuildPath(pathValue []string) string

type RunCatalog added in v0.4.0

type RunCatalog = map[string]Run

Jump to

Keyboard shortcuts

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