provider

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2018 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DevicePrefixLocal = "/dev/vd"
	DevicePrefixAPI   = "/dev/xvd"
)
View Source
const (
	DiskStatusInUse     = DiskStatus("In_use")
	DiskStatusAvailable = DiskStatus("Available")
	DiskStatusAttaching = DiskStatus("Attaching")
	DiskStatusDetaching = DiskStatus("Detaching")
	DiskStatusCreating  = DiskStatus("Creating")
	DiskStatusReIniting = DiskStatus("ReIniting")
)
View Source
const (
	TagResourceImage    = TagResourceType("image")
	TagResourceInstance = TagResourceType("instance")
	TagResourceSnapshot = TagResourceType("snapshot")
	TagResourceDisk     = TagResourceType("disk")
)
View Source
const DefaultInterval = time.Second
View Source
const DefaultTimeout = time.Minute

Variables

View Source
var (
	ErrInstanceNotExist   = errors.New("instance does not exist")
	ErrHostnameDuplicated = errors.New("instance hostname duplicated")
	ErrDiskNotExist       = errors.New("disk does not exist")
	ErrDiskTagDuplicated  = errors.New("disk tags duplicated")
)

Functions

This section is empty.

Types

type AddTagsArgs added in v1.2.0

type AddTagsArgs struct {
	ResourceId   string
	ResourceType TagResourceType
	Tag          map[string]string
}

type Aliyun

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

func (*Aliyun) AddTags added in v1.2.0

func (p *Aliyun) AddTags(args *AddTagsArgs) error

func (*Aliyun) AttachDisk

func (p *Aliyun) AttachDisk(instanceId string, diskId string) error

func (*Aliyun) DetachDisk

func (p *Aliyun) DetachDisk(instanceId string, diskId string) error

func (*Aliyun) GetDiskById

func (p *Aliyun) GetDiskById(diskId string) (*Disk, error)

func (*Aliyun) GetDiskByTags added in v1.2.0

func (p *Aliyun) GetDiskByTags(tags map[string]string) (*Disk, error)

func (*Aliyun) GetInstanceByHostname

func (p *Aliyun) GetInstanceByHostname(hostname string) (*Instance, error)

func (*Aliyun) WaitForDisk

func (p *Aliyun) WaitForDisk(diskId string, status DiskStatus, timeout time.Duration) error

type Disk

type Disk ecs.DiskItemType

func (*Disk) IsAvailable

func (d *Disk) IsAvailable() bool

func (*Disk) IsDetaching

func (d *Disk) IsDetaching() bool

func (*Disk) IsInUse

func (d *Disk) IsInUse() bool

func (*Disk) LocalDevice

func (d *Disk) LocalDevice() string

func (*Disk) SetLocalDevice

func (d *Disk) SetLocalDevice(device string)

type DiskStatus

type DiskStatus string

Status of disks

type Instance

type Instance ecs.InstanceAttributesType

func (*Instance) IsDiskAttached

func (i *Instance) IsDiskAttached(disk *Disk) bool

type Provider

type Provider interface {
	GetInstanceByHostname(hostname string) (*Instance, error)
	GetDiskById(diskId string) (*Disk, error)
	GetDiskByTags(tags map[string]string) (*Disk, error)
	AttachDisk(instanceId string, diskId string) error
	DetachDisk(isntanceId string, diskId string) error
	WaitForDisk(diskId string, status DiskStatus, timeout time.Duration) error
	AddTags(args *AddTagsArgs) error
}

func New

func New(accessKey, secretKey, region string) Provider

type TagResourceType added in v1.2.0

type TagResourceType string

Jump to

Keyboard shortcuts

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