storage

package
v0.2.5 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2021 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetAccountName

func GetAccountName(provider string, id string) string

GetAccountName returns a account name from a provider name and provider ID

Types

type AccessToken

type AccessToken struct {
	AccountName string
	Expiry      time.Time
}

AccessToken are used to make API requests on behalf of a user. The access token represents the authorization of a specific application to access specific parts of a user’s data.

type AccessTokenService

type AccessTokenService interface {
	Get(token string) (*AccessToken, error)
	Put(token string, at AccessToken) error
}

AccessTokenService provides access to AccessToken objects.

type Account

type Account struct {
	DisplayName string
}

Account represents a user account

type AccountService

type AccountService interface {
	Upsert(name string, a Account) error
	Get(name string) (*Account, error)
}

AccountService provides access to Account objects.

type MachineType

type MachineType struct {
	ID          int64    `json:"id"`
	DisplayName string   `json:"name"`
	Features    []string `json:"features,omitempty"`
	Login       string   `json:"login"`
	Password    string   `json:"password"`
}

MachineType describes a set of machines/hosts sharing same hardware specs

func (MachineType) ToBytes

func (mtm MachineType) ToBytes() []byte

type MachineTypeService

type MachineTypeService interface {
	GetByID(accountName string, id int64) (*MachineType, error)
	GetByUsername(username string) (*MachineType, error)
	Add(accountName string, machineType *MachineType) error
	Delete(accountName string, id int64) error
	List(accountName string) ([]MachineType, error)
	Update(accountName string, machineType MachineType) error
	Init() error
	CheckPassword(plain, hash string) bool
	GenPasswordHash(pwd string) string
}

MachineTypeService provides access to machine types objects.

type Service

type Service interface {
	MachineTypeService(ctx context.Context) (MachineTypeService, error)
	AccessTokenService(ctx context.Context) (AccessTokenService, error)
	AccountService(ctx context.Context) (AccountService, error)
}

Service provides access to all storage objects.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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