github.com/huaweicloud/golangsdk@v0.0.0-20210831081626-d823fe11ceba/openstack/compute/v2/extensions/suspendresume/requests.go (about) 1 package suspendresume 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 // Suspend is the operation responsible for suspending a Compute server. 10 func Suspend(client *golangsdk.ServiceClient, id string) (r SuspendResult) { 11 _, r.Err = client.Post(actionURL(client, id), map[string]interface{}{"suspend": nil}, nil, nil) 12 return 13 } 14 15 // Resume is the operation responsible for resuming a Compute server. 16 func Resume(client *golangsdk.ServiceClient, id string) (r UnsuspendResult) { 17 _, r.Err = client.Post(actionURL(client, id), map[string]interface{}{"resume": nil}, nil, nil) 18 return 19 }