delete snapshot
diff --git a/openstack/blockstorage/v1/client.go b/openstack/blockstorage/v1/client.go
index 40cab6c..52477ff 100644
--- a/openstack/blockstorage/v1/client.go
+++ b/openstack/blockstorage/v1/client.go
@@ -34,6 +34,10 @@
return fmt.Sprintf("%s/snapshots", c.endpoint)
}
+func (c *Client) GetSnapshotURL(id string) string {
+ return fmt.Sprintf("%s/snapshots/%s", c.endpoint, id)
+}
+
func (c *Client) GetHeaders() (map[string]string, error) {
t, err := c.getAuthToken()
if err != nil {
diff --git a/openstack/blockstorage/v1/snapshots/requests.go b/openstack/blockstorage/v1/snapshots/requests.go
index 18f1074..90c2ec3 100644
--- a/openstack/blockstorage/v1/snapshots/requests.go
+++ b/openstack/blockstorage/v1/snapshots/requests.go
@@ -23,3 +23,15 @@
})
return ss, err
}
+
+func Delete(c *blockstorage.Client, opts DeleteOpts) error {
+ h, err := c.GetHeaders()
+ if err != nil {
+ return err
+ }
+ url := c.GetSnapshotURL(opts["id"])
+ _, err = perigee.Request("DELETE", url, perigee.Options{
+ MoreHeaders: h,
+ })
+ return err
+}
diff --git a/openstack/blockstorage/v1/snapshots/snapshots.go b/openstack/blockstorage/v1/snapshots/snapshots.go
index 8525f1a..6a76f85 100644
--- a/openstack/blockstorage/v1/snapshots/snapshots.go
+++ b/openstack/blockstorage/v1/snapshots/snapshots.go
@@ -12,3 +12,4 @@
}
type CreateOpts map[string]interface{}
+type DeleteOpts map[string]string