v0.5.0 Latest Latest

This package is not in the latest version of its module.

Go to latest
Published: Nov 3, 2015 License: Apache-2.0, Apache-2.0 Imports: 5 Imported by: 0



Package snapshots provides information and interaction with the snapshot API resource for the Rackspace Block Storage service.



This section is empty.


This section is empty.


func Delete

func Delete(client *gophercloud.ServiceClient, id string) os.DeleteResult

Delete will delete the existing Snapshot with the provided ID.

func List

List returns Snapshots.


type CreateOpts

type CreateOpts struct {
	VolumeID string
	Description string
	Force bool
	Name string

CreateOpts contains options for creating a Snapshot. This object is passed to the snapshots.Create function. For more information about these parameters, see the Snapshot object.

func (CreateOpts) ToSnapshotCreateMap

func (opts CreateOpts) ToSnapshotCreateMap() (map[string]interface{}, error)

ToSnapshotCreateMap assembles a request body based on the contents of a CreateOpts.

type CreateOptsBuilder

type CreateOptsBuilder interface {
	ToSnapshotCreateMap() (map[string]interface{}, error)

CreateOptsBuilder allows extensions to add additional parameters to the Create request.

type CreateResult

type CreateResult struct {

CreateResult represents the result of a create operation

func Create

Create will create a new Snapshot based on the values in CreateOpts. To extract the Snapshot object from the response, call the Extract method on the CreateResult.

func (CreateResult) Extract

func (r CreateResult) Extract() (*Snapshot, error)

Extract will get the Snapshot object out of the CreateResult object.

type GetResult

type GetResult struct {

GetResult represents the result of a get operation

func Get

func Get(client *gophercloud.ServiceClient, id string) GetResult

Get retrieves the Snapshot with the provided ID. To extract the Snapshot object from the response, call the Extract method on the GetResult.

func (GetResult) Extract

func (r GetResult) Extract() (*Snapshot, error)

Extract will get the Snapshot object out of the GetResult object.

type Snapshot

type Snapshot struct {
	// The timestamp when this snapshot was created.
	CreatedAt string `mapstructure:"created_at"`

	// The human-readable description for this snapshot.
	Description string `mapstructure:"display_description"`

	// The human-readable name for this snapshot.
	Name string `mapstructure:"display_name"`

	// The UUID for this snapshot.
	ID string `mapstructure:"id"`

	// The random metadata associated with this snapshot. Note: unlike standard
	// OpenStack snapshots, this cannot actually be set.
	Metadata map[string]string `mapstructure:"metadata"`

	// Indicates the current progress of the snapshot's backup procedure.
	Progress string `mapstructure:"os-extended-snapshot-attributes:progress"`

	// The project ID.
	ProjectID string `mapstructure:"os-extended-snapshot-attributes:project_id"`

	// The size of the volume which this snapshot backs up.
	Size int `mapstructure:"size"`

	// The status of the snapshot.
	Status Status `mapstructure:"status"`

	// The ID of the volume which this snapshot seeks to back up.
	VolumeID string `mapstructure:"volume_id"`

Snapshot is the Rackspace representation of an external block storage device.

func ExtractSnapshots

func ExtractSnapshots(page pagination.Page) ([]Snapshot, error)

ExtractSnapshots extracts and returns Snapshots. It is used while iterating over a snapshots.List call.

func (Snapshot) WaitUntilComplete

func (snapshot Snapshot) WaitUntilComplete(c *gophercloud.ServiceClient, timeout int) error

WaitUntilComplete will continually poll a snapshot until it successfully transitions to a specified state. It will do this for at most the number of seconds specified.

func (Snapshot) WaitUntilDeleted

func (snapshot Snapshot) WaitUntilDeleted(c *gophercloud.ServiceClient, timeout int) error

WaitUntilDeleted will continually poll a snapshot until it has been successfully deleted, i.e. returns a 404 status.

type Status

type Status string

Status is the type used to represent a snapshot's status

const (
	Creating    Status = "CREATING"
	Available   Status = "AVAILABLE"
	Deleting    Status = "DELETING"
	Error       Status = "ERROR"
	DeleteError Status = "ERROR_DELETING"

Constants to use for supported statuses

type UpdateOpts

type UpdateOpts struct {
	Name        string
	Description string

UpdateOpts is the common options struct used in this package's Update operation.

func (UpdateOpts) ToSnapshotUpdateMap

func (opts UpdateOpts) ToSnapshotUpdateMap() (map[string]interface{}, error)

ToSnapshotUpdateMap casts a UpdateOpts struct to a map.

type UpdateOptsBuilder

type UpdateOptsBuilder interface {
	ToSnapshotUpdateMap() (map[string]interface{}, error)

UpdateOptsBuilder is the interface options structs have to satisfy in order to be used in the main Update operation in this package. Since many extensions decorate or modify the common logic, it is useful for them to satisfy a basic interface in order for them to be used.

type UpdateResult

type UpdateResult struct {

UpdateResult represents the result of an update operation

func Update

func Update(c *gophercloud.ServiceClient, snapshotID string, opts UpdateOptsBuilder) UpdateResult

Update accepts a UpdateOpts struct and updates an existing snapshot using the values provided.

func (UpdateResult) Extract

func (r UpdateResult) Extract() (*Snapshot, error)

Extract will get the Snapshot object out of the UpdateResult object.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL