-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a initial Version of the Disk Driver API
- Loading branch information
1 parent
8331431
commit 12df9e9
Showing
2 changed files
with
61 additions
and
2 deletions.
There are no files selected for viewing
55 changes: 55 additions & 0 deletions
55
cloud-control-manager/cloud-driver/interfaces/resources/DiskHandler.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
// 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" | ||
) | ||
|
||
//-------- Info Structure | ||
type DiskInfo struct { | ||
IId IID // {NameId, SystemId} | ||
|
||
DiskType string // "", "SSD(gp2)", "Premium SSD", ... | ||
DiskSize string // "", "default", "50", "1000" # (GB) | ||
|
||
Status DiskStatus // DiskCreating | DiskAvailable | DiskAttached | DiskDeleting | ||
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) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters