-
Notifications
You must be signed in to change notification settings - Fork 48
/
DiskHandler.go
54 lines (43 loc) · 1.46 KB
/
DiskHandler.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
// Cloud Driver Interface of CB-Spider.
// The CB-Spider is a sub-Framework of the Cloud-Barista Multi-Cloud Project.
// The CB-Spider Mission is to connect all the clouds with a single interface.
//
// * Cloud-Barista: https://github.com/cloud-barista
//
// This is Resouces interfaces of Cloud Driver.
//
// by CB-Spider Team, 2022.08.
package resources
import "time"
// -------- Const
type DiskStatus string
const (
DiskCreating DiskStatus = "Creating"
DiskAvailable DiskStatus = "Available"
DiskAttached DiskStatus = "Attached"
DiskDeleting DiskStatus = "Deleting"
DiskError DiskStatus = "Error"
)
// -------- Info Structure
type DiskInfo struct {
Zone string // Target Zone Name
IId IID // {NameId, SystemId}
DiskType string // "", "SSD(gp2)", "Premium SSD", ...
DiskSize string // "", "default", "50", "1000" # (GB)
Status DiskStatus // DiskCreating | DiskAvailable | DiskAttached | DiskDeleting | DiskError
OwnerVM IID // When the Status is DiskAttached
CreatedTime time.Time
KeyValueList []KeyValue
}
// -------- Disk API
type DiskHandler interface {
//------ Disk Management
CreateDisk(DiskReqInfo DiskInfo) (DiskInfo, error)
ListDisk() ([]*DiskInfo, error)
GetDisk(diskIID IID) (DiskInfo, error)
ChangeDiskSize(diskIID IID, size string) (bool, error)
DeleteDisk(diskIID IID) (bool, error)
//------ Disk Attachment
AttachDisk(diskIID IID, ownerVM IID) (DiskInfo, error)
DetachDisk(diskIID IID, ownerVM IID) (bool, error)
}