projecthandler

package
v1.23.0-alpha.0 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2022 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	SearchFields           = []string{"ProjectName"}
	FilterFields           = []string{"project_name", "TenantID"}
	PreloadFields          = []string{"Applications", "Environments", "Registries", "Users", "Tenant"}
	OrderFields            = []string{"project_name", "ID"}
	PreloadSensitiveFields = map[string]string{"Cluster": "id, cluster_name"}
	ModelName              = "Project"
	PrimaryKeyName         = "project_id"
)

Functions

func GetNodeTotal

func GetNodeTotal(nodes *[]v1.Node, tquotalist *[]gemsv1beta1.TenantResourceQuota, nodeMetrics *[]v1beta1.NodeMetrics) map[string]interface{}

Types

type ClusterAggregateData

type ClusterAggregateData struct {
	ClusterName   string
	ClusterID     uint
	NetworkPolicy interface{}
	Environments  []EnvironmentAggregateData
}

type EnvironmentAggregateData

type EnvironmentAggregateData struct {
	Env           models.Environment
	ResourceQuota interface{}
}

type ProjectHandler

type ProjectHandler struct {
	base.BaseHandler
}

func (*ProjectHandler) DeleteProject

func (h *ProjectHandler) DeleteProject(c *gin.Context)

DeleteProject 删除 Project @Tags Project @Summary 删除 Project @Description 删除 Project @Accept json @Produce json @Param project_id path uint true "project_id" @Success 204 {object} handlers.ResponseStruct "resp" @Router /v1/project/{project_id} [delete] @Security JWT

func (*ProjectHandler) DeleteProjectUser

func (h *ProjectHandler) DeleteProjectUser(c *gin.Context)

DeleteProjectUser 删除 User 和 Project 的关系 @Tags Project @Summary 删除 User 和 Project 的关系 @Description 删除 User 和 Project 的关系 @Accept json @Produce json @Param project_id path uint true "project_id" @Param user_id path uint true "user_id" @Success 200 {object} handlers.ResponseStruct{Data=models.User} "models.User" @Router /v1/project/{project_id}/user/{user_id} [delete] @Security JWT

func (*ProjectHandler) EnvironmentStatistics

func (h *ProjectHandler) EnvironmentStatistics(c *gin.Context)

EnvironmentStatistics 项目环境资源统计 @Tags Project @Summary 项目环境资源统计 @Description 项目环境资源统计 @Accept json @Produce json @Param project_id path int true "project_id" @Param environment_id path int true "environment_id" @Success 200 {object} handlers.ResponseStruct{Data=object} "statistics" @Router /v1/project/{project_id}/environment/{environment_id}/statistics [get] @Security JWT

func (*ProjectHandler) GetEnvironmentResourceQuota

func (h *ProjectHandler) GetEnvironmentResourceQuota(c *gin.Context)

GetEnvironmentResourceQuota 单个环境下的资源统计[quota] @Tags Project @Summary 单个环境下的资源统计[quota] @Description 单个环境下的资源统计[quota] @Accept json @Produce json @Param project_id path int true "project_id" @Param environment_id path int true "environment_id" @Success 200 {object} handlers.ResponseStruct{Data=object} "quota" @Router /v1/project/{project_id}/environment/{environment_id}/quota [get] @Security JWT

func (*ProjectHandler) GetEnvironmentResourceQuotas

func (h *ProjectHandler) GetEnvironmentResourceQuotas(c *gin.Context)

GetEnvironmentResourceQuotas 获取项目下的环境资源统计列表[quota] @Tags Project @Summary 获取项目下的环境资源统计列表[quota] @Description 获取项目下的环境资源统计列表[quota] @Accept json @Produce json @Param project_id path int true "project_id" @Success 200 {object} handlers.ResponseStruct{Data=object} "quota" @Router /v1/project/{project_id}/environment/_/quotas [get] @Security JWT

func (*ProjectHandler) GetProjectListResourceQuotas

func (h *ProjectHandler) GetProjectListResourceQuotas(c *gin.Context)

GetProjectListResourceQuotas 获取项目资源统计列表[quota] @Tags Project @Summary 获取项目资源统计列表[quota] @Description 获取项目资源统计列表[quota] @Accept json @Produce json @Param TenantID query string false "TenantID" @Param page query int false "page" @Param size query int false "page" @Success 200 {object} handlers.ResponseStruct{Data=handlers.PageData{List=[]object}} "quotas" @Router /v1/project/_/quotas [get] @Security JWT

func (*ProjectHandler) GetProjectResource

func (h *ProjectHandler) GetProjectResource(c *gin.Context)

GetProjectResource 获取项目资源清单 @Tags ResourceList @Summary 获取项目资源清单 @Description 获取项目资源清单 @Accept json @Produce json @Param project_id path uint true "project_id" @Param date query string false "date" @Success 200 {object} handlers.ResponseStruct{Data=[]models.EnvironmentResource} "EnvironmentResource" @Router /v1/resources/project/{project_id} [get] @Security JWT

func (*ProjectHandler) GetProjectResourceQuota

func (h *ProjectHandler) GetProjectResourceQuota(c *gin.Context)

GetProjectResourceQuota 获取单个项目资源统计[quota] @Tags Project @Summary 获取单个项目资源统计[quota] @Description 获取单个项目资源统计[quota] @Accept json @Produce json @Param project_id path int true "project_id" @Success 200 {object} handlers.ResponseStruct{Data=object} "quota" @Router /v1/project/{project_id}/quota [get] @Security JWT

func (*ProjectHandler) ListProject

func (h *ProjectHandler) ListProject(c *gin.Context)

ListProject 列表 Project @Tags Project @Summary Project列表 @Description Project列表 @Accept json @Produce json @Param ProjectName query string false "ProjectName" @Param TenantID query string false "TenantID" @Param preload query string false "choices Applications,Environments,Registries,Users,Tenant" @Param page query int false "page" @Param size query int false "page" @Param search query string false "search in (ProjectName)" @Success 200 {object} handlers.ResponseStruct{Data=handlers.PageData{List=[]models.Project}} "Project" @Router /v1/project [get] @Security JWT

func (*ProjectHandler) ListProjectEnvironment

func (h *ProjectHandler) ListProjectEnvironment(c *gin.Context)

ListProjectEnvironment 获取属于Project的 Environment 列表 @Tags Project @Summary 获取属于 Project 的 Environment 列表 @Description 获取属于 Project 的 Environment 列表 @Accept json @Produce json @Param project_id path uint true "project_id" @Param preload query string false "choices Creator,Cluster,Project,Applications,Users" @Param page query int false "page" @Param size query int false "page" @Param search query string false "search in (EnvironmentName)" @Param containNSLabels query bool false "是否包含命名空间标签" @Success 200 {object} handlers.ResponseStruct{Data=handlers.PageData{List=[]models.Environment}} "models.Environment" @Router /v1/project/{project_id}/environment [get] @Security JWT

func (*ProjectHandler) ListProjectUser

func (h *ProjectHandler) ListProjectUser(c *gin.Context)

ListProjectUser 获取属于Project的 User 列表 @Tags Project @Summary 获取属于 Project 的 User 列表 @Description 获取属于 Project 的 User 列表 @Accept json @Produce json @Param project_id path uint true "project_id" @Param preload query string false "choices Tenants,SystemRole" @Param page query int false "page" @Param size query int false "page" @Param search query string false "search in (Username,Email)" @Success 200 {object} handlers.ResponseStruct{Data=handlers.PageData{List=[]models.User}} "models.User" @Router /v1/project/{project_id}/user [get] @Security JWT

func (*ProjectHandler) PostProjectEnvironment

func (h *ProjectHandler) PostProjectEnvironment(c *gin.Context)

PostProjectEnvironment 创建一个属于 Project 的Environment @Tags Project @Summary 创建一个属于 Project 的Environment @Description 创建一个属于 Project 的Environment @Accept json @Produce json @Param project_id path uint true "project_id" @Param param body models.Environment true "表单" @Success 200 {object} handlers.ResponseStruct{Data=models.Environment} "models.Environment" @Router /v1/project/{project_id}/environment [post] @Security JWT

func (*ProjectHandler) PostProjectUser

func (h *ProjectHandler) PostProjectUser(c *gin.Context)

PostProjectUser 在User和Project间添加关联关系 @Tags Project @Summary 在User和Project间添加关联关系 @Description 在User和Project间添加关联关系 @Accept json @Produce json @Param project_id path uint true "project_id" @Param param body models.ProjectUserRels true "表单"` @Success 200 {object} handlers.ResponseStruct{Data=models.ProjectUserRels} "models.User" @Router /v1/project/{project_id}/user [post] @Security JWT

func (*ProjectHandler) ProjectEnvironments

func (h *ProjectHandler) ProjectEnvironments(c *gin.Context)

ProjectEnvironments 获取项目下环境列表,按照集群聚合,同时获取集群的下的租户网络策略 @Tags Project @Summary 获取项目下环境列表,按照集群聚合,同时获取集群的下的租户网络策略 @Description 获取项目下环境列表,按照集群聚合,同时获取集群的下的租户网络策略 @Accept json @Produce json @Param project_id path int true "project_id" @Success 200 {object} handlers.ResponseStruct{Data=object} "object" @Router /v1/project/{project_id}/agg_environment [get] @Security JWT

func (*ProjectHandler) ProjectNoneResourceStatistics

func (h *ProjectHandler) ProjectNoneResourceStatistics(c *gin.Context)

ProjectNoneResourceStatistics 项目非资源类型数据统计 @Tags Project @Summary 项目非资源类型数据统计 @Description 项目非资源类型数据统计 @Accept json @Produce json @Param project_id path int true "project_id" @Success 200 {object} handlers.ResponseStruct{Data=object} "statistics" @Router /v1/project/{project_id}/none_resource_statistics [get] @Security JWT

func (*ProjectHandler) ProjectStatistics

func (h *ProjectHandler) ProjectStatistics(c *gin.Context)

ProjectStatistics 项目资源统计 @Tags Project @Summary 项目资源统计 @Description 项目资源统计 @Accept json @Produce json @Param project_id path int true "project_id" @Param aggregate query string false "是否聚合(yes,no;default no)" @Success 200 {object} handlers.ResponseStruct{Data=object} "statistics" @Router /v1/project/{project_id}/statistics [get] @Security JWT

func (*ProjectHandler) ProjectSwitch

func (h *ProjectHandler) ProjectSwitch(c *gin.Context)

@Tags NetworkIsolated @Summary 项目网络隔离开关 @Description 项目网络隔离开关 @Accept json @Produce json @Param project_id path uint true "project_id" @Param param body handlers.ClusterIsolatedSwitch true "表单 " @Success 200 {object} handlers.ResponseStruct{Data=handlers.IsolatedSwitch} "object" @Router /v1/project/{project_id}/action/networkisolate [post] @Security JWT

func (*ProjectHandler) PutProject

func (h *ProjectHandler) PutProject(c *gin.Context)

PutProject 修改Project @Tags Project @Summary 修改Project @Description 修改Project @Accept json @Produce json @Param project_id path uint true "project_id" @Param param body models.Project true "表单" @Success 200 {object} handlers.ResponseStruct{Data=models.Project} "Project" @Router /v1/project/{project_id} [put] @Security JWT

func (*ProjectHandler) PutProjectUser

func (h *ProjectHandler) PutProjectUser(c *gin.Context)

PutProjectUser 修改 User 和 Project 的关联关系 @Tags Project @Summary 修改 User 和 Project 的关联关系 @Description 修改 User 和 Project 的关联关系 @Accept json @Produce json @Param project_id path uint true "project_id" @Param user_id path uint true "user_id" @Param param body models.ProjectUserRels true "表单"` @Success 200 {object} handlers.ResponseStruct{Data=models.ProjectUserRels} "models.User" @Router /v1/project/{project_id}/user/{user_id} [put] @Security JWT

func (*ProjectHandler) RegistRouter

func (h *ProjectHandler) RegistRouter(rg *gin.RouterGroup)

func (*ProjectHandler) RetrieveProject

func (h *ProjectHandler) RetrieveProject(c *gin.Context)

RetrieveProject Project详情 @Tags Project @Summary Project详情 @Description get Project详情 @Accept json @Produce json @Param project_id path uint true "project_id" @Success 200 {object} handlers.ResponseStruct{Data=models.Project} "Project" @Router /v1/project/{project_id} [get] @Security JWT

func (*ProjectHandler) RetrieveProjectEnvironment

func (h *ProjectHandler) RetrieveProjectEnvironment(c *gin.Context)

RetrieveProjectEnvironment 获取Project 的一个 Environment详情 @Tags Project @Summary 获取Project 的一个 Environment详情 @Description 获取Project 的一个 Environment详情 @Accept json @Produce json @Param project_id path uint true "project_id" @Param environment_id path uint true "environment_id" @Success 200 {object} handlers.ResponseStruct{Data=models.Environment} "models.Environment" @Router /v1/project/{project_id}/environment/{environment_id} [get] @Security JWT

func (*ProjectHandler) RetrieveProjectUser

func (h *ProjectHandler) RetrieveProjectUser(c *gin.Context)

RetrieveProjectUser 获取Project 的一个 User详情 @Tags Project @Summary 获取Project 的一个 User详情 @Description 获取Project 的一个 User详情 @Accept json @Produce json @Param project_id path uint true "project_id" @Param user_id path uint true "user_id" @Success 200 {object} handlers.ResponseStruct{Data=models.User} "models.User" @Router /v1/project/{project_id}/user/{user_id} [get] @Security JWT

func (*ProjectHandler) TenantProjectListResourceQuotas

func (h *ProjectHandler) TenantProjectListResourceQuotas(c *gin.Context)

TenantProjectListResourceQuotas 租户下所有项目的资源统计列表[quota] @Tags Tenant @Summary 租户下所有项目的资源统计列表[quota] @Description 租户下所有项目的资源统计列表[quota] @Accept json @Produce json @Param tenant_id path uint true "tenant_id" @Success 200 {object} handlers.ResponseStruct{Data=[]object} "quotas" @Router /v1/tenant/{tenant_id}/projectquotas [get] @Security JWT

type Res

type Res map[v1.ResourceName]int64

func NewEmptyResoureList

func NewEmptyResoureList() Res

func (*Res) AsResourceList

func (r *Res) AsResourceList() v1.ResourceList

func (*Res) Total

func (r *Res) Total(rtype string, rqs ...*v1.ResourceQuota)

type ResourceCount

type ResourceCount struct {
	Total v1.ResourceList
	Used  v1.ResourceList
}

func GetResourceCount

func GetResourceCount(rqs ...*v1.ResourceQuota) *ResourceCount

Jump to

Keyboard shortcuts

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