cloudvolumes

package
v0.0.0-...-d823fe1 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2021 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func List

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

Types

type Attachment

type Attachment struct {
	// Specifies the ID of the attachment information
	AttachmentID string `json:"attachment_id"`
	// Specifies the disk ID
	VolumeID string `json:"volume_id"`
	// Specifies the ID of the attached resource, equals to volume_id
	ResourceID string `json:"id"`
	// Specifies the ID of the server to which the disk is attached
	ServerID string `json:"server_id"`
	// Specifies the name of the host accommodating the server to which the disk is attached
	HostName string `json:"host_name"`
	// Specifies the device name
	Device string `json:"device"`
	// Specifies the time when the disk was attached. Time format: UTC YYYY-MM-DDTHH:MM:SS.XXXXXX
	AttachedAt string `json:"attached_at"`
}

Attachment contains the disk attachment information

type CreateOpts

type CreateOpts struct {
	Volume     VolumeOpts          `json:"volume" required:"true"`
	ChargeInfo *structs.ChargeInfo `json:"bssParam,omitempty"`
	Scheduler  *SchedulerOpts      `json:"OS-SCH-HNT:scheduler_hints,omitempty"`
	ServerID   string              `json:"server_id,omitempty"`
}

CreateOpts contains options for creating a Volume. This object is passed to the cloudvolumes.Create function.

func (CreateOpts) ToVolumeCreateMap

func (opts CreateOpts) ToVolumeCreateMap() (map[string]interface{}, error)

ToVolumeCreateMap assembles a request body based on the contents of a CreateOpts.

type CreateOptsBuilder

type CreateOptsBuilder interface {
	ToVolumeCreateMap() (map[string]interface{}, error)
}

CreateOptsBuilder allows extensions to add additional parameters to the Create request.

type DeleteOpts

type DeleteOpts struct {
	// Specifies to delete all snapshots associated with the EVS disk.
	Cascade bool `q:"cascade"`
}

DeleteOpts contain options for deleting an existing Volume. This object is passed to the cloudvolumes.Delete function.

func (DeleteOpts) ToVolumeDeleteQuery

func (opts DeleteOpts) ToVolumeDeleteQuery() (string, error)

ToVolumeDeleteQuery assembles a request body based on the contents of an DeleteOpts.

type DeleteOptsBuilder

type DeleteOptsBuilder interface {
	ToVolumeDeleteQuery() (string, error)
}

DeleteOptsBuilder is an interface by which can be able to build the query string of volume deletion.

type DeleteResult

type DeleteResult struct {
	golangsdk.ErrResult
}

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

func Delete

func Delete(client *golangsdk.ServiceClient, id string, opts DeleteOptsBuilder) (r DeleteResult)

Delete will delete the existing Volume with the provided ID

type ErrorInfo

type ErrorInfo struct {
	Message string `json:"message"`
	Code    string `json:"code"`
}

ErrorInfo contains the error message returned when an error occurs

type ExtendChargeOpts

type ExtendChargeOpts struct {
	IsAutoPay string `json:"is_auto_pay,omitempty"`
}

ExtendChargeOpts contains the charging parameters of the volume

type ExtendOpts

type ExtendOpts struct {
	SizeOpts   ExtendSizeOpts    `json:"os-extend" required:"true"`
	ChargeInfo *ExtendChargeOpts `json:"bssParam,omitempty"`
}

ExtendOpts contains options for extending the size of an existing Volume. This object is passed to the cloudvolumes.ExtendSize function.

func (ExtendOpts) ToVolumeExtendMap

func (opts ExtendOpts) ToVolumeExtendMap() (map[string]interface{}, error)

ToVolumeExtendMap assembles a request body based on the contents of an ExtendOpts.

type ExtendOptsBuilder

type ExtendOptsBuilder interface {
	ToVolumeExtendMap() (map[string]interface{}, error)
}

ExtendOptsBuilder allows extensions to add additional parameters to the ExtendSize request.

type ExtendSizeOpts

type ExtendSizeOpts struct {
	NewSize int `json:"new_size" required:"true"`
}

ExtendSizeOpts contains the new size of the volume, in GB.

type GetResult

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

GetResult contains the response body from a Get request.

func Get

func Get(client *golangsdk.ServiceClient, id string) (r GetResult)

Get retrieves the Volume with the provided ID. To extract the Volume object from the response, call the Extract method on the GetResult.

func (GetResult) Extract

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

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

func (GetResult) ExtractInto

func (r GetResult) ExtractInto(v interface{}) error

ExtractInto converts our response data into a volume struct

type JobResponse

type JobResponse struct {
	JobID     string    `json:"job_id"`
	OrderID   string    `json:"order_id"`
	VolumeIDs []string  `json:"volume_ids"`
	Error     ErrorInfo `json:"error"`
}

JobResponse contains all the information from Create and ExtendSize response

type JobResult

type JobResult struct {
	golangsdk.Result
}

JobResult contains the response body and error from Create and ExtendSize requests

func Create

func Create(client *golangsdk.ServiceClient, opts CreateOptsBuilder) (r JobResult)

Create will create a new Volume based on the values in CreateOpts.

func ExtendSize

func ExtendSize(client *golangsdk.ServiceClient, id string, opts ExtendOptsBuilder) (r JobResult)

ExtendSize will extend the size of the volume based on the provided information. This operation does not return a response body.

func (JobResult) Extract

func (r JobResult) Extract() (*JobResponse, error)

Extract will get the JobResponse object out of the JobResult

type ListOpts

type ListOpts struct {
	// Name will filter by the specified volume name.
	Name string `q:"name"`

	// Status will filter by the specified status.
	Status string `q:"status"`

	// Metadata will filter results based on specified metadata.
	Metadata map[string]string `q:"metadata"`

	ID string `q:"id"`

	ServerID string `q:"server_id"`

	SortKey string `q:"sort_key"`
	SortDir string `q:"sort_dir"`

	// Requests a page size of items.
	Limit int `q:"limit"`

	// Used in conjunction with limit to return a slice of items.
	Offset int `q:"offset"`

	// The ID of the last-seen item.
	Marker string `q:"marker"`
}

ListOpts holds options for listing Volumes. It is passed to the volumes.List function.

func (ListOpts) ToVolumeListQuery

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

ToVolumeListQuery formats a ListOpts into a query string.

type ListOptsBuilder

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

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

type SchedulerOpts

type SchedulerOpts struct {
	StorageID string `json:"dedicated_storage_id,omitempty"`
}

SchedulerOpts contains the scheduler hints

type UpdateOpts

type UpdateOpts struct {
	Name        string  `json:"name,omitempty"`
	Description *string `json:"description,omitempty"`
}

UpdateOpts contain options for updating an existing Volume. This object is passed to the cloudvolumes.Update function.

func (UpdateOpts) ToVolumeUpdateMap

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

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

type UpdateOptsBuilder

type UpdateOptsBuilder interface {
	ToVolumeUpdateMap() (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 from a Update request.

func Update

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

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

func (UpdateResult) Extract

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

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

func (UpdateResult) ExtractInto

func (r UpdateResult) ExtractInto(v interface{}) error

ExtractInto converts our response data into a volume struct

type Volume

type Volume struct {
	// Unique identifier for the volume.
	ID string `json:"id"`
	// Human-readable display name for the volume.
	Name string `json:"name"`
	// Current status of the volume.
	Status string `json:"status"`
	// Size of the volume in GB.
	Size int `json:"size"`
	// Human-readable description for the volume.
	Description string `json:"description"`
	// The type of volume to create, either SATA or SSD.
	VolumeType string `json:"volume_type"`
	// AvailabilityZone is which availability zone the volume is in.
	AvailabilityZone string `json:"availability_zone"`
	// Instances onto which the volume is attached.
	Attachments []Attachment `json:"attachments"`

	// The metadata of the disk image.
	ImageMetadata map[string]string `json:"volume_image_metadata"`
	// The ID of the snapshot from which the volume was created
	SnapshotID string `json:"snapshot_id"`
	// The ID of another block storage volume from which the current volume was created
	SourceVolID string `json:"source_volid"`

	// Indicates whether this is a bootable volume.
	Bootable string `json:"bootable"`
	// Multiattach denotes if the volume is multi-attach capable.
	Multiattach bool `json:"multiattach"`
	// Encrypted denotes if the volume is encrypted.
	Encrypted bool `json:"encrypted"`
	// wwn of the volume.
	WWN string `json:"wwn"`
	// enterprise project ID bound to the volume
	EnterpriseProjectID string `json:"enterprise_project_id"`
	// ReplicationStatus is the status of replication.
	ReplicationStatus string `json:"replication_status"`
	// ConsistencyGroupID is the consistency group ID.
	ConsistencyGroupID string `json:"consistencygroup_id"`
	// Arbitrary key-value pairs defined by the metadata field table.
	Metadata map[string]string `json:"metadata"`
	// Arbitrary key-value pairs defined by the user.
	Tags map[string]string `json:"tags"`
	// UserID is the id of the user who created the volume.
	UserID string `json:"user_id"`
	// The date when this volume was created.
	CreatedAt string `json:"created_at"`
	// The date when this volume was last updated
	UpdatedAt string `json:"updated_at"`
}

Volume contains all the information associated with a Volume.

func ExtractVolumes

func ExtractVolumes(r pagination.Page) ([]Volume, error)

ExtractVolumes extracts and returns Volumes. It is used while iterating over a cloudvolumes.List call.

type VolumeOpts

type VolumeOpts struct {
	// The availability zone
	AvailabilityZone string `json:"availability_zone" required:"true"`
	// The associated volume type
	VolumeType string `json:"volume_type" required:"true"`
	// The volume name
	Name string `json:"name,omitempty"`
	// The volume description
	Description string `json:"description,omitempty"`
	// The size of the volume, in GB
	Size int `json:"size,omitempty"`
	// The number to be created in a batch
	Count int `json:"count,omitempty"`
	// The backup_id
	BackupID string `json:"backup_id,omitempty"`
	// the ID of the existing volume snapshot
	SnapshotID string `json:"snapshot_id,omitempty"`
	// the ID of the image in IMS
	ImageID string `json:"imageRef,omitempty"`
	// Shared disk
	Multiattach bool `json:"multiattach,omitempty"`
	// One or more metadata key and value pairs to associate with the volume
	Metadata map[string]string `json:"metadata,omitempty"`
	// One or more tag key and value pairs to associate with the volume
	Tags map[string]string `json:"tags,omitempty"`
	// the enterprise project id
	EnterpriseProjectID string `json:"enterprise_project_id,omitempty"`
}

VolumeOpts contains options for creating a Volume.

type VolumePage

type VolumePage struct {
	pagination.LinkedPageBase
}

VolumePage is a pagination.pager that is returned from a call to the List function.

func (VolumePage) IsEmpty

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

IsEmpty returns true if a ListResult contains no Volumes.

func (VolumePage) NextPageURL

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

NextPageURL uses the response's embedded link reference to navigate to the next page of results.

Jump to

Keyboard shortcuts

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