cloud

package
v0.0.0-...-d1b2497 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrEmptyInstanceID = errors.New("meta service returns empty instanceID")
	ErrEmptyZone       = errors.New("meta service returns empty zone")
)
View Source
var (
	ErrMultiVolumes = fmt.Errorf("multi volumes with same name")
)

Functions

func ErrIsInvalidArgument

func ErrIsInvalidArgument(err error) bool

func ErrIsMultiVolumes

func ErrIsMultiVolumes(err error) bool

func ErrIsNotFound

func ErrIsNotFound(err error) bool

func InitLog

func InitLog()

Types

type Auth

type Auth interface {
	GetSigner(ctx context.Context) auth.Signer
	GetCredentials(ctx context.Context) *auth.BceCredentials
	GetSignOptions(ctx context.Context) *auth.SignOptions
}

func NewAccessKeyPairAuth

func NewAccessKeyPairAuth(ak, sk, token string) (Auth, error)

func NewCCEGatewayAuth

func NewCCEGatewayAuth(region, clusterID string) (Auth, error)

type AuthMode

type AuthMode string
const (
	AuthModeAccessKey  AuthMode = "key"
	AuthModeCCEGateway AuthMode = "gateway"
)

type BOSService

type BOSService interface {
	BucketExists(ctx context.Context, bucketName string, auth Auth) (bool, error)
}

func NewBOSService

func NewBOSService(endpoint string) (BOSService, error)

type Billing

type Billing struct {
	PaymentTiming string
	Reservation   *Reservation
}

type CDSVolume

type CDSVolume interface {
	Delete(ctx context.Context) error
	Attach(ctx context.Context, instanceID string) (*bccapi.VolumeAttachmentModel, error)
	Detach(ctx context.Context, instanceID string) error
	Resize(ctx context.Context, args *ResizeCSDVolumeArgs) error

	ID() string
	Zone() string
	SizeGB() int
	Detail() *bccapi.VolumeModel
	IsAvailable() bool
	IsInUse() bool
	IsScaling() bool
	IsAttached() bool
	IsAttaching() bool
	IsDetaching() bool
	IsCreating() bool
}

type CDSVolumeService

type CDSVolumeService interface {
	CreateVolume(ctx context.Context, args *CreateCDSVolumeArgs, auth Auth) (string, error)
	GetVolumeByID(ctx context.Context, id string, auth Auth) (CDSVolume, error)
	GetVolumeByName(ctx context.Context, name string, auth Auth) (CDSVolume, error)
}

func NewCDSService

func NewCDSService(endpoint, region string) (CDSVolumeService, error)

type CreateCDSVolumeArgs

type CreateCDSVolumeArgs struct {
	Name                string
	Description         string
	SnapshotID          string
	ZoneName            string
	CdsSizeInGB         int
	StorageType         string
	EncryptKey          string
	ClientToken         string
	PaymentTiming       string
	ReservationLength   int
	ReservationTimeUnit string
	Tags                map[string]string
}

type MetaDataService

type MetaDataService interface {
	// InstanceID returns instance id of which the instance is in.
	InstanceID() string
	// Zone returns zone of which the instance is in.
	Zone() string
}

MetaDataService represents BaiduCloud BCC meta data service.

func NewMetaDataService

func NewMetaDataService() (MetaDataService, error)

NewMetaDataService returns a new MetaDataService implementation.

type Node

type Node interface{}

type NodeService

type NodeService interface {
	GetNodeByID(ctx context.Context, nodeID string, auth Auth) (Node, error)
}

func NewBCCService

func NewBCCService(endpoint, region string) (NodeService, error)

type Reservation

type Reservation struct {
	ReservationLength   int
	ReservationTimeUnit string
}

type ResizeCSDVolumeArgs

type ResizeCSDVolumeArgs struct {
	NewCdsSizeInGB int
	NewVolumeType  bccapi.StorageType
}

Directories

Path Synopsis
Package mock is a generated GoMock package.
Package mock is a generated GoMock package.

Jump to

Keyboard shortcuts

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