Documentation
¶
Overview ¶
Package project 封装项目资源相关操作
Index ¶
- type Cache
- type CacheItme
- type Option
- type Project
- func (p *Project) Create(userID string, createReq *apistructs.ProjectCreateRequest) (*model.Project, error)
- func (p *Project) CreateWithEvent(userID string, createReq *apistructs.ProjectCreateRequest) (int64, error)
- func (p *Project) Delete(projectID int64) (*model.Project, error)
- func (p *Project) DeleteWithEvent(projectID int64) error
- func (p *Project) FillQuota(orgResources map[uint64]apistructs.OrgResourceInfo) error
- func (p *Project) Get(ctx context.Context, projectID int64, withQuota bool) (*apistructs.ProjectDTO, error)
- func (p *Project) GetAllProjects() ([]apistructs.ProjectDTO, error)
- func (p *Project) GetModelProject(projectID int64) (*model.Project, error)
- func (p *Project) GetModelProjectsMap(projectIDs []uint64) (map[int64]*model.Project, error)
- func (p *Project) GetMyProjectIDList(parentID int64, userID string) ([]uint64, error)
- func (p *Project) GetNamespacesBelongsTo(ctx context.Context, orgID uint64, clusterNames []string) (*apistructs.GetProjectsNamesapcesResponseData, error)
- func (p *Project) GetProjectIDListByStates(req apistructs.IssuePagingRequest, projectIDList []uint64) (int, []apistructs.ProjectDTO, error)
- func (p *Project) GetProjectNSInfo(projectID int64) (*apistructs.ProjectNameSpaceInfo, error)
- func (p *Project) GetProjectStats(projectID int64) (*apistructs.ProjectStats, error)
- func (p *Project) GetQuotaOnClusters(orgID int64, clusterNames []string) (*apistructs.GetQuotaOnClustersResponse, error)
- func (p *Project) ListAllProjects(userID string, params *apistructs.ProjectListRequest) (*apistructs.PagingProjectDTO, error)
- func (p *Project) ListJoinedProjects(orgID int64, userID string, params *apistructs.ProjectListRequest) (*apistructs.PagingProjectDTO, error)
- func (p *Project) ListPublicProjects(userID string, params *apistructs.ProjectListRequest) (*apistructs.PagingProjectDTO, error)
- func (p *Project) ListQuotaRecords(ctx context.Context) ([]*apistructs.ProjectQuota, error)
- func (p *Project) ReferCluster(clusterName string) bool
- func (p *Project) Update(ctx context.Context, orgID, projectID int64, userID string, ...) (*model.Project, error)
- func (p *Project) UpdateCache()
- func (p *Project) UpdateProjectActiveTime(req *apistructs.ProjectActiveTimeUpdateRequest) error
- func (p *Project) UpdateProjectFunction(req *apistructs.ProjectFunctionSetRequest) (int64, error)
- func (p *Project) UpdateWithEvent(ctx context.Context, orgID, projectID int64, userID string, ...) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CacheItme ¶ added in v1.4.0
type CacheItme struct { Object interface{} // contains filtered or unexported fields }
func (*CacheItme) UpdateExpiredTime ¶ added in v1.4.0
type Option ¶
type Option func(*Project)
Option 定义 Project 对象的配置选项
func WithI18n ¶ added in v1.4.0
func WithI18n(trans i18n.Translator) Option
WithI18n set the translator
type Project ¶
type Project struct {
// contains filtered or unexported fields
}
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) DeleteWithEvent ¶
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 ¶
GetModelProject 获取项目
func (*Project) GetModelProjectsMap ¶ added in v1.2.0
func (*Project) GetMyProjectIDList ¶
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 ¶
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 更新项目 & 发送事件
Click to show internal directories.
Click to hide internal directories.