github.com/opentelekomcloud/gophertelekomcloud@v0.9.3/openstack/mrs/v1/cluster/Update.go (about) 1 package cluster 2 3 import ( 4 golangsdk "github.com/opentelekomcloud/gophertelekomcloud" 5 "github.com/opentelekomcloud/gophertelekomcloud/internal/build" 6 "github.com/opentelekomcloud/gophertelekomcloud/internal/extract" 7 ) 8 9 type UpdateOpts struct { 10 // Cluster ID 11 ClusterId string 12 // Service ID. 13 // This parameter is reserved for extension. 14 // You do not need to set this parameter. 15 ServiceId string `json:"service_id,omitempty"` 16 // Plan ID. 17 // This parameter is reserved for extension. 18 // You do not need to set this parameter. 19 PlanId string `json:"plan_id,omitempty"` 20 // Core parameters. 21 Parameters Parameters `json:"parameters"` 22 } 23 24 func Update(client *golangsdk.ServiceClient, opts UpdateOpts) (string, error) { 25 body, err := build.RequestBody(opts, "") 26 if err != nil { 27 return "", err 28 } 29 30 // PUT /v1.1/{project_id}/cluster_infos/{cluster_id} 31 raw, err := client.Put(client.ServiceURL("cluster_infos", opts.ClusterId), body, nil, &golangsdk.RequestOpts{ 32 OkCodes: []int{200}, 33 }) 34 if err != nil { 35 return "", err 36 } 37 38 var res struct { 39 Result string `json:"result"` 40 } 41 err = extract.Into(raw.Body, &res) 42 return res.Result, err 43 } 44 45 type Parameters struct { 46 // Order ID obtained by the system during scale-out or scale-in. 47 // You do not need to set the parameter 48 OrderId string `json:"order_id,omitempty"` 49 // - scale_in: cluster scale-in 50 // - scale_out: cluster scale-out 51 ScaleType string `json:"scale_type"` 52 // ID of the newly added or removed node. 53 // The parameter value is fixed to node_orderadd. 54 // The ID of a newly added or removed node includes node_orderadd, for example, node-orderadd-TBvSr.com. 55 NodeId string `json:"node_id"` 56 // Node group to be scaled out or in 57 // - If the value of node_group is core_node_default_group, the ode group is a Core node group. 58 // - If the value of node_group is task_node_default_group, the node group is a Task node group. 59 // If it is left blank, the default value core_node_default_group is used. 60 NodeGroup string `json:"node_group,omitempty"` 61 // Task node specifications. 62 // - When the number of Task nodes is 0, this parameter is used to specify Task node specifications. 63 // - When the number of Task nodes is greater than 0, this parameter is unavailable. 64 TaskNodeInfo TaskNodeInfo `json:"task_node_info,omitempty"` 65 // Number of nodes to be added or removed 66 // - The maximum number of nodes to be added is 500 minus the number of Core and Task nodes. 67 // For example, the current number of Core nodes is 3, 68 // the number of nodes to be added must be less than or equal to 497. 69 // A maximum of 500 Core and Task nodes are supported by default. 70 // If more than 500 Core and Task nodes are required, 71 // contact technical support engineers or call a background API to modify the database. 72 // - Nodes can be deleted for cluster scale-out 73 // when the number of Core nodes is greater than 3 or the number of Task nodes is greater than 0. 74 // For example, 75 // if there are 5 Core nodes and 5 Task nodes in a cluster, 76 // only 2 (5 minus 3) Core nodes are available for deletion and 5 or fewer than 5 Task nodes can be deleted. 77 Instances int `json:"instances"` 78 // This parameter is valid only when a bootstrap action is configured during cluster creation and takes effect during scale-out. 79 // It indicates whether the bootstrap action specified during cluster creation is performed on nodes added during scale-out. 80 // The default value is false, indicating that the bootstrap action is performed. 81 // MRS 1.7.2 or later supports this parameter. 82 SkipBootstrapScripts string `json:"skip_bootstrap_scripts,omitempty"` 83 // Whether to start components on the added nodes after cluster scale-out 84 // - true: Do not start components after scale-out. 85 // - false: Start components after scale-out. 86 // This parameter is valid only in MRS 1.7.2 or later. 87 ScaleWithoutStart *bool `json:"scale_without_start,omitempty"` 88 // ID list of Task nodes to be deleted during task node scale-in. 89 // - This parameter does not take effect when scale_type is set to scale-out. 90 // - If scale_type is set to scale-in and cannot be left blank, 91 // the system deletes the specified Task nodes. 92 // - When scale_type is set to scale-in and server_ids is left blank, 93 // the system automatically deletes the Task nodes based on the system rules. 94 ServerIds []string `json:"server_ids,omitempty"` 95 } 96 97 type TaskNodeInfo struct { 98 // Instance specifications of a Task node, for example, c6.4xlarge.4linux.mrs 99 NodeSize string `json:"node_size"` 100 // Data disk storage type of the Task node, supporting SATA, SAS, and SSD currently 101 // - SATA: Common I/O 102 // - SAS: High I/O 103 // - SSD: Ultra-high I/O 104 DataVolumeType string `json:"data_volume_type,omitempty"` 105 // Number of data disks of a Task node 106 // Value range: 1 to 10 107 DataVolumeCount int `json:"data_volume_count,omitempty"` 108 // Data disk storage space of a Task node 109 // Value range: 100 GB to 32,000 GB 110 DataVolumeSize int `json:"data_volume_size,omitempty"` 111 }