accounts

package
v0.2.11 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2018 License: MPL-2.0 Imports: 6 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrCredExists = errors.New("can't check credentials without key id and name")
	ErrExists     = errors.New("can't check existence without id or name")
	ErrMissingID  = errors.New("missing identifer for save")
)

Functions

This section is empty.

Types

type Account

type Account struct {
	ID          string
	AccountName string
	TritonUUID  string
	KeyID       string
	CreatedAt   time.Time
	UpdatedAt   time.Time
	// contains filtered or unexported fields
}

Account represents the data associated with an tsg_accounts row.

func New

func New(store *Store) *Account

New constructs a new Account with the Store for backend persistence.

func (*Account) Exists

func (a *Account) Exists(ctx context.Context) (bool, error)

Exists returns a boolean and error. True if the row exists, false if it doesn't, error if there was an error executing the query.

func (*Account) GetTritonCredential

func (a *Account) GetTritonCredential(ctx context.Context) (*TritonCredential, error)

GetTritonCredential gets Triton credentials from an existing Account. If the account is found, then we will get the KeyID and KeyMaterial for the TSG Management key of that account. If we do not find any credentials, we return an error.

func (*Account) Insert

func (a *Account) Insert(ctx context.Context) error

Insert inserts a new account into the tsg_accounts table.

func (*Account) Save

func (a *Account) Save(ctx context.Context) error

Save saves an accounts.Account object and it's field values.

type Store

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

func NewStore

func NewStore(pool *pgx.ConnPool) *Store

NewStore returns a new store object.

func (*Store) FindByID

func (s *Store) FindByID(ctx context.Context, accountID string) (*Account, error)

FindByID finds an account by a specific ID.

func (*Store) FindByName

func (s *Store) FindByName(ctx context.Context, accountName string) (*Account, error)

FindByName finds an account by a specific account_name.

type TritonCredential

type TritonCredential struct {
	AccountName string
	KeyID       string
	KeyMaterial string
}

Jump to

Keyboard shortcuts

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