package compute import ( "context" "encoding/json" "net/http" "repository.basistech.ru/BASIS/decort-golang-sdk/internal/constants" "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) // MigrateResolveRequest to resolve a migration type MigrateV2ResolveRequest struct { // Workflow job ID // Required: true WorkflowJobID string `url:"workflow_job_id" json:"workflow_job_id" validate:"required"` // Take over cleanup // Required: false TakeOverCleanup interface{} `url:"take_over_cleanup,omitempty" json:"take_over_cleanup,omitempty" validate:"omitempty,isBool"` } // MigrateV2Resolve resolves a migration of a compute func (c Compute) MigrateV2Resolve(ctx context.Context, req MigrateV2ResolveRequest) (*MigrateV2ResolveRecord, error) { res, err := c.MigrateV2ResolveRaw(ctx, req) if err != nil { return nil, err } info := MigrateV2ResolveRecord{} err = json.Unmarshal(res, &info) if err != nil { return nil, err } return &info, nil } // MigrateV2ResolveRaw resolves a migration of a compute and returns an array of bytes func (c Compute) MigrateV2ResolveRaw(ctx context.Context, req MigrateV2ResolveRequest) ([]byte, error) { err := validators.ValidateRequest(req) if err != nil { return nil, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/compute/migrate_v2_resolve" res, err := c.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req) return res, err }