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 ¶
- func List(client *gophercloud.ServiceClient, opts ListOptsBuilder) pagination.Pager
- func WaitForStatus(ctx context.Context, c *gophercloud.ServiceClient, id, status string) error
- type CreateOpts
- type CreateOptsBuilder
- type CreateResult
- type DeleteResult
- type GetResult
- type ListOpts
- type ListOptsBuilder
- type Snapshot
- type SnapshotPage
- type UpdateMetadataOpts
- type UpdateMetadataOptsBuilder
- type UpdateMetadataResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func List ¶
func List(client *gophercloud.ServiceClient, opts ListOptsBuilder) pagination.Pager
List returns Snapshots optionally limited by the conditions provided in ListOpts.
Types ¶
type CreateOpts ¶
type CreateOpts struct { VolumeID string `json:"volume_id" required:"true"` Force bool `json:"force,omitempty"` Name string `json:"name,omitempty"` Description string `json:"description,omitempty"` Metadata map[string]string `json:"metadata,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]any, error)
ToSnapshotCreateMap assembles a request body based on the contents of a CreateOpts.
type CreateOptsBuilder ¶
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(ctx context.Context, 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.
type DeleteResult ¶
type DeleteResult struct {
gophercloud.ErrResult
}
DeleteResult contains the response body and error from a Delete request.
type GetResult ¶
type GetResult struct {
// contains filtered or unexported fields
}
GetResult contains the response body and error from a Get request.
type ListOpts ¶
type ListOpts struct { // AllTenants will retrieve snapshots of all tenants/projects. AllTenants bool `q:"all_tenants"` // Name will filter by the specified snapshot name. Name string `q:"name"` // Status will filter by the specified status. Status string `q:"status"` // TenantID will filter by a specific tenant/project ID. // Setting AllTenants is required to use this. TenantID string `q:"project_id"` // VolumeID will filter by a specified volume ID. VolumeID string `q:"volume_id"` }
ListOpts hold options for listing Snapshots. It is passed to the snapshots.List function.
func (ListOpts) ToSnapshotListQuery ¶
ToSnapshotListQuery formats a ListOpts into a query string.
type ListOptsBuilder ¶
ListOptsBuilder allows extensions to add additional parameters to the List request.
type Snapshot ¶
type Snapshot struct { // Unique identifier. ID string `json:"id"` // Date created. CreatedAt time.Time `json:"-"` // Date updated. UpdatedAt time.Time `json:"-"` // Display name. Name string `json:"name"` // Display description. Description string `json:"description"` // ID of the Volume from which this Snapshot was created. VolumeID string `json:"volume_id"` // Currect status of the Snapshot. Status string `json:"status"` // Size of the Snapshot, in GB. Size int `json:"size"` // User-defined key-value pairs. Metadata map[string]string `json:"metadata"` }
Snapshot contains all the information associated with a Cinder 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 ¶
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 ¶
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]any, error)
ToSnapshotUpdateMetadataMap assembles a request body based on the contents of an UpdateMetadataOpts.
type UpdateMetadataOptsBuilder ¶
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 ¶
func UpdateMetadata(ctx context.Context, client *gophercloud.ServiceClient, id string, opts UpdateMetadataOptsBuilder) (r UpdateMetadataResult)
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 ¶
Extract will get the Snapshot object out of the commonResult object.
func (UpdateMetadataResult) ExtractMetadata ¶
func (r UpdateMetadataResult) ExtractMetadata() (map[string]any, error)
ExtractMetadata returns the metadata from a response from snapshots.UpdateMetadata.