blob: 18f107483d53eb45459bb9e0d39c82e4ee13a252 [file] [log] [blame]
Jon Perritt687c7d02014-05-05 18:44:54 -05001package snapshots
2
3import (
4 "github.com/racker/perigee"
5 blockstorage "github.com/rackspace/gophercloud/openstack/blockstorage/v1"
6)
7
8func Create(c *blockstorage.Client, opts CreateOpts) (Snapshot, error) {
9 var ss Snapshot
10 h, err := c.GetHeaders()
11 if err != nil {
12 return ss, err
13 }
14 url := c.GetSnapshotsURL()
15 _, err = perigee.Request("POST", url, perigee.Options{
16 Results: &struct {
17 Snapshot *Snapshot `json:"snapshot"`
18 }{&ss},
19 ReqBody: map[string]interface{}{
20 "snapshot": opts,
21 },
22 MoreHeaders: h,
23 })
24 return ss, err
25}