Add update server call
diff --git a/openstack/compute/servers/client.go b/openstack/compute/servers/client.go
index 8b7d1fb..03c5c15 100644
--- a/openstack/compute/servers/client.go
+++ b/openstack/compute/servers/client.go
@@ -38,6 +38,10 @@
return c.getDeleteUrl(id)
}
+func (c *Client) getUpdateUrl(id string) string {
+ return c.getDeleteUrl(id)
+}
+
func (c *Client) getListHeaders() (map[string]string, error) {
t, err := c.getAuthToken()
if err != nil {
@@ -61,6 +65,10 @@
return c.getListHeaders()
}
+func (c *Client) getUpdateHeaders() (map[string]string, error) {
+ return c.getListHeaders()
+}
+
func (c *Client) getAuthToken() (string, error) {
var err error
diff --git a/openstack/compute/servers/requests.go b/openstack/compute/servers/requests.go
index 8506aac..385e3c2 100644
--- a/openstack/compute/servers/requests.go
+++ b/openstack/compute/servers/requests.go
@@ -78,3 +78,22 @@
return sr, err
}
+// Update requests that various attributes of the indicated server be changed.
+func Update(c *Client, id string, opts map[string]interface{}) (ServerResult, error) {
+ var sr ServerResult
+
+ h, err := c.getUpdateHeaders()
+ if err != nil {
+ return nil, err
+ }
+
+ err = perigee.Put(c.getUpdateUrl(id), perigee.Options{
+ Results: &sr,
+ ReqBody: map[string]interface{}{
+ "server": opts,
+ },
+ MoreHeaders: h,
+ })
+ return sr, err
+}
+