snapshots

package
Version: v0.3.0 Latest Latest
Warning

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

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

Documentation

Overview

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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

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.

Types

type CreateOpts

type CreateOpts struct {
	// REQUIRED
	VolumeID string
	// OPTIONAL
	Description string
	// OPTIONAL
	Force bool
	// OPTIONAL
	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 {
	os.CreateResult
}

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 {
	os.GetResult
}

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 {
	gophercloud.Result
}

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
t or T : Toggle theme light dark auto
y or Y : Canonical URL