Help us shape the future of Go! Take the 2026 Go Developer Survey

cluster

package
v0.6.2 Latest Latest
Warning

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

Go to latest
Published: May 30, 2023 License: Apache-2.0 Imports: 7 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateCluster

func CreateCluster(client *golangsdk.ServiceClient, opts CreateClusterOpts) (string, error)

CreateCluster is an asynchronous API. It takes 10 to 15 minutes to create a cluster.

func DeleteCluster

func DeleteCluster(client *golangsdk.ServiceClient, opts DeleteClusterOpts) error

func ExtractClusterId

func ExtractClusterId(err error, raw *http.Response) (string, error)

func ResetPassword

func ResetPassword(client *golangsdk.ServiceClient, opts ResetPasswordOpts) (err error)

func ResizeCluster

func ResizeCluster(client *golangsdk.ServiceClient, opts ResizeClusterOpts) (err error)

func RestartCluster

func RestartCluster(client *golangsdk.ServiceClient, opts RestartClusterOpts) (err error)

func WaitForCreate

func WaitForCreate(c *golangsdk.ServiceClient, id string, secs int) error

func WaitForResize

func WaitForResize(c *golangsdk.ServiceClient, id string, secs int) error

func WaitForRestart

func WaitForRestart(c *golangsdk.ServiceClient, id string, secs int) error

Types

type ClusterDetail

type ClusterDetail struct {
	// Cluster ID
	Id string `json:"id"`
	// Cluster name
	Name string `json:"name"`
	// Cluster status. The value can be one of the following:
	// CREATING
	// AVAILABLE
	// UNAVAILABLE
	// CREATION FAILED
	Status string `json:"status"`
	// Data warehouse version
	Version string `json:"version"`
	// Last modification time of a cluster. Format: ISO8601:YYYY-MM-DDThh:mm:ssZ
	Updated string `json:"updated"`
	// Cluster creation time. Format: ISO8601: YYYY-MM-DDThh:mm:ssZ
	Created string `json:"created"`
	// Service port of a cluster. The value ranges from 8000 to 30000. The default value is 8000.
	Port int `json:"port"`
	// Private network connection information about the cluster.
	Endpoints []Endpoints `json:"endpoints"`
	// Unused
	Nodes []Nodes `json:"nodes"`
	// Labels in a cluster
	Tags []Tags `json:"tags"`
	// Administrator name
	UserName string `json:"user_name"`
	// Number of nodes in a cluster. The value ranges from 2 to 256.
	NumberOfNode int `json:"number_of_node"`
	// Number of events
	RecentEvent int `json:"recent_event"`
	// AZ
	AvailabilityZone string `json:"availability_zone"`
	// Enterprise project ID. The value 0 indicates the ID of the default enterprise project.
	EnterpriseProjectId string `json:"enterprise_project_id"`
	// Node type
	NodeType string `json:"node_type"`
	// VPC ID
	VpcId string `json:"vpc_id"`
	// Subnet ID
	SubnetId string `json:"subnet_id"`
	// Public IP address. If the parameter is not specified, public connection is not used by default.
	PublicIp PublicIp `json:"public_ip"`
	// Public network connection information about the cluster. If the parameter is not specified, the public network connection information is not used by default.
	PublicEndpoints []PublicEndpoints `json:"public_endpoints"`
	// The key indicates an ongoing task. The value can be one of the following:
	// GROWING
	// RESTORING
	// SNAPSHOTTING
	// REPAIRING
	// CREATING
	// The value indicates the task progress.
	ActionProgress map[string]interface{} `json:"action_progress"`
	// Sub-status of clusters in the AVAILABLE state. The value can be one of the following:
	// NORMAL
	// READONLY
	// REDISTRIBUTING
	// REDISTRIBUTION-FAILURE
	// UNBALANCED
	// UNBALANCED | READONLY
	// DEGRADED
	// DEGRADED | READONLY
	// DEGRADED | UNBALANCED
	// UNBALANCED | REDISTRIBUTING
	// UNBALANCED | REDISTRIBUTION-FAILURE
	// READONLY | REDISTRIBUTION-FAILURE
	// UNBALANCED | READONLY | REDISTRIBUTION-FAILURE
	// DEGRADED | REDISTRIBUTION-FAILURE
	// DEGRADED | UNBALANCED | REDISTRIBUTION-FAILURE
	// DEGRADED | UNBALANCED | READONLY | REDISTRIBUTION-FAILURE
	// DEGRADED | UNBALANCED | READONLY
	SubStatus string `json:"sub_status"`
	// Cluster management task. The value can be one of the following:
	// RESTORING
	// SNAPSHOTTING
	// GROWING
	// REBOOTING
	// SETTING_CONFIGURATION
	// CONFIGURING_EXT_DATASOURCE
	// DELETING_EXT_DATASOURCE
	// REBOOT_FAILURE
	// RESIZE_FAILURE
	TaskStatus string `json:"task_status"`
	// Parameter group details
	ParameterGroup ParameterGroup `json:"parameter_group,omitempty"`
	// Node type ID
	NodeTypeId string `json:"node_type_id"`
	// Security group ID
	SecurityGroupId string `json:"security_group_id"`
	// List of private network IP addresses
	PrivateIp []string `json:"private_ip"`
	// Cluster maintenance window
	MaintainWindow MaintainWindow `json:"maintain_window"`
	// Cluster scale-out details
	ResizeInfo ResizeInfo `json:"resize_info,omitempty"`
	// Cause of failure. If the parameter is left empty, the cluster is in the normal state.
	FailedReasons FailedReason `json:"failed_reasons,omitempty"`
}

func ListClusterDetails

func ListClusterDetails(client *golangsdk.ServiceClient, clusterId string) (*ClusterDetail, error)

type ClusterInfo

type ClusterInfo struct {
	// Cluster ID
	Id string `json:"id"`
	// Cluster name
	Name string `json:"name"`
	// Cluster status. The value can be one of the following:
	// CREATING
	// AVAILABLE
	// UNAVAILABLE
	// CREATION FAILED
	Status string `json:"status"`
	// Data warehouse version
	Version string `json:"version"`
	// Last modification time of a cluster. Format: ISO8601:YYYY-MM-DDThh:mm:ssZ
	Updated string `json:"updated"`
	// Cluster creation time. Format: ISO8601:YYYY-MM-DDThh:mm:ssZ
	Created string `json:"created"`
	// Service port of a cluster. The value ranges from 8000 to 30000. The default value is 8000.
	Port int `json:"port"`
	// Private network connection information about the cluster.
	Endpoints []Endpoints `json:"endpoints"`
	// Unused
	Nodes []Nodes `json:"nodes"`
	// Tags in a cluster
	Tags []Tags `json:"tags"`
	// Cluster administrator name
	UserName string `json:"user_name"`
	// Number of nodes in a cluster. The value ranges from 2 to 256.
	NumberOfNode int `json:"number_of_node"`
	// Number of events
	RecentEvent int `json:"recent_event"`
	// AZ
	AvailabilityZone string `json:"availability_zone"`
	// Enterprise project ID. The value 0 indicates the ID of the default enterprise project.
	EnterpriseProjectId string `json:"enterprise_project_id"`
	// Node type
	NodeType string `json:"node_type"`
	// VPC ID
	VpcId string `json:"vpc_id"`
	// Subnet ID
	SubnetId string `json:"subnet_id"`
	// Public IP address. If the parameter is not specified, public connection is not used by default.
	PublicIp PublicIp `json:"public_ip"`
	// Public network connection information about the cluster.
	// If the parameter is not specified, the public network connection information is not used by default.
	PublicEndpoints []PublicEndpoints `json:"public_endpoints"`
	// Task information, consisting of a key and a value. The key indicates an ongoing task, and the value indicates the progress of the ongoing task.
	// Valid key values include:
	// GROWING
	// RESTORING
	// SNAPSHOTTING
	// REPAIRING
	// CREATING
	// The value indicates the task progress.
	// Example:
	// "action_progress":
	// {"SNAPSHOTTING":"16%"}
	ActionProgress map[string]string `json:"action_progress"`
	// Sub-status of clusters in the AVAILABLE state. The value can be one of the following:
	// NORMAL
	// READONLY
	// REDISTRIBUTING
	// REDISTRIBUTION-FAILURE
	// UNBALANCED
	// UNBALANCED | READONLY
	// DEGRADED
	// DEGRADED | READONLY
	// DEGRADED | UNBALANCED
	// UNBALANCED | REDISTRIBUTING
	// UNBALANCED | REDISTRIBUTION-FAILURE
	// READONLY | REDISTRIBUTION-FAILURE
	// UNBALANCED | READONLY | REDISTRIBUTION-FAILURE
	// DEGRADED | REDISTRIBUTION-FAILURE
	// DEGRADED | UNBALANCED | REDISTRIBUTION-FAILURE
	// DEGRADED | UNBALANCED | READONLY | REDISTRIBUTION-FAILURE
	// DEGRADED | UNBALANCED | READONLY
	SubStatus string `json:"sub_status"`
	// Cluster management task. The value can be one of the following:
	// RESTORING
	// SNAPSHOTTING
	// GROWING
	// REBOOTING
	// SETTING_CONFIGURATION
	// CONFIGURING_EXT_DATASOURCE
	// DELETING_EXT_DATASOURCE
	// REBOOT_FAILURE
	// RESIZE_FAILURE
	TaskStatus string `json:"task_status"`
	// Security group ID
	SecurityGroupId string `json:"security_group_id"`
	// Cause of failure. If the parameter is left empty, the cluster is in the normal state.
	FailedReasons FailedReason `json:"failed_reasons,omitempty"`
}

type CreateClusterOpts

type CreateClusterOpts struct {
	// Node type
	NodeType string `json:"node_type" required:"true"`
	// Number of cluster nodes. For a cluster, the value ranges from 3 to 256. For a hybrid data warehouse (standalone), the value is 1.
	NumberOfNode int `json:"number_of_node" required:"true"`
	// Subnet ID, which is used for configuring cluster network.
	SubnetId string `json:"subnet_id" required:"true"`
	// ID of a security group, which is used for configuring cluster network.
	SecurityGroupId string `json:"security_group_id" required:"true"`
	// VPC ID, which is used for configuring cluster network.
	VpcId string `json:"vpc_id" required:"true"`
	// AZ of a cluster.
	AvailabilityZone string `json:"availability_zone,omitempty"`
	// Service port of a cluster. The value ranges from 8000 to 30000. The default value is 8000.
	Port int `json:"port,omitempty"`
	// Cluster name, which must be unique. The cluster name must contain 4 to 64 characters, which must start with a letter.
	// Only letters, digits, hyphens (-), and underscores (_) are allowed.
	Name string `json:"name" required:"true"`
	// Administrator username for logging in to a GaussDB(DWS) cluster. The username must:
	// Consist of lowercase letters, digits, or underscores.
	// Start with a lowercase letter or an underscore.
	// Contain 1 to 63 characters.
	// Cannot be a keyword of the GaussDB(DWS) database.
	UserName string `json:"user_name" required:"true"`
	// Administrator password for logging in to a GaussDB(DWS) cluster
	UserPwd string `json:"user_pwd" required:"true"`
	// Public IP address. If the parameter is not specified, public connection is not used by default.
	PublicIp PublicIp `json:"public_ip,omitempty"`
	// Number of deployed CNs. The value ranges from 2 to the number of cluster nodes minus 1. The maximum value is 20 and the default value is 3.
	NumberOfCn int `json:"number_of_cn,omitempty"`
	// Enterprise project. The default enterprise project ID is 0.
	EnterpriseProjectId string `json:"enterprise_project_id,omitempty"`
}

type DeleteClusterOpts

type DeleteClusterOpts struct {
	ClusterId string `json:"-"`
	// The number of the latest manual snapshots that need to be retained for a cluster.
	KeepLastManualSnapshot *int `json:"keep_last_manual_snapshot" required:"true"`
}

type Endpoints

type Endpoints struct {
	// Private network connection information
	ConnectInfo string `json:"connect_info,omitempty"`
	// JDBC URL on the private network. The following is the default format:
	//jdbc:postgresql://< connect_info>/<YOUR_DATABASE_name>
	JdbcUrl string `json:"jdbc_url,omitempty"`
}

type FailedReason

type FailedReason struct {
	// Error code
	ErrorCode string `json:"error_code,omitempty"`
	// Error message
	ErrorMsg string `json:"error_msg,omitempty"`
}

type ListClustersResponse

type ListClustersResponse struct {
	// List of cluster objects
	Clusters []ClusterInfo `json:"clusters,omitempty"`
	// Total number of cluster objects
	Count int `json:"count,omitempty"`
}

func ListClusters

func ListClusters(client *golangsdk.ServiceClient) (*ListClustersResponse, error)

type MaintainWindow

type MaintainWindow struct {
	// Maintenance time in each week in the unit of day. The value can be one of the following:
	// Mon
	// Tue
	// Wed
	// Thu
	// Fri
	// Sat
	// Sun
	Day string `json:"day,omitempty"`
	// Maintenance start time in HH:mm format. The time zone is GMT+0.
	StartTime string `json:"start_time,omitempty"`
	// Maintenance end time in HH:mm format. The time zone is GMT+0.
	EndTime string `json:"end_time,omitempty"`
}

type Nodes

type Nodes struct {
	Id     string `json:"id"`
	Status string `json:"status"`
}

type ParameterGroup

type ParameterGroup struct {
	// Parameter group ID
	Id string `json:"id"`
	// Parameter group name
	Name string `json:"name"`
	// Cluster parameter status. The value can be one of the following:
	// In-Sync: synchronized
	// Applying: in application
	// Pending-Reboot: restart for the modification to take effect
	// Sync-Failure: application failure
	Status string `json:"status"`
}

type PublicEndpoints

type PublicEndpoints struct {
	// Public network connection information
	PublicConnectInfo string `json:"public_connect_info,omitempty"`
	// JDBC URL of the public network. The following is the default format:
	//jdbc:postgresql://< public_connect_info>/<YOUR_DATABASE_name>
	JdbcUrl string `json:"jdbc_url,omitempty"`
}

type PublicIp

type PublicIp struct {
	// Binding type of EIP. The value can be one of the following:
	// auto_assign
	// not_use
	// bind_existing
	PublicBindType string `json:"public_bind_type" required:"true"`
	// EIP ID
	EipId string `json:"eip_id,omitempty"`
}

type ResetPasswordOpts

type ResetPasswordOpts struct {
	ClusterId string `json:"-"`
	// New password of the GaussDB(DWS) cluster administrator
	// A password must conform to the following rules:
	// Contains 8 to 32 characters.
	// Cannot be the same as the username or the username written in reverse order.
	// Contains at least three types of the following:
	// Lowercase letters
	// Uppercase letters
	// Digits
	// Special characters: ~!?,.:;-_'"(){}[]/<>@#%^&*+|\=
	// Cannot be the same as previous passwords.
	// Cannot be a weak password.
	NewPassword string `json:"new_password" required:"true"`
}

type ResizeClusterOpts

type ResizeClusterOpts struct {
	ClusterId string `json:"-"`
	// Number of nodes to be added
	Count int `json:"count" required:"true"`
}

type ResizeInfo

type ResizeInfo struct {
	// Number of nodes after the scale-out
	TargetNodeNum int `json:"target_node_num,omitempty"`
	// Number of nodes before the scale-out
	OriginNodeNum int `json:"origin_node_num,omitempty"`
	// Scale-out status. The value can be one of the following:
	// GROWING
	// RESIZE_FAILURE
	ResizeStatus string `json:"resize_status,omitempty"`
	// Scale-out start time. Format: ISO8601:YYYY-MM-DDThh:mm:ss
	StartTime string `json:"start_time,omitempty"`
}

type RestartClusterOpts

type RestartClusterOpts struct {
	ClusterId string `json:"-"`
	// Restart flag.
	Restart interface{} `json:"restart" required:"true"`
}

type Tags

type Tags struct {
	// Key. A key can contain a maximum of 36 Unicode characters, which cannot be null.
	// The first and last characters cannot be spaces.
	// Only letters, digits, hyphens (-), and underscores (_) are allowed. It cannot contain the following characters: =*<>\,|/
	Key string `json:"key"`
	// Value. A value can contain a maximum of 43 Unicode characters, which can be null. The first and last characters cannot be spaces.
	// Only letters, digits, hyphens (-), and underscores (_) are allowed. It cannot contain the following characters: =*<>\,|/
	Value string `json:"value"`
}

Jump to

Keyboard shortcuts

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