store

package
v0.0.2-beta.1 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2022 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DataStore

type DataStore interface {
	CreateRegion(name, code string) (*cherrygo.Region, error)
	ListRegions() ([]*cherrygo.Region, error)
	GetRegion(ID int) (*cherrygo.Region, error)
	GetRegionByName(name string) (*cherrygo.Region, error)
	GetRegionByCode(code string) (*cherrygo.Region, error)
	CreatePlan(name string) (*cherrygo.Plans, error)
	ListPlans() ([]*cherrygo.Plans, error)
	GetPlan(ID int) (*cherrygo.Plans, error)
	GetPlanByName(name string) (*cherrygo.Plans, error)
	CreateServer(projectID int, name string, plan cherrygo.Plans, region cherrygo.Region) (*cherrygo.Server, error)
	UpdateServer(ID int, server *cherrygo.Server) error
	ListServers(projectID int) ([]*cherrygo.Server, error)
	GetServer(ID int) (*cherrygo.Server, error)
	DeleteServer(ID int) (bool, error)
	CreateProject(name string, bgp bool) (*cherrygo.Project, error)
	GetProject(ID int) (*cherrygo.Project, error)
	UpdateProject(ID int, project *cherrygo.Project) error
}

DataStore is the item that retrieves backend information to serve out following a contract API

type Memory

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

Memory is an implementation of DataStore which stores everything in memory

func NewMemory

func NewMemory() *Memory

NewMemory returns a properly initialized Memory

func (*Memory) CreatePlan

func (m *Memory) CreatePlan(name string) (*cherrygo.Plans, error)

CreatePlan create a single plan

func (*Memory) CreateProject

func (m *Memory) CreateProject(name string, bgp bool) (*cherrygo.Project, error)

func (*Memory) CreateRegion

func (m *Memory) CreateRegion(name, code string) (*cherrygo.Region, error)

CreateFacility creates a new region

func (*Memory) CreateServer

func (m *Memory) CreateServer(projectID int, name string, plan cherrygo.Plans, region cherrygo.Region) (*cherrygo.Server, error)

CreateServer creates a new server

func (*Memory) DeleteServer

func (m *Memory) DeleteServer(serverID int) (bool, error)

DeleteServer delete a single server

func (*Memory) GetPlan

func (m *Memory) GetPlan(id int) (*cherrygo.Plans, error)

GetPlan get plan by ID

func (*Memory) GetPlanByName

func (m *Memory) GetPlanByName(name string) (*cherrygo.Plans, error)

GetPlanByName get plan by name

func (*Memory) GetProject

func (m *Memory) GetProject(ID int) (*cherrygo.Project, error)

func (*Memory) GetRegion

func (m *Memory) GetRegion(id int) (*cherrygo.Region, error)

GetRegion get a single region by ID

func (*Memory) GetRegionByCode

func (m *Memory) GetRegionByCode(code string) (*cherrygo.Region, error)

GetRegionByCode get a single region by name

func (*Memory) GetRegionByName

func (m *Memory) GetRegionByName(name string) (*cherrygo.Region, error)

GetRegionByName get a single region by name

func (*Memory) GetServer

func (m *Memory) GetServer(serverID int) (*cherrygo.Server, error)

GetServer get information about a single server

func (*Memory) ListPlans

func (m *Memory) ListPlans() ([]*cherrygo.Plans, error)

ListPlans list all plans

func (*Memory) ListRegions

func (m *Memory) ListRegions() ([]*cherrygo.Region, error)

ListRegions returns regions; if blank, it knows about ewr1

func (*Memory) ListServers

func (m *Memory) ListServers(projectID int) ([]*cherrygo.Server, error)

ListServers list all known servers for the project

func (*Memory) UpdateProject

func (m *Memory) UpdateProject(ID int, project *cherrygo.Project) error

func (*Memory) UpdateServer

func (m *Memory) UpdateServer(ID int, server *cherrygo.Server) error

UpdateServer updates an existing device

Jump to

Keyboard shortcuts

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