This commit is contained in:
2026-06-05 17:30:36 +03:00
parent 3e2edf53a5
commit f1112e5a11
1246 changed files with 6117 additions and 1589 deletions

View File

@@ -5,7 +5,7 @@ import (
"net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
)
// GuestAgentFeatureUpdateRequest struct to feature update guest agent
@@ -15,6 +15,12 @@ type GuestAgentFeatureUpdateRequest struct {
ComputeID uint64 `url:"compute_id" json:"compute_id" validate:"required"`
}
type wrapperGuestAgentFeatureUpdateRequest struct {
GuestAgentFeatureUpdateRequest
AsyncMode bool `url:"asyncMode"`
}
// Feature update guest agent
func (c Compute) GuestAgentFeatureUpdate(ctx context.Context, req GuestAgentFeatureUpdateRequest) (bool, error) {
err := validators.ValidateRequest(req)
@@ -22,9 +28,14 @@ func (c Compute) GuestAgentFeatureUpdate(ctx context.Context, req GuestAgentFeat
return false, validators.ValidationErrors(validators.GetErrors(err))
}
reqWrapped := wrapperGuestAgentFeatureUpdateRequest{
GuestAgentFeatureUpdateRequest: req,
AsyncMode: false,
}
url := "/cloudapi/compute/guest_agent_feature_update"
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, req)
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
if err != nil {
return false, err
}
@@ -36,3 +47,25 @@ func (c Compute) GuestAgentFeatureUpdate(ctx context.Context, req GuestAgentFeat
return result, nil
}
// GuestAgentFeatureUpdateAsync feature updates guest agent with AsyncMode
func (c Compute) GuestAgentFeatureUpdateAsync(ctx context.Context, req GuestAgentFeatureUpdateRequest) (string, error) {
err := validators.ValidateRequest(req)
if err != nil {
return "", validators.ValidationErrors(validators.GetErrors(err))
}
reqWrapped := wrapperGuestAgentFeatureUpdateRequest{
GuestAgentFeatureUpdateRequest: req,
AsyncMode: true,
}
url := "/cloudapi/compute/guest_agent_feature_update"
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
if err != nil {
return "", err
}
return string(res), nil
}