pools

package
v0.3.42 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2021 License: MPL-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Create

func Create(c *gcorecloud.ServiceClient, clusterID string, opts CreateOptsBuilder) (r tasks.Result)

Create accepts a CreateOpts struct and creates a new cluster Pool using the values provided. This operation does not actually require a request body, i.e. the CreateOpts struct argument can be empty.

func Delete

func Delete(c *gcorecloud.ServiceClient, clusterID, poolID string) (r tasks.Result)

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

func ExtractClusterPoolIDFromTask

func ExtractClusterPoolIDFromTask(task *tasks.Task) (string, error)

func ExtractClusterPoolsInto

func ExtractClusterPoolsInto(r pagination.Page, v interface{}) error

func Instances

func Instances(c *gcorecloud.ServiceClient, clusterID string, id string) pagination.Pager

Instances returns a Pager which allows you to iterate over a collection of pool instances.

func InstancesAll

func InstancesAll(c *gcorecloud.ServiceClient, clusterID, id string) ([]instances.Instance, error)

List returns all pool instances.

func List

List returns a Pager which allows you to iterate over a collection of cluster pools. It accepts a ListOpts struct, which allows you to filter and sort the returned collection for greater efficiency.

func Volumes

func Volumes(c *gcorecloud.ServiceClient, clusterID string, id string) pagination.Pager

Volumes returns a Pager which allows you to iterate over a collection of pool instances.

func VolumesAll

func VolumesAll(c *gcorecloud.ServiceClient, clusterID, id string) ([]volumes.Volume, error)

List returns all pool volumes.

Types

type ClusterListPool

type ClusterListPool struct {
	UUID             string             `json:"uuid"`
	Name             string             `json:"name"`
	FlavorID         string             `json:"flavor_id"`
	ImageID          string             `json:"image_id"`
	NodeCount        int                `json:"node_count"`
	MinNodeCount     int                `json:"min_node_count"`
	MaxNodeCount     int                `json:"max_node_count"`
	DockerVolumeSize int                `json:"docker_volume_size"`
	DockerVolumeType volumes.VolumeType `json:"docker_volume_type"`
	IsDefault        bool               `json:"is_default"`
	StackID          string             `json:"stack_id"`
	Status           string             `json:"status"`
	Role             types.PoolRole     `json:"role"`
	CreatedAt        time.Time          `json:"created_at"`
	UpdatedAt        *time.Time         `json:"updated_at"`
}

ClusterListPool represents a cluster Pool in the list response.

func ExtractClusterPools

func ExtractClusterPools(r pagination.Page) ([]ClusterListPool, error)

ExtractClusterPools accepts a Page struct, specifically a ClusterPoolPage struct, and extracts the elements into a slice of ClusterPool structs. In other words, a generic collection is mapped into a relevant slice.

func ListAll

func ListAll(client *gcorecloud.ServiceClient, clusterID string, opts ListOptsBuilder) ([]ClusterListPool, error)

ListAll is a convenience function that returns a all cluster pools.

type ClusterPool

type ClusterPool struct {
	ClusterID     string            `json:"cluster_id"`
	ProjectID     string            `json:"project_id"`
	Labels        map[string]string `json:"labels"`
	NodeAddresses []net.IP          `json:"node_addresses"`
	StatusReason  string            `json:"status_reason"`
	*ClusterListPool
}

ClusterPool represents a cluster Pool.

type ClusterPoolPage

type ClusterPoolPage struct {
	pagination.LinkedPageBase
}

ClusterPoolPage is the page returned by a pager when traversing over a collection of networks.

func (ClusterPoolPage) IsEmpty

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

IsEmpty checks whether a ClusterPool struct is empty.

func (ClusterPoolPage) NextPageURL

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

NextPageURL is invoked when a paginated collection of cluster Pools 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 {
	Name             string             `json:"name" required:"true" validate:"required"`
	FlavorID         string             `json:"flavor_id" required:"true" validate:"required"`
	NodeCount        int                `json:"node_count" required:"true" validate:"required,gt=0"`
	DockerVolumeSize int                `json:"docker_volume_size,omitempty" validate:"omitempty,gt=0"`
	DockerVolumeType volumes.VolumeType `json:"docker_volume_type,omitempty" validate:"omitempty,enum"`
	MinNodeCount     int                `json:"min_node_count,omitempty" validate:"omitempty,gt=0,ltefield=NodeCount"`
	MaxNodeCount     int                `json:"max_node_count,omitempty" validate:"omitempty,gt=0,gtefield=MinNodeCount,gtefield=NodeCount"`
}

CreateOpts represents options used to create a cluster Pool.

func (CreateOpts) ToClusterPoolCreateMap

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

ToClusterPoolCreateMap builds a request body from CreateOpts.

func (CreateOpts) Validate

func (opts CreateOpts) Validate() error

Validate CreateOpts

type CreateOptsBuilder

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

CreateOptsBuilder allows extensions to add additional parameters to the Create request.

type GetResult

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

GetResult represents the result of a get operation. Call its Extract method to interpret it as a Pool.

func Get

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

Get retrieves a specific cluster pool based on its unique ID.

func (GetResult) Extract

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

Extract is a function that accepts a result and extracts a cluster Pool resource.

func (GetResult) ExtractInto

func (r GetResult) ExtractInto(v interface{}) error

type ListOpts

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

ListOpts allows the filtering and sorting of paginated collections through the API. Filtering is achieved by passing in struct field values that map to the cluster pools attributes you want to see returned. SortKey allows you to sort by a particular cluster pools attribute. SortDir sets the direction, and is either `asc' or `desc'. Marker and Limit are used for pagination.

func (ListOpts) ToClusterPoolsListQuery

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

ToClusterPoolsListQuery formats a ListOpts into a query string.

type ListOptsBuilder

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

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

type PoolTaskResult

type PoolTaskResult struct {
	K8sPools []string `json:"k8s_pools" mapstructure:"k8s_pools"`
}

type UpdateOpts

type UpdateOpts struct {
	Name         string `json:"name,omitempty" validate:"required_without_all=MinNodeCount MaxNodeCount,omitempty"`
	MinNodeCount int    `json:"min_node_count,omitempty" validate:"required_without_all=Name MaxNodeCount,omitempty,gt=0"`
	MaxNodeCount int    `json:"max_node_count,omitempty" validate:"required_without_all=Name MixNodeCount,omitempty,gt=0,gtefield=MinNodeCount"`
}

UpdateOpts represents options used to update a pool.

func (UpdateOpts) ToClusterPoolUpdateMap

func (opts UpdateOpts) ToClusterPoolUpdateMap() (map[string]interface{}, error)

ToClusterPoolUpdateMap builds a request body from UpdateOpts.

func (UpdateOpts) Validate

func (opts UpdateOpts) Validate() error

Validate UpdateOpts

type UpdateOptsBuilder

type UpdateOptsBuilder interface {
	ToClusterPoolUpdateMap() (map[string]interface{}, error)
}

UpdateOptsBuilder allows extensions to add additional parameters to the Update request.

type UpdateResult

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

UpdateResult represents the result of an update operation. Call its Extract method to interpret it as a Pool.

func Update

func Update(c *gcorecloud.ServiceClient, clusterID, poolID string, opts UpdateOptsBuilder) (r UpdateResult)

Update accepts a UpdateOpts struct and updates an existing Pool using the values provided.

func (UpdateResult) Extract

func (r UpdateResult) Extract() (*ClusterPool, error)

Extract is a function that accepts a result and extracts a cluster Pool resource.

func (UpdateResult) ExtractInto

func (r UpdateResult) ExtractInto(v interface{}) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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