cloud

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2022 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Overview

Package cloud is a generated GoMock package.

Index

Constants

View Source
const (
	// Available disk types
	// 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 (
	// DefaultVolumeSize represents the default volume size.
	DefaultVolumeSize int64 = 100 * util.GiB
	// DefaultVolumeType specifies which storage to use for newly created volumes.
	DefaultVolumeType = VolumeTypeStandardFlashA

	// TagKeyCSIVolumeName is the tag key for CSI volume name.
	TagKeyCSIVolumeName = "disk.csi.hatoba.nifcloud.com/csi-volume-name"
)

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")

	// ErrVolumeInUse is returned when a disk is already attached to an node.
	ErrDiskInUse = errors.New("Request disk is already attached to an node")
)

Functions

This section is empty.

Types

type AttachDiskRequest

type AttachDiskRequest struct {
	DiskName string `json:"-"`
	NodeName string `json:"nodeName"`
}

type Cloud

type Cloud interface {
	CreateDisk(ctx context.Context, clusterName string, diskOptions *DiskOptions) (disk *Volume, err error)
	DeleteDisk(ctx context.Context, volumeID string) (success bool, err error)
	AttachDisk(ctx context.Context, volumeID, nodeID string) (devicePath string, err error)
	DetachDisk(ctx context.Context, volumeID, nodeID string) (err error)
	ResizeDisk(ctx context.Context, volumeID string, size int64) (int64, error)
	GetDiskByName(ctx context.Context, name string, capacityBytes int64) (disk *Volume, err error)
	GetDiskByID(ctx context.Context, volumeID string) (disk *Volume, err error)
	IsExistNode(ctx context.Context, clusterName, nodeID string) (success bool)
	GetClusterName(ctx context.Context, nrn string) (string, error)
}

Cloud is interface for cloud api manipulator

func NewCloud

func NewCloud(region string) (Cloud, error)

NewCloud creates the cloud object.

type Cluster

type Cluster struct {
	Name      string
	NodePools []*NodePool
}

Cluster represents a NIFCLOUD Hatoba cluster

type ClusterForDisk

type ClusterForDisk struct {
	Name string `json:"name"`
}

type CreateDiskRequest

type CreateDiskRequest struct {
	Disk *DiskToCreate `json:"disk"`
}

type CreateDiskResponse

type CreateDiskResponse struct {
	Disk *Disk `json:"disk"`
}

type DeleteDiskRequest

type DeleteDiskRequest struct {
	DiskName string
}

type DeleteDiskResponse

type DeleteDiskResponse struct{}

type DetachDiskRequest

type DetachDiskRequest struct {
	DiskName string `json:"-"`
	NodeName string `json:"nodeName"`
}

type Disk

type Disk struct {
	Name             string            `json:"name"`
	Cluster          *ClusterForDisk   `json:"cluster,omitempty"`
	Size             uint              `json:"size"`
	Type             string            `json:"type"`
	AvailabilityZone string            `json:"availabilityZone"`
	Attachments      []*DiskAttachment `json:"attachments,omitempty"`
	Description      string            `json:"description"`
	Status           string            `json:"status"`
	NRN              string            `json:"nrn"`
}

type DiskAttachment

type DiskAttachment struct {
	NodeName   string `json:"nodeName"`
	DevicePath string `json:"devicePath"`
	AttachTime string `json:"attachTime"`
	Status     string `json:"status"`
}

type DiskOptions

type DiskOptions struct {
	CapacityBytes int64
	VolumeType    string
	Zone          string
	Tags          map[string]string
}

DiskOptions represents parameters to create an NIFCLOUD Hatoba disk

type DiskToCreate

type DiskToCreate struct {
	Name             string          `json:"name"`
	Cluster          *ClusterForDisk `json:"cluster"`
	Size             uint            `json:"size"`
	Type             string          `json:"type"`
	AvailabilityZone string          `json:"availabilityZone"`
	Description      string          `json:"description"`
	Tags             []*Tag          `json:"tags,omitempty"`
}

type DiskToUpdate

type DiskToUpdate struct {
	Name        string `json:"name,omitempty"`
	Description string `json:"description,omitempty"`
	Size        uint   `json:"size,omitempty"`
}

type ErrorResponse

type ErrorResponse struct {
	Message string `json:"message"`
	Code    string `json:"code"`
}

type GetDiskRequest

type GetDiskRequest struct {
	DiskName string
}

type GetDiskResponse

type GetDiskResponse struct {
	Disk *Disk `json:"disk"`
}

type ListDisksResponse

type ListDisksResponse struct {
	Disks []*Disk `json:"disks"`
}

type MockCloud

type MockCloud struct {
	// contains filtered or unexported fields
}

MockCloud is a mock of Cloud interface.

func NewMockCloud

func NewMockCloud(ctrl *gomock.Controller) *MockCloud

NewMockCloud creates a new mock instance.

func (*MockCloud) AttachDisk

func (m *MockCloud) AttachDisk(ctx context.Context, volumeID, nodeID string) (string, error)

AttachDisk mocks base method.

func (*MockCloud) CreateDisk

func (m *MockCloud) CreateDisk(ctx context.Context, clusterName string, diskOptions *DiskOptions) (*Volume, error)

CreateDisk mocks base method.

func (*MockCloud) DeleteDisk

func (m *MockCloud) DeleteDisk(ctx context.Context, volumeID string) (bool, error)

DeleteDisk mocks base method.

func (*MockCloud) DetachDisk

func (m *MockCloud) DetachDisk(ctx context.Context, volumeID, nodeID string) error

DetachDisk mocks base method.

func (*MockCloud) EXPECT

func (m *MockCloud) EXPECT() *MockCloudMockRecorder

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockCloud) GetClusterName

func (m *MockCloud) GetClusterName(ctx context.Context, nrn string) (string, error)

GetClusterName mocks base method.

func (*MockCloud) GetDiskByID

func (m *MockCloud) GetDiskByID(ctx context.Context, volumeID string) (*Volume, error)

GetDiskByID mocks base method.

func (*MockCloud) GetDiskByName

func (m *MockCloud) GetDiskByName(ctx context.Context, name string, capacityBytes int64) (*Volume, error)

GetDiskByName mocks base method.

func (*MockCloud) IsExistNode

func (m *MockCloud) IsExistNode(ctx context.Context, clusterName, nodeID string) bool

IsExistNode mocks base method.

func (*MockCloud) ResizeDisk

func (m *MockCloud) ResizeDisk(ctx context.Context, volumeID string, size int64) (int64, error)

ResizeDisk mocks base method.

type MockCloudMockRecorder

type MockCloudMockRecorder struct {
	// contains filtered or unexported fields
}

MockCloudMockRecorder is the mock recorder for MockCloud.

func (*MockCloudMockRecorder) AttachDisk

func (mr *MockCloudMockRecorder) AttachDisk(ctx, volumeID, nodeID interface{}) *gomock.Call

AttachDisk indicates an expected call of AttachDisk.

func (*MockCloudMockRecorder) CreateDisk

func (mr *MockCloudMockRecorder) CreateDisk(ctx, clusterName, diskOptions interface{}) *gomock.Call

CreateDisk indicates an expected call of CreateDisk.

func (*MockCloudMockRecorder) DeleteDisk

func (mr *MockCloudMockRecorder) DeleteDisk(ctx, volumeID interface{}) *gomock.Call

DeleteDisk indicates an expected call of DeleteDisk.

func (*MockCloudMockRecorder) DetachDisk

func (mr *MockCloudMockRecorder) DetachDisk(ctx, volumeID, nodeID interface{}) *gomock.Call

DetachDisk indicates an expected call of DetachDisk.

func (*MockCloudMockRecorder) GetClusterName

func (mr *MockCloudMockRecorder) GetClusterName(ctx, nrn interface{}) *gomock.Call

GetClusterName indicates an expected call of GetClusterName.

func (*MockCloudMockRecorder) GetDiskByID

func (mr *MockCloudMockRecorder) GetDiskByID(ctx, volumeID interface{}) *gomock.Call

GetDiskByID indicates an expected call of GetDiskByID.

func (*MockCloudMockRecorder) GetDiskByName

func (mr *MockCloudMockRecorder) GetDiskByName(ctx, name, capacityBytes interface{}) *gomock.Call

GetDiskByName indicates an expected call of GetDiskByName.

func (*MockCloudMockRecorder) IsExistNode

func (mr *MockCloudMockRecorder) IsExistNode(ctx, clusterName, nodeID interface{}) *gomock.Call

IsExistNode indicates an expected call of IsExistNode.

func (*MockCloudMockRecorder) ResizeDisk

func (mr *MockCloudMockRecorder) ResizeDisk(ctx, volumeID, size interface{}) *gomock.Call

ResizeDisk indicates an expected call of ResizeDisk.

type Node

type Node struct {
	Name            string
	PublicIPAddress string
}

Node represents a node in cluster

type NodePool

type NodePool struct {
	Name  string
	Nodes []*Node
}

NodePool represents a pool of nodes in cluster

type Tag

type Tag struct {
	Key   string `json:"key"`
	Value string `json:"value"`
}

type UpdateDiskRequest

type UpdateDiskRequest struct {
	Name string        `json:"-"`
	Disk *DiskToUpdate `json:"disk"`
}

type UpdateDiskResponse

type UpdateDiskResponse struct {
	Disk *Disk `json:"disk"`
}

type Volume

type Volume struct {
	VolumeID         string
	CapacityGiB      int64
	AvailabilityZone string
}

Disk represents a NIFCLOUD Hatoba disk

Jump to

Keyboard shortcuts

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