client

package
v2.1.3+incompatible Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2017 License: Apache-2.0 Imports: 13 Imported by: 2

Documentation

Index

Constants

View Source
const CarinaHomeDirEnvVar = "CARINA_HOME"

CarinaHomeDirEnvVar is the environment variable name for carina data, config, etc.

View Source
const CloudMagnum = "private"

CloudMagnum is the Rackspace Private Cloud Magnum cloud type

View Source
const CloudMakeCOE = "public"

CloudMakeCOE is the v2 Carina (make-coe) cloud type

View Source
const CloudMakeSwarm = "make-swarm"

CloudMakeSwarm is the v1 Carina (make-swarm) cloud type

Variables

This section is empty.

Functions

func CredentialsNextStepsString

func CredentialsNextStepsString(clusterName string) string

CredentialsNextStepsString returns instructions to load the cluster credentials

func GetCredentialsDir

func GetCredentialsDir() (string, error)

GetCredentialsDir gets the carina home directory, e.g. ~/.carina

Types

type Account

type Account interface {
	Cacheable

	// GetID returns a unique string to identity to the account's credentials
	GetID() string

	// GetClusterPrefix returns a unique string to identity the account's clusters
	GetClusterPrefix() (string, error)

	// NewClusterService create the appropriate ClusterService for the account
	NewClusterService() common.ClusterService
}

Account contains the data required to communicate with a Carina API instance

type Cache

type Cache struct {
	sync.Mutex

	LastUpdateCheck time.Time            `json:"last-check"`
	Accounts        map[string]cacheItem `json:"accounts"`
	// contains filtered or unexported fields
}

Cache is an on-disk cache of transient application values

func (*Cache) SaveAccount

func (cache *Cache) SaveAccount(account Account) error

SaveAccount caches transient account data, such as the auth token

func (*Cache) SaveLastUpdateCheck

func (cache *Cache) SaveLastUpdateCheck(timestamp time.Time) error

SaveLastUpdateCheck caches the last time that we checked for updates

type CacheUnavailableError

type CacheUnavailableError struct {
	// contains filtered or unexported fields
}

CacheUnavailableError explains why the on-disk cache is unavailable

func (CacheUnavailableError) Cause

func (error CacheUnavailableError) Cause() error

Cause returns the underlying cause of the error

func (CacheUnavailableError) Error

func (error CacheUnavailableError) Error() string

Error returns the underlying error message

type Cacheable

type Cacheable interface {
	// BuildCache builds the set of data to cache
	BuildCache() map[string]string

	// ApplyCache applies a set of cached data
	ApplyCache(c map[string]string)
}

Cacheable represents an item that can be stored in a serialized cache

type Client

type Client struct {
	Cache *Cache
	Error error
}

Client is the multi-cloud Carina client, which coordinates communication with all Carina-esque clouds

func NewClient

func NewClient(cacheEnabled bool) *Client

NewClient builds a new Carina client

func (*Client) CreateCluster

func (client *Client) CreateCluster(account Account, name string, template string, nodes int, waitUntilActive bool) (common.Cluster, error)

CreateCluster creates a new cluster and prints the cluster information

func (*Client) DeleteCluster

func (client *Client) DeleteCluster(account Account, name string, waitUntilDeleted bool) error

DeleteCluster deletes a cluster

func (*Client) DeleteClusterCredentials

func (client *Client) DeleteClusterCredentials(account Account, name string, customPath string) error

DeleteClusterCredentials removes a cluster's downloaded credentials

func (*Client) DownloadClusterCredentials

func (client *Client) DownloadClusterCredentials(account Account, name string, customPath string) (credentialsPath string, err error)

DownloadClusterCredentials downloads the TLS certificates and configuration scripts for a cluster

func (*Client) GetCluster

func (client *Client) GetCluster(account Account, name string, waitUntilActive bool) (common.Cluster, error)

GetCluster retrieves a cluster

func (*Client) GetQuotas

func (client *Client) GetQuotas(account Account) (common.Quotas, error)

GetQuotas retrieves the quotas set for the account

func (*Client) GetSourceCommand

func (client *Client) GetSourceCommand(account Account, shell string, name string, customPath string) (sourceText string, err error)

GetSourceCommand returns the shell command and appropriate help text to load a cluster's credentials

func (*Client) GrowCluster

func (client *Client) GrowCluster(account Account, name string, nodes int, waitUntilActive bool) (common.Cluster, error)

GrowCluster adds nodes to a cluster

func (*Client) ListClusterTemplates

func (client *Client) ListClusterTemplates(account Account, nameFilter string) ([]common.ClusterTemplate, error)

ListClusterTemplates retrieves available templates for creating a new cluster

func (*Client) ListClusters

func (client *Client) ListClusters(account Account) ([]common.Cluster, error)

ListClusters retrieves all clusters

func (*Client) RebuildCluster

func (client *Client) RebuildCluster(account Account, name string, waitUntilActive bool) (common.Cluster, error)

RebuildCluster destroys and recreates the cluster

func (*Client) ResizeCluster

func (client *Client) ResizeCluster(account Account, name string, nodes int, waitUntilActive bool) (common.Cluster, error)

ResizeCluster resizes the cluster to the specified number of nodes

func (*Client) SetAutoScale

func (client *Client) SetAutoScale(account Account, name string, value bool) (common.Cluster, error)

SetAutoScale adds nodes to a cluster

type UserError

type UserError struct {
	Context map[string]interface{}
	// contains filtered or unexported fields
}

UserError is a user-ready error container

func (*UserError) Cause

func (err *UserError) Cause() error

Cause returns the underlying cause of the error, if possible.

func (*UserError) Error

func (err *UserError) Error() string

Jump to

Keyboard shortcuts

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