pools

package
v0.6.28 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2024 License: MPL-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Create

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

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

func Delete

func Delete(c *gcorecloud.ServiceClient, clusterName, poolName string) (r tasks.Result)

Delete accepts a pool name 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 List

func List(c *gcorecloud.ServiceClient, clusterName string) pagination.Pager

List returns a Pager which allows you to iterate over a collection of cluster pools.

func ListInstances

func ListInstances(c *gcorecloud.ServiceClient, clusterName, poolName string) pagination.Pager

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

func ListInstancesAll

func ListInstancesAll(c *gcorecloud.ServiceClient, clusterName, poolName string) ([]instances.Instance, error)

List returns all pool instances.

func Resize

func Resize(c *gcorecloud.ServiceClient, clusterName, poolName string, opts ResizeOptsBuilder) (r tasks.Result)

Resize accepts a ResizeOpts struct and resizes an existing cluster using the values provided.

Types

type ClusterPool

type ClusterPool struct {
	ID                 string             `json:"id"`
	Name               string             `json:"name"`
	FlavorID           string             `json:"flavor_id"`
	NodeCount          int                `json:"node_count"`
	MinNodeCount       int                `json:"min_node_count"`
	MaxNodeCount       int                `json:"max_node_count"`
	Status             string             `json:"status"`
	BootVolumeType     volumes.VolumeType `json:"boot_volume_type"`
	BootVolumeSize     int                `json:"boot_volume_size"`
	AutoHealingEnabled bool               `json:"auto_healing_enabled"`
	CreatedAt          time.Time          `json:"created_at"`
	IsPublicIPv4       bool               `json:"is_public_ipv4"`
}

ClusterPool represents a cluster pool.

func ExtractClusterPools

func ExtractClusterPools(r pagination.Page) ([]ClusterPool, 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, clusterName string) ([]ClusterPool, error)

ListAll is a convenience function that returns all cluster pools.

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"`
	MinNodeCount       int                `json:"min_node_count" required:"true" validate:"required,gt=0,ltefield=MaxNodeCount"`
	MaxNodeCount       int                `json:"max_node_count,omitempty" validate:"omitempty,gt=0,gtefield=MinNodeCount"`
	BootVolumeSize     int                `json:"boot_volume_size,omitempty" validate:"omitempty,gt=0"`
	BootVolumeType     volumes.VolumeType `json:"boot_volume_type,omitempty" validate:"omitempty,enum"`
	AutoHealingEnabled bool               `json:"auto_healing_enabled,omitempty"`
	IsPublicIPv4       bool               `json:"is_public_ipv4,omitempty"`
}

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 ClusterPool.

func Get

func Get(c *gcorecloud.ServiceClient, clusterName, poolName string) (r GetResult)

Get retrieves a specific cluster pool based on its name.

func (GetResult) Extract

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

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

func (GetResult) ExtractInto

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

type PoolTaskResult

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

type ResizeOpts

type ResizeOpts struct {
	NodeCount int `json:"node_count" required:"true" validate:"required,gt=0,lte=20"`
}

ResizeOpts represents options used to update a cluster.

func (ResizeOpts) ToClusterPoolResizeMap

func (opts ResizeOpts) ToClusterPoolResizeMap() (map[string]interface{}, error)

ToClusterPoolResizeMap builds a request body from ResizeOpts.

func (ResizeOpts) Validate

func (opts ResizeOpts) Validate() error

Validate ResizeOpts

type ResizeOptsBuilder

type ResizeOptsBuilder interface {
	ToClusterPoolResizeMap() (map[string]interface{}, error)
}

ResizeOptsBuilder allows extensions to add additional parameters to the Resize request.

type UpdateOpts

type UpdateOpts struct {
	AutoHealingEnabled bool `json:"auto_healing_enabled,omitempty"`
	MinNodeCount       int  `json:"min_node_count,omitempty" validate:"omitempty,gt=0,lte=20,ltefield=MaxNodeCount"`
	MaxNodeCount       int  `json:"max_node_count,omitempty" validate:"omitempty,gt=0,lte=20,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 ClusterPool.

func Update

func Update(c *gcorecloud.ServiceClient, clusterName, poolName string, opts UpdateOptsBuilder) (r UpdateResult)

Update accepts an UpdateOpts struct and updates an existing cluster 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 ClusterPool 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