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

     1  package instances
     2  
     3  import (
     4  	"github.com/opentelekomcloud/gophertelekomcloud"
     5  	"github.com/opentelekomcloud/gophertelekomcloud/internal/build"
     6  )
     7  
     8  type RestartOpts struct {
     9  	InstanceId string `json:"-"`
    10  	// This parameter is left blank.
    11  	Restart struct{} `json:"restart"`
    12  }
    13  
    14  func Restart(client *golangsdk.ServiceClient, opts RestartOpts) (*string, error) {
    15  	b, err := build.RequestBody(opts, "")
    16  	if err != nil {
    17  		return nil, err
    18  	}
    19  
    20  	// POST https://{Endpoint}/v3/{project_id}/instances/{instance_id}/action
    21  	raw, err := client.Post(client.ServiceURL("instances", opts.InstanceId, "action"), b, nil, &golangsdk.RequestOpts{
    22  		OkCodes: []int{202},
    23  	})
    24  	return extraJob(err, raw)
    25  }