bays

package
v0.0.0-...-b267f23 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2016 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package bays contains functionality for working with Magnum bay resources. A bay is a container orchestration engine capable of hosting containers, such as Docker.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func List

List returns a Pager which allows you to iterate over a collection of bays. It accepts a ListOptsBuilder, which allows you to sort the returned collection for greater efficiency.

Types

type Bay

type Bay struct {
	// UUID for the bay
	ID string `json:"uuid"`

	// Human-readable name for the bay. Might not be unique.
	Name string `json:"name"`

	// Indicates whether bay is currently operational. Possible values include:
	// CREATE_IN_PROGRESS, CREATE_FAILED, CREATE_COMPLETE, UPDATE_IN_PROGRESS, UPDATE_FAILED, UPDATE_COMPLETE,
	// DELETE_IN_PROGRESS, DELETE_FAILED, DELETE_COMPLETE, RESUME_COMPLETE, RESTORE_COMPLETE, ROLLBACK_COMPLETE,
	// SNAPSHOT_COMPLETE, CHECK_COMPLETE, ADOPT_COMPLETE.
	Status string `json:"status"`

	// Additional information on the bay status, such as why the bay is in a failed state.
	StatusReason string `json:"status_reason"`

	// The number of master nodes in the bay.
	Masters int `json:"master_count"`

	// The number of host nodes in the bay.
	Nodes int `json:"node_count"`

	// The UUID of the baymodel used to generate the bay.
	BayModelID string `json:"baymodel_id"`

	// The URL of the COE API.
	COEEndpoint string `json:"api_address"`

	// The IP addresses of the master nodes.
	MasterAddresses []string `json:"master_addresses"`

	// The IP addresses of the host nodes.
	NodeAddresses []string `json:"node_addresses"`

	// The version of the Docker client compatible with the bay.
	ContainerVersion string `json:"container_version"`
}

Represents a Container Orchestration Engine Bay, i.e. a cluster

func ExtractBays

func ExtractBays(r pagination.Page) ([]Bay, error)

ExtractBays accepts a Page struct, specifically a BayPage struct, and extracts the elements into a slice of Bay structs. In other words, a generic collection is mapped into a relevant slice.

type BayPage

type BayPage struct {
	pagination.LinkedPageBase
}

BayPage is the page returned by a pager when traversing over a collection of bays.

func (BayPage) IsEmpty

func (r BayPage) IsEmpty() (bool, error)

IsEmpty checks whether a BayPage struct is empty.

func (BayPage) NextPageURL

func (r BayPage) NextPageURL() (string, error)

NextPageURL is invoked when a paginated collection of bays has reached the end of a page and the pager seeks to traverse over a new one. In order to do this, it needs to construct the next page's URL.

type CreateOpts

type CreateOpts struct {
	BayModelID   string `json:"baymodel_id" required:"true"`
	Name         string `json:"name,omitempty"`
	Masters      int    `json:"master_count,omitempty"`
	Nodes        int    `json:"node_count,omitempty"`
	DiscoveryURL string `json:"discovery_url,omitempty"`
}

CreateOpts satisfies the CreateOptsBuilder interface

func (CreateOpts) ToBayCreateMap

func (opts CreateOpts) ToBayCreateMap() (map[string]interface{}, error)

ToBayCreateMap casts a CreateOpts struct to a map.

type CreateOptsBuilder

type CreateOptsBuilder interface {
	ToBayCreateMap() (map[string]interface{}, error)
}

CreateOptsBuilder is the interface options structs have to satisfy in order to be used in the main Create operation in this package. Since many extensions decorate or modify the common logic, it is useful for them to satisfy a basic interface in order for them to be used.

type CreateResult

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

CreateResult temporarily contains the response from a Create call.

func Create

Create accepts a CreateOpts struct and creates a new bay using the values provided.

func (CreateResult) Extract

func (r CreateResult) Extract() (*Bay, error)

Extract is a function that accepts a result and extracts a bay resource.

type DeleteResult

type DeleteResult struct {
	gophercloud.ErrResult
}

DeleteResult represents the result of a delete operation.

func Delete

func Delete(c *gophercloud.ServiceClient, bayID string) (r DeleteResult)

Delete accepts a unique ID and deletes the bay associated with it.

type GetResult

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

GetResult represents the result of a get operation.

func Get

func Get(c *gophercloud.ServiceClient, id string) (r GetResult)

Get retrieves a specific bay based on its unique ID.

func (GetResult) Extract

func (r GetResult) Extract() (*Bay, error)

Extract is a function that accepts a result and extracts a bay resource.

type ListOpts

type ListOpts struct {
	Marker  string `q:"marker"`
	Limit   int    `q:"limit"`
	SortKey string `q:"sort_key"`
	SortDir string `q:"sort_dir"`
}

ListOpts allows the sorting of paginated collections through the API. SortKey allows you to sort by a particular bay attribute. SortDir sets the direction, and is either `asc' or `desc'. Marker and Limit are used for pagination.

func (ListOpts) ToBayListQuery

func (opts ListOpts) ToBayListQuery() (string, error)

ToBayListQuery formats a ListOpts into a query string.

type ListOptsBuilder

type ListOptsBuilder interface {
	ToBayListQuery() (string, error)
}

ListOptsBuilder allows extensions to add additional parameters to the List request.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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