public function xEc2MigrateAction($id, $cloudLocation, $destinationRegion)
{
$this->request->restrictAccess(Acl::RESOURCE_IMAGES_ENVIRONMENT, Acl::PERM_IMAGES_ENVIRONMENT_MANAGE);
/* @var $image Image */
$image = Image::findOne([['platform' => SERVER_PLATFORMS::EC2], ['id' => $id], ['cloudLocation' => $cloudLocation], ['envId' => $this->getEnvironmentId()]]);
if (!$image) {
throw new Exception('Image not found');
}
$this->request->checkPermissions($image, true);
$newImage = $image->migrateEc2Location($destinationRegion, $this->request->getUser());
$this->response->data(['hash' => $newImage->hash]);
$this->response->success('Image successfully migrated');
}