clusters

package
v0.9.5 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2025 License: Apache-2.0 Imports: 8 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ChangeClusterName added in v0.9.4

func ChangeClusterName(client *golangsdk.ServiceClient, clusterID string, opts ChangeClusterNameOpts) error

ChangeClusterName function is used to change the name of a cluster.

func ChangePassword added in v0.9.4

func ChangePassword(client *golangsdk.ServiceClient, clusterID string, opts ChangePasswordOpts) (err error)

ChangePassword function is used to change the password of a cluster.

func Delete

func Delete(client *golangsdk.ServiceClient, id string) (err error)

func DisablePublicAccess added in v0.9.4

func DisablePublicAccess(client *golangsdk.ServiceClient, opts ManagePublicAccessOpts) (string, error)

DisablePublicAccess function is used to disable public network access

func DisablePublicWhitelist added in v0.9.4

func DisablePublicWhitelist(client *golangsdk.ServiceClient, clusterID string) error

DisablePublicWhitelist function is used to disable whitelist for a single ip

func DownloadCertificate

func DownloadCertificate(client *golangsdk.ServiceClient, clusterID string) (string, error)

func EnablePublicAccess added in v0.9.4

func EnablePublicAccess(client *golangsdk.ServiceClient, opts ManagePublicAccessOpts) (string, error)

EnablePublicAccess function is used to enable public network access

func EnablePublicWhitelist added in v0.9.4

func EnablePublicWhitelist(client *golangsdk.ServiceClient, clusterId, whitelist string) error

EnablePublicWhitelist function is used to enable public whitelist

func RestartCluster added in v0.9.4

func RestartCluster(client *golangsdk.ServiceClient, clusterID string) error

RestartCluster function is used to restart a cluster.

func ScaleInCluster added in v0.9.4

func ScaleInCluster(client *golangsdk.ServiceClient, clusterID string, opts []ScaleInOpts) error

ScaleInCluster scales in a cluster by removing specified nodes.

func UpdateClusterFlavor added in v0.9.4

func UpdateClusterFlavor(client *golangsdk.ServiceClient, clusterID string, opts ClusterFlavorOpts) error

UpdateClusterFlavor is used to modify the specifications of a cluster or specifications of a specified node type.

func UpdatePublicAccess added in v0.9.4

func UpdatePublicAccess(client *golangsdk.ServiceClient, opts ManagePublicAccessOpts) error

UpdatePublicAccess function is used to enable public network access

func UpdateSecurityGroup added in v0.9.4

func UpdateSecurityGroup(client *golangsdk.ServiceClient, clusterID string, opts SecurityGroupOpts) error

UpdateSecurityGroup - change the security group of a cluster.

func UpdateSecurityMode added in v0.9.4

func UpdateSecurityMode(client *golangsdk.ServiceClient, clusterID string, opts SecurityModeOpts) error

UpdateSecurityMode - change the security mode of a cluster.

func WaitForCluster added in v0.9.4

func WaitForCluster(client *golangsdk.ServiceClient, id string, timeout int) error

func WaitForClusterOperationSucces

func WaitForClusterOperationSucces(client *golangsdk.ServiceClient, id string, timeout int) error

func WaitForClusterToExtend

func WaitForClusterToExtend(client *golangsdk.ServiceClient, id string, timeout int) error

Types

type AddNodesOpts added in v0.9.4

type AddNodesOpts struct {
	// NodeSize - Number of nodes. The value range is 1 to 32.
	// If the node type is ess-master, the number of nodes must be an odd number in the range 3 to 10.
	// If the node type is ess-client, the number of nodes must be in the range 1 to 32.
	NodeSize int `json:"node_size" required:"true"`
	// Flavor - Flavor ID.
	Flavor string `json:"flavor_ref" required:"true"`
	// Type of the volume.
	// One of:
	//   - `COMMON`: Common I/O
	//   - `HIGH`: High I/O
	//   - `ULTRAHIGH`: Ultra-high I/O
	VolumeType string `json:"volume_type" required:"true"`
}

AddNodesOpts defines options to add master or client nodes .

type AddNodesResponse added in v0.9.4

type AddNodesResponse struct {
	ID string `json:"id"`
}

func AddClusterNodes added in v0.9.4

func AddClusterNodes(client *golangsdk.ServiceClient, clusterID string, NodeType string, opts AddNodesOpts) (*AddNodesResponse, error)

AddClusterNodes function lets you add master and client nodes to a cluster.

type BackupStrategy

type BackupStrategy struct {
	// Period - time when a snapshot is created every day.
	// Snapshots can only be created on the hour.
	// The time format is the time followed by the time zone, specifically, `HH:mm z`.
	// In the format, `HH:mm` refers to the hour time and `z` refers to the time zone, for example,
	// `00:00 GMT+08:00` and `01:00 GMT+08:00`.
	Period string `json:"period" required:"true"`
	// Prefix - prefix of the name of the snapshot that is automatically created.
	Prefix string `json:"prefix" required:"true"`
	// KeepDay - number of days for which automatically created snapshots are reserved.
	// Value range: `1` to `90`
	KeepDay int `json:"keepday" required:"true"`
}

type Bandwidth added in v0.9.4

type Bandwidth struct {
	Size int `json:"size" required:"true"`
}

type ChangeClusterNameOpts added in v0.9.4

type ChangeClusterNameOpts struct {
	// DisplayName contains options for new name
	// This object is passed to the snapshots.ChangeClusterName function.
	DisplayName string `json:"displayName" required:"true"`
}

type ChangePasswordOpts added in v0.9.4

type ChangePasswordOpts struct {
	// DisplayName contains options for new name
	// This object is passed to the snapshots.ChangeClusterName function.
	NewPassword string `json:"newpassword" required:"true"`
}

type Cluster

type Cluster struct {
	Datastore        Datastore          `json:"datastore"`
	Instances        []Instance         `json:"instances"`
	Updated          string             `json:"updated"`
	Name             string             `json:"name"`
	Created          string             `json:"created"`
	ID               string             `json:"id"`
	Status           string             `json:"status"`
	Endpoint         string             `json:"endpoint"`
	ActionProgress   map[string]string  `json:"actionProgress"`
	Actions          []string           `json:"actions"`
	FailedReasons    *FailedReasons     `json:"failed_reasons"`
	HttpsEnabled     bool               `json:"httpsEnable"`
	AuthorityEnabled bool               `json:"authorityEnable"`
	DiskEncrypted    bool               `json:"diskEncrypted"`
	CmkID            string             `json:"cmkId"`
	VpcID            string             `json:"vpcId"`
	SubnetID         string             `json:"subnetId"`
	SecurityGroupID  string             `json:"securityGroupId"`
	Tags             []tags.ResourceTag `json:"tags"`
	PublicKibana     *PublicKibana      `json:"publicKibanaResp"`
	PublicNetwork    *PublicNetwork     `json:"elbWhiteList"`
	PublicIp         string             `json:"publicIp"`
	VpcEpIp          string             `json:"vpcepIp"`
	BandwidthSize    int                `json:"bandwidthSize"`
	BackupAvailable  bool               `json:"backupAvailable"`
}

func Get

func Get(client *golangsdk.ServiceClient, id string) (*Cluster, error)

func List

func List(client *golangsdk.ServiceClient) ([]Cluster, error)

type ClusterExtendCommonOpts

type ClusterExtendCommonOpts struct {
	// ModifySize - number of instances to be added.
	ModifySize int `json:"modifySize"`
}

ClusterExtendCommonOpts is used to extend cluster with only `common` nodes. Clusters with master, client, or cold data nodes cannot use this.

type ClusterExtendOptsBuilder

type ClusterExtendOptsBuilder interface {
}

type ClusterExtendSpecialOpts

type ClusterExtendSpecialOpts struct {
	// Type of the instance to be scaled out.
	// Select at least one from `ess`, `ess-cold`, `ess-master`, and `ess-client`.
	// You can only add instances, rather than increase storage capacity, on nodes of the `ess-master` and `ess-client` types.
	Type string `json:"type"`
	// NodeSize - number of instances to be scaled out.
	// The total number of existing instances and newly added instances in a cluster cannot exceed 32.
	NodeSize int `json:"nodesize"`
	// DiskSize - Storage capacity of the instance to be expanded.
	// The total storage capacity of existing instances and newly added instances in a cluster cannot exceed the maximum instance storage capacity allowed when a cluster is being created.
	// In addition, you can expand the instance storage capacity for a cluster for up to six times.
	// Unit: GB
	DiskSize int `json:"disksize"`
}

ClusterExtendSpecialOpts is used to extend cluster with special nodes. If a cluster has master, client, or cold data nodes, this should be used

type ClusterFlavorOpts added in v0.9.4

type ClusterFlavorOpts struct {
	// Indicates whether to verify replicas.
	NeedCheckReplica *bool `json:"needCheckReplica,omitempty"`
	// ID of the new flavor.
	NewFlavorID string `json:"newFlavorId" required:"true"`
	// Type of the cluster node to modify.
	NodeType string `json:"-"`
}

type CreateOpts

type CreateOpts struct {
	// Instance - instance specification
	Instance *InstanceSpec `json:"instance" required:"true"`
	// Datastore - type of the data search engine
	Datastore *Datastore `json:"datastore,omitempty"`
	// Name - cluster name.
	// It contains 4 to 32 characters. Only letters, digits, hyphens (-), and underscores (_) are allowed.
	// The value must start with a letter.
	Name string `json:"name" required:"true"`
	// InstanceNum - number of clusters. The value range is 1 to 32.
	InstanceNum int `json:"instanceNum" required:"true"`
	// BackupStrategy - configuration of automatic snapshot creation.
	// This function is enabled by default.
	BackupStrategy *BackupStrategy `json:"backupStrategy,omitempty"`
	// DiskEncryption - disk encryption configuration
	DiskEncryption *DiskEncryption `json:"diskEncryption" required:"true"`
	// HttpsEnabled - whether communication is not encrypted on the cluster.
	HttpsEnabled string `json:"httpsEnable,omitempty"`
	// AuthorityEnabled - whether to enable authentication.
	// Available values include `true` and `false`. Authentication is disabled by default.
	// When authentication is enabled, `HttpsEnabled` must be set to `true`.
	AuthorityEnabled bool `json:"authorityEnable,omitempty"`
	// AdminPassword - password of the cluster user `admin` in security mode.
	// This parameter is mandatory only when `AuthorityEnabled` is set to `true`.
	AdminPassword string `json:"adminPwd,omitempty"`
	// Tags - tags of a cluster.
	Tags []tags.ResourceTag `json:"tags,omitempty"`
}

type CreatedCluster

type CreatedCluster struct {
	ID   string `json:"id"`
	Name string `json:"name"`
}

func Create

func Create(client *golangsdk.ServiceClient, opts CreateOpts) (*CreatedCluster, error)

type Datastore

type Datastore struct {
	// Version - engine version.
	// The default value is 7.6.2.
	Version string `json:"version" required:"true"`
	// Type - Engine type.
	// The value is `elasticsearch` or 'opensearch'.
	Type string `json:"type" required:"true"`
}

type DiskEncryption

type DiskEncryption struct {
	// SystemEncrypted - value `1` indicates encryption is performed, and value `0` indicates encryption is not performed.
	// Boolean sucks.
	Encrypted string `json:"systemEncrypted" required:"true"`
	// Key ID.
	//  - The Default Master Keys cannot be used to create grants.
	//    Specifically, you cannot use Default Master Keys whose aliases end with `/default` in KMS to create clusters.
	//  - After a cluster is created, do not delete the key used by the cluster. Otherwise, the cluster will become unavailable.
	CmkID string `json:"systemCmkid"`
}

type Eip added in v0.9.4

type Eip struct {
	Bandwidth Bandwidth `json:"bandWidth" required:"true"`
}

type ExtendedCluster

type ExtendedCluster struct {
	ID        string             `json:"id"`
	Instances []ExtendedInstance `json:"instances"`
}

func ExtendCluster

func ExtendCluster(client *golangsdk.ServiceClient, clusterID string, opts ClusterExtendOptsBuilder) (*ExtendedCluster, error)

ExtendCluster - extends cluster capacity. ClusterExtendCommonOpts should be used as options to extend cluster with only `common` nodes. ClusterExtendSpecialOpts should be used if extended cluster has master, client, or cold data nodes.

type ExtendedInstance

type ExtendedInstance struct {
	ID      string `json:"id"`
	Name    string `json:"name"`
	Type    string `json:"type"`
	ShardID string `json:"shard_id"`
}

type FailedReasons

type FailedReasons struct {
	ErrorCode    string `json:"errorCode"`
	ErrorMessage string `json:"errorMsg"`
}

type Instance

type Instance struct {
	Type             string             `json:"type"`
	ID               string             `json:"id"`
	Name             string             `json:"name"`
	Status           string             `json:"status"`
	SpecCode         string             `json:"specCode"`
	AvailabilityZone string             `json:"azCode"`
	Volume           *ShowClusterVolume `json:"volume"`
}

type InstanceSpec

type InstanceSpec struct {
	// Flavor - instance flavor name.
	Flavor string `json:"flavorRef" required:"true"`
	// Volume - information about the volume.
	Volume *Volume `json:"volume" required:"true"`
	// Nics - subnet information.
	Nics             *Nics  `json:"nics" required:"true"`
	AvailabilityZone string `json:"availability_zone,omitempty"`
}

type ManagePublicAccessOpts added in v0.9.4

type ManagePublicAccessOpts struct {
	ClusterId string `json:"-"`
	Size      int    `json:"-" required:"true"`
}

type Nics

type Nics struct {
	// VpcID - VPC ID which is used for configuring cluster network.
	VpcID string `json:"vpcId" required:"true"`
	// SubnetID - Subnet ID.
	// All instances in a cluster must have the same subnet.
	SubnetID string `json:"netId" required:"true"`
	// SecurityGroupID - Security group ID.
	// All instances in a cluster must have the same security grou.
	SecurityGroupID string `json:"securityGroupId" required:"true"`
}

type PublicAccessOpts added in v0.9.4

type PublicAccessOpts struct {
	Eip Eip `json:"eip"`
}

type PublicKibana added in v0.6.1

type PublicKibana struct {
	// Bandwidth range. Unit: Mbit/s
	Bandwidth int `json:"eipSize"`
	// Kibana public network access information.
	ElbWhiteList *PublicNetwork `json:"elbWhiteListResp"`
	// Specifies the IP address for accessing Kibana.
	PublicIp string `json:"publicKibanaIp"`
}

type PublicNetwork added in v0.6.1

type PublicNetwork struct {
	// Whether the public network access control is enabled.
	// true: Public network access control is enabled.
	// false: Public network access control is disabled.
	Enabled bool `json:"enableWhiteList"`
	// Whitelist of public network for accessing Kibana.
	Whitelist string `json:"whiteList"`
}

type ScaleInOpts added in v0.9.4

type ScaleInOpts struct {
	// Type specifies the type of instance to be scaled in.
	// Select at least one from `ess`, `ess-cold`, `ess-master`, and `ess-client`.
	Type string `json:"type"`
	// ReduceNodeNum is the number of nodes to be removed.
	// After scaling in, there must be at least one node in each AZ under each node type.
	// In a cross-AZ cluster, the difference between the number of nodes of the same type in different AZs cannot exceed 1.
	// For a cluster with Master nodes, the number of removed master nodes in a scale-in must be fewer than half of the original master node count.
	ReduceNodeNum int `json:"reducedNodeNum"`
}

ScaleInOpts defines options for scaling in a cluster.

type ScaleInRequest added in v0.9.4

type ScaleInRequest struct {
	Shrink []ScaleInOpts `json:"shrink"`
}

ScaleInRequest is a wrapper to structure the "shrink" key in the JSON body.

type SecurityGroupOpts added in v0.9.4

type SecurityGroupOpts struct {
	// Security group ID.
	SecurityGroupID string `json:"security_group_ids" required:"true"`
}

type SecurityModeOpts added in v0.9.4

type SecurityModeOpts struct {
	// Indicates whether to enable the security mode.
	AuthorityEnabled *bool `json:"authorityEnable"`
	// Cluster password.
	AdminPassword string `json:"adminPwd"`
	// Indicates whether to enable HTTPS.
	HttpsEnabled *bool `json:"httpsEnable"`
}

type ShowClusterVolume added in v0.6.1

type ShowClusterVolume struct {
	// Instance disk type
	Type string `json:"type"`
	// Instance disk size
	Size int `json:"size"`
}

type Volume

type Volume struct {
	// Type of the volume.
	// One of:
	//   - `COMMON`: Common I/O
	//   - `HIGH`: High I/O
	//   - `ULTRAHIGH`: Ultra-high I/O
	Type string `json:"volume_type" required:"true"`
	// Size of the volume, which must be a multiple of 4 and 10.
	// Unit: GB.
	Size int `json:"size" required:"true"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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