2016-12-18 05:21:29 +00:00
|
|
|
package portainer
|
|
|
|
|
|
|
|
// General errors.
|
|
|
|
const (
|
2017-05-23 18:56:10 +00:00
|
|
|
ErrUnauthorized = Error("Unauthorized")
|
|
|
|
ErrResourceAccessDenied = Error("Access denied to resource")
|
2018-06-19 11:15:10 +00:00
|
|
|
ErrObjectNotFound = Error("Object not found inside the database")
|
2017-05-23 18:56:10 +00:00
|
|
|
ErrMissingSecurityContext = Error("Unable to find security details in request context")
|
2016-12-18 05:21:29 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
// User errors.
|
|
|
|
const (
|
2018-07-23 04:57:38 +00:00
|
|
|
ErrUserAlreadyExists = Error("User already exists")
|
|
|
|
ErrInvalidUsername = Error("Invalid username. White spaces are not allowed")
|
|
|
|
ErrAdminAlreadyInitialized = Error("An administrator user already exists")
|
|
|
|
ErrAdminCannotRemoveSelf = Error("Cannot remove your own user account. Contact another administrator")
|
|
|
|
ErrCannotRemoveLastLocalAdmin = Error("Cannot remove the last local administrator account")
|
2016-12-18 05:21:29 +00:00
|
|
|
)
|
|
|
|
|
2017-05-23 18:56:10 +00:00
|
|
|
// Team errors.
|
|
|
|
const (
|
|
|
|
ErrTeamAlreadyExists = Error("Team already exists")
|
|
|
|
)
|
|
|
|
|
|
|
|
// TeamMembership errors.
|
|
|
|
const (
|
2018-04-26 16:08:46 +00:00
|
|
|
ErrTeamMembershipAlreadyExists = Error("Team membership already exists for this user and team")
|
2017-05-23 18:56:10 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
// ResourceControl errors.
|
|
|
|
const (
|
|
|
|
ErrResourceControlAlreadyExists = Error("A resource control is already applied on this resource")
|
|
|
|
ErrInvalidResourceControlType = Error("Unsupported resource control type")
|
|
|
|
)
|
|
|
|
|
2016-12-25 20:34:02 +00:00
|
|
|
// Endpoint errors.
|
|
|
|
const (
|
2017-03-12 16:24:15 +00:00
|
|
|
ErrEndpointAccessDenied = Error("Access denied to endpoint")
|
|
|
|
)
|
|
|
|
|
2018-05-28 14:40:33 +00:00
|
|
|
// Azure environment errors
|
|
|
|
const (
|
|
|
|
ErrAzureInvalidCredentials = Error("Invalid Azure credentials")
|
|
|
|
)
|
|
|
|
|
2018-04-26 16:08:46 +00:00
|
|
|
// Endpoint group errors.
|
|
|
|
const (
|
|
|
|
ErrCannotRemoveDefaultGroup = Error("Cannot remove the default endpoint group")
|
|
|
|
)
|
|
|
|
|
2017-06-20 11:00:32 +00:00
|
|
|
// Registry errors.
|
|
|
|
const (
|
|
|
|
ErrRegistryAlreadyExists = Error("A registry is already defined for this URL")
|
|
|
|
)
|
|
|
|
|
2017-10-15 17:24:40 +00:00
|
|
|
// Stack errors
|
|
|
|
const (
|
|
|
|
ErrStackAlreadyExists = Error("A stack already exists with this name")
|
|
|
|
ErrComposeFileNotFoundInRepository = Error("Unable to find a Compose file in the repository")
|
2018-06-11 13:13:19 +00:00
|
|
|
ErrStackNotExternal = Error("Not an external stack")
|
2017-10-15 17:24:40 +00:00
|
|
|
)
|
|
|
|
|
2018-06-15 07:18:25 +00:00
|
|
|
// Tag errors
|
|
|
|
const (
|
|
|
|
ErrTagAlreadyExists = Error("A tag already exists with this name")
|
|
|
|
)
|
|
|
|
|
2018-02-23 02:10:26 +00:00
|
|
|
// Endpoint extensions error
|
|
|
|
const (
|
|
|
|
ErrEndpointExtensionNotSupported = Error("This extension is not supported")
|
|
|
|
ErrEndpointExtensionAlreadyAssociated = Error("This extension is already associated to the endpoint")
|
|
|
|
)
|
|
|
|
|
2016-12-18 05:21:29 +00:00
|
|
|
// Crypto errors.
|
|
|
|
const (
|
|
|
|
ErrCryptoHashFailure = Error("Unable to hash data")
|
|
|
|
)
|
|
|
|
|
|
|
|
// JWT errors.
|
|
|
|
const (
|
2017-03-12 16:24:15 +00:00
|
|
|
ErrSecretGeneration = Error("Unable to generate secret key")
|
|
|
|
ErrInvalidJWTToken = Error("Invalid JWT token")
|
|
|
|
ErrMissingContextData = Error("Unable to find JWT data in request context")
|
2016-12-18 05:21:29 +00:00
|
|
|
)
|
|
|
|
|
2016-12-25 20:34:02 +00:00
|
|
|
// File errors.
|
|
|
|
const (
|
|
|
|
ErrUndefinedTLSFileType = Error("Undefined TLS file type")
|
|
|
|
)
|
|
|
|
|
2016-12-18 05:21:29 +00:00
|
|
|
// Error represents an application error.
|
|
|
|
type Error string
|
|
|
|
|
|
|
|
// Error returns the error message.
|
|
|
|
func (e Error) Error() string { return string(e) }
|
2018-09-03 10:08:03 +00:00
|
|
|
|
|
|
|
// Webhook errors
|
|
|
|
const (
|
|
|
|
ErrWebhookAlreadyExists = Error("A webhook for this resource already exists")
|
|
|
|
ErrUnsupportedWebhookType = Error("Webhooks for this resource are not currently supported")
|
|
|
|
)
|