Ovh\Dedicated\Server\ServerClient::createBackupFTPAccess PHP Метод

createBackupFTPAccess() публичный Метод

Creatge backupFTP ACL
public createBackupFTPAccess ( $domain, $ipBlock ) : object
$domain -> Server that this applies to
$ipBlock -> ipblock that is being granted access this requires that one type of access be set - and since this is called backuipFTP - I chose the FTP as default a second call to set actual desired ACL will be required to set acl to what is desired
Результат object result set throws BadMethodCallException if server is not defined usual handling for 400/404 errors
    public function createBackupFTPAccess($domain, $ipBlock)
    {
        //	$domain = (string)$domain;
        //	$ipBlock= (string)$ipBlock;
        if (!$domain) {
            throw new BadMethodCallException('Parameter $domain is missing.');
        }
        if (!$ipBlock) {
            throw new BadMethodCallException('Parameter $ipBlock is missing.');
        }
        $payload = array('ftp' => 1 == 1, 'ipBlock' => $ipBlock, 'nfs' => 1 == 0, 'cifs' => 1 == 0);
        try {
            $r = $this->post('dedicated/server/' . $domain . '/features/backupFTP/access', array('Content-Type' => 'application/json;charset=UTF-8'), json_encode($payload))->send();
        } catch (\Exception $e) {
            throw new ServerException($e->getMessage(), $e->getCode(), $e);
        }
        return $r->getBody(true);
    }