namespace

package
v1.17.2 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2023 License: Apache-2.0, BSD-2-Clause, BSD-3-Clause, + 3 more Imports: 21 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 *apimodel.Namespace) *apiservice.Response
	// CreateNamespaces Batch creation namespace
	CreateNamespaces(ctx context.Context, req []*apimodel.Namespace) *apiservice.BatchWriteResponse
	// DeleteNamespace Delete a single namespace
	DeleteNamespace(ctx context.Context, req *apimodel.Namespace) *apiservice.Response
	// DeleteNamespaces Batch delete namespace
	DeleteNamespaces(ctx context.Context, req []*apimodel.Namespace) *apiservice.BatchWriteResponse
	// UpdateNamespaces Batch update naming space
	UpdateNamespaces(ctx context.Context, req []*apimodel.Namespace) *apiservice.BatchWriteResponse
	// UpdateNamespaceToken Update token with namespace
	UpdateNamespaceToken(ctx context.Context, req *apimodel.Namespace) *apiservice.Response
	// GetNamespaces Get a list of namespaces
	GetNamespaces(ctx context.Context, query map[string][]string) *apiservice.BatchQueryResponse
	// GetNamespaceToken Get the token with namespace
	GetNamespaceToken(ctx context.Context, req *apimodel.Namespace) *apiservice.Response
	// CreateNamespaceIfAbsent Create a single name space
	CreateNamespaceIfAbsent(ctx context.Context, req *apimodel.Namespace) (string, *apiservice.Response)
}

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,
	userMgn auth.UserServer, strategyMgn auth.StrategyServer) (NamespaceOperateServer, error)

type ResourceEvent

type ResourceEvent struct {
	ReqNamespace *apimodel.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 *apimodel.Namespace) *apiservice.Response

CreateNamespace 创建单个命名空间

func (*Server) CreateNamespaceIfAbsent

func (s *Server) CreateNamespaceIfAbsent(ctx context.Context,
	req *apimodel.Namespace) (string, *apiservice.Response)

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

func (*Server) CreateNamespaces

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

CreateNamespaces 批量创建命名空间

func (*Server) DeleteNamespace

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

DeleteNamespace 删除单个命名空间

func (*Server) DeleteNamespaces

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

DeleteNamespaces 批量删除命名空间

func (*Server) GetNamespaceToken

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

GetNamespaceToken 获取命名空间的token

func (*Server) GetNamespaces

func (s *Server) GetNamespaces(ctx context.Context, query map[string][]string) *apiservice.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 *apimodel.Namespace) *apiservice.Response

UpdateNamespace 修改单个命名空间

func (*Server) UpdateNamespaceToken

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

UpdateNamespaceToken 更新命名空间token

func (*Server) UpdateNamespaces

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

UpdateNamespaces 批量修改命名空间

Jump to

Keyboard shortcuts

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