1.1.0
This commit is contained in:
64
CHANGELOG.md
64
CHANGELOG.md
@@ -2,45 +2,65 @@
|
||||
|
||||
### Features
|
||||
|
||||
<<<<<<< CHANGELOG.md
|
||||
#### CloudAPI
|
||||
=======
|
||||
## CloudAPI
|
||||
>>>>>>> CHANGELOG.md
|
||||
|
||||
- Account
|
||||
- Delete "ResTypes" field in Create/Update request structs
|
||||
- Add fields "DiskSizeMax", "Shareable", "SEPs" in Get/List response structs
|
||||
- Delete "ResTypes" field in Create/Update request structs
|
||||
- Add fields "DiskSizeMax", "Shareable", "SEPs" in Get/List response structs
|
||||
- BService
|
||||
- Add fields "SEPID", "SEPPool" in GroupAdd request structs
|
||||
- Add field "PoolName" in List/ListDeleted response structs
|
||||
- Add fields "SEPID", "SEPPool" in GroupAdd request structs
|
||||
- Add field "PoolName" in List/ListDeleted response structs
|
||||
- Compute
|
||||
- Add fields "PresentTo", "Shareable" in Get/List/ListDeleted response structs
|
||||
- Add fields "PresentTo", "Shareable" in Get/List/ListDeleted response structs
|
||||
- Disks
|
||||
- Add fields "PresentTo", "Shareable", "Computes" in Get/List/ListDeleted/ListUnattached/Search response structs
|
||||
- Delete fields "ComputeID", "ComputeName" in List/ListDeleted/ListUnattached/Search response structs
|
||||
- Add fields "PresentTo", "Shareable", "Computes" in Get/List/ListDeleted/ListUnattached/Search response structs
|
||||
- Delete fields "ComputeID", "ComputeName" in List/ListDeleted/ListUnattached/Search response structs
|
||||
<<<<<<< CHANGELOG.md
|
||||
- Add Share/Unshare methods
|
||||
=======
|
||||
>>>>>>> CHANGELOG.md
|
||||
- FLIPgroup
|
||||
- Add field "ClientNames" in Get response struct
|
||||
- Add field "ClientNames" in Get response struct
|
||||
- Image
|
||||
- Add field "PresentTo" in Get response struct
|
||||
- Add field "PresentTo" in Get response struct
|
||||
- RG
|
||||
- Delete "ResTypes" field in Create/Update request structs
|
||||
- Add fields "DiskSizeMax", "Shareable", "SEPs" in Get/List response structs
|
||||
- Delete "ResTypes" field in Create/Update request structs
|
||||
- Add fields "DiskSizeMax", "Shareable", "SEPs" in Get/List response structs
|
||||
|
||||
<<<<<<< CHANGELOG.md
|
||||
#### Cloudbroker
|
||||
=======
|
||||
## Cloudbroker
|
||||
>>>>>>> CHANGELOG.md
|
||||
|
||||
- Account
|
||||
- Add fields "SEPs", "ResourceTypes", "PresentTo", "DiskSizeMax", "UniqPools", "Shareable" in Get/List/ListDeleted/ListDisks/ListRG response structs
|
||||
- Add fields "SEPs", "ResourceTypes", "PresentTo", "DiskSizeMax", "UniqPools", "Shareable" in Get/List/ListDeleted/ListDisks/ListRG response structs
|
||||
- Compute
|
||||
- Add fields "VINSConnected", "TotalDiskSize", "Shareable", "PresentTo" in Get/List/ListDeleted response structs
|
||||
- Add fields "VINSConnected", "TotalDiskSize", "Shareable", "PresentTo" in Get/List/ListDeleted response structs
|
||||
- Disks
|
||||
- Add fields "ReferenceID", "Shareable", "PresentTo", "Computes" in List/ListDeleted/ListUnattached/Search response structs
|
||||
- Delete fields "ComputeID", "ComputeName" in List/ListDeleted/ListUnattached/Search response structs
|
||||
- Add fields "ReferenceID", "Shareable", "PresentTo", "Computes" in List/ListDeleted/ListUnattached/Search response structs
|
||||
- Delete fields "ComputeID", "ComputeName" in List/ListDeleted/ListUnattached/Search response structs
|
||||
<<<<<<< CHANGELOG.md
|
||||
- Add Share/Unshare methods
|
||||
=======
|
||||
>>>>>>> CHANGELOG.md
|
||||
- Grid
|
||||
- Add fields "SEPs", "DiskSizeMax" in Get/List response structs
|
||||
- Add fields "SEPs", "DiskSizeMax" in Get/List response structs
|
||||
- Image
|
||||
- Add field "PresentTo" in Get response struct
|
||||
- Add field "PresentTo" in Get response struct
|
||||
- KVMX86
|
||||
- Add field "Userdata" in MassCreate request struct
|
||||
- Delete field "IPAddr" in MassCreate request struct
|
||||
- Add field "Userdata" in MassCreate request struct
|
||||
- Delete field "IPAddr" in MassCreate request struct
|
||||
- KVMPPC
|
||||
- Add field "Userdata" in MassCreate request struct
|
||||
- Delete field "IPAddr" in MassCreate request struct
|
||||
- Add field "Userdata" in MassCreate request struct
|
||||
- Delete field "IPAddr" in MassCreate request struct
|
||||
- RG
|
||||
- Add fields "DiskSizeMax", "Shareable", "SEPs" in Get/List response structs
|
||||
- Add fields "DiskSizeMax", "Shareable", "SEPs" in Get/List response structs
|
||||
<<<<<<< CHANGELOG.md
|
||||
|
||||
=======
|
||||
>>>>>>> CHANGELOG.md
|
||||
|
||||
45
pkg/cloudbroker/disks/share.go
Normal file
45
pkg/cloudbroker/disks/share.go
Normal file
@@ -0,0 +1,45 @@
|
||||
package disks
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"net/http"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
// Request struct for share data disk
|
||||
type ShareRequest struct {
|
||||
// ID of the disk to share
|
||||
// Required: true
|
||||
DiskID uint64 `url:"diskId"`
|
||||
}
|
||||
|
||||
func (drq ShareRequest) validate() error {
|
||||
if drq.DiskID == 0 {
|
||||
return errors.New("validation-error: field DiskID can not be empty or equal to 0")
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// Share shares data disk
|
||||
func (d Disks) Share(ctx context.Context, req ShareRequest) (bool, error) {
|
||||
err := req.validate()
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
url := "/cloudbroker/disks/share"
|
||||
|
||||
res, err := d.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
result, err := strconv.ParseBool(string(res))
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
return result, nil
|
||||
}
|
||||
45
pkg/cloudbroker/disks/unshare.go
Normal file
45
pkg/cloudbroker/disks/unshare.go
Normal file
@@ -0,0 +1,45 @@
|
||||
package disks
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"net/http"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
// Request struct for unshare data disk
|
||||
type UnshareRequest struct {
|
||||
// ID of the disk to unshare
|
||||
// Required: true
|
||||
DiskID uint64 `url:"diskId"`
|
||||
}
|
||||
|
||||
func (drq UnshareRequest) validate() error {
|
||||
if drq.DiskID == 0 {
|
||||
return errors.New("validation-error: field DiskID can not be empty or equal to 0")
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// Unshare unshares data disk
|
||||
func (d Disks) Unshare(ctx context.Context, req UnshareRequest) (bool, error) {
|
||||
err := req.validate()
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
url := "/cloudbroker/disks/unshare"
|
||||
|
||||
res, err := d.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
result, err := strconv.ParseBool(string(res))
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
return result, nil
|
||||
}
|
||||
Reference in New Issue
Block a user