Documentation ¶
Index ¶
- Constants
- Variables
- func DisplayName(resType string) string
- func ErrorInvalidItemType(expected, actual interface{}) error
- func PluralDisplayName(resType string) string
- func PluralType(resType string) string
- func Validate(resource Resource) error
- type ByMeta
- type KDSFlagType
- type Pagination
- type Resource
- type ResourceKey
- type ResourceList
- type ResourceMeta
- type ResourceNameExtensions
- type ResourceScope
- type ResourceSpec
- type ResourceType
- type ResourceTypeDescriptor
- type ResourceValidator
- type ResourceWithAddress
- type TypeFilter
- func AllowedToInspect() TypeFilter
- func HasKDSFlag(flagType KDSFlagType) TypeFilter
- func HasKdsEnabled() TypeFilter
- func HasKumactlEnabled() TypeFilter
- func HasScope(scope ResourceScope) TypeFilter
- func HasWsEnabled() TypeFilter
- func Named(names ...ResourceType) TypeFilter
- func Not(filter TypeFilter) TypeFilter
- type TypeFilterFn
Constants ¶
const ( DefaultMesh = "default" // NoMesh defines a marker that resource is not bound to a Mesh. // Resources not bound to a mesh (ScopeGlobal) should have an empty string in Mesh field. NoMesh = "" )
const ( ScopeMesh = "Mesh" ScopeGlobal = "Global" )
const ( ConsumedByZone = KDSFlagType(1) ConsumedByGlobal = KDSFlagType(1 << 2) ProvidedByZone = KDSFlagType(1 << 3) ProvidedByGlobal = KDSFlagType(1 << 4) FromZoneToGlobal = ConsumedByGlobal | ProvidedByZone FromGlobalToZone = ProvidedByGlobal | ConsumedByZone )
Variables ¶
var ( // ResourceNameExtensionsUnsupported is a convenience constant // that is meant to make source code more readable. ResourceNameExtensionsUnsupported = ResourceNameExtensions(nil) )
Functions ¶
func DisplayName ¶ added in v1.8.1
func ErrorInvalidItemType ¶
func ErrorInvalidItemType(expected, actual interface{}) error
func PluralDisplayName ¶ added in v1.8.1
func PluralType ¶ added in v1.8.1
Types ¶
type KDSFlagType ¶ added in v1.8.1
type KDSFlagType uint32
func (KDSFlagType) Has ¶ added in v1.8.1
func (kt KDSFlagType) Has(flag KDSFlagType) bool
Has return whether this flag has all the passed flags on.
type Pagination ¶
func (*Pagination) GetNextOffset ¶
func (p *Pagination) GetNextOffset() string
func (*Pagination) GetTotal ¶
func (p *Pagination) GetTotal() uint32
func (*Pagination) SetNextOffset ¶
func (p *Pagination) SetNextOffset(nextOffset string)
func (*Pagination) SetTotal ¶
func (p *Pagination) SetTotal(total uint32)
type Resource ¶
type Resource interface { GetMeta() ResourceMeta SetMeta(ResourceMeta) GetSpec() ResourceSpec SetSpec(ResourceSpec) error Descriptor() ResourceTypeDescriptor }
type ResourceKey ¶
func MetaToResourceKey ¶
func MetaToResourceKey(meta ResourceMeta) ResourceKey
func WithMesh ¶ added in v1.8.1
func WithMesh(mesh string, name string) ResourceKey
func WithoutMesh ¶ added in v1.8.1
func WithoutMesh(name string) ResourceKey
type ResourceList ¶
type ResourceList interface { GetItemType() ResourceType GetItems() []Resource NewItem() Resource AddItem(Resource) error GetPagination() *Pagination }
type ResourceMeta ¶
type ResourceNameExtensions ¶
ResourceNameExtensions represents an composite resource name in environments other than Universal.
E.g., name of a Kubernetes resource consists of a namespace component and a name component that is local to that namespace.
Technically, ResourceNameExtensions is a mapping between a component identifier and a component value, e.g.
"k8s.kuma.io/namespace" => "my-namespace" "k8s.kuma.io/name" => "my-policy"
Component identifier must be considered a part of user-facing Kuma API. In other words, it is supposed to be visible to users and should not be changed lightly.
Component identifier might have any value, however, it's preferable to choose one that is intuitive to users of that particular environment. E.g., on Kubernetes component identifiers should use a label name format, like in "k8s.kuma.io/namespace" and "k8s.kuma.io/name".
type ResourceScope ¶
type ResourceScope string
type ResourceSpec ¶
type ResourceType ¶
type ResourceType string
type ResourceTypeDescriptor ¶ added in v1.8.1
type ResourceTypeDescriptor struct { // Name identifier of this resourceType this maps to the k8s entity and universal name. Name ResourceType // Resource a created element of this type Resource Resource // ResourceList a create list container of this type ResourceList ResourceList // ReadOnly if this type will be created, modified and deleted by the system. ReadOnly bool // AdminOnly if this type requires users to be admin to access. AdminOnly bool // Scope whether this resource is Global or Mesh scoped. Scope ResourceScope // KDSFlags a set of flags that defines how this entity is sent using KDS (if unset KDS is disabled). KDSFlags KDSFlagType // WsPath the path to access on the REST api. WsPath string // KumactlArg the name of the cmdline argument when doing `get` or `delete`. KumactlArg string // KumactlListArg the name of the cmdline argument when doing `list`. KumactlListArg string // AllowToInspect if it's required to generate Inspect API endpoint for this type AllowToInspect bool // IsPolicy if this type is a policy (Dataplanes, Insights, Ingresses are not policies as they describe either metadata or workload, Retries are policies). IsPolicy bool // DisplayName the name of the policy showed as plural to be displayed in the UI and maybe CLI SingularDisplayName string // PluralDisplayName the name of the policy showed as plural to be displayed in the UI and maybe CLI PluralDisplayName string // IsExperimental indicates if a policy is in experimental state (might not be production ready). IsExperimental bool }
func (ResourceTypeDescriptor) NewList ¶ added in v1.8.1
func (d ResourceTypeDescriptor) NewList() ResourceList
func (ResourceTypeDescriptor) NewObject ¶ added in v1.8.1
func (d ResourceTypeDescriptor) NewObject() Resource
type ResourceValidator ¶ added in v1.8.1
type ResourceValidator interface {
Validate() error
}
type ResourceWithAddress ¶ added in v1.8.1
type TypeFilter ¶ added in v1.8.1
type TypeFilter interface {
Apply(descriptor ResourceTypeDescriptor) bool
}
func AllowedToInspect ¶ added in v1.8.1
func AllowedToInspect() TypeFilter
func HasKDSFlag ¶ added in v1.8.1
func HasKDSFlag(flagType KDSFlagType) TypeFilter
func HasKdsEnabled ¶ added in v1.8.1
func HasKdsEnabled() TypeFilter
func HasKumactlEnabled ¶ added in v1.8.1
func HasKumactlEnabled() TypeFilter
func HasScope ¶ added in v1.8.1
func HasScope(scope ResourceScope) TypeFilter
func HasWsEnabled ¶ added in v1.8.1
func HasWsEnabled() TypeFilter
func Named ¶ added in v1.8.1
func Named(names ...ResourceType) TypeFilter
func Not ¶ added in v1.8.1
func Not(filter TypeFilter) TypeFilter
type TypeFilterFn ¶ added in v1.8.1
type TypeFilterFn func(descriptor ResourceTypeDescriptor) bool
func (TypeFilterFn) Apply ¶ added in v1.8.1
func (f TypeFilterFn) Apply(descriptor ResourceTypeDescriptor) bool