package compute import ( "context" "encoding/json" "net/http" "repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators" ) // MigrateStorageInfoRequest struct to get info about migration type MigrateStorageInfoRequest struct { // ID of the compute instance // Required: true ComputeID uint64 `url:"computeId" json:"computeId" validate:"required"` } // MigrateStorageInfo gets info about last (include ongoing) storage migration func (c Compute) MigrateStorageInfo(ctx context.Context, req MigrateStorageInfoRequest) (*RecordMigrateStorageInfo, error) { res, err := c.MigrateStorageInfoRaw(ctx, req) if err != nil { return nil, err } info := RecordMigrateStorageInfo{} err = json.Unmarshal(res, &info) if err != nil { return nil, err } return &info, nil } // MigrateStorageInfoRaw gets info about last (include ongoing) storage migration as an array of bytes func (c Compute) MigrateStorageInfoRaw(ctx context.Context, req MigrateStorageInfoRequest) ([]byte, error) { err := validators.ValidateRequest(req) if err != nil { return nil, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/compute/migrateStorageInfo" res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, req) if err != nil { return nil, err } return res, nil }