project

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2021 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Overview

Package project 封装项目资源相关操作

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache added in v1.4.0

type Cache struct {
	sync.Map

	C chan uint64
	// contains filtered or unexported fields
}

func NewCache added in v1.4.0

func NewCache(expiredDuration time.Duration) *Cache

func (*Cache) Store added in v1.4.0

func (c *Cache) Store(key interface{}, value *CacheItme)

type CacheItme added in v1.4.0

type CacheItme struct {
	Object interface{}
	// contains filtered or unexported fields
}

func (*CacheItme) IsExpired added in v1.4.0

func (i *CacheItme) IsExpired() bool

func (*CacheItme) UpdateExpiredTime added in v1.4.0

func (i *CacheItme) UpdateExpiredTime(duration time.Duration)

type Option

type Option func(*Project)

Option 定义 Project 对象的配置选项

func WithBundle

func WithBundle(bdl *bundle.Bundle) Option

WithBundle 配置 bundle

func WithDBClient

func WithDBClient(dbClient *dao.DBClient) Option

WithDBClient 配置 db client

func WithI18n added in v1.4.0

func WithI18n(trans i18n.Translator) Option

WithI18n set the translator

func WithUCClient

func WithUCClient(ucClient *ucauth.UCClient) Option

WithUCClient 配置 uc client

type Project

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

Project 资源对象操作封装

func New

func New(opts ...Option) *Project

New 新建 Project 实例,通过 Project 实例操作企业资源

func (*Project) Create

func (p *Project) Create(userID string, createReq *apistructs.ProjectCreateRequest) (*model.Project, error)

Create 创建项目

func (*Project) CreateWithEvent

func (p *Project) CreateWithEvent(userID string, createReq *apistructs.ProjectCreateRequest) (int64, error)

CreateWithEvent 创建项目 & 发送事件

func (*Project) Delete

func (p *Project) Delete(projectID int64) (*model.Project, error)

Delete 删除项目

func (*Project) DeleteWithEvent

func (p *Project) DeleteWithEvent(projectID int64) error

DeleteWithEvent 删除项目 & 发送事件

func (*Project) FillQuota

func (p *Project) FillQuota(orgResources map[uint64]apistructs.OrgResourceInfo) error

FillQuota 根据项目资源使用情况填充项目资源配额

func (*Project) Get

func (p *Project) Get(ctx context.Context, projectID int64, withQuota bool) (*apistructs.ProjectDTO, error)

Get 获取项目

func (*Project) GetAllProjects

func (p *Project) GetAllProjects() ([]apistructs.ProjectDTO, error)

GetAllProjects list all project

func (*Project) GetModelProject

func (p *Project) GetModelProject(projectID int64) (*model.Project, error)

GetModelProject 获取项目

func (*Project) GetModelProjectsMap added in v1.2.0

func (p *Project) GetModelProjectsMap(projectIDs []uint64) (map[int64]*model.Project, error)

func (*Project) GetMyProjectIDList

func (p *Project) GetMyProjectIDList(parentID int64, userID string) ([]uint64, error)

func (*Project) GetNamespacesBelongsTo added in v1.4.0

func (p *Project) GetNamespacesBelongsTo(ctx context.Context, orgID uint64, clusterNames []string) (*apistructs.GetProjectsNamesapcesResponseData, error)

func (*Project) GetProjectIDListByStates

func (p *Project) GetProjectIDListByStates(req apistructs.IssuePagingRequest, projectIDList []uint64) (int, []apistructs.ProjectDTO, error)

func (*Project) GetProjectNSInfo

func (p *Project) GetProjectNSInfo(projectID int64) (*apistructs.ProjectNameSpaceInfo, error)

GetProjectNSInfo 获取项目级别命名空间信息

func (*Project) GetProjectStats

func (p *Project) GetProjectStats(projectID int64) (*apistructs.ProjectStats, error)

GetProjectStats 获取项目状态

func (*Project) GetQuotaOnClusters added in v1.4.0

func (p *Project) GetQuotaOnClusters(orgID int64, clusterNames []string) (*apistructs.GetQuotaOnClustersResponse, error)

func (*Project) ListAllProjects

func (p *Project) ListAllProjects(userID string, params *apistructs.ProjectListRequest) (
	*apistructs.PagingProjectDTO, error)

ListAllProjects 企业管理员可查看当前企业下所有项目,包括未加入的项目

func (*Project) ListJoinedProjects

func (p *Project) ListJoinedProjects(orgID int64, userID string, params *apistructs.ProjectListRequest) (
	*apistructs.PagingProjectDTO, error)

ListJoinedProjects 返回用户有权限的项目

func (*Project) ListPublicProjects

func (p *Project) ListPublicProjects(userID string, params *apistructs.ProjectListRequest) (
	*apistructs.PagingProjectDTO, error)

ListPublicProjects 获取公开项目列表

func (*Project) ListQuotaRecords added in v1.4.0

func (p *Project) ListQuotaRecords(ctx context.Context) ([]*apistructs.ProjectQuota, error)

func (*Project) ReferCluster

func (p *Project) ReferCluster(clusterName string) bool

ReferCluster 检查 cluster 是否被某个项目所使用

func (*Project) Update

func (p *Project) Update(ctx context.Context, orgID, projectID int64, userID string, updateReq *apistructs.ProjectUpdateBody) (*model.Project, error)

Update 更新项目

func (*Project) UpdateCache added in v1.4.0

func (p *Project) UpdateCache()

func (*Project) UpdateProjectActiveTime

func (p *Project) UpdateProjectActiveTime(req *apistructs.ProjectActiveTimeUpdateRequest) error

UpdateProjectActiveTime 更新项目活跃时间

func (*Project) UpdateProjectFunction

func (p *Project) UpdateProjectFunction(req *apistructs.ProjectFunctionSetRequest) (int64, error)

UpdateProjectFunction 更新项目的功能开关

func (*Project) UpdateWithEvent

func (p *Project) UpdateWithEvent(ctx context.Context, orgID, projectID int64, userID string, updateReq *apistructs.ProjectUpdateBody) error

UpdateWithEvent 更新项目 & 发送事件

Jump to

Keyboard shortcuts

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