github.com/opentelekomcloud/gophertelekomcloud@v0.9.3/openstack/rds/v3/instances/StartFailover.go (about) 1 package instances 2 3 import ( 4 golangsdk "github.com/opentelekomcloud/gophertelekomcloud" 5 "github.com/opentelekomcloud/gophertelekomcloud/internal/extract" 6 ) 7 8 func StartFailover(client *golangsdk.ServiceClient, instanceId string) (*StartFailoverResponse, error) { 9 // PUT /v3/{project_id}/instances/{instance_id}/failover 10 raw, err := client.Put(client.ServiceURL("instances", instanceId, "failover"), struct{}{}, nil, &golangsdk.RequestOpts{ 11 OkCodes: []int{200}, 12 }) 13 if err != nil { 14 return nil, err 15 } 16 17 var res StartFailoverResponse 18 err = extract.Into(raw.Body, &res) 19 return &res, err 20 } 21 22 type StartFailoverResponse struct { 23 // Indicates the DB instance ID. 24 InstanceId string `json:"instanceId,omitempty"` 25 // Indicates former slave node that becomes a master node. 26 NodeId string `json:"nodeId,omitempty"` 27 // Indicates the workflow ID. 28 WorkflowId string `json:"workflowId,omitempty"` 29 }