cluster

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

Documentation

Index

Constants

View Source
const (
	RestartImmediately = "IMMEDIATELY"
	RestartForcely     = "FORCELY"
	RestartSoftly      = "SOFTLY"
)
View Source
const (
	StopImmediately = "IMMEDIATELY"
	StopGracefully  = "GRACEFULLY"
)
View Source
const (
	HeaderXLanguage   = "X-Language"
	HeaderContentType = "Content-Type"

	ApplicationJson = "application/json"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ActionProgress

type ActionProgress struct {
	// Cluster creation progress, for example, 29%
	Creating string `json:"creating"`
	// Cluster expansion progress, for example, 29%
	Growing string `json:"growing"`
	// Cluster restoration progress, for example, 29%
	Restoring string `json:"restoring"`
	// Cluster snapshotting progress, for example, 29%
	Snapshotting string `json:"snapshotting"`
	// Cluster repairing progress, for example, 29%
	Repairing string `json:"repairing"`
}

type Cluster

type Cluster struct {
	// ScheduleBootTime Time for scheduled startup of a CDM cluster. The CDM cluster starts at this time every day.
	ScheduleBootTime string `json:"scheduleBootTime,omitempty"`
	// IsScheduleBootOff Whether to enable scheduled startup/shutdown. The scheduled startup/shutdown and auto shutdown functions cannot be enabled at the same time.
	IsScheduleBootOff *bool `json:"isScheduleBootOff,omitempty"`
	// Instances Node list.
	Instances []Instance `json:"instances,omitempty"`
	// DataStore Cluster information.
	DataStore *Datastore `json:"datastore,omitempty"`
	// ExtendedProperties Extended attribute.
	ExtendedProperties *ExtendedProp `json:"extended_properties,omitempty"`
	// ScheduleOffTime Time for scheduled shutdown of a CDM cluster. The CDM cluster shuts down directly at this time every day without waiting for unfinished jobs to complete.
	ScheduleOffTime string `json:"scheduleOffTime,omitempty"`
	// VpcId VPC ID, which is used for configuring a network for the cluster.
	VpcId string `json:"vpcId,omitempty"`
	// Name Cluster name.
	Name string `json:"name,omitempty"`
	// SysTags Enterprise project information. For details, see the descriptions of sys_tags parameters.
	SysTags []tag.ResourceTag `json:"sys_tags,omitempty"`
	// IsAutoOff Whether to enable auto shutdown. The auto shutdown and scheduled startup/shutdown functions cannot be enabled at the same time.
	// When auto shutdown is enabled, if no job is running in the cluster and no scheduled job is available, a cluster will be automatically shut down 15 minutes after it starts running, which reduces costs for you.
	IsAutoOff bool `json:"isAutoOff,omitempty"`
}

type ClusterInstance added in v0.9.4

type ClusterInstance struct {
	// Node VM ID
	Id string `json:"id"`
	// Name of the VM on the node
	Name string `json:"name"`
	// Node type. Currently, only cdm is available.
	Type string `json:"type"`
	// Shard ID
	ShardId string `json:"shard_id"`
}
type ClusterLinks struct {
	// Relationship
	Rel string `json:"rel"`
	// Link address
	Href string `json:"href"`
}

type ClusterQuery

type ClusterQuery struct {
	// EIP bound to the cluster
	PublicEndpoint string `json:"publicEndpoint"`
	// Cluster node information. For details, see the descriptions of instances parameters.
	Instances []DetailedInstances `json:"instances"`
	// Security group ID
	SecurityGroupId string `json:"security_group_id"`
	// Subnet ID
	SubnetId string `json:"subnet_id"`
	// VPC ID
	VpcId string `json:"vpc_id"`
	// User configuration
	CustomerConfig CustomerConfig `json:"customerConfig"`
	// CDM information
	Datastore Datastore `json:"datastore"`
	// Auto shutdown
	IsAutoOff bool `json:"isAutoOff"`
	// Domain name for the EIP bound to the cluster
	PublicEndpointDomainName string `json:"publicEndpointDomainName"`
	// Start time
	BakExpectedStartTime string `json:"bakExpectedStartTime"`
	// Retention duration
	BakKeepDay string `json:"bakKeepDay"`
	// Maintenance window
	MaintainWindow MaintainWindow `json:"maintainWindow"`
	// Number of events
	RecentEvent int `json:"recentEvent"`
	// Flavor name
	FlavorName string `json:"flavorName"`
	// AZ name
	AzName string `json:"azName"`
	// Peer domain name
	EndpointDomainName string `json:"endpointDomainName"`
	// EIP status
	PublicEndpointStatus PublicEndpointStatus `json:"publicEndpointStatus"`
	// Whether to enable scheduled startup/shutdown. The scheduled startup/shutdown and auto shutdown functions cannot be enabled at the same time.
	IsScheduleBootOff bool `json:"isScheduleBootOff"`
	// Namespace
	Namespace string `json:"namespace"`
	// EIP ID
	EipId string `json:"eipId"`
	// Failure cause. If this parameter is left empty, the cluster is in normal state.
	FailedReasons FailedReasons `json:"failedReasons"`
	// Database user
	DbUser string `json:"dbuser"`
	// Cluster link information
	Links []ClusterLinks `json:"links"`
	// Cluster mode: sharding
	ClusterMode string `json:"clusterMode"`
	// Task information
	Task ClusterTask `json:"task"`
	// Cluster creation time in ISO 8601 format: YYYY-MM-DDThh:mm:ssZ
	Created string `json:"created"`
	// Cluster status: normal
	StatusDetail string `json:"statusDetail"`
	// Cluster configuration status
	//    In-Sync: The configuration has been synchronized.
	//    Applying: The configuration is in progress.
	//    Sync-Failure: The configuration fails.
	ConfigStatus string `json:"config_status"`
	// Cluster operation progress, which consists of a key and a value.
	// The key indicates an ongoing task, and the value indicates the progress of the ongoing task.
	// An example is "action_progress":{"SNAPSHOTTING":"16%"}.
	ActionProgress ActionProgress `json:"actionProgress"`
	// Cluster name
	Name string `json:"name"`
	// Cluster ID
	Id string `json:"id"`
	// Whether the cluster is frozen. The value can be 0 (not frozen) or 1 (frozen).
	IsFrozen string `json:"isFrozen"`
	// Cluster configuration status. Options: - In-Sync: The cluster configuration has been synchronized. - Applying: The cluster is being configured. - Sync-Failure: The cluster configuration failed.
	Actions []string `json:"actions"`
	// Cluster update time in ISO 8601 format: YYYY-MM-DDThh:mm:ssZ
	Updated string `json:"updated"`
	// Cluster status
	//    100: creating
	//    200: normal
	//    300: failed
	//    303: failed to be created
	//    800: frozen
	//    900: stopped
	//    910: stopping
	//    920: starting
	Status string `json:"status"`
}

func Get

func Get(client *golangsdk.ServiceClient, clusterId string) (*ClusterQuery, error)

Get is used to query cluster details. Send request GET /v1.1/{project_id}/clusters/{cluster_id}

func List added in v0.9.4

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

List Querying the Cluster List. Send request GET /v1.1/{project_id}/clusters

type ClusterResp added in v0.9.4

type ClusterResp struct {
	// Cluster name
	Name string `json:"name"`
	// Cluster ID
	Id string `json:"id"`
	// Task information
	Task Task `json:"task"`
	// Cluster information
	Datastore Datastore `json:"datastore"`
	// Cluster node information
	Instances []ClusterInstance `json:"instances"`
}

func Create

func Create(client *golangsdk.ServiceClient, reqOpts CreateOpts) (*ClusterResp, error)

Create is used to create a cluster. Send request POST /v1.1/{project_id}/clusters

type ClusterTask

type ClusterTask struct {
	// Task description
	Description string `json:"description"`
	// Task ID
	Id string `json:"id"`
	// Task name
	Name string `json:"name"`
}

type CreateFailed

type CreateFailed struct {
	// Error code
	ErrorCode string `json:"errorCode"`
	// Failure cause
	ErrorMsg string `json:"errorMsg"`
}

type CreateOpts

type CreateOpts struct {
	Cluster Cluster `json:"cluster" required:"true"`
	// AutoRemind Whether to enable message notification.
	// If you enable this function, you can configure a maximum of five mobile numbers or email addresses.
	// You will be notified of table/file migration job failures and EIP exceptions by SMS message or email.
	AutoRemind bool `json:"auto_remind,omitempty"`
	// PhoneNum Mobile number for receiving notifications.
	PhoneNum string `json:"phone_num,omitempty"`
	// Email address for receiving notifications.
	Email string `json:"email,omitempty"`
	// Request language.
	XLang string `json:"-"`
}

type CustomerConfig

type CustomerConfig struct {
	// Failure notification
	FailureRemind string `json:"failureRemind"`
	// Cluster type
	ClusterName string `json:"clusterName"`
	// Service provisioning
	ServiceProvider string `json:"serviceProvider"`
	// Whether the disk is a local disk
	LocalDisk string `json:"localDisk"`
	// Whether to enable SSL
	Ssl string `json:"ssl"`
	// Source
	CreateFrom string `json:"createFrom"`
	// Resource ID
	ResourceId string `json:"resourceId"`
	// Flavor type
	FlavorType string `json:"flavorType"`
	// Workspace ID
	WorkSpaceId string `json:"workSpaceId"`
	// Trial
	Trial string `json:"trial"`
}

type Datastore

type Datastore struct {
	// Type Generally, the value is cdm.
	Type string `json:"type,omitempty"`
	// Version Cluster version.
	Version string `json:"version,omitempty"`
}

type DeleteOpts added in v0.9.4

type DeleteOpts struct {
	// KeepBackup Number of backup log files. Retain the default value 0.
	KeepBackup int `json:"keep_last_manual_backup"`
}

type DeleteResp added in v0.9.4

type DeleteResp struct {
	JobId string `json:"jobId"`
}

func Delete

func Delete(client *golangsdk.ServiceClient, id string, reqOpts DeleteOpts) (*DeleteResp, error)

Delete is used to delete a cluster. Send request DELETE /v1.1/{project_id}/clusters/{cluster_id}

type DetailedInstances

type DetailedInstances struct {
	// VM flavor of a node. For details, see the descriptions of flavor parameters.
	Flavor Flavor `json:"flavor"`
	// Disk information of a node. For details, see the descriptions of volume parameters.
	Volume Volume `json:"volume"`
	// Node status
	//    100: creating
	//    200: normal
	//    300: failed
	//    303: failed to be created
	//    400: deleted
	//    800: frozen
	Status string `json:"status"`
	// Node operation status
	//    REBOOTING: restarting
	//    RESTORING: restoring
	//    REBOOT_FAILURE: failed to restart
	Actions []string `json:"actions"`
	// Node type. Currently, only cdm is available.
	Type string `json:"type"`
	// Node VM ID
	Id string `json:"id"`
	// Name of the VM on the node
	Name string `json:"name"`
	// Whether the node is frozen. The value can be 0 (not frozen) or 1 (frozen).
	IsFrozen string `json:"isFrozen"`
	// Component
	Components string `json:"components"`
	// Node configuration status. The value is null when the cluster list is queried.
	//    In-Sync: The configuration has been synchronized.
	//    Applying: The configuration is in progress.
	//    Sync-Failure: The configuration fails.
	ConfigStatus string `json:"config_status"`
	// Instance role
	Role string `json:"role"`
	// Group
	Group string `json:"group"`
	// Link information
	Links []ClusterLinks `json:"links"`
	// Group ID
	ParamsGroupId string `json:"paramsGroupId"`
	// Public IP address
	PublicIp string `json:"publicIp"`
	// Management IP address
	ManageIp string `json:"manageIp"`
	// Traffic IP address
	TrafficIp string `json:"trafficIp"`
	// Slice ID
	ShardId string `json:"shard_id"`
	// Management fix IP address
	ManageFixIp string `json:"manage_fix_ip"`
	// Private IP address
	PrivateIp string `json:"private_ip"`
	// Internal IP address
	InternalIp string `json:"internal_ip"`
	// Resource information (null is returned for querying the cluster list)
	Resource []Resource `json:"resource"`
}

type EmptyStruct added in v0.9.4

type EmptyStruct struct{}

type ExtendedProp

type ExtendedProp struct {
	// WorkSpaceId Workspace ID.
	WorkSpaceId string `json:"workSpaceId,omitempty"`
	// ResourceId Resource ID.
	ResourceId string `json:"resourceId,omitempty"`
	// Trial Whether the cluster is a trial cluster.
	Trial string `json:"trial,omitempty"`
}

type FailedReasons

type FailedReasons struct {
	// Cause of the cluster creation failure
	CreateFailed CreateFailed `json:"CREATE_FAILED"`
}

type Flavor

type Flavor struct {
	// VM flavor ID
	Id string `json:"id"`
	// Link information
	Links []ClusterLinks `json:"links"`
}

type Instance

type Instance struct {
	// AZ availability zone where a cluster is located.
	AZ string `json:"availability_zone" required:"true"`
	// Nics NIC list. A maximum of two NICs are supported. For details, see the descriptions of nics parameters.
	Nics []Nic `json:"nics" required:"true"`
	// FlavorRef Instance flavor.
	FlavorRef string `json:"flavorRef" required:"true"`
	// Type Node type. Currently, only cdm is available.
	Type string `json:"type" required:"true"`
}

type JobId

type JobId struct {
	JobId []string `json:"jobId"`
}

func Restart

func Restart(client *golangsdk.ServiceClient, clusterId string, opts RestartOpts) (*JobId, error)

Restart is used to restart a cluster. Send request POST /v1.1/{project_id}/clusters/{cluster_id}/action

func Start

func Start(client *golangsdk.ServiceClient, clusterId string, startOpts StartOpts) (*JobId, error)

Start is used to start a cluster. Send request POST /v1.1/{project_id}/clusters/{cluster_id}/action

func Stop

func Stop(client *golangsdk.ServiceClient, clusterId string, opts StopOpts) (*JobId, error)

Stop is used to stop a cluster. Send request POST /v1.1/{project_id}/clusters/{cluster_id}/action

type MaintainWindow

type MaintainWindow struct {
	// Day of a week
	Day string `json:"day"`
	// Start time
	StartTime string `json:"startTime"`
	// End time
	EndTime string `json:"endTime"`
}

type Nic

type Nic struct {
	// SecurityGroupId Security group ID.
	SecurityGroupId string `json:"securityGroupId" required:"true"`
	// NetId Subnet ID.
	NetId string `json:"net-id" required:"true"`
}

type PublicEndpointStatus

type PublicEndpointStatus struct {
	// Status
	Status string `json:"status"`
	// Error message
	ErrorMessage string `json:"errorMessage"`
}

type Resource

type Resource struct {
	// Resource ID
	ResourceId string `json:"resource_id"`
	// Resource type: server
	ResourceType string `json:"resource_type"`
}

type RestartOpts

type RestartOpts struct {
	// Restart Cluster restart. For details about how to define the cluster to restart, see RestartStruct.
	Restart RestartStruct `json:"restart" required:"true"`
}

type RestartStruct

type RestartStruct struct {
	// RestartDelayTime Restart delay, in seconds.
	RestartDelayTime int `json:"restartDelayTime,omitempty"`
	// Restart mode
	// IMMEDIATELY: immediate restart
	// FORCELY: forcible restart
	// SOFTLY: common restart
	// The default value is IMMEDIATELY. Forcibly restarting the service process will interrupt the service process and restart the VMs in the cluster.
	RestartMode string `json:"restartMode,omitempty"`
	// RestartLevel Restart level
	// SERVICE: service restart
	// VM: VM restart
	// The default value is SERVICE.
	RestartLevel string `json:"restartLevel,omitempty"`
	// Type of the cluster to be restarted. The value can be set to cdm only.
	Type string `json:"type,omitempty"`
	// Instance Reserved field. When restartLevel is set to SERVICE, this parameter is mandatory and an empty string should be entered.
	Instance string `json:"instance,omitempty"`
	// Reserved field. When restartLevel is set to SERVICE, this parameter is mandatory and an empty string should be entered.
	Group string `json:"group,omitempty"`
}

type StartOpts added in v0.9.4

type StartOpts struct {
	// Start Starting a cluster. This parameter is an empty object.
	Start EmptyStruct `json:"start"`
}

type StopOpts

type StopOpts struct {
	// Stop Cluster stop operation, which defines the parameters for stopping a cluster.
	Stop StopStruct `json:"stop"`
}

type StopStruct

type StopStruct struct {
	// StopMode should be StopImmediately or StopGracefully
	StopMode string `json:"stopMode,omitempty"`
	// DelayTime Stop delay, in seconds.
	// This parameter is valid only when stopMode is set to GRACEFULLY.
	// If the value of this parameter is set to -1, the system waits for all jobs to complete and stops accepting new jobs.
	// If the value of this parameter is greater than 0, the system stops the cluster after the specified time and stops accepting new jobs.
	DelayTime int `json:"delayTime,omitempty"`
}

type Task

type Task struct {
	// Task ID
	Id string `json:"id"`
	// Task name
	Name string `json:"name"`
}

type Volume

type Volume struct {
	// Type of disks on the node. Only local disks are supported.
	Type string `json:"type"`
	// Size of the disk on the node (GB)
	Size int64 `json:"size"`
}

Jump to

Keyboard shortcuts

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