github.com/opentelekomcloud/gophertelekomcloud@v0.9.3/openstack/gaussdb/v3/instance/CreateReadonlyNode.go (about) 1 package instance 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 CreateNodeOpts struct { 10 // Instance ID, which is compliant with the UUID format. 11 InstanceId string 12 // Read replica failover priority ranging from 1 to 16. 13 // The total number of primary node and read replicas is less than or equal to 16. 14 Priorities []int `json:"priorities"` 15 } 16 17 func CreateReplica(client *golangsdk.ServiceClient, opts CreateNodeOpts) (*CreateNodeResponse, error) { 18 b, err := build.RequestBody(opts, "") 19 if err != nil { 20 return nil, err 21 } 22 23 // POST https://{Endpoint}/mysql/v3/{project_id}/instances/{instance_id}/nodes/enlarge 24 raw, err := client.Post(client.ServiceURL("instances", opts.InstanceId, "nodes", "enlarge"), b, nil, nil) 25 if err != nil { 26 return nil, err 27 } 28 29 var res CreateNodeResponse 30 err = extract.Into(raw.Body, &res) 31 return &res, err 32 } 33 34 type CreateNodeResponse struct { 35 // Instance ID 36 InstanceId string `json:"instance_id"` 37 // Node name list 38 NodeNames []string `json:"node_names"` 39 // Instance creation task ID 40 // This parameter is returned only for the creation of pay-per-use instances. 41 JobId string `json:"job_id"` 42 // Order ID. This parameter is returned only for the creation of yearly/monthly instances. 43 OrderId string `json:"order_id"` 44 }