model

package
v0.0.0-...-d9ebf33 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildResourceKey

func BuildResourceKey(mesh string, name string) string

BuildResourceKey build a unique identifier for a resource, usually is `mesh/name`

func DisplayName

func DisplayName(resType string) string

func Equal

func Equal(x, y ResourceSpec) bool

func FromAny

func FromAny(src *anypb.Any, spec ResourceSpec) error

func FromJSON

func FromJSON(src []byte, spec ResourceSpec) error

func FromYAML

func FromYAML(src []byte, spec ResourceSpec) error

func FullName

func FullName(spec ResourceSpec) string

func IsEmpty

func IsEmpty(spec ResourceSpec) bool

func PluralType

func PluralType(resType string) string

func RegisterResourceSchema

func RegisterResourceSchema(kind ResourceKind, newFunc NewResourceFunc, newListFunc NewResourceListFunc)

func ToAny

func ToAny(spec ResourceSpec) (*anypb.Any, error)

func ToJSON

func ToJSON(spec ResourceSpec) ([]byte, error)

func ToYAML

func ToYAML(spec ResourceSpec) ([]byte, error)

Types

type MutableRegistry

type MutableRegistry interface {
	Registry
	RegistryMutator
}

type NewResourceFunc

type NewResourceFunc func() Resource

type NewResourceListFunc

type NewResourceListFunc func() ResourceList

type PageData

type PageData[T any] struct {
	Pagination
	Data []T `json:"data"`
}

func NewPageData

func NewPageData[T any](total, pageOffset, pageSize int, data []T) *PageData[T]

func (*PageData[T]) WithCurPage

func (pd *PageData[T]) WithCurPage(curPage int) *PageData[T]

func (*PageData[T]) WithData

func (pd *PageData[T]) WithData(data []T) *PageData[T]

func (*PageData[T]) WithPageSize

func (pd *PageData[T]) WithPageSize(pageSize int) *PageData[T]

func (*PageData[T]) WithTotal

func (pd *PageData[T]) WithTotal(total int) *PageData[T]

type PageReq

type PageReq struct {
	PageOffset int `form:"pageOffset" json:"pageOffset"`
	PageSize   int `form:"pageSize" json:"pageSize"`
}

type Pagination

type Pagination struct {
	Total      int `json:"total"`
	PageSize   int `json:"pageSize"`
	PageOffset int `json:"pageOffset"`
}

type Registry

type Registry interface {
	// AllResourceKinds returns all registered resource resourceDir
	AllResourceKinds() []ResourceKind
	// NewResourceFunc returns the new resource function for a resource kind
	NewResourceFunc(kind ResourceKind) (NewResourceFunc, error)
	// NewResourceListFunc returns the new resource list function for a resource kind
	NewResourceListFunc(kind ResourceKind) (NewResourceListFunc, error)
}

func ResourceSchemaRegistry

func ResourceSchemaRegistry() Registry

type RegistryMutator

type RegistryMutator interface {
	// Register registers a resource kind, if a resource kind has been registered before, it will be ignored
	Register(kind ResourceKind, newFunc NewResourceFunc, newListFunc NewResourceListFunc)
}

type Resource

type Resource interface {
	k8sruntime.Object
	// ResourceKind returns the resource type, e.g. Application, Service etc.
	ResourceKind() ResourceKind
	// ResourceKey returns the unique resource key
	ResourceKey() string
	// ResourceMesh returns the mesh which the resource belongs to
	ResourceMesh() string
	// ResourceMeta returns the resource metadata
	ResourceMeta() metav1.ObjectMeta
	// ResourceSpec returns the resource spec
	ResourceSpec() ResourceSpec
	// String returns the string representation of the resource
	String() string
}

type ResourceKind

type ResourceKind string

ResourceKind defines the resource type

func (ResourceKind) ToString

func (rk ResourceKind) ToString() string

type ResourceList

type ResourceList interface {
	k8sruntime.Object
	k8smeta.List

	SetItems(items []Resource)
}

type ResourceSpec

type ResourceSpec interface{}

Jump to

Keyboard shortcuts

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