github.com/opentelekomcloud/gophertelekomcloud@v0.9.3/openstack/dds/v3/instances/AddNode.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 AddNodeOpts struct {
     9  	Type       string      `json:"type" required:"true"`
    10  	SpecCode   string      `json:"spec_code" required:"true"`
    11  	Num        int         `json:"num" required:"true"`
    12  	Volume     *VolumeNode `json:"volume,omitempty"`
    13  	InstanceId string      `json:"-"`
    14  }
    15  
    16  type VolumeNode struct {
    17  	Size int `json:"size"`
    18  }
    19  
    20  func AddNode(client *golangsdk.ServiceClient, opts AddNodeOpts) (*string, error) {
    21  	b, err := build.RequestBody(opts, "")
    22  	if err != nil {
    23  		return nil, err
    24  	}
    25  
    26  	raw, err := client.Post(client.ServiceURL("instances", opts.InstanceId, "enlarge"), b, nil, &golangsdk.RequestOpts{
    27  		OkCodes: []int{200, 202},
    28  	})
    29  	return extractJob(err, raw)
    30  }