use space type from request
This commit is contained in:
@@ -170,6 +170,18 @@ func (g Graph) CreateDrive(w http.ResponseWriter, r *http.Request) {
|
||||
errorcode.GeneralException.Render(w, r, http.StatusInternalServerError, fmt.Errorf("invalid name").Error())
|
||||
return
|
||||
}
|
||||
|
||||
var driveType string
|
||||
if drive.DriveType != nil {
|
||||
driveType = *drive.DriveType
|
||||
}
|
||||
switch driveType {
|
||||
case "":
|
||||
driveType = "project"
|
||||
case "share":
|
||||
errorcode.GeneralException.Render(w, r, http.StatusBadRequest, fmt.Errorf("drives of type share cannot be created via this api").Error())
|
||||
}
|
||||
|
||||
var quota uint64
|
||||
if drive.Quota != nil && drive.Quota.Total != nil {
|
||||
quota = uint64(*drive.Quota.Total)
|
||||
@@ -179,7 +191,7 @@ func (g Graph) CreateDrive(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
csr := provider.CreateStorageSpaceRequest{
|
||||
Owner: us,
|
||||
Type: "share",
|
||||
Type: driveType,
|
||||
Name: spaceName,
|
||||
Quota: &provider.Quota{
|
||||
QuotaMaxBytes: quota,
|
||||
|
||||
Reference in New Issue
Block a user