bcode

package
v0.0.0-...-f0d3a47 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2024 License: LGPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	//ErrApplicationNotFound -
	ErrApplicationNotFound = newByMessage(404, 11001, "application not found")
	//ErrApplicationExist -
	ErrApplicationExist = newByMessage(400, 11002, "application already exist")
	//ErrCreateNeedCorrectAppID -
	ErrCreateNeedCorrectAppID = newByMessage(404, 11003, "create service need correct application ID")
	//ErrUpdateNeedCorrectAppID -
	ErrUpdateNeedCorrectAppID = newByMessage(404, 11004, "update service need correct application ID")
	//ErrDeleteDueToBindService -
	ErrDeleteDueToBindService = newByMessage(400, 11005, "the application cannot be deleted because there are bound services")
	// ErrK8sServiceNameExists -
	ErrK8sServiceNameExists = newByMessage(400, 11006, "kubernetes service name already exists")
	// ErrInvalidHelmAppValues -
	ErrInvalidHelmAppValues = newByMessage(400, 11007, "invalid helm app values")
	// ErrInvalidGovernanceMode -
	ErrInvalidGovernanceMode = newByMessage(400, 11008, "invalid governance mode")
	// ErrControlPlaneNotInstall -
	ErrControlPlaneNotInstall = newByMessage(400, 11009, "control plane not install")
	// ErrInvaildK8sApp -
	ErrInvaildK8sApp = newByMessage(400, 11010, "invalid k8s app name")
	// ErrK8sAppExists -
	ErrK8sAppExists = newByMessage(400, 11011, "k8s app name exists")
)

tenant application 11000~11099

View Source
var (
	//ErrApplicationConfigGroupExist -
	ErrApplicationConfigGroupExist = newByMessage(400, 11101, "application config group already exist")
	//ErrConfigGroupServiceExist -
	ErrConfigGroupServiceExist = newByMessage(400, 11102, "config group under this service already exists")
	//ErrConfigItemExist -
	ErrConfigItemExist = newByMessage(400, 11103, "config item under this config group already exist")
	//ErrServiceNotFound -
	ErrServiceNotFound = newByMessage(404, 11104, "this service ID cannot be found under this application")
)

app config group 11100~11199

View Source
var (
	// OK means everything si good.
	OK = new(200, 200)
	// StatusFound means the requested resource resides temporarily under a different URI.
	StatusFound = new(302, 302)
	// BadRequest means the request could not be understood by the server due to malformed syntax.
	// The client SHOULD NOT repeat the request without modifications.
	BadRequest = new(400, 400)
	// NotFound means the server has not found anything matching the request.
	NotFound = new(404, 404)
	// ServerErr means  the server encountered an unexpected condition which prevented it from fulfilling the request.
	ServerErr = new(500, 500)

	// TokenInvalid -
	TokenInvalid = new(400, 401)
)
View Source
var (
	ErrIngressHTTPRuleNotFound = newByMessage(404, 11200, "http rule not found")
	ErrIngressTCPRuleNotFound  = newByMessage(404, 11201, "tcp rule not found")
)

ingress: 11200~11299

View Source
var (
	//ErrPortNotFound -
	ErrPortNotFound = newByMessage(404, 10001, "service port not found")
	//ErrServiceMonitorNotFound -
	ErrServiceMonitorNotFound = newByMessage(404, 10101, "service monitor not found")
	//ErrServiceMonitorNameExist -
	ErrServiceMonitorNameExist = newByMessage(400, 10102, "service monitor name is exist")
	// ErrSyncOperation -
	ErrSyncOperation = newByMessage(409, 10103, "The asynchronous operation is executing")
	// ErrHorizontalDueToNoChange
	ErrHorizontalDueToNoChange = newByMessage(400, 10104, "The number of components has not changed, no need to scale")
	ErrPodNotFound             = newByMessage(404, 10105, "pod not found")
	ErrK8sComponentNameExists  = newByMessage(400, 10106, "k8s component name exists")
)

service: 10000~10099

View Source
var (
	ErrNamespaceExists = newByMessage(400, 11300, "tenant namespace exists")
)

tenant 11300~11399

Functions

This section is empty.

Types

type Code

type Code struct {
	Status  int    `json:"status"`
	Code    int    `json:"code"`
	Message string `json:"msg"`
}

Code business a bussiness Code

func (*Code) Equal

func (c *Code) Equal(err error) bool

Equal -

func (*Code) Error

func (c *Code) Error() string

func (*Code) GetCode

func (c *Code) GetCode() int

GetCode returns the business Code

func (*Code) GetStatus

func (c *Code) GetStatus() int

GetStatus returns the Status Code

type Coder

type Coder interface {
	// Status Code
	GetStatus() int
	// business Code
	GetCode() int
	Error() string
	Equal(err error) bool
}

Coder has ability to get Code, msg or detail from error.

func Err2Coder

func Err2Coder(err error) Coder

Err2Coder converts the given err to Coder.

func NewBadRequest

func NewBadRequest(msg string) Coder

NewBadRequest -

func Str2Coder

func Str2Coder(str string) Coder

Str2Coder converts the given str to Coder.

Jump to

Keyboard shortcuts

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