cloud

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// VolumeTypeStandard represents a general purpose volume.
	VolumeTypeStandard = "standard"
	// VolumeTypeHighSpeed represents a high spped volume (randomly select type A or B)
	VolumeTypeHighSpeed = "high-speed"
	// VolumeTypeHighSpeedA represents a high speed volume (only use type A).
	VolumeTypeHighSpeedA = "high-speed-a"
	// VolumeTypeHighSpeedB represents a high speed volume (only use type B).
	VolumeTypeHighSpeedB = "high-speed-b"
	// VolumeTypeFlash represents a flash volume.
	VolumeTypeFlash = "flash"
	// VolumeTypeStandardFlash represents a standard flash volume (randomly select type A or B)
	VolumeTypeStandardFlash = "standard-flash"
	// VolumeTypeStandardFlashA represents a standard flash volume (only use type A)
	VolumeTypeStandardFlashA = "standard-flash-a"
	// VolumeTypeStandardFlashB represents a standard flash volume (only use type B)
	VolumeTypeStandardFlashB = "standard-flash-b"
	// VolumeTypeHighSpeedFlash represents a high spped flash volume (randomly select type A or B)
	VolumeTypeHighSpeedFlash = "high-speed-flash"
	// VolumeTypeHighSpeedFlashA represents a high spped flash volume (only use type A)
	VolumeTypeHighSpeedFlashA = "high-speed-flash-a"
	// VolumeTypeHighSpeedFlashB represents a high spped flash volume (only use type B)
	VolumeTypeHighSpeedFlashB = "high-speed-flash-b"
)
View Source
const (

	// AccountingTypeMonthly represents an accounting type monthly.
	AccountingTypeMonthly = "monthly"
	// AccountingTypeHourly represents an accounting type hourly.
	AccountingTypeHourly = "hourly"
)
View Source
const (
	// DefaultVolumeSize represents the default volume size.
	DefaultVolumeSize int64 = 100 * util.GiB
	// DefaultVolumeType specifies which storage to use for newly created volumes.
	DefaultVolumeType = VolumeTypeStandardFlashA
	// DefaultVolumeType specifies which storage to use for newly created volumes.
	DefaultAccountingType = AccountingTypeHourly
)

Variables

View Source
var (
	// ErrMultiDisks is an error that is returned when multiple
	// disks are found with the same volume name.
	ErrMultiDisks = errors.New("Multiple disks with same name")

	// ErrDiskExistsDiffSize is an error that is returned if a disk with a given
	// name, but different size, is found.
	ErrDiskExistsDiffSize = errors.New("There is already a disk with same name and different size")

	// ErrNotFound is returned when a resource is not found.
	ErrNotFound = errors.New("Resource was not found")

	// ErrAlreadyExists is returned when a resource is already existent.
	ErrAlreadyExists = errors.New("Resource already exists")

	// ErrInvalidMaxResults is returned when a MaxResults pagination parameter is between 1 and 4
	ErrInvalidMaxResults = errors.New("MaxResults parameter must be 0 or greater than or equal to 5")
)

Functions

This section is empty.

Types

type Cloud

type Cloud interface {
	CreateDisk(ctx context.Context, volumeName string, diskOptions *DiskOptions) (disk *Disk, err error)
	DeleteDisk(ctx context.Context, volumeID string) (success bool, err error)
	AttachDisk(ctx context.Context, volumeID string, nodeID string) (devicePath string, err error)
	DetachDisk(ctx context.Context, volumeID string, nodeID string) (err error)
	ResizeDisk(ctx context.Context, volumeID string, size int64) (newSize int64, err error)
	ListDisks(ctx context.Context) (disks []*Disk, err error)
	WaitForAttachmentState(ctx context.Context, volumeID, state string) error
	GetDiskByName(ctx context.Context, name string, capacityBytes int64) (disk *Disk, err error)
	GetDiskByID(ctx context.Context, volumeID string) (disk *Disk, err error)
	IsExistInstance(ctx context.Context, nodeID string) (success bool)
	GetInstanceByName(ctx context.Context, name string) (*Instance, error)
}

Cloud is interface for cloud api manipulator

func NewCloud

func NewCloud(nifcloudSdkDebugLog bool) (Cloud, error)

NewCloud creates the cloud object.

type Disk

type Disk struct {
	VolumeID           string
	CapacityGiB        int64
	AvailabilityZone   string
	AttachedInstanceID string
}

Disk represents a NIFCLOUD additional storage

type DiskOptions

type DiskOptions struct {
	AccountingType string
	CapacityBytes  int64
	VolumeType     string
	Zone           string
}

DiskOptions represents parameters to create an NIFCLOUD additional storage

type Instance

type Instance struct {
	InstanceID       string
	AvailabilityZone string
}

Instance represents a NIFCLOUD VM

Jump to

Keyboard shortcuts

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