client

package
v0.2.2-rc7 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2020 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	Phonebook Phonebook
	Directory Directory
	Workloads Workloads
}

Client structure

func NewClient

func NewClient(u string, kp identity.KeyPair) (*Client, error)

NewClient creates a new client

type Directory

type Directory interface {
	FarmRegister(farm directory.Farm) (schema.ID, error)
	FarmList(tid schema.ID, name string, page *Pager) (farms []directory.Farm, err error)
	FarmGet(id schema.ID) (farm directory.Farm, err error)

	NodeRegister(node directory.Node) error
	NodeList(filter NodeFilter) (nodes []directory.Node, err error)
	NodeGet(id string, proofs bool) (node directory.Node, err error)

	NodeSetInterfaces(id string, ifaces []directory.Iface) error
	NodeSetPorts(id string, ports []uint) error
	NodeSetPublic(id string, pub directory.PublicIface) error

	//TODO: this method call uses types from zos that is not generated
	//from the schema. Which is wrong imho.
	NodeSetCapacity(
		id string,
		resources directory.ResourceAmount,
		dmiInfo dmi.DMI,
		disksInfo capacity.Disks,
		hypervisor []string,
	) error

	NodeUpdateUptime(id string, uptime uint64) error
	NodeUpdateUsedResources(id string, amount directory.ResourceAmount) error
}

Directory API interface

type NodeFilter

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

NodeFilter used to build a query for node list

func (NodeFilter) Apply

func (n NodeFilter) Apply(query url.Values)

Apply fills query

func (NodeFilter) WithCRU

func (n NodeFilter) WithCRU(cru int64) NodeFilter

WithCRU filter with CRU

func (NodeFilter) WithCity

func (n NodeFilter) WithCity(city string) NodeFilter

WithCity filter with city

func (NodeFilter) WithCountry

func (n NodeFilter) WithCountry(country string) NodeFilter

WithCountry filter with country

func (NodeFilter) WithFarm

func (n NodeFilter) WithFarm(id int64) NodeFilter

WithFarm filter with farm

func (NodeFilter) WithHRU

func (n NodeFilter) WithHRU(hru int64) NodeFilter

WithHRU filter with HRU

func (NodeFilter) WithMRU

func (n NodeFilter) WithMRU(sru int64) NodeFilter

WithMRU filter with mru

func (NodeFilter) WithProofs

func (n NodeFilter) WithProofs(proofs bool) NodeFilter

WithProofs filter with proofs

type Pager

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

Pager for listing

func Page

func Page(page, size int) *Pager

Page returns a pager

type Phonebook

type Phonebook interface {
	Create(user phonebook.User) (schema.ID, error)
	List(name, email string, page *Pager) (output []phonebook.User, err error)
	Get(id schema.ID) (phonebook.User, error)
	// Update() #TODO
	Validate(id schema.ID, message, signature string) (bool, error)
}

Phonebook interface

type Signer

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

Signer is a utility to easily sign payloads

func NewSigner

func NewSigner(seed []byte) (*Signer, error)

NewSigner create a signer with a seed

func NewSignerFromFile

func NewSignerFromFile(path string) (*Signer, error)

NewSignerFromFile loads signer from a seed file

func (*Signer) Sign

func (s *Signer) Sign(o ...interface{}) ([]byte, []byte, error)

Sign constructs a message from all it's arguments then sign it

func (*Signer) SignHex

func (s *Signer) SignHex(o ...interface{}) (string, string, error)

SignHex like sign, but return message and signature in hex encoded format

type Workloads

type Workloads interface {
	Create(reservation workloads.Reservation) (id schema.ID, err error)
	List(nextAction *workloads.NextActionEnum, customerTid int64, page *Pager) (reservation []workloads.Reservation, err error)
	Get(id schema.ID) (reservation workloads.Reservation, err error)

	SignProvision(id schema.ID, user schema.ID, signature string) error
	SignDelete(id schema.ID, user schema.ID, signature string) error

	Workloads(nodeID string, from uint64) ([]workloads.ReservationWorkload, error)
	WorkloadGet(gwid string) (result workloads.ReservationWorkload, err error)
	WorkloadPutResult(nodeID, gwid string, result workloads.Result) error
	WorkloadPutDeleted(nodeID, gwid string) error
}

Workloads interface

Jump to

Keyboard shortcuts

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