Documentation ¶
Index ¶
- Constants
- Variables
- type APIController
- func (c *APIController) AbortBadRequest(msg string)
- func (c *APIController) AbortForbidden(msg string)
- func (c *APIController) AbortInternalServerError(msg string)
- func (c *APIController) AbortUnauthorized(msg string)
- func (c *APIController) CheckPermission(perType string, perAction string)
- func (c *APIController) Client(cluster string) *kubernetes.Clientset
- func (c *APIController) HandleError(err error)
- func (c *APIController) KubeClient(cluster string) client.ResourceHandler
- func (c *APIController) Manager(cluster string) *client.ClusterManager
- func (c *APIController) Prepare()
- func (c *APIController) Success(data interface{})
- type APIKeyController
- type ErrorSubCode
- type LoggedInController
- type ParamBuilderController
- func (c *ParamBuilderController) BuildKubernetesQueryParam() *common.QueryParam
- func (c *ParamBuilderController) BuildQueryParam() *common.QueryParam
- func (c *ParamBuilderController) GetBoolParamFromQuery(param string) bool
- func (c *ParamBuilderController) GetBoolParamFromQueryWithDefault(param string, defaultValue bool) bool
- func (c *ParamBuilderController) GetDeleteFromQuery() bool
- func (c *ParamBuilderController) GetIDFromURL() int64
- func (c *ParamBuilderController) GetIntParamFromQuery(param string) int64
- func (c *ParamBuilderController) GetIntParamFromURL(param string) int64
- func (c *ParamBuilderController) GetIsOnlineFromQuery() bool
- func (c *ParamBuilderController) GetLogicalFromQuery() bool
- type Result
- type ResultHandlerController
- func (c *ResultHandlerController) AbortBadRequest(msg string)
- func (c *ResultHandlerController) AbortBadRequestFormat(paramName string)
- func (c *ResultHandlerController) AbortForbidden(msg string)
- func (c *ResultHandlerController) AbortInternalServerError(msg string)
- func (c *ResultHandlerController) AbortUnauthorized(msg string)
- func (c *ResultHandlerController) HandleError(err error) int
- func (c *ResultHandlerController) Success(data interface{})
Constants ¶
View Source
const (
ErrorSubCodeInsufficientResource = 403001
)
Variables ¶
View Source
var (
PublishRequestMessageMethodFilter = []string{
"POST",
"PUT",
"DELETE",
"PATCH",
}
)
Functions ¶
This section is empty.
Types ¶
type APIController ¶
type APIController struct { LoggedInController NamespaceId int64 AppId int64 }
func (*APIController) AbortBadRequest ¶
func (c *APIController) AbortBadRequest(msg string)
func (*APIController) AbortForbidden ¶
func (c *APIController) AbortForbidden(msg string)
Abort stops controller handler and show the error data, e.g. Prepare
func (*APIController) AbortInternalServerError ¶
func (c *APIController) AbortInternalServerError(msg string)
func (*APIController) AbortUnauthorized ¶
func (c *APIController) AbortUnauthorized(msg string)
func (*APIController) CheckPermission ¶
func (c *APIController) CheckPermission(perType string, perAction string)
* 检查资源权限
func (*APIController) Client ¶ added in v1.3.0
func (c *APIController) Client(cluster string) *kubernetes.Clientset
func (*APIController) HandleError ¶
func (c *APIController) HandleError(err error)
Handle return http code and body normally, need return
func (*APIController) KubeClient ¶ added in v1.3.0
func (c *APIController) KubeClient(cluster string) client.ResourceHandler
func (*APIController) Manager ¶ added in v1.3.0
func (c *APIController) Manager(cluster string) *client.ClusterManager
func (*APIController) Prepare ¶
func (c *APIController) Prepare()
func (*APIController) Success ¶
func (c *APIController) Success(data interface{})
type APIKeyController ¶
type APIKeyController struct { beego.Controller APIKey *models.APIKey Action string Success response.Success Failure response.Failure }
func (*APIKeyController) AddError ¶
func (c *APIKeyController) AddError(err string)
func (*APIKeyController) AddErrorAndResponse ¶
func (c *APIKeyController) AddErrorAndResponse(err string, code int)
func (*APIKeyController) HandleByCode ¶
func (c *APIKeyController) HandleByCode(code int)
func (*APIKeyController) HandleResponse ¶
func (c *APIKeyController) HandleResponse(data interface{})
用于负责 get 数据的接口,当 error 列表不为空的时候,返回 error 列表 当 参数为 nil 的时候,返回 "200"
func (*APIKeyController) Prepare ¶
func (c *APIKeyController) Prepare()
*
- 通过 apikey 参数判断调用权限
- apikey 类型:全局apikey(管理员可用)、命名空间级别的 apikey 和项目级别的 apikey(app 内部可用) *
type ErrorSubCode ¶
type ErrorSubCode int
type LoggedInController ¶
type LoggedInController struct { ParamBuilderController User *models.User }
func (*LoggedInController) Prepare ¶
func (c *LoggedInController) Prepare()
type ParamBuilderController ¶ added in v1.1.0
type ParamBuilderController struct {
ResultHandlerController
}
func (*ParamBuilderController) BuildKubernetesQueryParam ¶ added in v1.4.0
func (c *ParamBuilderController) BuildKubernetesQueryParam() *common.QueryParam
func (*ParamBuilderController) BuildQueryParam ¶ added in v1.1.0
func (c *ParamBuilderController) BuildQueryParam() *common.QueryParam
func (*ParamBuilderController) GetBoolParamFromQuery ¶ added in v1.1.0
func (c *ParamBuilderController) GetBoolParamFromQuery(param string) bool
func (*ParamBuilderController) GetBoolParamFromQueryWithDefault ¶ added in v1.1.0
func (c *ParamBuilderController) GetBoolParamFromQueryWithDefault(param string, defaultValue bool) bool
func (*ParamBuilderController) GetDeleteFromQuery ¶ added in v1.1.0
func (c *ParamBuilderController) GetDeleteFromQuery() bool
func (*ParamBuilderController) GetIDFromURL ¶ added in v1.1.0
func (c *ParamBuilderController) GetIDFromURL() int64
func (*ParamBuilderController) GetIntParamFromQuery ¶ added in v1.1.0
func (c *ParamBuilderController) GetIntParamFromQuery(param string) int64
func (*ParamBuilderController) GetIntParamFromURL ¶ added in v1.1.0
func (c *ParamBuilderController) GetIntParamFromURL(param string) int64
func (*ParamBuilderController) GetIsOnlineFromQuery ¶ added in v1.1.0
func (c *ParamBuilderController) GetIsOnlineFromQuery() bool
func (*ParamBuilderController) GetLogicalFromQuery ¶ added in v1.1.0
func (c *ParamBuilderController) GetLogicalFromQuery() bool
type ResultHandlerController ¶ added in v1.1.0
type ResultHandlerController struct {
beego.Controller
}
func (*ResultHandlerController) AbortBadRequest ¶ added in v1.1.0
func (c *ResultHandlerController) AbortBadRequest(msg string)
func (*ResultHandlerController) AbortBadRequestFormat ¶ added in v1.1.0
func (c *ResultHandlerController) AbortBadRequestFormat(paramName string)
format BadRequest with param name.
func (*ResultHandlerController) AbortForbidden ¶ added in v1.1.0
func (c *ResultHandlerController) AbortForbidden(msg string)
Abort stops controller handler and show the error data, e.g. Prepare
func (*ResultHandlerController) AbortInternalServerError ¶ added in v1.1.0
func (c *ResultHandlerController) AbortInternalServerError(msg string)
func (*ResultHandlerController) AbortUnauthorized ¶ added in v1.1.0
func (c *ResultHandlerController) AbortUnauthorized(msg string)
func (*ResultHandlerController) HandleError ¶ added in v1.1.0
func (c *ResultHandlerController) HandleError(err error) int
Handle return http code and body normally, need return
func (*ResultHandlerController) Success ¶ added in v1.1.0
func (c *ResultHandlerController) Success(data interface{})
Click to show internal directories.
Click to hide internal directories.