clusters

package
v0.0.0-...-63319d1 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2024 License: MPL-2.0, Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ActionProgressCreating     = "CREATING"
	ActionProgressGrowing      = "GROWING"
	ActionProgressRestoring    = "RESTORING"
	ActionProgressSnapshotting = "SNAPSHOTTING"
	ActionProgressRepairing    = "REPAIRING"

	StatusCreating       = "100"
	StatusNormal         = "200"
	StatusFailed         = "300"
	StatusCreationFailed = "303"
	StatusForzen         = "800"
	StatusStopped        = "900"
	StatusStopping       = "910"
	StatusStarting       = "920"
)

Variables

View Source
var RequestOpts = golangsdk.RequestOpts{
	MoreHeaders: map[string]string{"Content-Type": "application/json", "X-Language": "en-us"},
}

Functions

func Delete

func Delete(c *golangsdk.ServiceClient, clusterId string, opts ClusterDeleteOpts) *golangsdk.ErrResult

Types

type ActionResponse

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

func Start

func Start(c *golangsdk.ServiceClient, clusterId string, opts StartOpts) (*ActionResponse, error)

func Stop

func Stop(c *golangsdk.ServiceClient, clusterId string, opts StopConfig) (*ActionResponse, error)

type Cluster

type Cluster struct {
	ClusterCommon

	SecurityGroupId string `json:"security_group_id"`
	SubnetId        string `json:"subnet_id"`
	VpcId           string `json:"vpc_id"`
	// EIP domain name bound to the cluster
	PublicEndpointDomainName string `json:"publicEndpointDomainName"`
	// Start time
	BakExpectedStartTime string `json:"bakExpectedStartTime"`
	// Retention duration
	BakKeepDay int `json:"bakKeepDay"`
	// Maintenance window
	MaintainWindow MaintainWindow `json:"maintainWindow"`
	// EIP ID
	EipId string `json:"eipId"`
	// EIP status
	PublicEndpointStatus PublicEndpointStatus `json:"publicEndpointStatus"`
	// Cluster configuration status. The options are as follows: In-Sync: configuration synchronized;
	// Applying: being configured; Sync-Failure: configuration failed
	Actions []string `json:"actions"`
}

func Get

func Get(c *golangsdk.ServiceClient, clusterId string) (*Cluster, error)

type Cluster4List

type Cluster4List struct {
	ClusterCommon
	// Whether to enable the scheduled startup/shutdown function.
	// The scheduled startup/shutdown and auto shutdown functions cannot be enabled at the same time.
	IsScheduleBootOff bool                    `json:"isScheduleBootOff"`
	Version           string                  `json:"version"`
	FailedReasons     map[string]FailedDetail `json:"failedReasons"`
}

type ClusterCommon

type ClusterCommon struct {
	CustomerConfig CustomerConfig `json:"customerConfig"`
	Datastore      Datastore      `json:"datastore"`
	Instances      []Instance     `json:"instances"`
	AzName         string         `json:"azName"`
	Dbuser         string         `json:"dbuser"`
	FlavorName     string         `json:"flavorName"`
	// Number of events
	RecentEvent int         `json:"recentEvent"`
	IsAutoOff   bool        `json:"isAutoOff"`
	ClusterMode string      `json:"clusterMode"`
	Namespace   string      `json:"namespace"`
	Task        ClusterTask `json:"task"`
	// EIP bound to the cluster
	PublicEndpoint string `json:"publicEndpoint"`
	// 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 map[string]string `json:"actionProgress"`
	Id             string            `json:"id"`
	Name           string            `json:"name"`
	// Cluster creation time in ISO8601: YYYY-MM-DDThh:mm:ssZ format
	Created string `json:"created"`
	// Time when a cluster is updated. The format is YYYY-MM-DDThh:mm:ssZ (ISO 8601).
	Updated string `json:"updated"`
	// Cluster status. The options are as follows:
	//   - 100:creating
	//   - 200:normal
	//   - 300:failed
	//   - 303:creation failed
	//   - 800:forzen
	//   - 900:stopped
	//   - 910:stopping
	//   - 920:starting
	Status       string `json:"status"`
	StatusDetail string `json:"statusDetail"`
	// Whether the cluster is frozen. The value can be 0 (not frozen) or 1 (frozen).
	IsFrozen string `json:"isFrozen"`
	// Cluster configuration status. The options are as follows:
	// In-Sync: configuration synchronized; Applying: being configured; Sync-Failure: configuration failed
	ConfigStatus string `json:"config_status"`
	// Cluster links
	Links []ClusterLinks `json:"links"`

	IsScheduleBootOff bool   `json:"isScheduleBootOff"`
	ScheduleBootTime  string `json:"scheduleBootTime"`
	ScheduleOffTime   string `json:"scheduleOffTime"`
}

type ClusterCreateOpts

type ClusterCreateOpts struct {
	Cluster ClusterRequest `json:"cluster" required:"true"`
	// Whether to enable message notification. If this function is enabled, a maximum of five mobile numbers or email
	// addresses can be set. When a table/file migration job fails or an EIP exception occurs,
	// you will receive a notification by SMS message or email.
	AutoRemind *bool `json:"auto_remind,omitempty"`
	// Mobile number for receiving notifications
	PhoneNum string `json:"phone_num,omitempty"`
	// Email address for receiving notifications
	Email string `json:"email,omitempty"`
}

type ClusterCreateResult

type ClusterCreateResult struct {
	Name string `json:"name"`
	Id   string `json:"id"`
}

func Create

func Create(c *golangsdk.ServiceClient, opts ClusterCreateOpts) (*ClusterCreateResult, error)

type ClusterDeleteOpts

type ClusterDeleteOpts struct {
	// Number of backup log files. Retain the default value 0.
	KeepLastManualBackup int `q:"keep_last_manual_backup"`
}
type ClusterLinks struct {
	Rel  string `json:"rel"`
	Href string `json:"href"`
}

type ClusterRequest

type ClusterRequest struct {
	// Time for scheduled startup of a CDM cluster. The CDM cluster starts at this time every day.
	ScheduleBootTime string `json:"scheduleBootTime,omitempty"`
	// Whether to enable the scheduled startup/shutdown function.
	// The scheduled startup/shutdown and auto shutdown functions cannot be enabled at the same time.
	IsScheduleBootOff *bool `json:"isScheduleBootOff,omitempty"`
	// Node list.
	Instances []InstanceReq `json:"instances,omitempty"`
	// Cluster information. For details, see the description of the datastore parameter.
	Datastore *Datastore `json:"datastore,omitempty"`
	// Time for scheduled shutdown of a CDM cluster. The system shuts down directly at this time every day without waiting for unfinished jobs to complete.
	ScheduleOffTime string `json:"scheduleOffTime,omitempty"`
	// VPC ID, which is used for configuring a network for the cluster
	VpcId string `json:"vpcId,omitempty"`
	// Cluster name
	Name string `json:"name,omitempty"`
	// Enterprise project information. For details, see the description of the sys_tags parameter.
	SysTags []tags.ResourceTag `json:"sys_tags,omitempty"`
	// 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 created, a cluster will be automatically shut down 15 minutes after it starts running to reduce costs.
	IsAutoOff *bool `json:"isAutoOff,omitempty"`
}

type ClusterTask

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

type ClustersRepsonse

type ClustersRepsonse struct {
	Clusters []Cluster4List `json:"clusters"`
}

func List

func List(c *golangsdk.ServiceClient) (*ClustersRepsonse, error)

type CustomerConfig

type CustomerConfig struct {
	// Failure notification
	FailureRemind string `json:"failureRemind"`
	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"`
}

type Datastore

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

type FailedDetail

type FailedDetail struct {
	ErrorCode string `q:"errorCode"`
	ErrorMsg  string `q:"errorMsg"`
}

type Flavor

type Flavor struct {
	Id string `q:"id"`
}

type Instance

type Instance struct {
	// VM flavor of a node.
	Flavor Flavor `json:"flavor"`
	// Disk information of a node.
	Volume Volume `json:"volume"`
	// Node status:
	//   - 100:creating
	//   - 200:normal
	//   - 300:failed
	//   - 303:creation failed
	//   - 400:deleted
	//   - 800:forzen
	Status string `json:"status"`
	// Cluster operation status list. The options are as follows:
	//   - REBOOTING:restarting
	//   - RESTORING:restoring
	//   - REBOOT_FAILURE:restart failed
	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"`
	// Cluster configuration status. The options are as follows:
	//  In-Sync: configuration synchronized
	//  Applying: being configured
	//  Sync-Failure: configuration failed
	ConfigStatus string         `json:"config_status"`
	Role         string         `json:"role"`
	Group        string         `json:"group"`
	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"`
	// Shard 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   []Resource `json:"resource"`
}

type InstanceReq

type InstanceReq struct {
	AvailabilityZone string `json:"availability_zone" required:"true"`
	// NIC list. A maximum of two NICs are supported. For details, see the description of the nics parameter.
	Nics      []Nics `json:"nics" required:"true"`
	FlavorRef string `json:"flavorRef" required:"true"`
	// Node type. Currently, only cdm is available.
	Type string `json:"type" required:"true"`
}

type Job

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

func Restart

func Restart(c *golangsdk.ServiceClient, clusterId string, opts RestartReq) (*Job, error)

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 Nics

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

type PublicEndpointStatus

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

type Resource

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

type RestartConfig

type RestartConfig struct {
	// Restart delay, in seconds
	RestartDelayTime *int `json:"restartDelayTime,omitempty"`
	// Restart mode. The options are as follows:
	// IMMEDIATELY: immediate restart
	// GRACEFULL: graceful restart
	// FORCELY: forcible restart
	// SOFTLY: normal restart
	// The default value is IMMEDIATELY.
	RestartMode string `json:"restartMode,omitempty"`
	// Restart level. The options are as follows:
	// SERVICE: service restart
	// VM: VM restart
	// The default value is SERVICE.
	RestartLevel string `json:"restartLevel,omitempty"`
	Type         string `json:"type,omitempty"`
	// 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 RestartReq

type RestartReq struct {
	Restart RestartConfig `json:"restart" required:"true"`
}

type StartOpts

type StartOpts struct {
	Start map[string]string `json:"start" required:"true"`
}

type StopConfig

type StopConfig struct {
	// Stop type. The options are as follows:
	// IMMEDIATELY: immediate stop
	// GRACEFULLY: graceful stop
	// Enumeration values:
	// IMMEDIATELY
	// GRACEFULLY
	StopMode string `json:"stopMode"`
	// 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"`
}

type StopOpts

type StopOpts struct {
	Stop StopConfig `json:"stop" required:"true"`
}

type Volume

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

Jump to

Keyboard shortcuts

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