api

package
v0.0.0-...-0c09f60 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2021 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register

func Register(rootRouter *mux.Router, context *Context)

Register registers the API endpoints on the given router.

Types

type Context

type Context struct {
	Store       Store
	Supervisor  Supervisor
	Genesis     Genesis
	RequestID   string
	Environment string
	Logger      logrus.FieldLogger
}

Context provides the API with all necessary data and interfaces for responding to requests.

It is cloned before each request, allowing per-request changes such as logger annotations.

func (*Context) Clone

func (c *Context) Clone() *Context

Clone creates a shallow copy of context, allowing clones to apply per-request changes.

type Genesis

type Genesis interface {
}

Genesis describes the interface required to communicate with the AWS account.

type Store

type Store interface {
	CreateAccount(account *model.Account) error
	GetAccount(accountID string) (*model.Account, error)
	GetAccounts(filter *model.AccountFilter) ([]*model.Account, error)
	UpdateAccount(account *model.Account) error
	LockAccount(accountID, lockerID string) (bool, error)
	UnlockAccount(accountID, lockerID string, force bool) (bool, error)
	LockAccountAPI(accountID string) error
	UnlockAccountAPI(accountID string) error
	DeleteAccount(accountID string) error

	CreateWebhook(webhook *model.Webhook) error
	GetWebhook(webhookID string) (*model.Webhook, error)
	GetWebhooks(filter *model.WebhookFilter) ([]*model.Webhook, error)
	DeleteWebhook(webhookID string) error

	GetParentSubnet(id string) (model.ParentSubnet, error)
	GetParentSubnets(filter *model.ParentSubnetFilter) ([]model.ParentSubnet, error)
	AddParentSubnet(parentSubnet *model.ParentSubnet, subnets *[]model.Subnet) error
	LockParentSubnet(subnet, lockerID string) (bool, error)
	UnlockParentSubnet(subnet, lockerID string, force bool) (bool, error)

	ClaimSubnet(cidr string, accountID string) (*model.Subnet, error)
	GetSubnet(id string) (*model.Subnet, error)
	GetSubnets(filter *model.SubnetFilter) ([]*model.Subnet, error)
	UpdateSubnet(Subnet *model.Subnet) error
}

Store describes the interface required to persist changes made via API requests.

type Supervisor

type Supervisor interface {
	Do() error
}

Supervisor describes the interface to notify the background jobs of an actionable change.

Jump to

Keyboard shortcuts

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