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

     1  package instances
     2  
     3  import (
     4  	"net/http"
     5  
     6  	golangsdk "github.com/opentelekomcloud/gophertelekomcloud"
     7  	"github.com/opentelekomcloud/gophertelekomcloud/internal/extract"
     8  )
     9  
    10  func StartupInstance(client *golangsdk.ServiceClient, instanceId string) (*string, error) {
    11  	// POST https://{Endpoint}/v3/{project_id}/instances/{instance_id}/action/startup
    12  	raw, err := client.Post(client.ServiceURL("instances", instanceId, "action", "startup"), struct{}{}, nil, &golangsdk.RequestOpts{
    13  		OkCodes: []int{200},
    14  	})
    15  	return extraJob(err, raw)
    16  }
    17  
    18  func extraJob(err error, raw *http.Response) (*string, error) {
    19  	if err != nil {
    20  		return nil, err
    21  	}
    22  
    23  	var res JobId
    24  	err = extract.Into(raw.Body, &res)
    25  	return &res.JobId, err
    26  }