github.com/huaweicloud/golangsdk@v0.0.0-20210831081626-d823fe11ceba/openstack/compute/v2/extensions/startstop/requests.go (about)

     1  package startstop
     2  
     3  import "github.com/huaweicloud/golangsdk"
     4  
     5  func actionURL(client *golangsdk.ServiceClient, id string) string {
     6  	return client.ServiceURL("servers", id, "action")
     7  }
     8  
     9  // Start is the operation responsible for starting a Compute server.
    10  func Start(client *golangsdk.ServiceClient, id string) (r StartResult) {
    11  	_, r.Err = client.Post(actionURL(client, id), map[string]interface{}{"os-start": nil}, nil, nil)
    12  	return
    13  }
    14  
    15  // Stop is the operation responsible for stopping a Compute server.
    16  func Stop(client *golangsdk.ServiceClient, id string) (r StopResult) {
    17  	_, r.Err = client.Post(actionURL(client, id), map[string]interface{}{"os-stop": nil}, nil, nil)
    18  	return
    19  }