v1.0.0
This commit is contained in:
@@ -7,12 +7,18 @@ import (
|
||||
"strconv"
|
||||
)
|
||||
|
||||
// Request struct for detach vgpu for compute
|
||||
type DetachGPURequest struct {
|
||||
// Identifier compute
|
||||
// Required: true
|
||||
ComputeID uint64 `url:"computeId"`
|
||||
VGPUID int64 `url:"vgpuId,omitempty"`
|
||||
|
||||
// Identifier virtual GPU
|
||||
// Required: false
|
||||
VGPUID int64 `url:"vgpuId,omitempty"`
|
||||
}
|
||||
|
||||
func (crq DetachGPURequest) Validate() error {
|
||||
func (crq DetachGPURequest) validate() error {
|
||||
if crq.ComputeID == 0 {
|
||||
return errors.New("validation-error: field ComputeID can not be empty or equal to 0")
|
||||
}
|
||||
@@ -20,8 +26,10 @@ func (crq DetachGPURequest) Validate() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// DetachGPU detach vgpu for compute.
|
||||
// If param vgpuid is equivalent -1, then detach all vgpu for compute
|
||||
func (c Compute) DetachGPU(ctx context.Context, req DetachGPURequest) (bool, error) {
|
||||
err := req.Validate()
|
||||
err := req.validate()
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user