github.com/opentelekomcloud/gophertelekomcloud@v0.9.3/openstack/dds/v3/instances/ScaleStorage.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 ScaleStorageOpt struct {
     9  	// Specifies the role ID.
    10  	//
    11  	// For a cluster instance, this parameter is set to the ID of the shard group.
    12  	// This parameter is not transferred for replica set and single node instances.
    13  	GroupId string `json:"group_id,omitempty"`
    14  	// Specifies the requested disk capacity. The value must be an integer multiple of 10 and greater than the current storage space.
    15  	//
    16  	// In a cluster instance, this parameter indicates the storage space of shard nodes. The value range is from 10 GB to 2000 GB.
    17  	// In a replica set instance, this parameter indicates the disk capacity of the DB instance to be expanded. The value range is from 10 GB to 2000 GB.
    18  	// In a single node instance, this parameter indicates the disk capacity of the DB instance to be expanded. The value range is from 10 GB to 1000 GB.
    19  	Size string `json:"size" required:"true"`
    20  	// Specifies the instance
    21  	InstanceId string `json:"-"`
    22  }
    23  
    24  func ScaleStorage(client *golangsdk.ServiceClient, opts ScaleStorageOpt) (*string, error) {
    25  	b, err := build.RequestBody(opts, "volume")
    26  	if err != nil {
    27  		return nil, err
    28  	}
    29  
    30  	// POST https://{Endpoint}/v3/{project_id}/instances/{instance_id}/enlarge-volume
    31  	raw, err := client.Post(client.ServiceURL("instances", opts.InstanceId, "enlarge-volume"), b, nil, &golangsdk.RequestOpts{
    32  		OkCodes: []int{200, 202},
    33  	})
    34  	return extractJob(err, raw)
    35  }