apikeys

package
v0.0.0-...-2540817 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitRepositoryProvider

func InitRepositoryProvider(databaseProvider string)

InitRepositoryProvider - One time init for the given DB Provider

Types

type PgsqlAPIKeysRepository

type PgsqlAPIKeysRepository struct {
	// contains filtered or unexported fields
}

PgsqlAPIKeysRepository - Postgresql-backed API keys repository

func (*PgsqlAPIKeysRepository) AddAPIKey

func (p *PgsqlAPIKeysRepository) AddAPIKey(userID string, comment string) (*api.APIKey, error)

AddAPIKey - Add a new API key to the datastore.

func (*PgsqlAPIKeysRepository) DeleteAPIKey

func (p *PgsqlAPIKeysRepository) DeleteAPIKey(userGUID string, keyGUID string) error

DeleteAPIKey - delete an API key identified by its GUID

func (*PgsqlAPIKeysRepository) GetAPIKeyBySecret

func (p *PgsqlAPIKeysRepository) GetAPIKeyBySecret(keySecret string) (*api.APIKey, error)

GetAPIKeyBySecret - gets user ID for an API key

func (*PgsqlAPIKeysRepository) ListAPIKeys

func (p *PgsqlAPIKeysRepository) ListAPIKeys(userID string) ([]api.APIKey, error)

ListAPIKeys - list API keys for a given user GUID

func (*PgsqlAPIKeysRepository) UpdateAPIKeyLastUsed

func (p *PgsqlAPIKeysRepository) UpdateAPIKeyLastUsed(keyGUID string) error

UpdateAPIKeyLastUsed - sets API key last_used field to current time

type Repository

type Repository interface {
	AddAPIKey(userID string, comment string) (*api.APIKey, error)
	GetAPIKeyBySecret(keySecret string) (*api.APIKey, error)
	ListAPIKeys(userID string) ([]api.APIKey, error)
	DeleteAPIKey(userGUID string, keyGUID string) error
	UpdateAPIKeyLastUsed(keyGUID string) error
}

Repository - API keys repository

func NewPgsqlAPIKeysRepository

func NewPgsqlAPIKeysRepository(dcp *sql.DB) (Repository, error)

NewPgsqlAPIKeysRepository - get a reference to the API keys data source

Directories

Path Synopsis
Package mock_apikeys is a generated GoMock package.
Package mock_apikeys is a generated GoMock package.

Jump to

Keyboard shortcuts

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