bcode

package
v1.4.0-alpha.3 Latest Latest
Warning

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

Go to latest
Published: May 12, 2022 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrAddonNotExist addon registry not exist
	ErrAddonNotExist = NewBcode(404, 50001, "addon not exist")

	// ErrAddonRegistryExist addon registry already exist
	ErrAddonRegistryExist = NewBcode(400, 50002, "addon registry already exists")

	// ErrAddonRegistryInvalid addon registry is exist
	ErrAddonRegistryInvalid = NewBcode(400, 50003, "addon registry invalid")

	// ErrAddonRegistryRateLimit addon registry is rate limited by Github
	ErrAddonRegistryRateLimit = NewBcode(400, 50004, "Exceed Github rate limit")

	// ErrAddonRegistryNotExist addon registry doesn't exist
	ErrAddonRegistryNotExist = NewBcode(400, 50006, "addon registry doesn't exist")

	// ErrAddonRender fail to render addon application
	ErrAddonRender = NewBcode(500, 50010, "addon render fail")

	// ErrAddonApply fail to apply application to cluster
	ErrAddonApply = NewBcode(500, 50011, "fail to apply addon resources")

	// ErrReadGit fail to get addon application
	ErrReadGit = NewBcode(500, 50012, "fail to read git repo")

	// ErrGetAddonApplication fail to get addon application
	ErrGetAddonApplication = NewBcode(500, 50013, "fail to get addon application")

	// ErrAddonIsEnabled means addon has been enabled
	ErrAddonIsEnabled = NewBcode(500, 50014, "addon has been enabled")

	// ErrAddonSecretApply means fail to apply addon argument secret
	ErrAddonSecretApply = NewBcode(500, 50015, "fail to apply addon argument secret")

	// ErrAddonSecretGet means fail to get addon argument secret
	ErrAddonSecretGet = NewBcode(500, 50016, "fail to get addon argument secret")

	// ErrAddonDependencyNotSatisfy means addon's dependencies is not enabled
	ErrAddonDependencyNotSatisfy = NewBcode(500, 50017, "addon's dependencies is not enabled")

	// ErrAddonSystemVersionMismatch means addon's version required mismatch
	ErrAddonSystemVersionMismatch = NewBcode(400, 50018, "addon's system version requirement mismatch")

	// ErrAddonInvalidVersion means add version is invalid
	ErrAddonInvalidVersion = NewBcode(400, 50019, "")
)
View Source
var (
	// ErrUnsupportedLoginType is the error of unsupported login type
	ErrUnsupportedLoginType = NewBcode(401, 12001, "the login type is not supported")
	// ErrTokenExpired is the error of token expired
	ErrTokenExpired = NewBcode(401, 12002, "the token is expired")
	// ErrTokenNotValidYet is the error of token not valid yet
	ErrTokenNotValidYet = NewBcode(401, 12003, "the token is not valid yet")
	// ErrTokenInvalid is the error of token invalid
	ErrTokenInvalid = NewBcode(401, 12004, "the token is invalid")
	// ErrTokenMalformed is the error of token malformed
	ErrTokenMalformed = NewBcode(403, 12005, "the token is malformed")
	// ErrNotAuthorized is the error of not authorized
	ErrNotAuthorized = NewBcode(401, 12006, "the user is not authorized")
	// ErrNotAccessToken is the error of not access token
	ErrNotAccessToken = NewBcode(401, 12007, "the token is not an access token")
	// ErrInvalidLoginRequest is the error of invalid login request
	ErrInvalidLoginRequest = NewBcode(400, 12008, "the login request is invalid")
	// ErrInvalidDexConfig is the error of invalid dex config
	ErrInvalidDexConfig = NewBcode(400, 12009, "the dex config is invalid")
	// ErrRefreshTokenExpired is the error of refresh token expired
	ErrRefreshTokenExpired = NewBcode(400, 12010, "the refresh token is expired")
	// ErrNoDexConnector is the error of no dex connector
	ErrNoDexConnector = NewBcode(400, 12011, "there is no dex connector")
)
View Source
var (
	// ErrUnsupportedEmailModification is the error of unsupported email modification
	ErrUnsupportedEmailModification = NewBcode(400, 14001, "the user already has an email address and cannot modify it again")
	// ErrUserAlreadyDisabled is the error of user already disabled
	ErrUserAlreadyDisabled = NewBcode(400, 14002, "the user is already disabled")
	// ErrUserAlreadyEnabled is the error of user already enabled
	ErrUserAlreadyEnabled = NewBcode(400, 14003, "the user is already enabled")
	// ErrUserCannotModified is the error of user cannot modified
	ErrUserCannotModified = NewBcode(400, 14004, "the user cannot be modified in dex login mode")
	// ErrUserInvalidPassword is the error of user invalid password
	ErrUserInvalidPassword = NewBcode(400, 14005, "the password is invalid")
	// ErrDexConfigNotFound means the dex config is not configured
	ErrDexConfigNotFound = NewBcode(200, 14006, "the dex config is not found")
	// ErrUserInconsistentPassword is the error of user inconsistent password
	ErrUserInconsistentPassword = NewBcode(401, 14007, "the password is inconsistent with the user")
	// ErrUsernameNotExist is the error of username not exist
	ErrUsernameNotExist = NewBcode(401, 14008, "the username is not exist")
	// ErrDexNotFound is the error of dex not found
	ErrDexNotFound = NewBcode(200, 14009, "the dex is not found")
	// ErrEmptyAdminEmail is the error of empty admin email
	ErrEmptyAdminEmail = NewBcode(400, 14010, "the admin email is empty, please set the admin email before using sso login")
)
View Source
var (
	// ErrRolePermissionCheckFailure means the perm policy is invalid where create or update role
	ErrRolePermissionCheckFailure = NewBcode(400, 15001, "the permissions are invalid")
	// ErrRoleIsExist means the role is exist
	ErrRoleIsExist = NewBcode(400, 15002, "the role name is exist")
	// ErrRoleIsNotExist means the role is not exist
	ErrRoleIsNotExist = NewBcode(400, 15003, "the role is not exist")
	// ErrPermissionNotExist means the permission is not exist
	ErrPermissionNotExist = NewBcode(404, 15004, "the permission is not exist")
)
View Source
var ErrApplicationComponentExist = NewBcode(400, 10007, "application component is exist")

ErrApplicationComponentExist application component is exist

View Source
var ErrApplicationComponentNotAllowDelete = NewBcode(400, 10025, "main component in application can not be deleted")

ErrApplicationComponentNotAllowDelete means the component is main in one application, and it must be deleted before delete app.

View Source
var ErrApplicationComponentNotExist = NewBcode(404, 10008, "application component is not exist")

ErrApplicationComponentNotExist application component is not exist

View Source
var ErrApplicationConfig = NewBcode(400, 10000, "application config does not comply with OAM specification")

ErrApplicationConfig application config does not comply with OAM specification

View Source
var ErrApplicationEnvExist = NewBcode(400, 10014, "application env is exist")

ErrApplicationEnvExist application env is exist

View Source
var ErrApplicationEnvRefusedDelete = NewBcode(400, 10020, "The application envbinding cannot be deleted because it has been deployed")

ErrApplicationEnvRefusedDelete means the application env cannot be deleted because it has been deployed

View Source
var ErrApplicationExist = NewBcode(400, 10002, "application name is exist")

ErrApplicationExist application is exist

View Source
var ErrApplicationNoReadyRevision = NewBcode(400, 10017, "application not have ready revision")

ErrApplicationNoReadyRevision application not have ready revision

View Source
var ErrApplicationNotEnv = NewBcode(404, 10013, "application not set env binding")

ErrApplicationNotEnv no env binding policy

View Source
var ErrApplicationNotExist = NewBcode(404, 10012, "application name is not exist")

ErrApplicationNotExist application is not exist

View Source
var ErrApplicationPolicyExist = NewBcode(400, 10009, "application policy is exist")

ErrApplicationPolicyExist application policy is exist

View Source
var ErrApplicationPolicyNotExist = NewBcode(404, 10010, "application policy is not exist")

ErrApplicationPolicyNotExist application policy is not exist

View Source
var ErrApplicationRefusedDelete = NewBcode(400, 10019, "The application cannot be deleted because it has been deployed")

ErrApplicationRefusedDelete means the application cannot be deleted because it has been deployed

View Source
var ErrApplicationRevisionNotExist = NewBcode(404, 10018, "application revision is not exist")

ErrApplicationRevisionNotExist application revision is not exist

View Source
var ErrApplicationTriggerNotExist = NewBcode(404, 10024, "application trigger is not exist")

ErrApplicationTriggerNotExist means application trigger is not exist

View Source
var ErrBootstrapTerraformConfiguration = NewBcode(500, 40012, "failed to bootstrap terraform configuration")

ErrBootstrapTerraformConfiguration failed to bootstrap terraform configuration

View Source
var ErrChartNotExist = NewBcode(200, 13004, "this chart not exist in the repository")

ErrChartNotExist is the error of the chart not exist

View Source
var ErrCloudClusterAlreadyExists = NewBcode(400, 40009, "cloud cluster already exists")

ErrCloudClusterAlreadyExists cloud cluster already exists

View Source
var ErrClusterAlreadyExistInDataStore = NewBcode(400, 40004, "cluster already exists in data store")

ErrClusterAlreadyExistInDataStore cluster exists in datastore

View Source
var ErrClusterCreateNamespaceNoPermission = NewBcode(401, 40014, "no permission to create namespace in cluster")

ErrClusterCreateNamespaceNoPermission cluster create namespace is forbidden

View Source
var ErrClusterExistsInKubernetes = NewBcode(400, 40006, "cluster already exists in kubernetes")

ErrClusterExistsInKubernetes cluster exists in kubernetes

View Source
var ErrClusterIDNotFoundInTerraformConfiguration = NewBcode(500, 40011, "cannot find cluster_id in terraform configuration")

ErrClusterIDNotFoundInTerraformConfiguration cannot find cluster_id in terraform configuration

View Source
var ErrClusterNotFoundInDataStore = NewBcode(404, 40003, "cluster not found in data store")

ErrClusterNotFoundInDataStore cluster not found in datastore

View Source
var ErrComponentTypeNotSupport = NewBcode(400, 10001, "An unsupported component type was used.")

ErrComponentTypeNotSupport an unsupported component type was used.

View Source
var ErrCreateNamespace = NewBcode(500, 10011, "auto create namespace failure")

ErrCreateNamespace auto create namespace failure before deploy app

View Source
var ErrDefinitionNoSchema = NewBcode(400, 70002, "definition not have schema")

ErrDefinitionNoSchema definition not have schema

View Source
var ErrDefinitionNotFound = NewBcode(404, 70001, "definition is not exist")

ErrDefinitionNotFound definition is not exist

View Source
var ErrDefinitionTypeNotSupport = NewBcode(400, 70003, "definition type not support")

ErrDefinitionTypeNotSupport definition type not support

View Source
var ErrDeleteEnvButAppExist = NewBcode(400, 11005, "env can't be deleted as app existed inside")

ErrDeleteEnvButAppExist reports an error when delete an Env but still has apps inside

View Source
var ErrDeployApplyFail = NewBcode(500, 10005, "application deploy apply failure")

ErrDeployApplyFail Failed to update an application to the control cluster.

View Source
var ErrDeployConflict = NewBcode(400, 10004, "application deploy conflict")

ErrDeployConflict Occurs when a new event is triggered before the last deployment event has completed.

View Source
var ErrEnvAlreadyExists = NewBcode(400, 11001, "env name already exists")

ErrEnvAlreadyExists Env name is existed

View Source
var ErrEnvBindingExist = NewBcode(400, 90005, "application envbinding is exist")

ErrEnvBindingExist application envbinding is exist

View Source
var ErrEnvBindingNotExist = NewBcode(400, 90003, "application envbinding not exist")

ErrEnvBindingNotExist application envbinding is not exist

View Source
var ErrEnvBindingUpdateWorkflow = NewBcode(400, 90006, "application envbinding update workflow error")

ErrEnvBindingUpdateWorkflow application envbinding update workflow error

View Source
var ErrEnvBindingsNotExist = NewBcode(400, 90004, "application envbinding is not exist")

ErrEnvBindingsNotExist application envbindings is not exist

View Source
var ErrEnvNamespaceAlreadyBound = NewBcode(400, 11004, "the namespace specified already belongs to other env")

ErrEnvNamespaceAlreadyBound indicates the namespace already belongs to other env

View Source
var ErrEnvNamespaceFail = NewBcode(400, 11003, "env bind namespace failure")

ErrEnvNamespaceFail env binds namespace failure

View Source
var ErrEnvNotExisted = NewBcode(404, 11002, "env is not existed")

ErrEnvNotExisted means env is not existed

View Source
var ErrEnvTargetConflict = NewBcode(400, 11006, "in one project, one target can only belong to one env.")

ErrEnvTargetConflict in one project, one target can only belong to one env

View Source
var ErrEnvbindingDeliveryTargetNotAllExist = NewBcode(400, 90001, "application envbinding deliveryTarget is not all exist")

ErrEnvbindingDeliveryTargetNotAllExist application envbinding deliveryTarget is not exist

View Source
var ErrForbidden = NewBcode(403, 403, "403 Forbidden")

ErrForbidden check user perms failure

View Source
var ErrFoundEnvbindingDeliveryTarget = NewBcode(400, 90002, "found application envbinding deliveryTarget failure")

ErrFoundEnvbindingDeliveryTarget found application envbinding deliveryTarget failure

View Source
var ErrGetChartValues = NewBcode(200, 13003, "cannot get the values info of the chart")

ErrGetChartValues is the error of cannot get values of the chart

View Source
var ErrGetCloudClusterFailure = NewBcode(500, 40005, "get cloud cluster information failed")

ErrGetCloudClusterFailure get cloud cluster failed

View Source
var ErrInvalidAccessKeyOrSecretKey = NewBcode(400, 40013, "access key or secret key is invalid")

ErrInvalidAccessKeyOrSecretKey access key or secret key is invalid

View Source
var ErrInvalidCloudClusterProvider = NewBcode(400, 40000, "provider is not support")

ErrInvalidCloudClusterProvider provider is not support now

View Source
var ErrInvalidDefinitionUISchema = NewBcode(400, 70004, "invalid custom defnition ui schema")

ErrInvalidDefinitionUISchema invalid custom definition ui schema

View Source
var ErrInvalidProperties = NewBcode(400, 10003, "properties is invalid")

ErrInvalidProperties properties(trait or component or others) is invalid

View Source
var ErrInvalidWebhookPayloadBody = NewBcode(400, 10023, "Invalid webhook payload body")

ErrInvalidWebhookPayloadBody means the webhook payload body is invalid

View Source
var ErrInvalidWebhookPayloadType = NewBcode(400, 10022, "Invalid webhook payload type")

ErrInvalidWebhookPayloadType means the webhook payload type is invalid

View Source
var ErrInvalidWebhookToken = NewBcode(400, 10021, "Invalid webhook token")

ErrInvalidWebhookToken means the webhook token is invalid

View Source
var ErrKubeConfigAndSecretIsNotSet = NewBcode(400, 40002, "kubeConfig or kubeConfig secret must be provided")

ErrKubeConfigAndSecretIsNotSet kubeConfig and kubeConfigSecret are not set

View Source
var ErrKubeConfigSecretNotSupport = NewBcode(400, 40001, "kubeConfig secret is not supported now")

ErrKubeConfigSecretNotSupport kubeConfig secret is not support

View Source
var ErrListHelmChart = NewBcode(200, 13001, "cannot list helm charts from given repoURL")

ErrListHelmChart is the error of cannot list helm chart from given repoURL

View Source
var ErrListHelmVersions = NewBcode(200, 13002, "cannot list helm versions from given repoURL")

ErrListHelmVersions is the error of cannot list helm chart versions given given repoUrl

View Source
var ErrLocalClusterImmutable = NewBcode(400, 40008, "local cluster is immutable")

ErrLocalClusterImmutable local cluster kubeConfig is immutable

View Source
var ErrLocalClusterReserved = NewBcode(400, 40007, "local cluster is reserved")

ErrLocalClusterReserved cluster name reserved for local

View Source
var ErrMustQueryByApp = NewBcode(404, 20005, "you can only query the Workflow list based on applications.")

ErrMustQueryByApp you can only query the Workflow list based on applications.

View Source
var ErrNoComponent = NewBcode(200, 10006, "application not have components, can not deploy")

ErrNoComponent no component

View Source
var ErrParseQuery2Json = NewBcode(400, 60003, "fail to parse query result to json format")

ErrParseQuery2Json failed to parse query result to response

View Source
var ErrParseVelaQL = NewBcode(400, 60001, "fail to parse the velaQL")

ErrParseVelaQL failed to parse velaQL

View Source
var ErrProjectDenyDeleteByApplication = NewBcode(400, 30005, "the project can't be deleted as there are applications inside")

ErrProjectDenyDeleteByApplication the project can't be deleted as there are applications inside

View Source
var ErrProjectDenyDeleteByEnvironment = NewBcode(400, 30006, "the project can't be deleted before you clean up all the environments inside")

ErrProjectDenyDeleteByEnvironment the project can't be deleted because there are environments inside

View Source
var ErrProjectDenyDeleteByTarget = NewBcode(400, 30007, "the project can't be deleted before you clean up all these targets inside")

ErrProjectDenyDeleteByTarget the project can't be deleted as there are targets inside

View Source
var ErrProjectIsExist = NewBcode(400, 30001, "project name already exists")

ErrProjectIsExist project name is exist

View Source
var ErrProjectIsNotExist = NewBcode(404, 30002, "project is not existed")

ErrProjectIsNotExist project is not exist

View Source
var ErrProjectNamespaceFail = NewBcode(400, 30003, "project bind namespace failure")

ErrProjectNamespaceFail project bind namespace failure

View Source
var ErrProjectNamespaceIsExist = NewBcode(400, 30004, "the namespace belongs to the other project")

ErrProjectNamespaceIsExist the namespace belongs to the other project

View Source
var ErrProjectOwnerIsNotExist = NewBcode(400, 30010, "the project owner name is invalid")

ErrProjectOwnerIsNotExist means the project owner name is invalid

View Source
var ErrProjectRoleCheckFailure = NewBcode(400, 30008, "the specified role does't belong to this project or not exist")

ErrProjectRoleCheckFailure means the specified role does't belong to this project or not exist

View Source
var ErrProjectUserExist = NewBcode(400, 30009, "the user is already exist in this project")

ErrProjectUserExist means the user is already exist in this project

View Source
var ErrRepoBasicAuth = NewBcode(400, 13006, "extract repo auth info from secret error")

ErrRepoBasicAuth means extract repo auth info from secret error

View Source
var ErrRepoInvalidURL = NewBcode(400, 13007, "user input repository url is invalid")

ErrRepoInvalidURL means user input url is invalid

View Source
var ErrServer = NewBcode(500, 500, "The service has lapsed.")

ErrServer an unexpected mistake.

View Source
var ErrSkipCacheParameter = NewBcode(400, 13005, "skip cache parameter miss config, the value only can be true or false")

ErrSkipCacheParameter means the skip cache parameter miss config

View Source
var ErrTargetExist = NewBcode(400, 80001, "target is exist")

ErrTargetExist Target is exist

View Source
var ErrTargetInUseCantDeleted = NewBcode(404, 80003, "target in use, can't be deleted")

ErrTargetInUseCantDeleted Target being used

View Source
var ErrTargetInvalidWithEmptyClusterOrNamespace = NewBcode(400, 80005, "the namespace or cluster of target should not be empty")

ErrTargetInvalidWithEmptyClusterOrNamespace indicates the namespace/cluster of target is empty

View Source
var ErrTargetNamespaceAlreadyBound = NewBcode(400, 80004, "the namespace specified already belongs to other target")

ErrTargetNamespaceAlreadyBound indicates the namespace already belongs to other target, one namespace can only belong to one target

View Source
var ErrTargetNotExist = NewBcode(404, 80002, "target is not exist")

ErrTargetNotExist Target is not exist

View Source
var ErrTerraformConfigurationNotFound = NewBcode(404, 40010, "cannot find terraform configuration")

ErrTerraformConfigurationNotFound cannot find terraform configuration

View Source
var ErrTraitAlreadyExist = NewBcode(400, 10016, "trait is already exist")

ErrTraitAlreadyExist trait is already exist

View Source
var ErrTraitNotExist = NewBcode(400, 10015, "trait is not exist")

ErrTraitNotExist trait is not exist

View Source
var ErrUnauthorized = NewBcode(401, 401, "401 Unauthorized")

ErrUnauthorized check user auth failure

View Source
var ErrViewQuery = NewBcode(400, 60002, "view query failed")

ErrViewQuery failed to query view

View Source
var ErrWorkflowExist = NewBcode(404, 20003, "application workflow is exist")

ErrWorkflowExist application workflow is exist

View Source
var ErrWorkflowNoDefault = NewBcode(404, 20004, "application default workflow is not exist")

ErrWorkflowNoDefault application default workflow is not exist

View Source
var ErrWorkflowNoEnv = NewBcode(400, 20006, "workflow must set env name")

ErrWorkflowNoEnv workflow have not env

View Source
var ErrWorkflowNotExist = NewBcode(404, 20002, "application workflow is not exist")

ErrWorkflowNotExist application workflow is not exist

View Source
var ErrWorkflowRecordNotExist = NewBcode(404, 20007, "workflow record is not exist")

ErrWorkflowRecordNotExist workflow record is not exist

Functions

func NewBcodeWrapErr added in v1.2.0

func NewBcodeWrapErr(httpCode, businessCode int32, err error, message string) error

NewBcodeWrapErr new bcode error

func ReturnError

func ReturnError(req *restful.Request, res *restful.Response, err error)

ReturnError Unified handling of all types of errors, generating a standard return structure.

func WrapGithubRateLimitErr added in v1.2.0

func WrapGithubRateLimitErr(err error) error

WrapGithubRateLimitErr wraps error if it is github rate limit

Types

type Bcode

type Bcode struct {
	HTTPCode     int32 `json:"-"`
	BusinessCode int32
	Message      string
}

Bcode business error code

func NewBcode added in v1.2.0

func NewBcode(httpCode, businessCode int32, message string) *Bcode

NewBcode new business code

func (*Bcode) Error

func (b *Bcode) Error() string

func (*Bcode) SetMessage

func (b *Bcode) SetMessage(message string) *Bcode

SetMessage set new message and return a new bcode instance

Jump to

Keyboard shortcuts

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