Scalr\Api\Service\User\V1beta0\Controller\CloudCredentials::modifyAction PHP Method

modifyAction() public method

public modifyAction ( $cloudCredentialsId )
    public function modifyAction($cloudCredentialsId)
    {
        $this->checkScopedPermissions('CLOUD_CREDENTIALS');
        $object = $this->request->getJsonBody();
        $cloudCredentials = $this->getCloudCredentials($cloudCredentialsId, true);
        /* @var $adapter CloudCredentialsAdapter */
        $adapter = $this->adapter($cloudCredentials);
        //Pre validates the request object
        $adapter->validateObject($object, Request::METHOD_PATCH);
        //We keep current configuration to compare with further changes to determine
        //whether there is a need to re-validate credentials on cloud
        /* @var $ccProps SettingsCollection */
        $ccProps = $cloudCredentials->properties;
        $ccProps->load();
        $prevConfiguration = clone $cloudCredentials;
        //Copies all alterable properties to fetched Role Entity
        $adapter->copyAlterableProperties($object, $cloudCredentials);
        //Re-validates an Entity
        $adapter->validateEntity($cloudCredentials, $prevConfiguration);
        //Saves verified results
        $cloudCredentials->save();
        return $this->result($adapter->toData($cloudCredentials));
    }