Documentation ¶
Index ¶
- Constants
- Variables
- type CommonResourceIface
- type Entity
- func (n *Entity) GetCluster() string
- func (n *Entity) GetEnvironmentID() uint
- func (n *Entity) GetID() uint
- func (n *Entity) GetKind() string
- func (n *Entity) GetName() string
- func (n *Entity) GetNamespace() string
- func (n *Entity) GetOwners() []CommonResourceIface
- func (n *Entity) GetProjectID() uint
- func (n *Entity) GetTenantID() uint
- func (n *Entity) GetVirtualSpaceID() uint
- func (n *Entity) MarshalBinary() ([]byte, error)
- func (n *Entity) UnmarshalBinary(data []byte) error
- type InMemoryModelCache
- func (i *InMemoryModelCache) BuildCacheIfNotExist() error
- func (i *InMemoryModelCache) DelEnvironment(pid uint, eid uint, cluster string, namespace string) error
- func (i *InMemoryModelCache) DelProject(tid uint, pid uint) error
- func (i *InMemoryModelCache) DelTenant(tid uint) error
- func (i *InMemoryModelCache) DelVirtualSpace(vid uint) error
- func (i *InMemoryModelCache) FindEnvironment(cluster string, namespace string) CommonResourceIface
- func (i *InMemoryModelCache) FindParents(kind string, id uint) []CommonResourceIface
- func (i *InMemoryModelCache) FindResource(kind string, id uint) CommonResourceIface
- func (c *InMemoryModelCache) FlushUserAuthority(user models.CommonUserIface) *UserAuthority
- func (i *InMemoryModelCache) GetUserAuthority(user models.CommonUserIface) *UserAuthority
- func (i *InMemoryModelCache) UpsertEnvironment(pid uint, eid uint, name string, cluster string, namespace string) error
- func (i *InMemoryModelCache) UpsertProject(tid uint, pid uint, name string) error
- func (i *InMemoryModelCache) UpsertTenant(tid uint, name string) error
- func (i *InMemoryModelCache) UpsertVirtualSpace(vid uint, name string) error
- type ModelCache
- type RedisModelCache
- func (t RedisModelCache) BuildCacheIfNotExist() error
- func (t RedisModelCache) DelEnvironment(pid, eid uint, cluster, namespace string) error
- func (t RedisModelCache) DelProject(tid, pid uint) error
- func (t RedisModelCache) DelTenant(tid uint) error
- func (t RedisModelCache) DelVirtualSpace(vid uint) error
- func (c RedisModelCache) FindEnvironment(cluster, namespace string) CommonResourceIface
- func (c RedisModelCache) FindParents(kind string, id uint) []CommonResourceIface
- func (c RedisModelCache) FindResource(kind string, id uint) CommonResourceIface
- func (c RedisModelCache) FlushUserAuthority(user models.CommonUserIface) *UserAuthority
- func (c RedisModelCache) GetUserAuthority(user models.CommonUserIface) *UserAuthority
- func (t RedisModelCache) UpsertEnvironment(pid, eid uint, name, cluster, namespace string) error
- func (t RedisModelCache) UpsertProject(tid, pid uint, name string) error
- func (t RedisModelCache) UpsertTenant(tid uint, name string) error
- func (t RedisModelCache) UpsertVirtualSpace(vid uint, name string) error
- type UserAuthority
- func (auth *UserAuthority) GetResourceRole(kind string, id uint) string
- func (auth *UserAuthority) IsAnyTenantAdmin() bool
- func (auth *UserAuthority) IsEnvironmentOperator(envid uint) bool
- func (auth *UserAuthority) IsEnvironmentReader(envid uint) bool
- func (auth *UserAuthority) IsProjectAdmin(projectid uint) bool
- func (auth *UserAuthority) IsProjectDev(projectid uint) bool
- func (auth *UserAuthority) IsProjectOps(projectid uint) bool
- func (auth *UserAuthority) IsProjectTest(projectid uint) bool
- func (auth *UserAuthority) IsSystemAdmin() bool
- func (auth *UserAuthority) IsTenantAdmin(tenantid uint) bool
- func (auth *UserAuthority) IsTenantMember(tenantid uint) bool
- func (auth *UserAuthority) IsVirtualSpaceAdmin(vsid uint) bool
- func (auth *UserAuthority) IsVirtualSpaceMember(vsid uint) bool
- func (auth *UserAuthority) MarshalBinary() ([]byte, error)
- func (auth *UserAuthority) UnmarshalBinary(data []byte) error
- type UserResource
Constants ¶
View Source
const FindParentScript = `` /* 655-byte string literal not displayed */
View Source
const InMemoryModelCacheSize = 128
View Source
const (
// 全局模型结构缓存
ModelCacheKey = "_model_cache"
)
Variables ¶
View Source
var ErrCacheEntryNotFound = errors.New("cache entry not found")
Functions ¶
This section is empty.
Types ¶
type CommonResourceIface ¶
type Entity ¶
type Entity struct { Name string `json:",omitempty"` Kind string `json:",omitempty"` ID uint `json:",omitempty"` Namespace string `json:",omitempty"` Cluster string `json:",omitempty"` Owner []*Entity `json:",omitempty"` Children []string `json:",omitempty"` }
func (*Entity) GetCluster ¶
func (*Entity) GetEnvironmentID ¶
func (*Entity) GetNamespace ¶
func (*Entity) GetOwners ¶
func (n *Entity) GetOwners() []CommonResourceIface
func (*Entity) GetProjectID ¶
func (*Entity) GetTenantID ¶
func (*Entity) GetVirtualSpaceID ¶
func (*Entity) MarshalBinary ¶
func (*Entity) UnmarshalBinary ¶
type InMemoryModelCache ¶ added in v1.24.4
func NewMemoryModelCache ¶ added in v1.24.4
func NewMemoryModelCache(db *gorm.DB) *InMemoryModelCache
func (*InMemoryModelCache) BuildCacheIfNotExist ¶ added in v1.24.4
func (i *InMemoryModelCache) BuildCacheIfNotExist() error
BuildCacheIfNotExist implements ModelCache.
func (*InMemoryModelCache) DelEnvironment ¶ added in v1.24.4
func (i *InMemoryModelCache) DelEnvironment(pid uint, eid uint, cluster string, namespace string) error
DelEnvironment implements ModelCache.
func (*InMemoryModelCache) DelProject ¶ added in v1.24.4
func (i *InMemoryModelCache) DelProject(tid uint, pid uint) error
DelProject implements ModelCache.
func (*InMemoryModelCache) DelTenant ¶ added in v1.24.4
func (i *InMemoryModelCache) DelTenant(tid uint) error
DelTenant implements ModelCache.
func (*InMemoryModelCache) DelVirtualSpace ¶ added in v1.24.4
func (i *InMemoryModelCache) DelVirtualSpace(vid uint) error
DelVirtualSpace implements ModelCache.
func (*InMemoryModelCache) FindEnvironment ¶ added in v1.24.4
func (i *InMemoryModelCache) FindEnvironment(cluster string, namespace string) CommonResourceIface
FindEnvironment implements ModelCache.
func (*InMemoryModelCache) FindParents ¶ added in v1.24.4
func (i *InMemoryModelCache) FindParents(kind string, id uint) []CommonResourceIface
FindParents implements ModelCache. NOTE: find parents recursively returns all parents AND IT SELF.
func (*InMemoryModelCache) FindResource ¶ added in v1.24.4
func (i *InMemoryModelCache) FindResource(kind string, id uint) CommonResourceIface
FindResource implements ModelCache.
func (*InMemoryModelCache) FlushUserAuthority ¶ added in v1.24.4
func (c *InMemoryModelCache) FlushUserAuthority(user models.CommonUserIface) *UserAuthority
FlushUserAuthority implements ModelCache.
func (*InMemoryModelCache) GetUserAuthority ¶ added in v1.24.4
func (i *InMemoryModelCache) GetUserAuthority(user models.CommonUserIface) *UserAuthority
GetUserAuthority implements ModelCache.
func (*InMemoryModelCache) UpsertEnvironment ¶ added in v1.24.4
func (i *InMemoryModelCache) UpsertEnvironment(pid uint, eid uint, name string, cluster string, namespace string) error
UpsertEnvironment implements ModelCache.
func (*InMemoryModelCache) UpsertProject ¶ added in v1.24.4
func (i *InMemoryModelCache) UpsertProject(tid uint, pid uint, name string) error
UpsertProject implements ModelCache.
func (*InMemoryModelCache) UpsertTenant ¶ added in v1.24.4
func (i *InMemoryModelCache) UpsertTenant(tid uint, name string) error
UpsertTenant implements ModelCache.
func (*InMemoryModelCache) UpsertVirtualSpace ¶ added in v1.24.4
func (i *InMemoryModelCache) UpsertVirtualSpace(vid uint, name string) error
UpsertVirtualSpace implements ModelCache.
type ModelCache ¶
type ModelCache interface { BuildCacheIfNotExist() error UpsertTenant(tid uint, name string) error DelTenant(tid uint) error UpsertProject(tid, pid uint, name string) error DelProject(tid, pid uint) error UpsertEnvironment(pid, eid uint, name, cluster, namespace string) error DelEnvironment(pid, eid uint, cluster, namespace string) error FindEnvironment(cluster, namespace string) CommonResourceIface UpsertVirtualSpace(vid uint, name string) error DelVirtualSpace(vid uint) error GetUserAuthority(user models.CommonUserIface) *UserAuthority FlushUserAuthority(user models.CommonUserIface) *UserAuthority FindParents(kind string, id uint) []CommonResourceIface FindResource(kind string, id uint) CommonResourceIface }
nolint
func NewRedisModelCache ¶ added in v1.24.4
func NewRedisModelCache(db *gorm.DB, redis *redis.Client) ModelCache
type RedisModelCache ¶ added in v1.24.4
func (RedisModelCache) BuildCacheIfNotExist ¶ added in v1.24.4
func (t RedisModelCache) BuildCacheIfNotExist() error
func (RedisModelCache) DelEnvironment ¶ added in v1.24.4
func (t RedisModelCache) DelEnvironment(pid, eid uint, cluster, namespace string) error
func (RedisModelCache) DelProject ¶ added in v1.24.4
func (t RedisModelCache) DelProject(tid, pid uint) error
func (RedisModelCache) DelTenant ¶ added in v1.24.4
func (t RedisModelCache) DelTenant(tid uint) error
func (RedisModelCache) DelVirtualSpace ¶ added in v1.24.4
func (t RedisModelCache) DelVirtualSpace(vid uint) error
func (RedisModelCache) FindEnvironment ¶ added in v1.24.4
func (c RedisModelCache) FindEnvironment(cluster, namespace string) CommonResourceIface
func (RedisModelCache) FindParents ¶ added in v1.24.4
func (c RedisModelCache) FindParents(kind string, id uint) []CommonResourceIface
func (RedisModelCache) FindResource ¶ added in v1.24.4
func (c RedisModelCache) FindResource(kind string, id uint) CommonResourceIface
func (RedisModelCache) FlushUserAuthority ¶ added in v1.24.4
func (c RedisModelCache) FlushUserAuthority(user models.CommonUserIface) *UserAuthority
func (RedisModelCache) GetUserAuthority ¶ added in v1.24.4
func (c RedisModelCache) GetUserAuthority(user models.CommonUserIface) *UserAuthority
func (RedisModelCache) UpsertEnvironment ¶ added in v1.24.4
func (t RedisModelCache) UpsertEnvironment(pid, eid uint, name, cluster, namespace string) error
func (RedisModelCache) UpsertProject ¶ added in v1.24.4
func (t RedisModelCache) UpsertProject(tid, pid uint, name string) error
func (RedisModelCache) UpsertTenant ¶ added in v1.24.4
func (t RedisModelCache) UpsertTenant(tid uint, name string) error
func (RedisModelCache) UpsertVirtualSpace ¶ added in v1.24.4
func (t RedisModelCache) UpsertVirtualSpace(vid uint, name string) error
type UserAuthority ¶
type UserAuthority struct { SystemRole string `json:"systemRole"` Tenants []*UserResource `json:"tenant"` Projects []*UserResource `json:"projects"` Environments []*UserResource `json:"environments"` VirtualSpaces []*UserResource `json:"virtualSpaces"` }
UserAuthority 用户权限
func (*UserAuthority) GetResourceRole ¶
func (auth *UserAuthority) GetResourceRole(kind string, id uint) string
func (*UserAuthority) IsAnyTenantAdmin ¶
func (auth *UserAuthority) IsAnyTenantAdmin() bool
func (*UserAuthority) IsEnvironmentOperator ¶
func (auth *UserAuthority) IsEnvironmentOperator(envid uint) bool
func (*UserAuthority) IsEnvironmentReader ¶
func (auth *UserAuthority) IsEnvironmentReader(envid uint) bool
func (*UserAuthority) IsProjectAdmin ¶
func (auth *UserAuthority) IsProjectAdmin(projectid uint) bool
func (*UserAuthority) IsProjectDev ¶
func (auth *UserAuthority) IsProjectDev(projectid uint) bool
func (*UserAuthority) IsProjectOps ¶
func (auth *UserAuthority) IsProjectOps(projectid uint) bool
func (*UserAuthority) IsProjectTest ¶
func (auth *UserAuthority) IsProjectTest(projectid uint) bool
func (*UserAuthority) IsSystemAdmin ¶
func (auth *UserAuthority) IsSystemAdmin() bool
func (*UserAuthority) IsTenantAdmin ¶
func (auth *UserAuthority) IsTenantAdmin(tenantid uint) bool
func (*UserAuthority) IsTenantMember ¶
func (auth *UserAuthority) IsTenantMember(tenantid uint) bool
func (*UserAuthority) IsVirtualSpaceAdmin ¶
func (auth *UserAuthority) IsVirtualSpaceAdmin(vsid uint) bool
func (*UserAuthority) IsVirtualSpaceMember ¶
func (auth *UserAuthority) IsVirtualSpaceMember(vsid uint) bool
func (*UserAuthority) MarshalBinary ¶
func (auth *UserAuthority) MarshalBinary() ([]byte, error)
func (*UserAuthority) UnmarshalBinary ¶
func (auth *UserAuthority) UnmarshalBinary(data []byte) error
Click to show internal directories.
Click to hide internal directories.