volumes

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2020 License: Apache-2.0 Imports: 5 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetJobEntity

func GetJobEntity(client *golangsdk.ServiceClient, jobId string, label string) (interface{}, error)

func WaitForJobSuccess

func WaitForJobSuccess(client *golangsdk.ServiceClient, secs int, jobID string) error

Types

type Attachment

type Attachment struct {
	AttachedAt   time.Time `json:"-"`
	AttachmentID string    `json:"attachment_id"`
	Device       string    `json:"device"`
	HostName     string    `json:"host_name"`
	ID           string    `json:"id"`
	ServerID     string    `json:"server_id"`
	VolumeID     string    `json:"volume_id"`
}

func (*Attachment) UnmarshalJSON

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

type CreateOpts

type CreateOpts 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
	ImageRef string `json:"imageRef,omitempty"`
	// This field is no longer used. Use multiattach.
	Shareable string `json:"shareable,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"`
}

CreateOpts contains options for creating a Volume. This object is passed to the volumes.Create function. For more information about these parameters, see the Volume object.

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 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 *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 JobEntity

type JobEntity struct {
	VolumeID string `json:"volume_id"`
}

type JobResponse

type JobResponse struct {
	JobID string `json:"job_id"`
}

type JobResult

type JobResult struct {
	golangsdk.Result
}

func Create

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

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

func (JobResult) ExtractJobResponse

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

func (JobResult) ExtractJobStatus

func (r JobResult) ExtractJobStatus() (*JobStatus, error)

type JobStatus

type JobStatus struct {
	Status     string      `json:"status"`
	Entities   JobEntity   `json:"entities"`
	JobID      string      `json:"job_id"`
	JobType    string      `json:"job_type"`
	BeginTime  string      `json:"begin_time"`
	EndTime    string      `json:"end_time"`
	ErrorCode  string      `json:"error_code"`
	FailReason string      `json:"fail_reason"`
	Message    string      `json:"message"`
	Code       string      `json:"code"`
	SubJobs    []JobStatus `json:"sub_jobs"`
}

type Volume

type Volume struct {
	// Unique identifier for the volume.
	ID string `json:"id"`
	// Current status of the volume.
	Status string `json:"status"`
	// Size of the volume in GB.
	Size int `json:"size"`
	// AvailabilityZone is which availability zone the volume is in.
	AvailabilityZone string `json:"availability_zone"`
	// The date when this volume was created.
	CreatedAt time.Time `json:"-"`
	// The date when this volume was last updated
	UpdatedAt time.Time `json:"-"`
	// Instances onto which the volume is attached.
	Attachments []Attachment `json:"attachments"`
	// Human-readable display name for the volume.
	Name string `json:"name"`
	// 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"`
	// 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"`
	// The ID of the back that can be used to create an EVS disk
	BackupID string `json:"backup_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"`
	// Indicates whether this is a bootable volume.
	Bootable string `json:"bootable"`
	// Encrypted denotes if the volume is encrypted.
	Encrypted bool `json:"encrypted"`
	// ReplicationStatus is the status of replication.
	ReplicationStatus string `json:"replication_status"`
	// ConsistencyGroupID is the consistency group ID.
	ConsistencyGroupID string `json:"consistencygroup_id"`
	// Multiattach denotes if the volume is multi-attach capable.
	Multiattach bool `json:"multiattach"`
	// wwn of the volume.
	WWN string `json:"wwn"`
	// enterprise project ID bound to the volume
	EnterpriseProjectID string `json:"enterprise_project_id"`
}

Volume contains all the information associated with a Volume.

func (*Volume) UnmarshalJSON

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

Jump to

Keyboard shortcuts

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