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

     1  package instances
     2  
     3  import (
     4  	"github.com/opentelekomcloud/gophertelekomcloud"
     5  	"github.com/opentelekomcloud/gophertelekomcloud/internal/build"
     6  	"github.com/opentelekomcloud/gophertelekomcloud/internal/extract"
     7  )
     8  
     9  type ResizeOpts struct {
    10  	InstanceId string `json:"-"`
    11  	// Specifies the resource specification code. Use rds.mysql.m1.xlarge as an example. rds indicates RDS, mysql indicates the DB engine, and m1.xlarge indicates the performance specification (large-memory). The parameter containing rr indicates the read replica specifications. The parameter not containing rr indicates the single or primary/standby DB instance specifications.
    12  	SpecCode string `json:"spec_code" required:"true"`
    13  }
    14  
    15  func Resize(client *golangsdk.ServiceClient, opts ResizeOpts) (*string, error) {
    16  	b, err := build.RequestBody(opts, "resize_flavor")
    17  	if err != nil {
    18  		return nil, err
    19  	}
    20  
    21  	// POST https://{Endpoint}/v3/{project_id}/instances/{instance_id}/action
    22  	raw, err := client.Post(client.ServiceURL("instances", opts.InstanceId, "action"), b, nil, nil)
    23  	if err != nil {
    24  		return nil, err
    25  	}
    26  
    27  	var res JobId
    28  	err = extract.Into(raw.Body, &res)
    29  	return &res.JobId, err
    30  }