project

package
v1.3.0-rc.0...-8297314 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2024 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Overview

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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RunningPodCond

func RunningPodCond(projectID uint64) map[string]interface{}

Types

type Option

type Option func(*Project)

Option 定义 Project 对象的配置选项

func WithBundle

func WithBundle(bdl *bundle.Bundle) Option

WithBundle 配置 bundle

func WithDBClient

func WithDBClient(db *dao.DBClient) Option

WithDBClient 配置 db client

func WithI18n

func WithI18n(trans i18n.Translator) Option

WithI18n set the translator

func WithUCClient

func WithUCClient(uc userpb.UserServiceServer) 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) BatchConvertProjectDTO

func (p *Project) BatchConvertProjectDTO(joined map[int64]bool, projects []model.Project) []apistructs.ProjectDTO

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) 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

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

func (*Project) GetMyProjectIDList

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

func (*Project) GetNamespacesBelongsTo

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

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

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

func (*Project) ListUnblockAppCountsByProjectIDS

func (p *Project) ListUnblockAppCountsByProjectIDS(projectIDS []uint64) ([]model.ProjectUnblockAppCount, error)

func (*Project) ReferCluster

func (p *Project) ReferCluster(clusterName string, orgID uint64) 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) 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