Add Nova get-password support
Add support to get a encrypted administrative password for a server
through a GET on: /v2.1/{tenant_id}/servers/{server_id}/os-server-password
optionally decrypting the password if a private key is supplied.
The same operation with OpenStack CLI is done with:
nova get-password <server_id> [private_key.pem]
diff --git a/openstack/compute/v2/servers/requests.go b/openstack/compute/v2/servers/requests.go
index 8e60daa..b995053 100644
--- a/openstack/compute/v2/servers/requests.go
+++ b/openstack/compute/v2/servers/requests.go
@@ -861,3 +861,12 @@
return "", fmt.Errorf("Found %d servers matching %s", serverCount, name)
}
}
+
+// GetPassword makes a request agains the nova API to get the encrypted administrative password.
+func GetPassword(client *gophercloud.ServiceClient, serverId string) GetPasswordResult {
+ var res GetPasswordResult
+ _, res.Err = client.Request("GET", passwordURL(client, serverId), gophercloud.RequestOpts{
+ JSONResponse: &res.Body,
+ })
+ return res
+}