client

package
v0.2.4 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2020 License: Apache-2.0 Imports: 11 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, id Identity) (*Client, error)

NewClient creates a new client, if identity is not nil, it will be used to authenticate requests against the server

type Directory

type Directory interface {
	FarmRegister(farm directory.Farm) (schema.ID, error)
	FarmUpdate(farm directory.Farm) 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
	NodeSetFreeToUse(id string, free bool) 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, resources directory.ResourceAmount, workloads directory.WorkloadAmount) error
}

Directory API interface

type Identity

type Identity interface {
	// The unique ID as known by the explorer
	Identity() string
	// PrivateKey used to sign the requests
	PrivateKey() ed25519.PrivateKey
}

Identity is used by the client to authenticate to the explorer API

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 Workloads

type Workloads interface {
	Create(reservation workloads.Reservation) (resp wrklds.ReservationCreateResponse, 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