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/strabox/caravela/cli provided.
Index ¶
- Constants
- type Client
- func (client *Client) ListContainers(ctx context.Context) ([]types.ContainerStatus, *Error)
- func (client *Client) Shutdown(ctx context.Context) *Error
- func (client *Client) StopContainers(ctx context.Context, containersIDs []string) *Error
- func (client *Client) SubmitContainers(c context.Context, containersConfigs []types.ContainerConfig) *Error
- type Configuration
- func (config *Configuration) CaravelaInstanceIP() string
- func (config *Configuration) CaravelaInstancePort() int
- func (config *Configuration) RequestTimeout() time.Duration
- func (config *Configuration) SetCaravelaInstancePort(newPort int)
- func (config *Configuration) SetRequestTimeout(newReqTimeout time.Duration)
- 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 ¶ added in v0.2.0
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 ¶ added in v0.2.0
ListContainers returns a slice of container status that represent all the containers that the user have running in the CARAVELA's system.
func (*Client) Shutdown ¶ added in v0.2.0
Shutdown makes the daemon cleanly shutdown and leave the system.
func (*Client) StopContainers ¶ added in v0.2.0
StopContainers stops and removes all the containers given by the containersIDs slice.
func (*Client) SubmitContainers ¶ added in v0.2.0
func (client *Client) SubmitContainers(c context.Context, containersConfigs []types.ContainerConfig) *Error
SubmitContainers allows 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 ¶ added in v0.2.0
func DefaultConfig(caravelaInstanceIP string) *Configuration
DefaultConfig creates a new configuration structure with the default values.
func (*Configuration) CaravelaInstanceIP ¶
func (config *Configuration) CaravelaInstanceIP() string
CaravelaInstanceIP returns the IP address to where send the API requests.
func (*Configuration) CaravelaInstancePort ¶
func (config *Configuration) CaravelaInstancePort() int
CaravelaInstancePort returns the port to where send the API requests.
func (*Configuration) RequestTimeout ¶ added in v0.2.0
func (config *Configuration) RequestTimeout() time.Duration
RequestTimeout returns the timeout for the API requests.
func (*Configuration) SetCaravelaInstancePort ¶ added in v0.2.0
func (config *Configuration) SetCaravelaInstancePort(newPort int)
SetCaravelaInstancePort sets the port to where send the API requests.
func (*Configuration) SetRequestTimeout ¶ added in v0.2.0
func (config *Configuration) SetRequestTimeout(newReqTimeout time.Duration)
SetRequestTimeout sets the timeout for the API requests.