v15.0.0
This commit is contained in:
@@ -5,7 +5,7 @@ import (
|
||||
"net/http"
|
||||
"strings"
|
||||
|
||||
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/validators"
|
||||
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
|
||||
)
|
||||
|
||||
// MigrateAbortRequest struct to abort migration
|
||||
@@ -15,6 +15,12 @@ type MigrateAbortRequest struct {
|
||||
ComputeID uint64 `url:"compute_id" json:"compute_id" validate:"required"`
|
||||
}
|
||||
|
||||
type wrapperMigrateAbortRequest struct {
|
||||
MigrateAbortRequest
|
||||
|
||||
AsyncMode bool `url:"asyncMode"`
|
||||
}
|
||||
|
||||
// MigrateAbort aborts compute migration
|
||||
func (c Compute) MigrateAbort(ctx context.Context, req MigrateAbortRequest) (string, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
@@ -22,9 +28,14 @@ func (c Compute) MigrateAbort(ctx context.Context, req MigrateAbortRequest) (str
|
||||
return "", validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
reqWrapped := wrapperMigrateAbortRequest{
|
||||
MigrateAbortRequest: req,
|
||||
AsyncMode: false,
|
||||
}
|
||||
|
||||
url := "/cloudbroker/compute/migrate_abort"
|
||||
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
@@ -33,3 +44,25 @@ func (c Compute) MigrateAbort(ctx context.Context, req MigrateAbortRequest) (str
|
||||
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// MigrateAbortAsync aborts compute migration with AsyncMode
|
||||
func (c Compute) MigrateAbortAsync(ctx context.Context, req MigrateAbortRequest) (string, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return "", validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
reqWrapped := wrapperMigrateAbortRequest{
|
||||
MigrateAbortRequest: req,
|
||||
AsyncMode: true,
|
||||
}
|
||||
|
||||
url := "/cloudbroker/compute/migrate_abort"
|
||||
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return string(res), nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user