v16.10.0
v16.10.0
This commit is contained in:
1 parent
bc8c2b40e9
commit
00994516ba
52 files changed
+2287
-98
No files matched your search
@@ -0,0 +1,47 @@
|
||||
package disks
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
|
||||
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/constants"
|
||||
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/validators"
|
||||
)
|
||||
|
||||
// MigrateV2AbortRequest struct to abort disks migrations
|
||||
type MigrateV2AbortRequest struct {
|
||||
// Migration workflow job IDs
|
||||
// Required: true
|
||||
WorkflowJobIDs []string `url:"workflow_job_ids" json:"workflow_job_ids" validate:"required,min=1,max=100,unique,dive,required"`
|
||||
}
|
||||
|
||||
// MigrateV2Abort aborts disks migrations
|
||||
func (d Disks) MigrateV2Abort(ctx context.Context, req MigrateV2AbortRequest) (*MigrateV2AbortRecord, error) {
|
||||
res, err := d.MigrateV2AbortRaw(ctx, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
info := MigrateV2AbortRecord{}
|
||||
|
||||
err = json.Unmarshal(res, &info)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &info, nil
|
||||
}
|
||||
|
||||
// MigrateV2AbortRaw aborts disks migrations and returns an array of bytes
|
||||
func (d Disks) MigrateV2AbortRaw(ctx context.Context, req MigrateV2AbortRequest) ([]byte, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return nil, validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
url := "/cloudbroker/disks/migrate_v2_abort"
|
||||
|
||||
res, err := d.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req)
|
||||
return res, err
|
||||
}
|
||||
Reference in new issue
Block a user