Adding instance actions
diff --git a/openstack/db/v1/instances/requests.go b/openstack/db/v1/instances/requests.go
index 8bac170..b272ce3 100644
--- a/openstack/db/v1/instances/requests.go
+++ b/openstack/db/v1/instances/requests.go
@@ -253,3 +253,60 @@
return res.Body.(map[string]interface{})["rootEnabled"] == true, err
}
+
+func RestartService(client *gophercloud.ServiceClient, id string) ActionResult {
+ var res ActionResult
+
+ resp, err := perigee.Request("POST", actionURL(client, id), perigee.Options{
+ MoreHeaders: client.AuthenticatedHeaders(),
+ ReqBody: map[string]bool{"restart": true},
+ OkCodes: []int{202},
+ })
+
+ res.Header = resp.HttpResponse.Header
+ res.Err = err
+
+ return res
+}
+
+func ResizeInstance(client *gophercloud.ServiceClient, id, flavorRef string) ActionResult {
+ var res ActionResult
+
+ reqBody := map[string]map[string]string{
+ "resize": map[string]string{
+ "flavorRef": flavorRef,
+ },
+ }
+
+ resp, err := perigee.Request("POST", actionURL(client, id), perigee.Options{
+ MoreHeaders: client.AuthenticatedHeaders(),
+ ReqBody: reqBody,
+ OkCodes: []int{202},
+ })
+
+ res.Header = resp.HttpResponse.Header
+ res.Err = err
+
+ return res
+}
+
+func ResizeVolume(client *gophercloud.ServiceClient, id string, size int) ActionResult {
+ var res ActionResult
+
+ reqBody := map[string]map[string]map[string]int{
+ "resize": map[string]map[string]int{
+ "volume": map[string]int{"size": size},
+ },
+ }
+
+ resp, err := perigee.Request("POST", actionURL(client, id), perigee.Options{
+ MoreHeaders: client.AuthenticatedHeaders(),
+ ReqBody: reqBody,
+ OkCodes: []int{202},
+ })
+
+ res.Header = resp.HttpResponse.Header
+ res.Err = err
+
+ return res
+}