snapshots

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2019 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IDFromName

func IDFromName(client *gophercloud.ServiceClient, name string) (string, error)

IDFromName is a convenience function that returns a snapshot's ID given its name.

func ListDetail

func ListDetail(client *gophercloud.ServiceClient, opts ListOptsBuilder) pagination.Pager

ListDetail returns []Snapshot optionally limited by the conditions provided in ListOpts.

Types

type CreateOpts

type CreateOpts struct {
	// The UUID of the share from which to create a snapshot
	ShareID string `json:"share_id" required:"true"`
	// Defines the snapshot name
	Name string `json:"name,omitempty"`
	// Defines the snapshot description
	Description string `json:"description,omitempty"`
	// DisplayName is equivalent to Name. The API supports using both
	// This is an inherited attribute from the block storage API
	DisplayName string `json:"display_name,omitempty"`
	// DisplayDescription is equivalent to Description. The API supports using both
	// This is an inherited attribute from the block storage API
	DisplayDescription string `json:"display_description,omitempty"`
}

CreateOpts contains the options for create a Snapshot. This object is passed to snapshots.Create(). For more information about these parameters, please refer to the Snapshot object, or the shared file systems API v2 documentation

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 from the commonResult

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 an existing Snapshot with the given UUID.

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 will get a single snapshot with given UUID

func (GetResult) Extract

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

Extract will get the Snapshot object from the commonResult

type ListOpts

type ListOpts struct {
	// (Admin only). Defines whether to list the requested resources for all projects.
	AllTenants bool `q:"all_tenants"`
	// The snapshot name.
	Name string `q:"name"`
	// Filter  by a snapshot description.
	Description string `q:"description"`
	// Filters by a share from which the snapshot was created.
	ShareID string `q:"share_id"`
	// Filters by a snapshot size in GB.
	Size int `q:"size"`
	// Filters by a snapshot status.
	Status string `q:"status"`
	// The maximum number of snapshots to return.
	Limit int `q:"limit"`
	// The offset to define start point of snapshot or snapshot group listing.
	Offset int `q:"offset"`
	// The key to sort a list of snapshots.
	SortKey string `q:"sort_key"`
	// The direction to sort a list of snapshots.
	SortDir string `q:"sort_dir"`
	// The UUID of the project in which the snapshot was created. Useful with all_tenants parameter.
	ProjectID string `q:"project_id"`
	// The name pattern that can be used to filter snapshots, snapshot snapshots, snapshot networks or snapshot groups.
	NamePattern string `q:"name~"`
	// The description pattern that can be used to filter snapshots, snapshot snapshots, snapshot networks or snapshot groups.
	DescriptionPattern string `q:"description~"`
}

ListOpts holds 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 {
	// The UUID of the snapshot
	ID string `json:"id"`
	// The name of the snapshot
	Name string `json:"name,omitempty"`
	// A description of the snapshot
	Description string `json:"description,omitempty"`
	// UUID of the share from which the snapshot was created
	ShareID string `json:"share_id"`
	// The shared file system protocol
	ShareProto string `json:"share_proto"`
	// Size of the snapshot share in GB
	ShareSize int `json:"share_size"`
	// Size of the snapshot in GB
	Size int `json:"size"`
	// The snapshot status
	Status string `json:"status"`
	// The UUID of the project in which the snapshot was created
	ProjectID string `json:"project_id"`
	// Timestamp when the snapshot was created
	CreatedAt time.Time `json:"-"`
	// Snapshot links for pagination
	Links []map[string]string `json:"links"`
}

Snapshot contains all information associated with an OpenStack Snapshot

func ExtractSnapshots

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

ExtractSnapshots extracts and returns a Snapshot slice. 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.MarkerPageBase
}

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 satisifies the IsEmpty method of the Page interface

func (SnapshotPage) LastMarker

func (r SnapshotPage) LastMarker() (string, error)

LastMarker returns the last offset in a ListResult.

func (SnapshotPage) NextPageURL

func (r SnapshotPage) NextPageURL() (string, error)

NextPageURL generates the URL for the page of results after this one.

type UpdateOpts

type UpdateOpts struct {
	// Snapshot name. Manila snapshot update logic doesn't have a "name" alias.
	DisplayName *string `json:"display_name,omitempty"`
	// Snapshot description. Manila snapshot update logic doesn't have a "description" alias.
	DisplayDescription *string `json:"display_description,omitempty"`
}

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

func (UpdateOpts) ToSnapshotUpdateMap

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

ToSnapshotUpdateMap assembles a request body based on the contents of an UpdateOpts.

type UpdateOptsBuilder

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

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

type UpdateResult

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

UpdateResult contains the response body and error from an Update request.

func Update

func Update(client *gophercloud.ServiceClient, id string, opts UpdateOptsBuilder) (r UpdateResult)

Update will update the Snapshot with provided information. To extract the updated Snapshot from the response, call the Extract method on the UpdateResult.

func (UpdateResult) Extract

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

Extract will get the Snapshot object from the commonResult

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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