v14.5.0
This commit is contained in:
58
pkg/cloudbroker/resource_optimizer/drs_update.go
Normal file
58
pkg/cloudbroker/resource_optimizer/drs_update.go
Normal file
@@ -0,0 +1,58 @@
|
||||
package resource_optimizer
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
||||
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
|
||||
)
|
||||
|
||||
// DRSUpdateRequest struct to update DRS
|
||||
type DRSUpdateRequest struct {
|
||||
// ID of the zone
|
||||
// Required: true
|
||||
ZoneID uint64 `url:"zone_id" json:"zone_id" validate:"required"`
|
||||
|
||||
// Application ID
|
||||
// Required: false
|
||||
AppID string `url:"app_id,omitempty" json:"app_id,omitempty"`
|
||||
|
||||
// Application secret
|
||||
// Required: false
|
||||
AppSecret string `url:"app_secret,omitempty" json:"app_secret,omitempty"`
|
||||
|
||||
// Decort URL
|
||||
// Required: false
|
||||
DecortURL string `url:"decort_url,omitempty" json:"decort_url,omitempty"`
|
||||
|
||||
// SSO URL
|
||||
// Required: false
|
||||
SSOURL string `url:"sso_url,omitempty" json:"sso_url,omitempty"`
|
||||
|
||||
// DRS name
|
||||
// Required: false
|
||||
DRSName string `url:"drs_name,omitempty" json:"drs_name,omitempty"`
|
||||
}
|
||||
|
||||
// DRSUpdate updates DRS configuration in the specified zone
|
||||
func (ro ResourceOptimizer) DRSUpdate(ctx context.Context, req DRSUpdateRequest) (bool, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return false, validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
url := "/cloudbroker/resource_optimizer/drs_update"
|
||||
|
||||
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
|
||||
}
|
||||
Reference in New Issue
Block a user