func (snapshot Snapshot) WaitUntilDeleted(c *gophercloud.ServiceClient, timeout int) error {
	return gophercloud.WaitFor(timeout, func() (bool, error) {
		_, err := Get(c, snapshot.ID).Extract()
		if casted, ok := err.(*gophercloud.UnexpectedResponseCodeError); ok && casted.Actual == 404 {
			return true, nil
		} else if err != nil {
			return false, err
		}
		return false, nil
	})
}
WaitUntilDeleted will continually poll a snapshot until it has been
successfully deleted, i.e. returns a 404 status.
package snapshots
import (
	"github.com/rackspace/gophercloud"
	os "github.com/rackspace/gophercloud/openstack/blockstorage/v1/snapshots"
	"github.com/rackspace/gophercloud/pagination"
	"github.com/mitchellh/mapstructure"
)
type Status string
const (
	Creating    Status = "CREATING"
	Available   Status = "AVAILABLE"
	Deleting    Status = "DELETING"
	Error       Status = "ERROR"
	DeleteError Status = "ERROR_DELETING"
)
type Snapshot struct {
	CreatedAt string `mapstructure:"created_at"`
	Description string `mapstructure:"display_description"`
	Name string `mapstructure:"display_name"`
	ID string `mapstructure:"id"`
	Metadata map[string]string `mapstructure:"metadata"`
	Progress string `mapstructure:"os-extended-snapshot-attributes:progress"`
	ProjectID string `mapstructure:"os-extended-snapshot-attributes:project_id"`
	Size int `mapstructure:"size"`
	Status Status `mapstructure:"status"`
	VolumeID string `mapstructure:"volume_id"`
}
type CreateResult struct {
	os.CreateResult
}
type GetResult struct {
	os.GetResult
}
type UpdateResult struct {
	gophercloud.Result
}
func commonExtract(resp interface{}, err error) (*Snapshot, error) {
	if err != nil {
		return nil, err
	}
	var respStruct struct {
		Snapshot *Snapshot `json:"snapshot"`
	}
	err = mapstructure.Decode(resp, &respStruct)
	return respStruct.Snapshot, err
}
func (r GetResult) Extract() (*Snapshot, error) {
	return commonExtract(r.Body, r.Err)
}
func (r CreateResult) Extract() (*Snapshot, error) {
	return commonExtract(r.Body, r.Err)
}
func (r UpdateResult) Extract() (*Snapshot, error) {
	return commonExtract(r.Body, r.Err)
}
func ExtractSnapshots(page pagination.Page) ([]Snapshot, error) {
	var response struct {
		Snapshots []Snapshot `json:"snapshots"`
	}
	err := mapstructure.Decode(page.(os.ListResult).Body, &response)
	return response.Snapshots, err
}
func (snapshot Snapshot) WaitUntilComplete(c *gophercloud.ServiceClient, timeout int) error {
	return gophercloud.WaitFor(timeout, func() (bool, error) {
		current, err := Get(c, snapshot.ID).Extract()
		if err != nil {
			return false, err
		}
		if current.Progress == "100%" {
			return true, nil
		}
		return false, nil
	})
}