Documentation ¶
Index ¶
- Variables
- func AfterEnvironmentSave(ctx context.Context, h base.BaseHandler, tx *gorm.DB, env *models.Environment) error
- func ValidateEnvironmentNamespace(ctx context.Context, h base.BaseHandler, tx *gorm.DB, ...) error
- type EnvironmentHandler
- func (h *EnvironmentHandler) DeleteEnvironment(c *gin.Context)
- func (h *EnvironmentHandler) DeleteEnvironmentUser(c *gin.Context)
- func (h *EnvironmentHandler) EnvironmentObservabilityDetails(c *gin.Context)
- func (h *EnvironmentHandler) EnvironmentSwitch(c *gin.Context)
- func (h *EnvironmentHandler) GetEnvironmentResource(c *gin.Context)
- func (h *EnvironmentHandler) ListEnvironment(c *gin.Context)
- func (h *EnvironmentHandler) ListEnvironmentUser(c *gin.Context)
- func (h *EnvironmentHandler) PostEnvironmentUser(c *gin.Context)
- func (h *EnvironmentHandler) PutEnvironment(c *gin.Context)
- func (h *EnvironmentHandler) PutEnvironmentUser(c *gin.Context)
- func (h *EnvironmentHandler) RegistRouter(rg *gin.RouterGroup)
- func (h *EnvironmentHandler) RetrieveEnvironment(c *gin.Context)
- func (h *EnvironmentHandler) RetrieveEnvironmentUser(c *gin.Context)
- type EnvironmentObservabilityRet
Constants ¶
This section is empty.
Variables ¶
var ( SearchFields = []string{"environment_name"} FilterFields = []string{"environment_name"} PreloadFields = []string{"Creator", "Cluster", "Project", "Project.Tenant", "Applications", "Users"} PreloadSensitiveFields = map[string]string{"Cluster": "id, cluster_name"} OrderFields = []string{"environment_name"} ModelName = "Environment" PrimaryKeyName = "environment_id" )
Functions ¶
func AfterEnvironmentSave ¶
func AfterEnvironmentSave(ctx context.Context, h base.BaseHandler, tx *gorm.DB, env *models.Environment) error
环境的创建,修改,删除,都会触发hook,将状态同步到对应的集群下
func ValidateEnvironmentNamespace ¶
func ValidateEnvironmentNamespace(ctx context.Context, h base.BaseHandler, tx *gorm.DB, namespace, envname, clustername string) error
ValidateEnvironmentNamespace 校验绑定的namespace是否合法.
Types ¶
type EnvironmentHandler ¶
type EnvironmentHandler struct {
base.BaseHandler
}
func (*EnvironmentHandler) DeleteEnvironment ¶
func (h *EnvironmentHandler) DeleteEnvironment(c *gin.Context)
DeleteEnvironment 删除 Environment @Tags Environment @Summary 删除 Environment @Description 删除 Environment @Accept json @Produce json @Param environment_id path uint true "environment_id" @Success 204 {object} handlers.ResponseStruct "resp" @Router /v1/environment/{environment_id} [delete] @Security JWT
func (*EnvironmentHandler) DeleteEnvironmentUser ¶
func (h *EnvironmentHandler) DeleteEnvironmentUser(c *gin.Context)
DeleteEnvironmentUser 删除 User 和 Environment 的关系 @Tags Environment @Summary 删除 User 和 Environment 的关系 @Description 删除 User 和 Environment 的关系 @Accept json @Produce json @Param environment_id path uint true "environment_id" @Param user_id path uint true "user_id" @Success 200 {object} handlers.ResponseStruct{Data=models.User} "models.User" @Router /v1/environment/{environment_id}/user/{user_id} [delete] @Security JWT
func (*EnvironmentHandler) EnvironmentObservabilityDetails ¶
func (h *EnvironmentHandler) EnvironmentObservabilityDetails(c *gin.Context)
@Tags EnvironmentObservabilityDetails @Summary 环境可观测性概览 @Description 环境可观测性概览 @Accept json @Produce json @Param environment_id path uint true "environment_id" @Param duration query string false "过去多长时间: 30s,5m,1h,1d,1w, 默认1h" @Success 200 {object} handlers.ResponseStruct{Data=EnvironmentObservabilityRet} "object" @Router /v1/environment/{environment_id}/observability [get] @Security JWT
func (*EnvironmentHandler) EnvironmentSwitch ¶
func (h *EnvironmentHandler) EnvironmentSwitch(c *gin.Context)
@Tags NetworkIsolated @Summary 环境网络隔离开关 @Description 环境网络隔离开关 @Accept json @Produce json @Param environment_id path uint true "environment_id" @Param param body handlers.IsolatedSwitch true "表单" @Success 200 {object} handlers.ResponseStruct{Data=handlers.IsolatedSwitch} "object" @Router /v1/environment/{environment_id}/action/networkisolate [post] @Security JWT
func (*EnvironmentHandler) GetEnvironmentResource ¶
func (h *EnvironmentHandler) GetEnvironmentResource(c *gin.Context)
GetEnvironmentResource 获取环境资源清单 @Tags ResourceList @Summary 获取环境资源清单 @Description 获取环境资源清单 @Accept json @Produce json @Param environment_id path uint true "environment_id" @Param date query string false "date" @Success 200 {object} handlers.ResponseStruct{Data=[]models.EnvironmentResource} "EnvironmentResource" @Router /v1/environment/{environment_id}/resources [get] @Security JWT
func (*EnvironmentHandler) ListEnvironment ¶
func (h *EnvironmentHandler) ListEnvironment(c *gin.Context)
ListEnvironment 列表 Environment @Tags Environment @Summary Environment列表 @Description Environment列表 @Accept json @Produce json @Param EnvironmentName query string false "EnvironmentName" @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)" @Success 200 {object} handlers.ResponseStruct{Data=handlers.PageData{List=[]models.Environment}} "Environment" @Router /v1/environment [get] @Security JWT
func (*EnvironmentHandler) ListEnvironmentUser ¶
func (h *EnvironmentHandler) ListEnvironmentUser(c *gin.Context)
ListEnvironmentUser 获取属于Environment的 User 列表 @Tags Environment @Summary 获取属于 Environment 的 User 列表 @Description 获取属于 Environment 的 User 列表 @Accept json @Produce json @Param environment_id path uint true "environment_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/environment/{environment_id}/user [get] @Security JWT
func (*EnvironmentHandler) PostEnvironmentUser ¶
func (h *EnvironmentHandler) PostEnvironmentUser(c *gin.Context)
PostEnvironmentUser 在User和Environment间添加关联关系 @Tags Environment @Summary 在User和Environment间添加关联关系 @Description 在User和Environment间添加关联关系 @Accept json @Produce json @Param environment_id path uint true "environment_id" @Param param body models.EnvironmentUserRels true "表单"` @Success 200 {object} handlers.ResponseStruct{Data=models.EnvironmentUserRels} "models.User" @Router /v1/environment/{environment_id}/user [post] @Security JWT
func (*EnvironmentHandler) PutEnvironment ¶
func (h *EnvironmentHandler) PutEnvironment(c *gin.Context)
PutEnvironment 修改Environment @Tags Environment @Summary 修改Environment @Description 修改Environment @Accept json @Produce json @Param environment_id path uint true "environment_id" @Param param body models.Environment true "表单" @Success 200 {object} handlers.ResponseStruct{Data=models.Environment} "Environment" @Router /v1/environment/{environment_id} [put] @Security JWT
func (*EnvironmentHandler) PutEnvironmentUser ¶
func (h *EnvironmentHandler) PutEnvironmentUser(c *gin.Context)
PutEnvironmentUser 修改 User 和 Environment 的关联关系 @Tags Environment @Summary 修改 User 和 Environment 的关联关系 @Description 修改 User 和 Environment 的关联关系 @Accept json @Produce json @Param environment_id path uint true "environment_id" @Param user_id path uint true "user_id" @Param param body models.EnvironmentUserRels true "表单"` @Success 200 {object} handlers.ResponseStruct{Data=models.EnvironmentUserRels} "models.User" @Router /v1/environment/{environment_id}/user/{user_id} [put] @Security JWT
func (*EnvironmentHandler) RegistRouter ¶
func (h *EnvironmentHandler) RegistRouter(rg *gin.RouterGroup)
func (*EnvironmentHandler) RetrieveEnvironment ¶
func (h *EnvironmentHandler) RetrieveEnvironment(c *gin.Context)
RetrieveEnvironment Environment详情 @Tags Environment @Summary Environment详情 @Description get Environment详情 @Accept json @Produce json @Param environment_id path uint true "environment_id" @Success 200 {object} handlers.ResponseStruct{Data=models.Environment} "Environment" @Router /v1/environment/{environment_id} [get] @Security JWT
func (*EnvironmentHandler) RetrieveEnvironmentUser ¶
func (h *EnvironmentHandler) RetrieveEnvironmentUser(c *gin.Context)
RetrieveEnvironmentUser 获取Environment 的一个 User详情 @Tags Environment @Summary 获取Environment 的一个 User详情 @Description 获取Environment 的一个 User详情 @Accept json @Produce json @Param environment_id path uint true "environment_id" @Param user_id path uint true "user_id" @Success 200 {object} handlers.ResponseStruct{Data=models.User} "models.User" @Router /v1/environment/{environment_id}/user/{user_id} [get] @Security JWT
type EnvironmentObservabilityRet ¶
type EnvironmentObservabilityRet struct { EnvironmentName string `json:"environmentName"` ClusterName string `json:"clusterName"` Namespace string `json:"namespace"` Labels map[string]string `json:"labels"` Monitoring bool `json:"monitoring"` // 是否启用监控 Logging bool `json:"logging"` // 是否启日志 ServiceMesh bool `json:"serviceMesh"` // 是否启用服务网格 ContainerRestartTotal int64 `json:"containerRestartTotal"` CPU string `json:"cpu"` Memory string `json:"memory"` MonitorCollectorCount int `json:"monitorCollectorCount"` // metrics采集器数量 AlertRuleCount int `json:"alertRuleCount"` // 告警规则列表 AlertResourceMap map[string]int `json:"alertResourceMap"` // 告警规则的资源map ErrorAlertCount int `json:"errorAlertCount"` CriticalAlertCount int `json:"criticalAlertCount"` LoggingCollectorCount int `json:"loggingCollectorCount"` ErrorLogCount int `json:"errorLogCount"` LogRate string `json:"logRate"` EventCount int `json:"eventCount"` // 事件数量 Warning string `json:"warning"` }