schema

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2026 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

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

func SortResourcesForDelete

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

Types

type BackendType

type BackendType int
const (
	CONSOLE BackendType = iota
	GATEWAY
)

type Catalog

type Catalog struct {
	Kind KindCatalog
	Run  RunCatalog
}

func ConsoleDefaultCatalog

func ConsoleDefaultCatalog() *Catalog

func GatewayDefaultCatalog

func GatewayDefaultCatalog() *Catalog

func (*Catalog) IsConsoleResource

func (catalog *Catalog) IsConsoleResource(res resource.Resource) bool

func (*Catalog) IsGatewayResource

func (catalog *Catalog) IsGatewayResource(res resource.Resource) bool

func (*Catalog) Merge

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

TODO: colision don't silently hide others.

type CatalogGeneric

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

type ConsoleKindVersion

type ConsoleKindVersion struct {
	ListPath           string
	Name               string
	ParentPathParam    []string
	ParentQueryParam   []string
	ListQueryParameter map[string]FlagParameterOption
	ApplyExample       string
	Order              int
}

func (*ConsoleKindVersion) GetApplyExample

func (c *ConsoleKindVersion) GetApplyExample() string

func (*ConsoleKindVersion) GetListPath

func (c *ConsoleKindVersion) GetListPath() string

func (*ConsoleKindVersion) GetListQueryParameter

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

func (*ConsoleKindVersion) GetName

func (c *ConsoleKindVersion) GetName() string

func (*ConsoleKindVersion) GetOrder

func (c *ConsoleKindVersion) GetOrder() int

func (*ConsoleKindVersion) GetParentPathParam

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

func (*ConsoleKindVersion) GetParentQueryParam

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

type FlagParameterOption

type FlagParameterOption struct {
	FlagName string
	Required bool
	Type     string
}

type GatewayKindVersion

type GatewayKindVersion struct {
	ListPath           string
	Name               string
	ParentPathParam    []string
	ParentQueryParam   []string
	ListQueryParameter map[string]FlagParameterOption
	GetAvailable       bool
	ApplyExample       string
	Order              int
}

func (*GatewayKindVersion) GetApplyExample

func (g *GatewayKindVersion) GetApplyExample() string

func (*GatewayKindVersion) GetListPath

func (g *GatewayKindVersion) GetListPath() string

func (*GatewayKindVersion) GetListQueryParameter

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

func (*GatewayKindVersion) GetName

func (g *GatewayKindVersion) GetName() string

func (*GatewayKindVersion) GetOrder

func (g *GatewayKindVersion) GetOrder() int

func (*GatewayKindVersion) GetParentPathParam

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

func (*GatewayKindVersion) GetParentQueryParam

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

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

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

func (*Kind) GetName

func (kind *Kind) GetName() string

func (*Kind) GetParentFlag

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

func (*Kind) GetParentQueryFlag

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

func (*Kind) IsConsoleKind

func (kind *Kind) IsConsoleKind() bool

Determines if the kind is a Console Kind.

func (*Kind) IsGatewayKind

func (kind *Kind) IsGatewayKind() bool

Determines if the kind is a Gateway Kind.

func (*Kind) IsKindGatewayInterceptor

func (kind *Kind) IsKindGatewayInterceptor() bool

Determines if the kind is a Gateway Kind that is an Interceptor.

func (*Kind) IsKindIdentifiedByNameAndVCluster

func (kind *Kind) IsKindIdentifiedByNameAndVCluster() bool

Determines if the kind is a Gateway Kind that need to be identified by name and vCluster.

func (*Kind) IsRootKind

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

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

func NewOpenAPIParser

func NewOpenAPIParser(schema []byte) (*OpenAPIParser, error)

func (*OpenAPIParser) GetConsoleCatalog

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

func (*OpenAPIParser) GetConsoleKinds

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

func (*OpenAPIParser) GetGatewayCatalog

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

func (*OpenAPIParser) GetGatewayKinds

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

type QueryInfo

type QueryInfo struct {
	Path        string
	QueryParams []QueryParam
}

type QueryParam

type QueryParam struct {
	Name  string
	Value string
}

type Run

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

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

type RunCatalog

type RunCatalog = map[string]Run

Jump to

Keyboard shortcuts

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