virtualstorages

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2019 License: Apache-2.0 Imports: 4 Imported by: 2

Documentation

Overview

Package virtualstorages provides information and interaction with virtualstorage in the Enterprise Cloud Block Storage service. A volume is a detachable block storage device, akin to a USB hard drive. It can only be attached to one instance at a time.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractVirtualStoragesInto

func ExtractVirtualStoragesInto(r pagination.Page, v interface{}) error

ExtractVirtualStoragesInto is information expander for virtual storage

func IDFromName

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

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

func List

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

func WaitForStatus

func WaitForStatus(c *eclcloud.ServiceClient, id, status string, secs int) error

WaitForStatus will continually poll the resource, checking for a particular status. It will do this for the amount of seconds defined.

Types

type CreateOpts

type CreateOpts struct {
	// The virtual storage name
	Name string `json:"name,required"`
	// The virtual storage description
	Description string `json:"description,omitempty"`
	// The network_id to connect virtual storage
	NetworkID string `json:"network_id,required"`
	// The subnet_id to connect virtual storage
	SubnetID string `json:"subnet_id,required"`
	// The virtual storage volume_type_id
	VolumeTypeID string `json:"volume_type_id,required"`
	// The ip address pool of virtual storage
	IPAddrPool IPAddressPool `json:"ip_addr_pool,required"`
	// The virtual storage host_routes
	HostRoutes []HostRoute `json:"host_routes,omitempty"`
}

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

func (CreateOpts) ToVirtualStorageCreateMap

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

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

type CreateOptsBuilder

type CreateOptsBuilder interface {
	ToVirtualStorageCreateMap() (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 *eclcloud.ServiceClient, opts CreateOptsBuilder) (r CreateResult)

Create will create a new VirtualStorage based on the values in CreateOpts. To extract the VirtualStorage object from the response, call the Extract method on the CreateResult.

func (CreateResult) Extract

func (r CreateResult) Extract() (*VirtualStorage, error)

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

func (CreateResult) ExtractInto

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

type DeleteResult

type DeleteResult struct {
	eclcloud.ErrResult
}

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

func Delete

func Delete(client *eclcloud.ServiceClient, id string) (r DeleteResult)

Delete will delete the existing VirtualStorage with the provided ID.

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 *eclcloud.ServiceClient, id string) (r GetResult)

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

func (GetResult) Extract

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

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

func (GetResult) ExtractInto

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

type HostRoute

type HostRoute struct {
	Destination string `json:"destination"`
	Nexthop     string `json:"nexthop"`
}

HostRoute is struct which corresponds to host_routes object.

type IPAddressPool

type IPAddressPool struct {
	Start string `json:"start"`
	End   string `json:"end"`
}

IPAddressPool is struct which corresponds to ip_addr_pool object.

type ListOpts

type ListOpts struct {
}

ListOpts holds options for listing VirtualStorages. It is passed to the virtualstorages.List function.

func (ListOpts) ToVirtualStorageListQuery

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

ToVirtualStorageListQuery formats a ListOpts into a query string.

type ListOptsBuilder

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

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

type UpdateOpts

type UpdateOpts struct {
	Name        *string        `json:"name,omitempty"`
	Description *string        `json:"description,omitempty"`
	IPAddrPool  *IPAddressPool `json:"ip_addr_pool,omitempty"`
	HostRoutes  *[]HostRoute   `json:"host_routes,omitempty"`
}

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

func (UpdateOpts) ToVirtualStorageUpdateMap

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

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

type UpdateOptsBuilder

type UpdateOptsBuilder interface {
	ToVirtualStorageUpdateMap() (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 *eclcloud.ServiceClient, id string, opts UpdateOptsBuilder) (r UpdateResult)

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

func (UpdateResult) Extract

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

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

func (UpdateResult) ExtractInto

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

type VirtualStorage

type VirtualStorage struct {
	// API error in virtual storage creation.
	APIErrorMessage string `json:"api_error_message"`
	// Unique identifier for the virtual storage.
	ID string `json:"id"`
	// network_id which this virtual storage is connected.
	NetworkID string `json:"network_id"`
	// subnet_id which this virtual storage is connected.
	SubnetID string `json:"subnet_id"`
	// ip_address_pool object for virtual storage.
	IPAddrPool IPAddressPool `json:"ip_addr_pool"`
	// List of host routes of virtual storage.
	HostRoutes []HostRoute `json:"host_routes"`
	// volume_type_id of virtual storage
	VolumeTypeID string `json:"volume_type_id"`
	// Human-readable display name for the virtual storage.
	Name string `json:"name"`
	// Human-readable description for the virtual storage.
	Description string `json:"description"`
	// Current status of the virtual storage.
	Status string `json:"status"`
	// The date when this volume was created.
	CreatedAt time.Time `json:"-"`
	// The date when this volume was last updated
	UpdatedAt time.Time `json:"-"`
	// Error in virtual storage creation.
	ErrorMessage string `json:"error_message"`
}

VirtualStorage contains all the information associated with a Virtual Storage.

func ExtractVirtualStorages

func ExtractVirtualStorages(r pagination.Page) ([]VirtualStorage, error)

ExtractVirtualStorages extracts and returns VirtualStorages. It is used while iterating over a virtualstorages.List call.

func (*VirtualStorage) UnmarshalJSON

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

UnmarshalJSON creates JSON format of virtual storage

type VirtualStoragePage

type VirtualStoragePage struct {
	pagination.LinkedPageBase
}

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

func (VirtualStoragePage) IsEmpty

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

IsEmpty returns true if a ListResult contains no VirtualStorages.

Directories

Path Synopsis
Package testing contains virtual storage unit tests
Package testing contains virtual storage unit tests

Jump to

Keyboard shortcuts

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