5cb03d6e62
* ServiceAccounts: Fix token-apikey cross deletion * ServiceAccounts: separate API key store and service account token store * ServiceAccounts: hide service account tokens from API Keys page * ServiceAccounts: uppercase statement * ServiceAccounts: fix and add new tests for SAT store * ServiceAccounts: remove service account ID from add API key * ServiceAccounts: clear up errors
42 lines
781 B
Go
42 lines
781 B
Go
package database
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/grafana/grafana/pkg/models"
|
|
)
|
|
|
|
type ErrMisingSAToken struct {
|
|
}
|
|
|
|
func (e *ErrMisingSAToken) Error() string {
|
|
return "service account token not found"
|
|
}
|
|
|
|
func (e *ErrMisingSAToken) Unwrap() error {
|
|
return models.ErrApiKeyNotFound
|
|
}
|
|
|
|
type ErrInvalidExpirationSAToken struct {
|
|
}
|
|
|
|
func (e *ErrInvalidExpirationSAToken) Error() string {
|
|
return "service account token not found"
|
|
}
|
|
|
|
func (e *ErrInvalidExpirationSAToken) Unwrap() error {
|
|
return models.ErrInvalidApiKeyExpiration
|
|
}
|
|
|
|
type ErrDuplicateSAToken struct {
|
|
name string
|
|
}
|
|
|
|
func (e *ErrDuplicateSAToken) Error() string {
|
|
return fmt.Sprintf("service account token %s already exists", e.name)
|
|
}
|
|
|
|
func (e *ErrDuplicateSAToken) Unwrap() error {
|
|
return models.ErrDuplicateApiKey
|
|
}
|