base

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2023 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

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

func (c *APIController) ApiextensionsClient(cluster string) *clientset.Clientset

func (*APIController) CheckPermission

func (c *APIController) CheckPermission(perType string, perAction string)

* 检查资源权限

func (*APIController) Client

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

func (c *APIController) KubeClient(cluster string) client.ResourceHandler

func (*APIController) Manager

func (c *APIController) Manager(cluster string) *client.ClusterManager

func (*APIController) Prepare

func (c *APIController) Prepare()

func (*APIController) PreparePermission

func (c *APIController) PreparePermission(methodActionMap map[string]string, method string, permissionType string)

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

type ParamBuilderController struct {
	ResultHandlerController
}

func (*ParamBuilderController) BuildKubernetesQueryParam

func (c *ParamBuilderController) BuildKubernetesQueryParam() *common.QueryParam

func (*ParamBuilderController) BuildQueryParam

func (c *ParamBuilderController) BuildQueryParam() *common.QueryParam

func (*ParamBuilderController) GetBoolParamFromQuery

func (c *ParamBuilderController) GetBoolParamFromQuery(param string) bool

func (*ParamBuilderController) GetBoolParamFromQueryWithDefault

func (c *ParamBuilderController) GetBoolParamFromQueryWithDefault(param string, defaultValue bool) bool

func (*ParamBuilderController) GetDeleteFromQuery

func (c *ParamBuilderController) GetDeleteFromQuery() bool

func (*ParamBuilderController) GetIDFromURL

func (c *ParamBuilderController) GetIDFromURL() int64

func (*ParamBuilderController) GetIntParamFromQuery

func (c *ParamBuilderController) GetIntParamFromQuery(param string) int64

func (*ParamBuilderController) GetIntParamFromURL

func (c *ParamBuilderController) GetIntParamFromURL(param string) int64

func (*ParamBuilderController) GetIsOnlineFromQuery

func (c *ParamBuilderController) GetIsOnlineFromQuery() bool

func (*ParamBuilderController) GetLogicalFromQuery

func (c *ParamBuilderController) GetLogicalFromQuery() bool

type Result

type Result struct {
	Data interface{} `json:"data"`
}

type ResultHandlerController

type ResultHandlerController struct {
	beego.Controller
}

func (*ResultHandlerController) AbortBadRequest

func (c *ResultHandlerController) AbortBadRequest(msg string)

func (*ResultHandlerController) AbortBadRequestFormat

func (c *ResultHandlerController) AbortBadRequestFormat(paramName string)

format BadRequest with param name.

func (*ResultHandlerController) AbortForbidden

func (c *ResultHandlerController) AbortForbidden(msg string)

Abort stops controller handler and show the error data, e.g. Prepare

func (*ResultHandlerController) AbortInternalServerError

func (c *ResultHandlerController) AbortInternalServerError(msg string)

func (*ResultHandlerController) AbortUnauthorized

func (c *ResultHandlerController) AbortUnauthorized(msg string)

func (*ResultHandlerController) HandleError

func (c *ResultHandlerController) HandleError(err error) int

Handle return http code and body normally, need return

func (*ResultHandlerController) Success

func (c *ResultHandlerController) Success(data interface{})

Jump to

Keyboard shortcuts

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