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

getServer() public method

Gets specified Server
public getServer ( string $serverId ) : Server
$serverId string UUID of the server
return Scalr\Model\Entity\Server Returns the Server Entity on success
    public function getServer($serverId)
    {
        $criteria = [['serverId' => $serverId]];
        $server = Server::findOne(array_merge($this->getDefaultCriteria(), $criteria));
        /* @var $server Server */
        if (!$server) {
            throw new ApiErrorException(404, ErrorMessage::ERR_OBJECT_NOT_FOUND, "Requested Server either does not exist or is not owned by your environment.");
        }
        if (!$this->hasPermissions($server)) {
            //Checks entity level write access permissions
            throw new ApiErrorException(403, ErrorMessage::ERR_PERMISSION_VIOLATION, "Insufficient permissions");
        }
        return $server;
    }