clusters

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2020 License: Apache-2.0 Imports: 5 Imported by: 10

Documentation

Overview

Package clusters provides information and interaction with the clusters through the OpenStack Clustering service.

Example to Create a Cluster

createOpts := clusters.CreateOpts{
	Name:            "test-cluster",
	DesiredCapacity: 1,
	ProfileID:       "b7b870ee-d3c5-4a93-b9d7-846c53b2c2da",
}

cluster, err := clusters.Create(serviceClient, createOpts).Extract()
if err != nil {
	panic(err)
}

Example to Get a Cluster

clusterName := "cluster123"
cluster, err := clusters.Get(serviceClient, clusterName).Extract()
if err != nil {
	panic(err)
}
fmt.Printf("%+v\n", cluster)

Example to List Clusters

listOpts := clusters.ListOpts{
	Name: "testcluster",
}

allPages, err := clusters.List(serviceClient, listOpts).AllPages()
if err != nil {
	panic(err)
}

allClusters, err := clusters.ExtractClusters(allPages)
if err != nil {
	panic(err)
}

for _, cluster := range allClusters {
	fmt.Printf("%+v\n", cluster)
}

Example to Update a Cluster

updateOpts := clusters.UpdateOpts{
	Name:       "testcluster",
	ProfileID:  "b7b870ee-d3c5-4a93-b9d7-846c53b2c2da",
}

clusterID := "7d85f602-a948-4a30-afd4-e84f47471c15"
cluster, err := clusters.Update(serviceClient, clusterName, opts).Extract()
if err != nil {
	panic(err)
}
fmt.Printf("%+v\n", cluster)

Example to Delete a Cluster

clusterID := "dc6d336e3fc4c0a951b5698cd1236ee"
err := clusters.Delete(serviceClient, clusterID).ExtractErr()
if err != nil {
	panic(err)
}

Example to Resize a Cluster

number := 1
maxSize := 5
minSize := 1
minStep := 1
strict := true

resizeOpts := clusters.ResizeOpts{
	AdjustmentType: clusters.ChangeInCapacityAdjustment,
	Number:         number,
	MaxSize:        &maxSize,
	MinSize:        &minSize,
	MinStep:        &minStep,
	Strict:         &strict,
}

actionID, err := clusters.Resize(client, clusterName, resizeOpts).Extract()
if err != nil {
	t.Fatalf("Unable to resize cluster: %v", err)
}
fmt.Println("Resize actionID", actionID)

Example to ScaleIn a Cluster

count := 2
scaleInOpts := clusters.ScaleInOpts{
	Count: &count,
}
clusterID:  "b7b870e3-d3c5-4a93-b9d7-846c53b2c2da"

action, err := clusters.ScaleIn(computeClient, clusterID, scaleInOpts).Extract()
if err != nil {
	panic(err)
}

Example to ScaleOut a cluster

scaleOutOpts := clusters.ScaleOutOpts{
	Count: 2,
}
clusterID := "b7b870e3-d3c5-4a93-b9d7-846c53b2c2da"

actionID, err := clusters.ScaleOut(computeClient, clusterID, scaleOutOpts).Extract()
if err != nil {
	panic(err)
}

Example to List Policies for a Cluster

clusterID := "7d85f602-a948-4a30-afd4-e84f47471c15"
allPages, err := clusters.ListPolicies(serviceClient, clusterID, nil).AllPages()
if err != nil {
	panic(err)
}

allClusterPolicies, err := clusters.ExtractClusterPolicies(allPages)
if err != nil {
	panic(err)
}

for _, clusterPolicy := range allClusterPolicies {
	fmt.Printf("%+v\n", clusterPolicy)
}

Example to Get a Cluster Policy

clusterID := "7d85f602-a948-4a30-afd4-e84f47471c15"
profileID := "714fe676-a08f-4196-b7af-61d52eeded15"
clusterPolicy, err := clusterpolicies.Get(serviceCLient, clusterID, profileID).Extract()
if err != nil {
	panic(err)
}

fmt.Printf("%+v\n", clusterPolicy)

Example to Attach a Policy to a Cluster

enabled := true
attachPolicyOpts := clusters.AttachPolicyOpts{
	PolicyID: "policy-123",
	Enabled:  &enabled,
}

clusterID := "b7b870e3-d3c5-4a93-b9d7-846c53b2c2da"
actionID, err := clusters.AttachPolicy(serviceClient, clusterID, attachPolicyOpts).Extract()
if err != nil {
	panic(err)
}

fmt.Println("Attach Policy actionID", actionID)

Example to Detach a Policy to Cluster

detachpolicyOpts := clusters.DetachPolicyOpts{
	PolicyID: "policy-123",
}

clusterID :=  "b7b870e3-d3c5-4a93-b9d7-846c53b2c2da"
actionID, err := clusters.DetachPolicy(serviceClient, clusterID, detachpolicyOpts).Extract()
if err != nil {
	panic(err)
}

fmt.Println("Update Policy actionID", actionID)

Example to Update a Policy to a Cluster

enabled := true
updatePolicyOpts := clusters.UpdatePolicyOpts{
	PolicyID: "policy-123",
	Enabled:  &enabled,
}

clusterID := "b7b870e3-d3c5-4a93-b9d7-846c53b2c2da"
actionID, err := clusters.UpdatePolicy(serviceClient, clusterID, updatePolicyOpts).Extract()
if err != nil {
	panic(err)
}

fmt.Println("Attach Policy actionID", actionID)

Example to Recover a Cluster

check := true
checkCapacity := true
recoverOpts := clusters.RecoverOpts{
	Operation:     clusters.RebuildRecovery,
	Check:         &check,
	CheckCapacity: &checkCapacity,
}

clusterID := "b7b870e3-d3c5-4a93-b9d7-846c53b2c2da"
actionID, err := clusters.Recover(computeClient, clusterID, recoverOpts).Extract()
if err != nil {
	panic(err)
}
fmt.Println("action=", actionID)

Example to Check a Cluster

clusterID :=  "b7b870e3-d3c5-4a93-b9d7-846c53b2c2da"
action, err := clusters.Check(computeClient, clusterID).Extract()
if err != nil {
	panic(err)
}

Example to Complete Life Cycle

clusterID :=  "b7b870e3-d3c5-4a93-b9d7-846c53b2c2da"
lifecycleOpts := clusters.CompleteLifecycleOpts{LifecycleActionTokenID: "2b827124-69e1-496e-9484-33ca769fe4df"}

action, err := clusters.CompleteLifecycle(computeClient, clusterID, lifecycleOpts).Extract()
if err != nil {
	panic(err)
}

Example to add nodes to a cluster

	addNodesOpts := clusters.AddNodesOpts{
		Nodes: []string{"node-123"},
	}
	clusterID := "b7b870e3-d3c5-4a93-b9d7-846c53b2c2da"
	actionID, err := clusters.AddNodes(serviceClient, clusterID, addNodesOpts).Extract()
	if err != nil {
		panic(err)
	}
    fmt.Println("action=", actionID)

Example to remove nodes from a cluster

removeNodesOpts := clusters.RemoveNodesOpts{
	Nodes: []string{"node-123"},
}
clusterID := "b7b870e3-d3c5-4a93-b9d7-846c53b2c2da"
err := clusters.RemoveNodes(serviceClient, clusterID, removeNodesOpts).ExtractErr()
if err != nil {
	panic(err)
}

Example to replace nodes for a cluster

replaceNodesOpts := clusters.ReplaceNodesOpts{
	Nodes: map[string]string{"node-1234": "node-5678"},
}
clusterID := "b7b870e3-d3c5-4a93-b9d7-846c53b2c2da"
actionID, err := clusters.ReplaceNodes(serviceClient, clusterID, replaceNodesOpts).Extract()
if err != nil {
	panic(err)
}

Example to collect node attributes across a cluster

serviceClient.Microversion = "1.2"
clusterID := "b7b870e3-d3c5-4a93-b9d7-846c53b2c2da"
opts := clusters.CollectOpts{
	Path: "status",
}
attrs, err := clusters.Collect(serviceClient, clusterID, opts).Extract()
if err != nil {
	panic(err)
}

Example to perform an operation on a cluster

serviceClient.Microversion = "1.4"
clusterID := "cluster123"
operationOpts := clusters.OperationOpts{
	Operation: clusters.RebootOperation,
	Filters:   clusters.OperationFilters{"role": "slave"},
	Params:    clusters.OperationParams{"type": "SOFT"},
}
actionID, err := clusters.Ops(serviceClient, clusterID, operationOpts).Extract()
if err != nil {
	panic(err)
}

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func List

List instructs OpenStack to provide a list of clusters.

func ListPolicies

func ListPolicies(client *gophercloud.ServiceClient, clusterID string, opts ListPoliciesOptsBuilder) pagination.Pager

ListPolicies instructs OpenStack to provide a list of policies for a cluster.

Types

type Action

type Action struct {
	Action string `json:"action"`
}

Action represents an OpenStack Clustering action.

type ActionResult

type ActionResult struct {
	gophercloud.Result
}

ActionResult is the response of Senlin actions. Call its Extract method to obtain the Action ID of the action.

func AddNodes

func AddNodes(client *gophercloud.ServiceClient, id string, opts AddNodesOpts) (r ActionResult)

func AttachPolicy

func AttachPolicy(client *gophercloud.ServiceClient, id string, opts AttachPolicyOptsBuilder) (r ActionResult)

Attach Policy will attach a policy to a cluster.

func Check

func Check(client *gophercloud.ServiceClient, id string) (r ActionResult)

Check will perform a health check on a cluster.

func CompleteLifecycle

func CompleteLifecycle(client *gophercloud.ServiceClient, id string, opts CompleteLifecycleOpts) (r ActionResult)

func DetachPolicy

func DetachPolicy(client *gophercloud.ServiceClient, id string, opts DetachPolicyOptsBuilder) (r ActionResult)

DetachPolicy will detach a policy from a cluster.

func Ops

func Recover

func Recover(client *gophercloud.ServiceClient, id string, opts RecoverOptsBuilder) (r ActionResult)

Recover implements cluster recover request.

func ReplaceNodes

func ReplaceNodes(client *gophercloud.ServiceClient, id string, opts ReplaceNodesOpts) (r ActionResult)

func Resize

func Resize(client *gophercloud.ServiceClient, id string, opts ResizeOptsBuilder) (r ActionResult)

func ScaleIn

func ScaleIn(client *gophercloud.ServiceClient, id string, opts ScaleInOptsBuilder) (r ActionResult)

ScaleIn will reduce the capacity of a cluster.

func ScaleOut

func ScaleOut(client *gophercloud.ServiceClient, id string, opts ScaleOutOptsBuilder) (r ActionResult)

ScaleOut will increase the capacity of a cluster.

func UpdatePolicy

func UpdatePolicy(client *gophercloud.ServiceClient, id string, opts UpdatePolicyOptsBuilder) (r ActionResult)

UpdatePolicy will update a cluster's policy.

func (ActionResult) Extract

func (r ActionResult) Extract() (string, error)

Extract interprets any Action result as an Action.

type AddNodesOpts

type AddNodesOpts struct {
	Nodes []string `json:"nodes" required:"true"`
}

func (AddNodesOpts) ToClusterAddNodeMap

func (opts AddNodesOpts) ToClusterAddNodeMap() (map[string]interface{}, error)

type AdjustmentType

type AdjustmentType string

AdjustmentType represents valid values for resizing a cluster.

const (
	ExactCapacityAdjustment      AdjustmentType = "EXACT_CAPACITY"
	ChangeInCapacityAdjustment   AdjustmentType = "CHANGE_IN_CAPACITY"
	ChangeInPercentageAdjustment AdjustmentType = "CHANGE_IN_PERCENTAGE"
)

type AttachPolicyOpts

type AttachPolicyOpts struct {
	PolicyID string `json:"policy_id" required:"true"`
	Enabled  *bool  `json:"enabled,omitempty"`
}

PolicyOpts params

func (AttachPolicyOpts) ToClusterAttachPolicyMap

func (opts AttachPolicyOpts) ToClusterAttachPolicyMap() (map[string]interface{}, error)

ToClusterAttachPolicyMap constructs a request body from AttachPolicyOpts.

type AttachPolicyOptsBuilder

type AttachPolicyOptsBuilder interface {
	ToClusterAttachPolicyMap() (map[string]interface{}, error)
}

AttachPolicyOptsBuilder allows extensions to add additional parameters to the AttachPolicy request.

type Cluster

type Cluster struct {
	Config          map[string]interface{} `json:"config"`
	CreatedAt       time.Time              `json:"-"`
	Data            map[string]interface{} `json:"data"`
	Dependents      map[string]interface{} `json:"dependents"`
	DesiredCapacity int                    `json:"desired_capacity"`
	Domain          string                 `json:"domain"`
	ID              string                 `json:"id"`
	InitAt          time.Time              `json:"-"`
	MaxSize         int                    `json:"max_size"`
	Metadata        map[string]interface{} `json:"metadata"`
	MinSize         int                    `json:"min_size"`
	Name            string                 `json:"name"`
	Nodes           []string               `json:"nodes"`
	Policies        []string               `json:"policies"`
	ProfileID       string                 `json:"profile_id"`
	ProfileName     string                 `json:"profile_name"`
	Project         string                 `json:"project"`
	Status          string                 `json:"status"`
	StatusReason    string                 `json:"status_reason"`
	Timeout         int                    `json:"timeout"`
	UpdatedAt       time.Time              `json:"-"`
	User            string                 `json:"user"`
}

Cluster represents an OpenStack Clustering cluster.

func ExtractClusters

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

ExtractClusters returns a slice of Clusters from the List operation.

func (*Cluster) UnmarshalJSON

func (r *Cluster) UnmarshalJSON(b []byte) error

type ClusterAttributes

type ClusterAttributes struct {
	ID    string      `json:"id"`
	Value interface{} `json:"value"`
}

type ClusterPage

type ClusterPage struct {
	pagination.LinkedPageBase
}

ClusterPage contains a single page of all clusters from a List call.

func (ClusterPage) IsEmpty

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

IsEmpty determines whether or not a page of Clusters contains any results.

type ClusterPolicy

type ClusterPolicy struct {
	ClusterID   string `json:"cluster_id"`
	ClusterName string `json:"cluster_name"`
	Enabled     bool   `json:"enabled"`
	ID          string `json:"id"`
	PolicyID    string `json:"policy_id"`
	PolicyName  string `json:"policy_name"`
	PolicyType  string `json:"policy_type"`
}

ClusterPolicy represents and OpenStack Clustering cluster policy.

func ExtractClusterPolicies

func ExtractClusterPolicies(r pagination.Page) ([]ClusterPolicy, error)

ExtractClusterPolicies returns a slice of ClusterPolicies from the ListClusterPolicies operation.

type ClusterPolicyPage

type ClusterPolicyPage struct {
	pagination.SinglePageBase
}

ClusterPolicyPage contains a single page of all policies from a List call

func (ClusterPolicyPage) IsEmpty

func (page ClusterPolicyPage) IsEmpty() (bool, error)

IsEmpty determines whether or not a page of ClusterPolicies contains any results.

type CollectOpts

type CollectOpts struct {
	Path string `q:"path" required:"true"`
}

CollectOpts represents options to collect attribute values across a cluster

func (CollectOpts) ToClusterCollectMap

func (opts CollectOpts) ToClusterCollectMap() (string, error)

type CollectOptsBuilder

type CollectOptsBuilder interface {
	ToClusterCollectMap() (string, error)
}

type CollectResult

type CollectResult struct {
	gophercloud.Result
}

func Collect

func Collect(client *gophercloud.ServiceClient, id string, opts CollectOptsBuilder) (r CollectResult)

Collect instructs OpenStack to aggregate attribute values across a cluster

func (CollectResult) Extract

func (r CollectResult) Extract() ([]ClusterAttributes, error)

Extract returns collected attributes across a cluster

type CompleteLifecycleOpts

type CompleteLifecycleOpts struct {
	LifecycleActionTokenID string `json:"lifecycle_action_token" required:"true"`
}

func (CompleteLifecycleOpts) ToClusterCompleteLifecycleMap

func (opts CompleteLifecycleOpts) ToClusterCompleteLifecycleMap() (map[string]interface{}, error)

ToClusterCompleteLifecycleMap constructs a request body from CompleteLifecycleOpts.

type CreateOpts

type CreateOpts struct {
	Name            string                 `json:"name" required:"true"`
	DesiredCapacity int                    `json:"desired_capacity"`
	ProfileID       string                 `json:"profile_id" required:"true"`
	MinSize         *int                   `json:"min_size,omitempty"`
	Timeout         int                    `json:"timeout,omitempty"`
	MaxSize         int                    `json:"max_size,omitempty"`
	Metadata        map[string]interface{} `json:"metadata,omitempty"`
	Config          map[string]interface{} `json:"config,omitempty"`
}

CreateOpts represents options used to create a cluster.

func (CreateOpts) ToClusterCreateMap

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

ToClusterCreateMap constructs 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 CreateResult

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

CreateResult is the response of a Create operations. Call its Extract method to interpret it as a Cluster.

func Create

func Create(client *gophercloud.ServiceClient, opts CreateOptsBuilder) (r CreateResult)

Create requests the creation of a new cluster.

func (CreateResult) Extract

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

Extract interprets any commonResult-based result as a Cluster.

type DeleteResult

type DeleteResult struct {
	gophercloud.ErrResult
}

DeleteResult is the result from a Delete operation. Call its ExtractErr method to determine if the call succeeded or failed.

func Delete

func Delete(client *gophercloud.ServiceClient, id string) (r DeleteResult)

Delete deletes the specified cluster ID.

func RemoveNodes

func RemoveNodes(client *gophercloud.ServiceClient, clusterID string, opts RemoveNodesOpts) (r DeleteResult)

type DetachPolicyOpts

type DetachPolicyOpts struct {
	PolicyID string `json:"policy_id" required:"true"`
}

DetachPolicyOpts represents options used to detach a policy from a cluster.

func (DetachPolicyOpts) ToClusterDetachPolicyMap

func (opts DetachPolicyOpts) ToClusterDetachPolicyMap() (map[string]interface{}, error)

ToClusterDetachPolicyMap constructs a request body from DetachPolicyOpts.

type DetachPolicyOptsBuilder

type DetachPolicyOptsBuilder interface {
	ToClusterDetachPolicyMap() (map[string]interface{}, error)
}

DetachPolicyOptsBuilder allows extensions to add additional parameters to the DetachPolicy request.

type GetPolicyResult

type GetPolicyResult struct {
	gophercloud.Result
}

GetPolicyResult is the response of a Get operations. Call its Extract method to interpret it as a ClusterPolicy.

func GetPolicy

func GetPolicy(client *gophercloud.ServiceClient, clusterID string, policyID string) (r GetPolicyResult)

GetPolicy retrieves details of a cluster policy.

func (GetPolicyResult) Extract

func (r GetPolicyResult) Extract() (*ClusterPolicy, error)

Extract interprets a GetPolicyResult as a ClusterPolicy.

type GetResult

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

GetResult is the response of a Get operations. Call its Extract method to interpret it as a Cluster.

func Get

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

Get retrieves details of a single cluster.

func (GetResult) Extract

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

Extract interprets any commonResult-based result as a Cluster.

type ListOpts

type ListOpts struct {
	Limit         int    `q:"limit"`
	Marker        string `q:"marker"`
	Sort          string `q:"sort"`
	GlobalProject *bool  `q:"global_project"`
	Name          string `q:"name,omitempty"`
	Status        string `q:"status,omitempty"`
}

ListOpts represents options to list clusters.

func (ListOpts) ToClusterListQuery

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

ToClusterListQuery formats a ListOpts into a query string.

type ListOptsBuilder

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

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

type ListPoliciesOpts

type ListPoliciesOpts struct {
	Enabled *bool  `q:"enabled"`
	Name    string `q:"policy_name"`
	Type    string `q:"policy_type"`
	Sort    string `q:"sort"`
}

ListPoliciesOpts represents options to list a cluster's policies.

func (ListPoliciesOpts) ToClusterPoliciesListQuery

func (opts ListPoliciesOpts) ToClusterPoliciesListQuery() (string, error)

ToClusterPoliciesListQuery formats a ListOpts into a query string.

type ListPoliciesOptsBuilder

type ListPoliciesOptsBuilder interface {
	ToClusterPoliciesListQuery() (string, error)
}

ListPolicyOptsBuilder allows extensions to add additional parameters to the ListPolicies request.

type OperationFilters

type OperationFilters map[string]interface{}

type OperationName

type OperationName string

OperationName represents valid values for cluster operation

const (
	// Nova Profile Op Names
	RebootOperation         OperationName = "reboot"
	RebuildOperation        OperationName = "rebuild"
	ChangePasswordOperation OperationName = "change_password"
	PauseOperation          OperationName = "pause"
	UnpauseOperation        OperationName = "unpause"
	SuspendOperation        OperationName = "suspend"
	ResumeOperation         OperationName = "resume"
	LockOperation           OperationName = "lock"
	UnlockOperation         OperationName = "unlock"
	StartOperation          OperationName = "start"
	StopOperation           OperationName = "stop"
	RescueOperation         OperationName = "rescue"
	UnrescueOperation       OperationName = "unrescue"
	EvacuateOperation       OperationName = "evacuate"

	// Heat Pofile Op Names
	AbandonOperation OperationName = "abandon"
)

type OperationOpts

type OperationOpts struct {
	Operation OperationName    `json:"operation" required:"true"`
	Filters   OperationFilters `json:"filters,omitempty"`
	Params    OperationParams  `json:"params,omitempty"`
}

OperationOpts represents options used to perform an operation on a cluster

func (OperationOpts) ToClusterOperationMap

func (opts OperationOpts) ToClusterOperationMap() (map[string]interface{}, error)

ToClusterOperationMap constructs a request body from OperationOpts.

type OperationOptsBuilder

type OperationOptsBuilder interface {
	ToClusterOperationMap() (map[string]interface{}, error)
}

OperationOptsBuilder allows extensions to add additional parameters to the Op request.

type OperationParams

type OperationParams map[string]interface{}

type RecoverOpts

type RecoverOpts struct {
	Operation     RecoveryAction `json:"operation,omitempty"`
	Check         *bool          `json:"check,omitempty"`
	CheckCapacity *bool          `json:"check_capacity,omitempty"`
}

RecoverOpts represents options used to recover a cluster.

func (RecoverOpts) ToClusterRecoverMap

func (opts RecoverOpts) ToClusterRecoverMap() (map[string]interface{}, error)

ToClusterRecovermap constructs a request body from RecoverOpts.

type RecoverOptsBuilder

type RecoverOptsBuilder interface {
	ToClusterRecoverMap() (map[string]interface{}, error)
}

RecoverOptsBuilder allows extensions to add additional parameters to the Recover request.

type RecoveryAction

type RecoveryAction string

RecoveryAction represents valid values for recovering a cluster.

const (
	RebootRecovery   RecoveryAction = "REBOOT"
	RebuildRecovery  RecoveryAction = "REBUILD"
	RecreateRecovery RecoveryAction = "RECREATE"
)

type RemoveNodesOpts

type RemoveNodesOpts struct {
	Nodes []string `json:"nodes" required:"true"`
}

func (RemoveNodesOpts) ToClusterRemoveNodeMap

func (opts RemoveNodesOpts) ToClusterRemoveNodeMap() (map[string]interface{}, error)

type ReplaceNodesOpts

type ReplaceNodesOpts struct {
	Nodes map[string]string `json:"nodes" required:"true"`
}

func (ReplaceNodesOpts) ToClusterReplaceNodeMap

func (opts ReplaceNodesOpts) ToClusterReplaceNodeMap() (map[string]interface{}, error)

type ResizeOpts

type ResizeOpts struct {
	AdjustmentType AdjustmentType `json:"adjustment_type,omitempty"`
	Number         interface{}    `json:"number,omitempty"`
	MinSize        *int           `json:"min_size,omitempty"`
	MaxSize        *int           `json:"max_size,omitempty"`
	MinStep        *int           `json:"min_step,omitempty"`
	Strict         *bool          `json:"strict,omitempty"`
}

ResizeOpts represents options for resizing a cluster.

func (ResizeOpts) ToClusterResizeMap

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

ToClusterResizeMap constructs a request body from ResizeOpts.

type ResizeOptsBuilder

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

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

type ScaleInOpts

type ScaleInOpts struct {
	Count *int `json:"count,omitempty"`
}

ScaleInOpts represents options used to scale-in a cluster.

func (ScaleInOpts) ToClusterScaleInMap

func (opts ScaleInOpts) ToClusterScaleInMap() (map[string]interface{}, error)

ToClusterScaleInMap constructs a request body from ScaleInOpts.

type ScaleInOptsBuilder

type ScaleInOptsBuilder interface {
	ToClusterScaleInMap() (map[string]interface{}, error)
}

ScaleInOptsBuilder allows extensions to add additional parameters to the ScaleIn request.

type ScaleOutOpts

type ScaleOutOpts struct {
	Count int `json:"count,omitempty"`
}

ScaleOutOpts represents options used to scale-out a cluster.

func (ScaleOutOpts) ToClusterScaleOutMap

func (opts ScaleOutOpts) ToClusterScaleOutMap() (map[string]interface{}, error)

ToClusterScaleOutMap constructs a request body from ScaleOutOpts.

type ScaleOutOptsBuilder

type ScaleOutOptsBuilder interface {
	ToClusterScaleOutMap() (map[string]interface{}, error)
}

ScaleOutOptsBuilder allows extensions to add additional parameters to the ScaleOut request.

type UpdateOpts

type UpdateOpts struct {
	Config      string                 `json:"config,omitempty"`
	Name        string                 `json:"name,omitempty"`
	ProfileID   string                 `json:"profile_id,omitempty"`
	Timeout     *int                   `json:"timeout,omitempty"`
	Metadata    map[string]interface{} `json:"metadata,omitempty"`
	ProfileOnly *bool                  `json:"profile_only,omitempty"`
}

UpdateOpts represents options to update a cluster.

func (UpdateOpts) ToClusterUpdateMap

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

ToClusterUpdateMap assembles a request body based on the contents of UpdateOpts.

type UpdateOptsBuilder

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

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

type UpdatePolicyOpts

type UpdatePolicyOpts struct {
	PolicyID string `json:"policy_id" required:"true"`
	Enabled  *bool  `json:"enabled,omitempty" required:"true"`
}

UpdatePolicyOpts represents options used to update a cluster policy.

func (UpdatePolicyOpts) ToClusterUpdatePolicyMap

func (opts UpdatePolicyOpts) ToClusterUpdatePolicyMap() (map[string]interface{}, error)

ToClusterUpdatePolicyMap constructs a request body from UpdatePolicyOpts.

type UpdatePolicyOptsBuilder

type UpdatePolicyOptsBuilder interface {
	ToClusterUpdatePolicyMap() (map[string]interface{}, error)
}

UpdatePolicyOptsBuilder allows extensions to add additional parameters to the UpdatePolicy request.

type UpdateResult

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

UpdateResult is the response of a Update operations. Call its Extract method to interpret it as a Cluster.

func Update

func Update(client *gophercloud.ServiceClient, id string, opts UpdateOptsBuilder) (r UpdateResult)

Update will update an existing cluster.

func (UpdateResult) Extract

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

Extract interprets any commonResult-based result as a Cluster.

Directories

Path Synopsis
clustering_clusters_v1
clustering_clusters_v1

Jump to

Keyboard shortcuts

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