github.com/opentelekomcloud/gophertelekomcloud@v0.9.3/openstack/rds/v3/instances/ChangeFailoverStrategy.go (about) 1 package instances 2 3 import ( 4 golangsdk "github.com/opentelekomcloud/gophertelekomcloud" 5 "github.com/opentelekomcloud/gophertelekomcloud/internal/build" 6 ) 7 8 type ChangeFailoverStrategyOpts struct { 9 InstanceId string `json:"-"` 10 // Specifies the failover priority. Valid value: 11 // reliability: Data reliability is preferentially ensured during the failover to minimize the amount of lost data. It is recommended for services that require high data consistency. 12 // availability: Data availability is preferentially ensured during the failover to recover services quickly. It is recommended for services that have high requirements on the database online duration. 13 RepairStrategy string `json:"repairStrategy"` 14 } 15 16 func ChangeFailoverStrategy(client *golangsdk.ServiceClient, opts ChangeFailoverStrategyOpts) (err error) { 17 b, err := build.RequestBody(opts, "") 18 if err != nil { 19 return 20 } 21 22 // PUT /v3/{project_id}/instances/{instance_id}/failover/strategy 23 _, err = client.Put(client.ServiceURL("instances", opts.InstanceId, "failover", "strategy"), b, nil, &golangsdk.RequestOpts{ 24 OkCodes: []int{200}, 25 }) 26 return 27 }