1.1.0
This commit is contained in:
20
CHANGELOG.md
20
CHANGELOG.md
@@ -2,7 +2,11 @@
|
|||||||
|
|
||||||
### Features
|
### Features
|
||||||
|
|
||||||
|
<<<<<<< CHANGELOG.md
|
||||||
#### CloudAPI
|
#### CloudAPI
|
||||||
|
=======
|
||||||
|
## CloudAPI
|
||||||
|
>>>>>>> CHANGELOG.md
|
||||||
|
|
||||||
- Account
|
- Account
|
||||||
- Delete "ResTypes" field in Create/Update request structs
|
- Delete "ResTypes" field in Create/Update request structs
|
||||||
@@ -15,6 +19,10 @@
|
|||||||
- Disks
|
- Disks
|
||||||
- Add fields "PresentTo", "Shareable", "Computes" in Get/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
|
- Delete fields "ComputeID", "ComputeName" in List/ListDeleted/ListUnattached/Search response structs
|
||||||
|
<<<<<<< CHANGELOG.md
|
||||||
|
- Add Share/Unshare methods
|
||||||
|
=======
|
||||||
|
>>>>>>> CHANGELOG.md
|
||||||
- FLIPgroup
|
- FLIPgroup
|
||||||
- Add field "ClientNames" in Get response struct
|
- Add field "ClientNames" in Get response struct
|
||||||
- Image
|
- Image
|
||||||
@@ -23,7 +31,11 @@
|
|||||||
- Delete "ResTypes" field in Create/Update request structs
|
- Delete "ResTypes" field in Create/Update request structs
|
||||||
- Add fields "DiskSizeMax", "Shareable", "SEPs" in Get/List response structs
|
- Add fields "DiskSizeMax", "Shareable", "SEPs" in Get/List response structs
|
||||||
|
|
||||||
|
<<<<<<< CHANGELOG.md
|
||||||
#### Cloudbroker
|
#### Cloudbroker
|
||||||
|
=======
|
||||||
|
## Cloudbroker
|
||||||
|
>>>>>>> CHANGELOG.md
|
||||||
|
|
||||||
- Account
|
- 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
|
||||||
@@ -32,6 +44,10 @@
|
|||||||
- Disks
|
- Disks
|
||||||
- Add fields "ReferenceID", "Shareable", "PresentTo", "Computes" 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
|
- Delete fields "ComputeID", "ComputeName" in List/ListDeleted/ListUnattached/Search response structs
|
||||||
|
<<<<<<< CHANGELOG.md
|
||||||
|
- Add Share/Unshare methods
|
||||||
|
=======
|
||||||
|
>>>>>>> CHANGELOG.md
|
||||||
- Grid
|
- Grid
|
||||||
- Add fields "SEPs", "DiskSizeMax" in Get/List response structs
|
- Add fields "SEPs", "DiskSizeMax" in Get/List response structs
|
||||||
- Image
|
- Image
|
||||||
@@ -44,3 +60,7 @@
|
|||||||
- Delete field "IPAddr" in MassCreate request struct
|
- Delete field "IPAddr" in MassCreate request struct
|
||||||
- RG
|
- 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