snapshots

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2023 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package snapshots provides information and interaction with snapshots in the OpenStack Block Storage service. A snapshot is a point in time copy of the data contained in an external storage volume, and can be controlled programmatically.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func List

List returns Snapshots optionally limited by the conditions provided in ListOpts.

func WaitForStatus

func WaitForStatus(c *gophercloud.ServiceClient, id, status string, secs int) error

WaitForStatus will continually poll the resource, checking for a particular status. It will do this for the amount of seconds defined.

Types

type CreateOpts

type CreateOpts struct {
	VolumeID    string                 `json:"volume_id" required:"true"`
	Description string                 `json:"display_description,omitempty"`
	Force       bool                   `json:"force,omitempty"`
	Metadata    map[string]interface{} `json:"metadata,omitempty"`
	Name        string                 `json:"display_name,omitempty"`
}

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 {
	// contains filtered or unexported fields
}

CreateResult contains the response body and error from a Create request.

func Create

func Create(client *gophercloud.ServiceClient, opts CreateOptsBuilder) (r CreateResult)

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 commonResult object.

type DeleteResult

type DeleteResult struct {
	gophercloud.ErrResult
}

DeleteResult contains the response body and error from a Delete request.

func Delete

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

Delete will delete the existing Snapshot with the provided ID.

type GetResult

type GetResult struct {
	// contains filtered or unexported fields
}

GetResult contains the response body and error from a Get request.

func Get

func Get(client *gophercloud.ServiceClient, id string) (r 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 commonResult object.

type ListOpts

type ListOpts struct {
	Name     string `q:"display_name"`
	Status   string `q:"status"`
	VolumeID string `q:"volume_id"`
}

ListOpts hold options for listing Snapshots. It is passed to the snapshots.List function.

func (ListOpts) ToSnapshotListQuery

func (opts ListOpts) ToSnapshotListQuery() (string, error)

ToSnapshotListQuery formats a ListOpts into a query string.

type ListOptsBuilder

type ListOptsBuilder interface {
	ToSnapshotListQuery() (string, error)
}

ListOptsBuilder allows extensions to add additional parameters to the List request.

type Snapshot

type Snapshot struct {
	// Currect status of the Snapshot.
	Status string `json:"status"`

	// Display name.
	Name string `json:"display_name"`

	// Instances onto which the Snapshot is attached.
	Attachments []string `json:"attachments"`

	// Logical group.
	AvailabilityZone string `json:"availability_zone"`

	// Is the Snapshot bootable?
	Bootable string `json:"bootable"`

	// Date created.
	CreatedAt time.Time `json:"-"`

	// Display description.
	Description string `json:"display_description"`

	// See VolumeType object for more information.
	VolumeType string `json:"volume_type"`

	// ID of the Snapshot from which this Snapshot was created.
	SnapshotID string `json:"snapshot_id"`

	// ID of the Volume from which this Snapshot was created.
	VolumeID string `json:"volume_id"`

	// User-defined key-value pairs.
	Metadata map[string]string `json:"metadata"`

	// Unique identifier.
	ID string `json:"id"`

	// Size of the Snapshot, in GB.
	Size int `json:"size"`
}

Snapshot contains all the information associated with an OpenStack Snapshot.

func ExtractSnapshots

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

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

func (*Snapshot) UnmarshalJSON

func (r *Snapshot) UnmarshalJSON(b []byte) error

type SnapshotPage

type SnapshotPage struct {
	pagination.SinglePageBase
}

SnapshotPage is a pagination.Pager that is returned from a call to the List function.

func (SnapshotPage) IsEmpty

func (r SnapshotPage) IsEmpty() (bool, error)

IsEmpty returns true if a SnapshotPage contains no Snapshots.

type UpdateMetadataOpts

type UpdateMetadataOpts struct {
	Metadata map[string]interface{} `json:"metadata,omitempty"`
}

UpdateMetadataOpts contain options for updating an existing Snapshot. This object is passed to the snapshots.Update function. For more information about the parameters, see the Snapshot object.

func (UpdateMetadataOpts) ToSnapshotUpdateMetadataMap

func (opts UpdateMetadataOpts) ToSnapshotUpdateMetadataMap() (map[string]interface{}, error)

ToSnapshotUpdateMetadataMap assembles a request body based on the contents of an UpdateMetadataOpts.

type UpdateMetadataOptsBuilder

type UpdateMetadataOptsBuilder interface {
	ToSnapshotUpdateMetadataMap() (map[string]interface{}, error)
}

UpdateMetadataOptsBuilder allows extensions to add additional parameters to the Update request.

type UpdateMetadataResult

type UpdateMetadataResult struct {
	// contains filtered or unexported fields
}

UpdateMetadataResult contains the response body and error from an UpdateMetadata request.

func UpdateMetadata

UpdateMetadata will update the Snapshot with provided information. To extract the updated Snapshot from the response, call the ExtractMetadata method on the UpdateMetadataResult.

func (UpdateMetadataResult) Extract

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

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

func (UpdateMetadataResult) ExtractMetadata

func (r UpdateMetadataResult) ExtractMetadata() (map[string]interface{}, error)

ExtractMetadata returns the metadata from a response from snapshots.UpdateMetadata.

Directories

Path Synopsis
snapshots_v1
snapshots_v1

Jump to

Keyboard shortcuts

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