Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type APIKeys ¶
type APIKeys struct {
// contains filtered or unexported fields
}
APIKeys wraps the datastore and any HTTP handlers for project api keys
func New ¶
func New(db interfaces.ProjectAPIKeysDatastore, config *config.AppConfig) *APIKeys
New returns a pointer to a new `APIKeys` struct
func (*APIKeys) GenerateKey ¶
GenerateKey retrieves a single api token of this project by ID
type Handler ¶
type Handler interface { UpdateKey(c *gin.Context) AddKey(c *gin.Context) ListKeys(c *gin.Context) GenerateKey(c *gin.Context) DeleteKey(c *gin.Context) }
Handler is an interface to the API Key HTTP handler functions.
type NewProjectKey ¶
type NewProjectKey struct { Key string `json:"key"` Description string `json:"description"` Read bool `json:"read"` Write bool `json:"write"` Role string `json:"role"` }
NewProjectKey is the JSON structure of a new api key request
func (*NewProjectKey) SupportedRole ¶
func (u *NewProjectKey) SupportedRole() bool
SupportedRole verifies that the users role is valid and supported
func (*NewProjectKey) Validate ¶
func (u *NewProjectKey) Validate() error
Validate checks that the new key is not empty
func (*NewProjectKey) ValidateRoleAccess ¶
func (u *NewProjectKey) ValidateRoleAccess() error
ValidateRoleAccess validates the role and access fields
Click to show internal directories.
Click to hide internal directories.