Documentation
¶
Index ¶
- func BuildResourceKey(mesh string, name string) string
- func DisplayName(resType string) string
- func Equal(x, y ResourceSpec) bool
- func FromAny(src *anypb.Any, spec ResourceSpec) error
- func FromJSON(src []byte, spec ResourceSpec) error
- func FromYAML(src []byte, spec ResourceSpec) error
- func FullName(spec ResourceSpec) string
- func IsEmpty(spec ResourceSpec) bool
- func PluralType(resType string) string
- func RegisterResourceSchema(kind ResourceKind, newFunc NewResourceFunc, newListFunc NewResourceListFunc)
- func ToAny(spec ResourceSpec) (*anypb.Any, error)
- func ToJSON(spec ResourceSpec) ([]byte, error)
- func ToYAML(spec ResourceSpec) ([]byte, error)
- type MutableRegistry
- type NewResourceFunc
- type NewResourceListFunc
- type PageData
- type PageReq
- type Pagination
- type Registry
- type RegistryMutator
- type Resource
- type ResourceKind
- type ResourceList
- type ResourceSpec
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildResourceKey ¶
BuildResourceKey build a unique identifier for a resource, usually is `mesh/name`
func DisplayName ¶
func Equal ¶
func Equal(x, y ResourceSpec) bool
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 RegisterResourceSchema ¶
func RegisterResourceSchema(kind ResourceKind, newFunc NewResourceFunc, newListFunc NewResourceListFunc)
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 (*PageData[T]) WithCurPage ¶
func (*PageData[T]) WithPageSize ¶
type Pagination ¶
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{}
Click to show internal directories.
Click to hide internal directories.