Scalr\Api\Service\Account\V1beta0\Controller\Environments::modifyAction PHP Method

modifyAction() public method

Change environment attributes.
public modifyAction ( integer $envId ) : Scalr\Api\DataType\ResultEnvelope
$envId integer Unique identifier of the environment
return Scalr\Api\DataType\ResultEnvelope
    public function modifyAction($envId)
    {
        if (!$this->getUser()->canManageAcl()) {
            throw new ApiErrorException(403, ErrorMessage::ERR_PERMISSION_VIOLATION, "Insufficient Permissions");
        }
        $object = $this->request->getJsonBody();
        /* @var $envAdapter EnvironmentAdapter */
        $envAdapter = $this->adapter('environment');
        //Pre validates the request object
        $envAdapter->validateObject($object, Request::METHOD_PATCH);
        $env = $this->getEnv($envId);
        //Copies all alterable properties to fetched Role Entity
        $envAdapter->copyAlterableProperties($object, $env);
        //Re-validates an Entity
        $envAdapter->validateEntity($env);
        //Saves verified results
        $env->save();
        return $this->result($envAdapter->toData($env));
    }