Documentation ¶
Index ¶
- func Create(c *gcorecloud.ServiceClient, opts CreateOptsBuilder) (r tasks.Result)
- func Delete(c *gcorecloud.ServiceClient, snapshotID string) (r tasks.Result)
- func ExtractSnapshotIDFromTask(task *tasks.Task) (string, error)
- func ExtractSnapshotsInto(r pagination.Page, v interface{}) error
- func IDFromName(client *gcorecloud.ServiceClient, name string, opts ListOptsBuilder) (string, error)
- func List(c *gcorecloud.ServiceClient, opts ListOptsBuilder) pagination.Pager
- type CreateOpts
- type CreateOptsBuilder
- type GetResult
- type ListOpts
- type ListOptsBuilder
- type MetadataActionResult
- type MetadataOpts
- type MetadataOptsBuilder
- type MetadataSetOpts
- type Snapshot
- type SnapshotPage
- type SnapshotTaskResult
- type UpdateOpts
- type UpdateOptsBuilder
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Create ¶
func Create(c *gcorecloud.ServiceClient, opts CreateOptsBuilder) (r tasks.Result)
Create accepts a CreateOpts struct and creates a new snapshot using the values provided.
func Delete ¶
func Delete(c *gcorecloud.ServiceClient, snapshotID string) (r tasks.Result)
Delete accepts a unique ID and deletes the snapshot associated with it.
func ExtractSnapshotsInto ¶
func ExtractSnapshotsInto(r pagination.Page, v interface{}) error
func IDFromName ¶
func IDFromName(client *gcorecloud.ServiceClient, name string, opts ListOptsBuilder) (string, error)
IDFromName is a convenience function that returns a snapshot ID, given its name.
func List ¶
func List(c *gcorecloud.ServiceClient, opts ListOptsBuilder) pagination.Pager
Types ¶
type CreateOpts ¶
type CreateOpts struct { VolumeID string `json:"volume_id" required:"true" validate:"required"` Name string `json:"name" required:"true" validate:"required"` Description string `json:"description,omitempty"` Metadata map[string]string `json:"metadata,omitempty"` }
CreateOpts represents options used to create a snapshot.
func (CreateOpts) ToSnapshotCreateMap ¶
func (opts CreateOpts) ToSnapshotCreateMap() (map[string]interface{}, error)
ToSnapshotCreateMap builds a request body from CreateOpts.
type CreateOptsBuilder ¶
CreateOptsBuilder allows extensions to add additional parameters to the Create request.
type GetResult ¶
type GetResult struct {
// contains filtered or unexported fields
}
GetResult represents the result of a get operation. Call its Extract method to interpret it as a Snapshot.
func Get ¶
func Get(c *gcorecloud.ServiceClient, id string) (r GetResult)
Get retrieves a specific snapshot based on its unique ID.
func MetadataReplace ¶ added in v0.4.26
func MetadataReplace(client *gcorecloud.ServiceClient, id string, opts MetadataSetOpts) (r GetResult)
MetadataReplace replace a metadata for an snapshot.
func (GetResult) Extract ¶
Extract is a function that accepts a result and extracts a snapshot resource.
func (GetResult) ExtractInto ¶
func (r GetResult) ExtractInto(v interface{}) error
type ListOpts ¶
ListOpts allows the filtering and sorting of paginated collections through the API.
func (ListOpts) ToSnapshotListQuery ¶
ToListenerListQuery formats a ListOpts into a query string.
type ListOptsBuilder ¶
ListOptsBuilder allows extensions to add additional parameters to the List request.
type MetadataActionResult ¶ added in v0.4.26
type MetadataActionResult struct {
gcorecloud.ErrResult
}
MetadataActionResult represents the result of a create, delete or update operation(no content)
type MetadataOpts ¶ added in v0.4.26
type MetadataOpts struct { Key string `json:"key" validate:"required,max=255"` Value string `json:"value" validate:"required,max=255"` }
MetadataOpts. Set parameters for Create or Update operation
type MetadataOptsBuilder ¶ added in v0.4.26
MetadataOptsBuilder allows extensions to add additional parameters to the metadata Create and Update request.
type MetadataSetOpts ¶ added in v0.4.26
type MetadataSetOpts struct {
Metadata []MetadataOpts `json:"metadata"`
}
MetadataSetOpts. Set parameters for Create or Update operation
func (MetadataSetOpts) ToMetadataMap ¶ added in v0.4.26
func (opts MetadataSetOpts) ToMetadataMap() (map[string]interface{}, error)
ToMetadataMap builds a request body from MetadataSetOpts.
func (MetadataSetOpts) Validate ¶ added in v0.4.26
func (opts MetadataSetOpts) Validate() error
Validate
type Snapshot ¶
type Snapshot struct { ID string `json:"id"` Name string `json:"name"` Description string `json:"description"` Status string `json:"status"` Size int `json:"size"` VolumeID string `json:"volume_id"` CreatedAt gcorecloud.JSONRFC3339Z `json:"created_at"` UpdatedAt *gcorecloud.JSONRFC3339Z `json:"updated_at"` Metadata map[string]string `json:"metadata"` CreatorTaskID *string `json:"creator_task_id"` TaskID *string `json:"task_id"` ProjectID int `json:"project_id"` RegionID int `json:"region_id"` Region string `json:"region"` }
Snapshot represents a snapshot.
func ExtractSnapshots ¶
func ExtractSnapshots(r pagination.Page) ([]Snapshot, error)
ExtractSnapshot accepts a Page struct, specifically a SnapshotPage struct, and extracts the elements into a slice of Snapshot structs. In other words, a generic collection is mapped into a relevant slice.
func ListAll ¶
func ListAll(client *gcorecloud.ServiceClient, opts ListOptsBuilder) ([]Snapshot, error)
ListAll is a convenience function that returns all snapshots.
type SnapshotPage ¶
type SnapshotPage struct {
pagination.LinkedPageBase
}
SnapshotPage is the page returned by a pager when traversing over a collection of snapshots.
func (SnapshotPage) IsEmpty ¶
func (r SnapshotPage) IsEmpty() (bool, error)
IsEmpty checks whether a SnapshotPage struct is empty.
func (SnapshotPage) NextPageURL ¶
func (r SnapshotPage) NextPageURL() (string, error)
NextPageURL is invoked when a paginated collection of snapshots has reached the end of a page and the pager seeks to traverse over a new one. In order to do this, it needs to construct the next page's URL.
type SnapshotTaskResult ¶
type SnapshotTaskResult struct {
Snapshots []string `json:"snapshots"`
}
type UpdateOpts ¶
type UpdateOpts struct {
Name string `json:"name,omitempty"`
}
UpdateOpts represents options used to update a snapshot.
func (UpdateOpts) ToSnapshotUpdateMap ¶
func (opts UpdateOpts) ToSnapshotUpdateMap() (map[string]interface{}, error)
ToSnapshotUpdateMap builds a request body from UpdateOpts.
type UpdateOptsBuilder ¶
UpdateOptsBuilder allows extensions to add additional parameters to the Update request.