39 lines
877 B
Go
39 lines
877 B
Go
package resource_optimizer
|
|
|
|
import (
|
|
"context"
|
|
"net/http"
|
|
"strconv"
|
|
|
|
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
|
)
|
|
|
|
// DRSRemoveRequest struct to remove DRS
|
|
type DRSRemoveRequest struct {
|
|
// ID of the zone
|
|
// Required: true
|
|
ZoneID uint64 `url:"zone_id" json:"zone_id" validate:"required"`
|
|
}
|
|
|
|
// DRSRemove removes DRS from the specified zone
|
|
func (ro ResourceOptimizer) DRSRemove(ctx context.Context, req DRSRemoveRequest) (bool, error) {
|
|
err := validators.ValidateRequest(req)
|
|
if err != nil {
|
|
return false, validators.ValidationErrors(validators.GetErrors(err))
|
|
}
|
|
|
|
url := "/cloudbroker/resource_optimizer/drs_remove"
|
|
|
|
res, err := ro.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
|
|
}
|