client

package
v0.0.0-...-487a084 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2017 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package client implements a client for a pop service. Client wraps the gRPC client stub for pop, converting the container-oriented pop types into the OpenStack like structures OpenBaton expects. The clients are handled by a cache, to allow a stateless user like plugind to create clients on demand without incurring in additional overheads.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FlushSessions

func FlushSessions() error

FlushSessions closes all the cached sessions, trying to log out from them first. If you wish, you can inspect the single errors from the Logout and Close operation through type casting the returned error into a FlushError.

Types

type Client

type Client struct {
	Credentials creds.Credentials
}

Client is a client instance for a Pop, that automatically converts Pop-protocol values into OpenBaton catalogue types. Clients use cached connections, and they are identified by their Credentials.

func New

func New(inst *catalogue.VIMInstance) *Client

New returns a Client initialized with credentials extracted from a given VIMInstance.

func (*Client) AddMetadata

func (cln *Client) AddMetadata(ctx context.Context, f Filter, keys map[string]string) error

AddMetadata adds metadata keys to a not yet started container. New keys will match existing ones; any empty value will delete its key from the map server side.

func (*Client) Create

func (cln *Client) Create(ctx context.Context, name, imageID, flavorID string, ips map[string]string) (*catalogue.Server, error)

Create creates a new server on the remote Pop. An entry in "ips" with an entry IP will randomly assign an IP from the given network.

func (*Client) Delete

func (cln *Client) Delete(ctx context.Context, f Filter) error

Delete stops and deletes the container identified by the given filter.

func (*Client) FetchMetadata

func (cln *Client) FetchMetadata(ctx context.Context, f Filter) (md map[string]string, err error)

FetchMetadata fetches the metadata for a given server. This function is generally not needed by a normal user of this library.

func (*Client) Flavour

func (cln *Client) Flavour(ctx context.Context, f Filter) (*catalogue.DeploymentFlavour, error)

Flavour returns the flavour having the given filter as an OpenBaton DeploymentFlavour.

func (*Client) Flavours

func (cln *Client) Flavours(ctx context.Context) ([]*catalogue.DeploymentFlavour, error)

Flavours returns all the available flavours as OpenBaton DeploymentFlavour.

func (*Client) Image

func (cln *Client) Image(ctx context.Context, f Filter) (*catalogue.NFVImage, error)

Image returns the image on the server having the given filter as an OpenBaton NFVImage struct.

func (*Client) Images

func (cln *Client) Images(ctx context.Context) ([]*catalogue.NFVImage, error)

Images returns the images on the server as OpenBaton NFVImage structs.

func (*Client) Info

func (cln *Client) Info(ctx context.Context) (infos *pop.Infos, err error)

Info retrieves informations from the current PoP.

func (*Client) Network

func (cln *Client) Network(ctx context.Context, f Filter) (*catalogue.Network, error)

Network returns the network on the server having the given filter as an OpenBaton Network struct.

func (*Client) Networks

func (cln *Client) Networks(ctx context.Context) ([]*catalogue.Network, error)

Networks returns the networks on the server as OpenBaton Network structs.

func (*Client) Server

func (cln *Client) Server(ctx context.Context, f Filter) (*catalogue.Server, error)

Server returns the container on the server having the given id as an OpenBaton Server struct.

func (*Client) Servers

func (cln *Client) Servers(ctx context.Context) ([]*catalogue.Server, error)

Servers returns the containers on the server as OpenBaton Server structs.

func (*Client) Spawn

func (cln *Client) Spawn(ctx context.Context, name, imageID, flavorID string, ips map[string]string) (*catalogue.Server, error)

Spawn creates and starts a new server on the remote Pop. An entry in "ips" with an entry IP will randomly assign an IP from the given network.

func (*Client) Start

func (cln *Client) Start(ctx context.Context, f Filter) (*catalogue.Server, error)

Start starts a Server created by Create().

func (*Client) Stop

func (cln *Client) Stop(ctx context.Context, f Filter) error

Stop stops a Server launched by Start or Spawn.

type Filter

type Filter interface {
	// contains filtered or unexported methods
}

Filter represents a filter type to be applied during a server query.

type FlushError

type FlushError []error

FlushError is an error type containing any error encountered while executing FlushSessions.

func (FlushError) Error

func (errs FlushError) Error() string

Error returns a string that summarises the various errors contained by this FlushError.

type IDFilter

type IDFilter string

IDFilter contains the ID that should be matched by an operation.

type NameFilter

type NameFilter string

NameFilter contains the name that will be matched during an operation.

Directories

Path Synopsis
Package creds implements a Credentials structure to represent and store Pop credentials.
Package creds implements a Credentials structure to represent and store Pop credentials.

Jump to

Keyboard shortcuts

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