Documentation ¶
Overview ¶
Client package provides a client that allows to interact with the a CARAVELA's daemon sending the requests to it. It can be used as a Golang SDK for the CARAVELA's. This is the same client used in the CLI github.com/ThomasPluck/caravela/cli provided.
Index ¶
- Constants
- type Client
- func (c *Client) ListContainers(ctx context.Context) ([]types.ContainerStatus, *Error)
- func (c *Client) Shutdown(ctx context.Context) *Error
- func (c *Client) StopContainers(ctx context.Context, containersIDs []string) *Error
- func (c *Client) SubmitContainers(ctx context.Context, containersConfigs []types.ContainerConfig) *Error
- type Configuration
- type Error
Constants ¶
const ( // UnknownError deals with unexpected errors. UnknownError = iota // instance that is not working e.g. because it is turned off. CaravelaInstanceUnavailableError )
CARAVELA's client error codes.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client holds all the necessary information to interact with CARAVELA's daemon.
func NewCaravelaIP ¶
NewCaravelaIP creates a new client for a CARAVELA's daemon hosted in the given IP.
func NewCaravelaTimeoutIP ¶
func (*Client) ListContainers ¶
ListContainers returns a slice of container status that represent all the containers that the user have running in the CARAVELA's system.
func (*Client) StopContainers ¶
StopContainers stops and removes all the containers given by the containersIDs slice.
func (*Client) SubmitContainers ¶
func (c *Client) SubmitContainers(ctx context.Context, containersConfigs []types.ContainerConfig) *Error
SubmitContainers allows you to submit a set of containers that you want to deploy in the CARAVELA's system. The containers configurations are given by the containersConfigs slice.
type Configuration ¶
type Configuration struct {
// contains filtered or unexported fields
}
Configuration holds the configuration parameters for the CARAVELA's client.
func DefaultConfig ¶
func DefaultConfig(caravelaInstanceIP string) *Configuration
DefaultConfig creates a new configuration structure with the default values.
func (*Configuration) CaravelaInstanceIP ¶
func (c *Configuration) CaravelaInstanceIP() string
CaravelaInstanceIP returns the IP address to where send the API requests.
func (*Configuration) CaravelaInstancePort ¶
func (c *Configuration) CaravelaInstancePort() int
CaravelaInstancePort returns the port to where send the API requests.
func (*Configuration) RequestTimeout ¶
func (c *Configuration) RequestTimeout() time.Duration
RequestTimeout returns the timeout for the API requests.
func (*Configuration) SetCaravelaInstancePort ¶
func (c *Configuration) SetCaravelaInstancePort(newPort int)
SetCaravelaInstancePort sets the port to where send the API requests.
func (*Configuration) SetRequestTimeout ¶
func (c *Configuration) SetRequestTimeout(newReqTimeout time.Duration)
SetRequestTimeout sets the timeout for the API requests.