vultrstorage

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2025 License: Apache-2.0 Imports: 6 Imported by: 0

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

Constants

This section is empty.

Variables

View Source
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

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

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

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

type VultrStorageAttachment struct {
	NodeID    string
	MountName string
}

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

type VultrStorageUpdateReq struct {
	SizeGB int
	Label  string
}

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

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

Update wraps the govultr Update function and converts the response for VFS storage.

Jump to

Keyboard shortcuts

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