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 ¶
- func FlushSessions() error
- type Client
- func (cln *Client) AddMetadata(ctx context.Context, f Filter, keys map[string]string) error
- func (cln *Client) Create(ctx context.Context, name, imageID, flavorID string, ips map[string]string) (*catalogue.Server, error)
- func (cln *Client) Delete(ctx context.Context, f Filter) error
- func (cln *Client) FetchMetadata(ctx context.Context, f Filter) (md map[string]string, err error)
- func (cln *Client) Flavour(ctx context.Context, f Filter) (*catalogue.DeploymentFlavour, error)
- func (cln *Client) Flavours(ctx context.Context) ([]*catalogue.DeploymentFlavour, error)
- func (cln *Client) Image(ctx context.Context, f Filter) (*catalogue.NFVImage, error)
- func (cln *Client) Images(ctx context.Context) ([]*catalogue.NFVImage, error)
- func (cln *Client) Info(ctx context.Context) (infos *pop.Infos, err error)
- func (cln *Client) Network(ctx context.Context, f Filter) (*catalogue.Network, error)
- func (cln *Client) Networks(ctx context.Context) ([]*catalogue.Network, error)
- func (cln *Client) Server(ctx context.Context, f Filter) (*catalogue.Server, error)
- func (cln *Client) Servers(ctx context.Context) ([]*catalogue.Server, error)
- func (cln *Client) Spawn(ctx context.Context, name, imageID, flavorID string, ips map[string]string) (*catalogue.Server, error)
- func (cln *Client) Start(ctx context.Context, f Filter) (*catalogue.Server, error)
- func (cln *Client) Stop(ctx context.Context, f Filter) error
- type Filter
- type FlushError
- type IDFilter
- type NameFilter
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 ¶
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) FetchMetadata ¶
FetchMetadata fetches the metadata for a given server. This function is generally not needed by a normal user of this library.
func (*Client) Flavour ¶
Flavour returns the flavour having the given filter as an OpenBaton DeploymentFlavour.
func (*Client) Flavours ¶
Flavours returns all the available flavours as OpenBaton DeploymentFlavour.
func (*Client) Image ¶
Image returns the image on the server having the given filter as an OpenBaton NFVImage struct.
func (*Client) Network ¶
Network returns the network on the server having the given filter as an OpenBaton Network struct.
func (*Client) Server ¶
Server returns the container on the server having the given id as an OpenBaton Server struct.
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.
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.