Scalr\Api\Service\User\V1beta0\Controller\Servers::resumeAction PHP Method

resumeAction() public method

Resumes instance
public resumeAction ( string $serverId ) : Scalr\Api\DataType\ResultEnvelope
$serverId string UUID of the server
return Scalr\Api\DataType\ResultEnvelope
    public function resumeAction($serverId)
    {
        $server = $this->getServer($serverId);
        $this->checkPermissions($server, Acl::PERM_FARMS_SERVERS);
        if ($server->status != Server::STATUS_SUSPENDED) {
            throw new ApiErrorException(409, ErrorMessage::ERR_UNACCEPTABLE_STATE, "Only Suspended Servers can be resumed.");
        }
        try {
            $server->resume();
        } catch (InstanceNotFound $e) {
            throw new ApiErrorException(409, ErrorMessage::ERR_OBJECT_NOT_FOUND_ON_CLOUD, "The Server that you are trying to use does not exist on the cloud.");
        } catch (Exception $e) {
            throw new ApiErrorException(409, ErrorMessage::ERR_UNACCEPTABLE_OBJECT_CONFIGURATION, $e->getMessage());
        }
        $this->response->setStatus(200);
        return $this->result($this->adapter('server')->toData($server));
    }