clusters

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: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Create

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

func Delete

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

Delete accepts cluster name and deletes the cluster associated with it.

func ExtractClustersInto

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

func ExtractVersionInto

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

func List

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

func ListInstances

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

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

func ListInstancesAll

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

ListInstancesAll is a convenience function that returns all cluster instances.

func Upgrade

func Upgrade(c *gcorecloud.ServiceClient, clusterID string, opts UpgradeOptsBuilder) (r tasks.Result)

Upgrade accepts a UpgradeOpts struct and upgrades an existing cluster using the values provided.

func Versions

Versions returns a Pager which allows you to iterate over a collection of supported cluster versions.

Types

type Certificate

type Certificate struct {
	Key         string `json:"key"`
	Certificate string `json:"certificate"`
}

Certificate represents a cluster CA certificate.

type CertificateResult

type CertificateResult struct {
	gcorecloud.Result
}

CertificateResult represents the result of a get certificate operation. Call its Extract method to interpret it as a Certificate.

func GetCertificate

func GetCertificate(c *gcorecloud.ServiceClient, clusterName string) (r CertificateResult)

GetCertificate accepts cluster name and returns the cluster CA certificate.

func (CertificateResult) Extract

func (r CertificateResult) Extract() (*Certificate, error)

Extract is a function that accepts a result and extracts a cluster CA certificate.

type Cluster

type Cluster struct {
	ID            string              `json:"id"`
	Name          string              `json:"name"`
	KeyPair       string              `json:"keypair"`
	NodeCount     int                 `json:"node_count"`
	FlavorID      string              `json:"flavor_id"`
	Status        string              `json:"status"`
	Pools         []pools.ClusterPool `json:"pools"`
	Version       string              `json:"version"`
	IsPublic      bool                `json:"is_public"`
	FixedNetwork  string              `json:"fixed_network"`
	FixedSubnet   string              `json:"fixed_subnet"`
	CreatedAt     time.Time           `json:"created_at"`
	CreatorTaskID string              `json:"creator_task_id"`
	TaskID        string              `json:"task_id"`
	ProjectID     int                 `json:"project_id"`
	RegionID      int                 `json:"region_id"`
	Region        string              `json:"region"`
}

Cluster represents a cluster structure.

func ExtractClusters

func ExtractClusters(r pagination.Page) ([]Cluster, error)

ExtractCluster accepts a Page struct, specifically a ClusterPage struct, and extracts the elements into a slice of ClusterListWithPool structs. In other words, a generic collection is mapped into a relevant slice.

func ListAll

func ListAll(c *gcorecloud.ServiceClient) ([]Cluster, error)

ListALL is a convenience function that returns all clusters.

type ClusterPage

type ClusterPage struct {
	pagination.LinkedPageBase
}

ClusterPage is the page returned by a pager when traversing over a collection of clusters.

func (ClusterPage) IsEmpty

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

IsEmpty checks whether a ClusterPage struct is empty.

func (ClusterPage) NextPageURL

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

NextPageURL is invoked when a paginated collection of clusters 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 Config

type Config struct {
	Config string `json:"config"`
}

Config represents a kubeconfig structure.

type ConfigResult

type ConfigResult struct {
	gcorecloud.Result
}

ConfigResult represents the result of a get config operation. Call its Extract method to interpret it as a Config.

func GetConfig

func GetConfig(c *gcorecloud.ServiceClient, clusterName string) (r ConfigResult)

GetConfig accepts cluster name and returns the cluster kubeconfig.

func (ConfigResult) Extract

func (r ConfigResult) Extract() (*Config, error)

Extract is a function that accepts a result and extracts a cluster config.

type CreateOpts

type CreateOpts struct {
	Name             string             `json:"name" required:"true" validate:"required,gt=0,lte=20"`
	FixedNetwork     string             `json:"fixed_network" validate:"omitempty,uuid4"`
	FixedSubnet      string             `json:"fixed_subnet" validate:"omitempty,uuid4"`
	PodsIPPool       *gcorecloud.CIDR   `json:"pods_ip_pool,omitempty" validate:"omitempty,cidr"`
	ServicesIPPool   *gcorecloud.CIDR   `json:"services_ip_pool,omitempty" validate:"omitempty,cidr"`
	PodsIPV6Pool     *gcorecloud.CIDR   `json:"pods_ipv6_pool,omitempty" validate:"omitempty,cidr"`
	ServicesIPV6Pool *gcorecloud.CIDR   `json:"services_ipv6_pool,omitempty" validate:"omitempty,cidr"`
	KeyPair          string             `json:"keypair" required:"true" validate:"required"`
	Version          string             `json:"version" required:"true" validate:"required"`
	IsIPV6           bool               `json:"is_ipv6,omitempty"`
	Pools            []pools.CreateOpts `json:"pools" required:"true" validate:"required,min=1,dive"`
}

CreateOpts represents options used to create a cluster.

func (CreateOpts) ToClusterCreateMap

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

ToClusterCreateMap builds a request body from CreateOpts.

type CreateOptsBuilder

type CreateOptsBuilder interface {
	ToClusterCreateMap() (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 Cluster.

func Get

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

Get retrieves a specific cluster based on its name.

func (GetResult) Extract

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

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

func (GetResult) ExtractInto

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

type UpgradeOpts

type UpgradeOpts struct {
	Version string `json:"version" required:"true"`
}

UpgradeOpts represents options used to upgrade a cluster.

func (UpgradeOpts) ToClusterUpgradeMap

func (opts UpgradeOpts) ToClusterUpgradeMap() (map[string]interface{}, error)

ToClusterUpgradeMap builds a request body from UpgradeOpts.

type UpgradeOptsBuilder

type UpgradeOptsBuilder interface {
	ToClusterUpgradeMap() (map[string]interface{}, error)
}

UpgradeOptsBuilder allows extensions to add additional parameters to the Upgrade request.

type Version

type Version struct {
	Version string `json:"version"`
}

Version represents a cluster version structure.

func ExtractVersions

func ExtractVersions(r pagination.Page) ([]Version, error)

ExtractVersions accepts a Page struct, specifically a VersionPage struct, and extracts the elements into a slice of Version structs.. In other words, a generic collection is mapped into a relevant slice.

func VersionsAll

func VersionsAll(c *gcorecloud.ServiceClient) ([]Version, error)

VersionsAll is a convenience function that returns all supported cluster versions.

type VersionPage

type VersionPage struct {
	pagination.LinkedPageBase
}

VersionPage is the page returned by a pager when traversing over a collection of cluster versions.

func (VersionPage) IsEmpty

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

IsEmpty checks whether a VersionPage struct is empty.

func (VersionPage) NextPageURL

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

NextPageURL is invoked when a paginated collection of clusters 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.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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