create snapshot
diff --git a/openstack/blockstorage/v1/client.go b/openstack/blockstorage/v1/client.go
index dfce924..40cab6c 100644
--- a/openstack/blockstorage/v1/client.go
+++ b/openstack/blockstorage/v1/client.go
@@ -30,6 +30,10 @@
return fmt.Sprintf("%s/volumes/%s", c.endpoint, id)
}
+func (c *Client) GetSnapshotsURL() string {
+ return fmt.Sprintf("%s/snapshots", c.endpoint)
+}
+
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
new file mode 100644
index 0000000..18f1074
--- /dev/null
+++ b/openstack/blockstorage/v1/snapshots/requests.go
@@ -0,0 +1,25 @@
+package snapshots
+
+import (
+ "github.com/racker/perigee"
+ blockstorage "github.com/rackspace/gophercloud/openstack/blockstorage/v1"
+)
+
+func Create(c *blockstorage.Client, opts CreateOpts) (Snapshot, error) {
+ var ss Snapshot
+ h, err := c.GetHeaders()
+ if err != nil {
+ return ss, err
+ }
+ url := c.GetSnapshotsURL()
+ _, err = perigee.Request("POST", url, perigee.Options{
+ Results: &struct {
+ Snapshot *Snapshot `json:"snapshot"`
+ }{&ss},
+ ReqBody: map[string]interface{}{
+ "snapshot": opts,
+ },
+ MoreHeaders: h,
+ })
+ return ss, err
+}
diff --git a/openstack/blockstorage/v1/snapshots/snapshots.go b/openstack/blockstorage/v1/snapshots/snapshots.go
new file mode 100644
index 0000000..8525f1a
--- /dev/null
+++ b/openstack/blockstorage/v1/snapshots/snapshots.go
@@ -0,0 +1,14 @@
+package snapshots
+
+type Snapshot struct {
+ Status string
+ Display_name string
+ Created_at string
+ Display_description string
+ Volume_id string
+ Metadata map[string]string
+ Id string
+ Size int
+}
+
+type CreateOpts map[string]interface{}