github.com/opentelekomcloud/gophertelekomcloud@v0.9.3/openstack/rds/v3/instances/SingleToHa.go (about)

     1  package instances
     2  
     3  import (
     4  	"github.com/opentelekomcloud/gophertelekomcloud"
     5  	"github.com/opentelekomcloud/gophertelekomcloud/internal/build"
     6  )
     7  
     8  type SingleToHaOpts struct {
     9  	InstanceId string `json:"-"`
    10  	// Specifies the AZ code of the DB instance node.
    11  	AzCodeNewNode string `json:"az_code_new_node" required:"true"`
    12  	// This parameter is mandatory only when a Microsoft SQL Server DB instance type is changed from single to primary/standby.
    13  	Password string `json:"password,omitempty"`
    14  }
    15  
    16  func SingleToHa(client *golangsdk.ServiceClient, opts SingleToHaOpts) (*string, error) {
    17  	b, err := build.RequestBody(&opts, "single_to_ha")
    18  	if err != nil {
    19  		return nil, err
    20  	}
    21  
    22  	// POST https://{Endpoint}/v3/{project_id}/instances/{instance_id}/action
    23  	raw, err := client.Post(client.ServiceURL("instances", opts.InstanceId, "action"), b, nil, &golangsdk.RequestOpts{
    24  		OkCodes: []int{202},
    25  	})
    26  	return extraJob(err, raw)
    27  }