common

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: 15 Imported by: 12

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Log = &consoleLogger{
	Logger: &logrus.Logger{
		Out: os.Stdout,
		Formatter: &logrus.TextFormatter{
			DisableTimestamp: true,
		},
		Hooks: make(logrus.LevelHooks),
		Level: logrus.WarnLevel,
	},
	ErrorContext: make(map[string]interface{}),
}

Log prints formatted, colored logs to the console

Functions

func BuildUserAgent

func BuildUserAgent() string

BuildUserAgent generates the user agent for the Carina client

func NewHTTPClient

func NewHTTPClient() *http.Client

NewHTTPClient return a custom HTTP client that allows for logging relevant information before and after the HTTP request.

Types

type Cluster

type Cluster interface {
	// GetID returns the cluster identifier
	GetID() string

	// GetName returns the cluster name
	GetName() string

	// GetTemplate returns the template used to create the cluster
	GetTemplate() ClusterTemplate

	// GetFlavor returns the flavor of the nodes in the cluster
	GetFlavor() string

	// GetNodes returns the number of nodes in the cluster
	GetNodes() string

	// GetStatus returns the status of the cluster
	GetStatus() string

	// GetStatusDetails returns additional information about the cluster's status.
	// For example, why the cluster is in a failed state.
	GetStatusDetails() string
}

Cluster is a common interface for clusters over multiple container orchestration engine APIs (magnum, make-swarm and make-coe)

type ClusterService

type ClusterService interface {
	// GetQuotas retrieves the quotas set for the account
	GetQuotas() (Quotas, error)

	// CreateCluster creates a new cluster
	CreateCluster(name string, template string, nodes int) (Cluster, error)

	// ListClusters retrieves all clusters
	ListClusters() ([]Cluster, error)

	// ListClusterTemplates retrieves available templates for creating a new cluster
	ListClusterTemplates() ([]ClusterTemplate, error)

	// GetCluster retrieves a cluster by its id or name (if unique)
	GetCluster(token string) (Cluster, error)

	// GetClusterCredentials retrieves the TLS certificates and configuration scripts for a cluster by its id or name (if unique)
	GetClusterCredentials(token string) (*libcarina.CredentialsBundle, error)

	// ResizeCluster resizes the cluster to the specified number of nodes
	ResizeCluster(token string, nodes int) (Cluster, error)

	// RebuildCluster destroys and recreates the cluster by its id or name (if unique)
	RebuildCluster(token string) (Cluster, error)

	// DeleteCluster permanently deletes a cluster by its id or name (if unique)
	DeleteCluster(token string) (Cluster, error)

	// GrowCluster adds nodes to a cluster by its id or name (if unique)
	GrowCluster(token string, nodes int) (Cluster, error)

	// SetAutoScale enables or disables autoscaling on a cluster by its id or name (if unique)
	SetAutoScale(token string, value bool) (Cluster, error)

	// WaitUntilClusterIsActive polls the cluster status until either an active or error state is hit
	WaitUntilClusterIsActive(cluster Cluster) (Cluster, error)

	// WaitUntilClusterIsDeleted polls the cluster status until either the cluster is gone or an error state is hit
	WaitUntilClusterIsDeleted(cluster Cluster) error
}

ClusterService is a common interface over multiple container orchestration engine APIs (magnum, make-swarm and make-coe)

type ClusterTemplate

type ClusterTemplate interface {
	// GetName returns the unique template name
	GetName() string

	// GetCOE returns the container orchestration engine used by the cluster
	GetCOE() string

	// GetHostType returns the underlying type of the host nodes, such as lxc or vm
	GetHostType() string
}

ClusterTemplate is a common interface for templates over multiple container orchestration engine APIs (magnum, make-swarm and make-coe)

type HTTPLog

type HTTPLog struct {
	Logger *logrus.Logger
	// contains filtered or unexported fields
}

HTTPLog satisfies the http.RoundTripper interface and is used to customize the default Gophercloud RoundTripper to allow for logging.

func (*HTTPLog) RoundTrip

func (hl *HTTPLog) RoundTrip(request *http.Request) (*http.Response, error)

RoundTrip performs a round-trip HTTP request and logs relevant information about it.

type MultipleMatchingTemplatesError

type MultipleMatchingTemplatesError struct {
	TemplatePattern string
}

MultipleMatchingTemplatesError indicates when a template search was too broad and matched multiple templates

func (MultipleMatchingTemplatesError) Error

func (error MultipleMatchingTemplatesError) Error() string

Error returns the underlying error message

type Quotas

type Quotas interface {
	// GetMaxClusters returns the maximum number of clusters allowed on the account
	GetMaxClusters() int

	// GetMaxNodesPerCluster returns the maximum number of nodes allowed in a cluster on the account
	GetMaxNodesPerCluster() int
}

Quotas is a common interface for cluster quotas over multiple container orchestration engine APIs (magnum, make-swarm and make-coe)

Jump to

Keyboard shortcuts

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