Documentation
¶
Overview ¶
Package vultrstorage is primarily focused on translating CSI storage requests into govultr requests for more than one type of storage configuration. Currently either block storage or virtual file system storage
Index ¶
- Variables
- type VultrBlockStorageHandler
- func (v *VultrBlockStorageHandler) Attach(ctx context.Context, storageID, instanceID string) error
- func (v *VultrBlockStorageHandler) Create(ctx context.Context, req VultrStorageReq) (*VultrStorage, error)
- func (v *VultrBlockStorageHandler) Delete(ctx context.Context, storageID string) error
- func (v *VultrBlockStorageHandler) Detach(ctx context.Context, storageID, instanceID string) error
- func (v *VultrBlockStorageHandler) Get(ctx context.Context, blockID string) (*VultrStorage, error)
- func (v *VultrBlockStorageHandler) List(ctx context.Context, options *govultr.ListOptions) ([]VultrStorage, *govultr.Meta, error)
- func (v *VultrBlockStorageHandler) Update(ctx context.Context, storageID string, req VultrStorageUpdateReq) (*VultrStorage, error)
- type VultrStorage
- type VultrStorageAttachment
- type VultrStorageHandler
- type VultrStorageReq
- type VultrStorageUpdateReq
- type VultrVFSStorageHandler
- func (v *VultrVFSStorageHandler) Attach(ctx context.Context, storageID, instanceID string) error
- func (v *VultrVFSStorageHandler) Create(ctx context.Context, req VultrStorageReq) (*VultrStorage, error)
- func (v *VultrVFSStorageHandler) Delete(ctx context.Context, storageID string) error
- func (v *VultrVFSStorageHandler) Detach(ctx context.Context, storageID, instanceID string) error
- func (v *VultrVFSStorageHandler) Get(ctx context.Context, storageID string) (*VultrStorage, error)
- func (v *VultrVFSStorageHandler) List(ctx context.Context, options *govultr.ListOptions) ([]VultrStorage, *govultr.Meta, error)
- func (v *VultrVFSStorageHandler) Update(ctx context.Context, storageID string, req VultrStorageUpdateReq) (*VultrStorage, error)
Constants ¶
This section is empty.
Variables ¶
var StorageTypes = []string{"block", "vfs"}
StorageTypes are the available storage types supported by the CSI. Currently only "block" & "vfs" are supported
Functions ¶
This section is empty.
Types ¶
type VultrBlockStorageHandler ¶
type VultrBlockStorageHandler struct {
// contains filtered or unexported fields
}
VultrBlockStorageHandler implements the Operations interface on the VultrStorageHandler and performs those operations for block storages.
func (*VultrBlockStorageHandler) Attach ¶
func (v *VultrBlockStorageHandler) Attach(ctx context.Context, storageID, instanceID string) error
Attach wraps the govultr Attach function for block storage.
func (*VultrBlockStorageHandler) Create ¶
func (v *VultrBlockStorageHandler) Create(ctx context.Context, req VultrStorageReq) (*VultrStorage, error)
Create wraps the govultr Create function and converts the response for block storage.
func (*VultrBlockStorageHandler) Delete ¶
func (v *VultrBlockStorageHandler) Delete(ctx context.Context, storageID string) error
Delete wraps the govultr Delete function for block storage.
func (*VultrBlockStorageHandler) Detach ¶
func (v *VultrBlockStorageHandler) Detach(ctx context.Context, storageID, instanceID string) error
Detach wraps the govultr Detach function for block storage.
func (*VultrBlockStorageHandler) Get ¶
func (v *VultrBlockStorageHandler) Get(ctx context.Context, blockID string) (*VultrStorage, error)
Get wraps the govultr Get function and converts the responses for block storage.
func (*VultrBlockStorageHandler) List ¶
func (v *VultrBlockStorageHandler) List(ctx context.Context, options *govultr.ListOptions) ([]VultrStorage, *govultr.Meta, error)
List wraps the govultr List and converts the response for block storage.
func (*VultrBlockStorageHandler) Update ¶
func (v *VultrBlockStorageHandler) Update(ctx context.Context, storageID string, req VultrStorageUpdateReq) (*VultrStorage, error)
Update wraps the govultr Update function and converts the response for block storage.
type VultrStorage ¶
type VultrStorage struct { ID string Label string Region string BlockType string DiskType string Status string StorageType string SizeGB int AttachedInstances []VultrStorageAttachment }
VultrStorage represents all the relevant data used by the CSI for Vultr storages of various types.
func ListAllStorages ¶
func ListAllStorages(ctx context.Context, client *govultr.Client) ([]VultrStorage, error)
ListAllStorages retrieves the list results of available storage types and returns the VultrStorage objects for further processing.
type VultrStorageAttachment ¶
VultrStorageAttachment represents the mount information for a Vultr storage attachment.
type VultrStorageHandler ¶
type VultrStorageHandler struct { StorageType string DiskType string DefaultSize int64 Capabilities []*csi.VolumeCapability Operations interface { List(ctx context.Context, options *govultr.ListOptions) ([]VultrStorage, *govultr.Meta, error) Get(ctx context.Context, storageID string) (*VultrStorage, error) Create(ctx context.Context, req VultrStorageReq) (*VultrStorage, error) Update(ctx context.Context, storageID string, req VultrStorageUpdateReq) (*VultrStorage, error) Delete(ctx context.Context, storageID string) error Attach(ctx context.Context, storageID, instanceID string) error Detach(ctx context.Context, storageID, instanceID string) error } // contains filtered or unexported fields }
VultrStorageHandler handles the operations for a VultrStorage of various types through its Operations interface.
func FindVultrStorageHandlerByID ¶
func FindVultrStorageHandlerByID(ctx context.Context, client *govultr.Client, storageID string) (*VultrStorageHandler, error)
FindVultrStorageHandlerByID performs a lookup of available storage types and returns the appropriate handler to use with the storage
func NewVultrStorageHandler ¶
func NewVultrStorageHandler(client *govultr.Client, storageType, diskType string, ignoreDiskType bool) (*VultrStorageHandler, error)
NewVultrStorageHandler instantiates a new VultrStorageHandler type and sets the Operations interface based on the storageType.
Possible storageTypes are 'block' & 'vfs' for block storage and virtual file system storage respectively.
type VultrStorageReq ¶
type VultrStorageReq struct { Region string SizeGB int Label string BlockType string DiskType string Tags []string // vfs only }
VultrStorageReq represents the general request data used for creating a Vultr storage.
type VultrStorageUpdateReq ¶
VultrStorageUpdateReq represents the general request data used for updating a Vultr storage.
type VultrVFSStorageHandler ¶
type VultrVFSStorageHandler struct {
// contains filtered or unexported fields
}
VultrVFSStorageHandler implements the Operations interface on the VultrStorageHandler and performs those operations for VFS storages.
func (*VultrVFSStorageHandler) Attach ¶
func (v *VultrVFSStorageHandler) Attach(ctx context.Context, storageID, instanceID string) error
Attach wraps the govultr Attach function for VFS storage.
func (*VultrVFSStorageHandler) Create ¶
func (v *VultrVFSStorageHandler) Create(ctx context.Context, req VultrStorageReq) (*VultrStorage, error)
Create wraps the govultr Create function and converts the respons for a VFS storage.
func (*VultrVFSStorageHandler) Delete ¶
func (v *VultrVFSStorageHandler) Delete(ctx context.Context, storageID string) error
Delete wraps the govultr Delete function for vfs storage.
func (*VultrVFSStorageHandler) Detach ¶
func (v *VultrVFSStorageHandler) Detach(ctx context.Context, storageID, instanceID string) error
Detach wraps the govultr Detach function for vfs storage.
func (*VultrVFSStorageHandler) Get ¶
func (v *VultrVFSStorageHandler) Get(ctx context.Context, storageID string) (*VultrStorage, error)
Get wraps the govultr Get and AttachmentList functions and converts the responses for VFS storage.
func (*VultrVFSStorageHandler) List ¶
func (v *VultrVFSStorageHandler) List(ctx context.Context, options *govultr.ListOptions) ([]VultrStorage, *govultr.Meta, error)
List wraps the govultr List and converts the response for VFS storage.
func (*VultrVFSStorageHandler) Update ¶
func (v *VultrVFSStorageHandler) Update(ctx context.Context, storageID string, req VultrStorageUpdateReq) (*VultrStorage, error)
Update wraps the govultr Update function and converts the response for VFS storage.