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

     1  package lockunlock
     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  // Lock is the operation responsible for locking a Compute server.
    10  func Lock(client *golangsdk.ServiceClient, id string) (r LockResult) {
    11  	_, r.Err = client.Post(actionURL(client, id), map[string]interface{}{"lock": nil}, nil, nil)
    12  	return
    13  }
    14  
    15  // Unlock is the operation responsible for unlocking a Compute server.
    16  func Unlock(client *golangsdk.ServiceClient, id string) (r UnlockResult) {
    17  	_, r.Err = client.Post(actionURL(client, id), map[string]interface{}{"unlock": nil}, nil, nil)
    18  	return
    19  }