store

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2023 License: Apache-2.0 Imports: 10 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 {
	CreateLocation(name string) (string, error)
	ListLocations() ([]string, error)
	GetLocation(name string) (string, error)
	CreateProductCategory(name string) (string, error)
	GetProductCategory(name string) (string, error)
	ListProductCategories() ([]string, error)
	ListProducts() ([]*billingapi.Product, error)
	GetProduct(code string) (*billingapi.Product, error)
	FindProduct(code, category string) (*billingapi.Product, error)
	CreateProduct(name, category string, plans []billingapi.PricingPlan) (*billingapi.Product, error)
	UpdateProduct(name string, plans []billingapi.PricingPlan) (*billingapi.Product, error)
	CreateServer(name, serverType, location string) (*bmcapi.Server, error)
	UpdateServer(server *bmcapi.Server) error
	ListServers() ([]*bmcapi.Server, error)
	GetServer(serverID string) (*bmcapi.Server, error)
	DeleteServer(serverID string) (bool, error)
}

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

type Memory

type Memory struct {
	ProductCategories map[string]bool
	// contains filtered or unexported fields
}

Memory is an implementation of DataStore which stores everything in memory

func NewMemory

func NewMemory() (*Memory, error)

NewMemory returns a properly initialized Memory

func (*Memory) CreateLocation

func (m *Memory) CreateLocation(name string) (string, error)

CreateLocation creates a new location

func (*Memory) CreateProduct

func (m *Memory) CreateProduct(name, category string, plans []billingapi.PricingPlan) (*billingapi.Product, error)

CreateProduct create a single product

func (*Memory) CreateProductCategory

func (m *Memory) CreateProductCategory(name string) (string, error)

CreateProductCategory create a single product type

func (*Memory) CreateServer

func (m *Memory) CreateServer(name, serverType, location string) (*bmcapi.Server, error)

CreateServer creates a new server

func (*Memory) DeleteServer

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

DeleteServer delete a single server

func (*Memory) FindProduct

func (m *Memory) FindProduct(code, category string) (*billingapi.Product, error)

GetProduct get a product by name and category

func (*Memory) GetLocation

func (m *Memory) GetLocation(name string) (string, error)

GetLocation get a single location

func (*Memory) GetProduct

func (m *Memory) GetProduct(code string) (*billingapi.Product, error)

GetProduct get a product by ID

func (*Memory) GetProductCategory

func (m *Memory) GetProductCategory(name string) (string, error)

GetProductCategory get a single product type

func (*Memory) GetServer

func (m *Memory) GetServer(serverID string) (*bmcapi.Server, error)

GetServer get information about a single server

func (*Memory) ListLocations

func (m *Memory) ListLocations() ([]string, error)

ListLocations returns locations; if blank, it knows about ASH

func (*Memory) ListProductCategories

func (m *Memory) ListProductCategories() ([]string, error)

func (*Memory) ListProducts

func (m *Memory) ListProducts() ([]*billingapi.Product, error)

ListProducts list all products

func (*Memory) ListServers

func (m *Memory) ListServers() ([]*bmcapi.Server, error)

ListServers list all known servers for the project

func (*Memory) UpdateProduct

func (m *Memory) UpdateProduct(name string, plans []billingapi.PricingPlan) (*billingapi.Product, error)

UpdateProduct update a single product

func (*Memory) UpdateServer

func (m *Memory) UpdateServer(server *bmcapi.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