namespace

package
v1.13.5 Latest Latest
Warning

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

Go to latest
Published: Dec 31, 2022 License: Apache-2.0, BSD-2-Clause, BSD-3-Clause, + 3 more Imports: 16 Imported by: 9

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Initialize

func Initialize(ctx context.Context, nsOpt *Config, storage store.Store, cacheMgn *cache.CacheManager) error

Initialize 初始化

Types

type Config

type Config struct {
	AutoCreate bool `yaml:"autoCreate"`
}

type NamespaceOperateServer

type NamespaceOperateServer interface {
	// CreateNamespace Create a single name space
	CreateNamespace(ctx context.Context, req *api.Namespace) *api.Response
	// CreateNamespaces Batch creation namespace
	CreateNamespaces(ctx context.Context, req []*api.Namespace) *api.BatchWriteResponse
	// DeleteNamespace Delete a single namespace
	DeleteNamespace(ctx context.Context, req *api.Namespace) *api.Response
	// DeleteNamespaces Batch delete namespace
	DeleteNamespaces(ctx context.Context, req []*api.Namespace) *api.BatchWriteResponse
	// UpdateNamespaces Batch update naming space
	UpdateNamespaces(ctx context.Context, req []*api.Namespace) *api.BatchWriteResponse
	// UpdateNamespaceToken Update token with namespace
	UpdateNamespaceToken(ctx context.Context, req *api.Namespace) *api.Response
	// GetNamespaces Get a list of namespaces
	GetNamespaces(ctx context.Context, query map[string][]string) *api.BatchQueryResponse
	// GetNamespaceToken Get the token with namespace
	GetNamespaceToken(ctx context.Context, req *api.Namespace) *api.Response
	// CreateNamespaceIfAbsent Create a single name space
	CreateNamespaceIfAbsent(ctx context.Context, req *api.Namespace) error
}

NamespaceOperateServer Namespace related operation

func GetServer

func GetServer() (NamespaceOperateServer, error)

GetServer 获取已经初始化好的Server

func TestInitialize

func TestInitialize(_ context.Context, nsOpt *Config, storage store.Store, cacheMgn *cache.CacheManager,
	authSvr auth.AuthServer) (NamespaceOperateServer, error)

type ResourceEvent

type ResourceEvent struct {
	ReqNamespace *api.Namespace
	Namespace    *model.Namespace
	IsRemove     bool
}

ResourceEvent 资源事件

type ResourceHook

type ResourceHook interface {

	// Before
	//  @param ctx
	//  @param resourceType
	Before(ctx context.Context, resourceType model.Resource)

	// After
	//  @param ctx
	//  @param resourceType
	//  @param res
	After(ctx context.Context, resourceType model.Resource, res *ResourceEvent) error
}

ResourceHook The listener is placed before and after the resource operation, only normal flow

type Server

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

func GetOriginServer

func GetOriginServer() (*Server, error)

GetOriginServer 获取已经初始化好的Server

func (*Server) CreateNamespace

func (s *Server) CreateNamespace(ctx context.Context, req *api.Namespace) *api.Response

CreateNamespace 创建单个命名空间

func (*Server) CreateNamespaceIfAbsent

func (s *Server) CreateNamespaceIfAbsent(ctx context.Context, req *api.Namespace) error

CreateNamespaceIfAbsent 创建命名空间,如果不存在

func (*Server) CreateNamespaces

func (s *Server) CreateNamespaces(ctx context.Context, req []*api.Namespace) *api.BatchWriteResponse

CreateNamespaces 批量创建命名空间

func (*Server) DeleteNamespace

func (s *Server) DeleteNamespace(ctx context.Context, req *api.Namespace) *api.Response

DeleteNamespace 删除单个命名空间

func (*Server) DeleteNamespaces

func (s *Server) DeleteNamespaces(ctx context.Context, req []*api.Namespace) *api.BatchWriteResponse

DeleteNamespaces 批量删除命名空间

func (*Server) GetNamespaceToken

func (s *Server) GetNamespaceToken(ctx context.Context, req *api.Namespace) *api.Response

GetNamespaceToken 获取命名空间的token

func (*Server) GetNamespaces

func (s *Server) GetNamespaces(ctx context.Context, query map[string][]string) *api.BatchQueryResponse

GetNamespaces 查询命名空间

func (*Server) RecordHistory

func (s *Server) RecordHistory(entry *model.RecordEntry)

RecordHistory server对外提供history插件的简单封装

func (*Server) SetResourceHooks

func (s *Server) SetResourceHooks(hooks ...ResourceHook)

SetResourceHooks 返回Cache

func (*Server) UpdateNamespace

func (s *Server) UpdateNamespace(ctx context.Context, req *api.Namespace) *api.Response

UpdateNamespace 修改单个命名空间

func (*Server) UpdateNamespaceToken

func (s *Server) UpdateNamespaceToken(ctx context.Context, req *api.Namespace) *api.Response

UpdateNamespaceToken 更新命名空间token

func (*Server) UpdateNamespaces

func (s *Server) UpdateNamespaces(ctx context.Context, req []*api.Namespace) *api.BatchWriteResponse

UpdateNamespaces 批量修改命名空间

Jump to

Keyboard shortcuts

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