Exemple #1
0
 public function communicate()
 {
     if (empty($this->sessionId)) {
         throw new Exception('Nenhum sessionId foi definido', 500);
     }
     if (empty($this->slaveGroup)) {
         throw new Exception('Nenhum nome de SlaveGroup foi definido', 500);
     }
     if (empty($this->getXml())) {
         $this->setXml('<?xml version="1.0" encoding="utf-8"?>
             <dnsshim version="1.0">
                 <request>
                     <printSlaveGroup>
                         <sessionId>' . $this->sessionId . '</sessionId>
                         <slaveGroup>' . $this->slaveGroup . '</slaveGroup>
                     </printSlaveGroup>
                 </request>
             </dnsshim>');
     }
     $xmlFormat = new \Cityware\Format\Xml();
     $xsdSchemaFileSource = file_get_contents($this->schemaFolder . $this->schemaName . '.xsd');
     $isValid = $xmlFormat->xsdValidateBySource($this->getXml(), $xsdSchemaFileSource);
     if ($isValid) {
         $return = parent::communicate();
         $returnArray = json_decode(json_encode($return), true);
         return $returnArray['response'];
     }
 }
Exemple #2
0
 public function communicate()
 {
     if (empty($this->sessionId)) {
         throw new Exception('Nenhum sessionId foi definido', 500);
     }
     if (empty($this->zone)) {
         throw new Exception('Nenhuma zona de dominio foi definido', 500);
     }
     if (empty($this->getXml())) {
         $this->setXml('<?xml version="1.0" encoding="UTF-8"?>
             <dnsshim version="1.0">
                 <request>
                     <zoneExists>
                         <sessionId>' . $this->sessionId . '</sessionId>
                         <zone>' . $this->zone . '</zone>
                     </zoneExists>
                 </request>
             </dnsshim>');
     }
     $xmlFormat = new \Cityware\Format\Xml();
     $xsdSchemaFileSource = file_get_contents($this->schemaFolder . $this->schemaName . '.xsd');
     $isValid = $xmlFormat->xsdValidateBySource($this->getXml(), $xsdSchemaFileSource);
     if ($isValid) {
         $return = parent::communicate();
         $returnArray = json_decode(json_encode($return), true);
         return $returnArray['response']['status'] == 1 ? true : false;
     }
 }
Exemple #3
0
 public function communicate()
 {
     if (empty($this->getXml())) {
         $this->setXml('<?xml version="1.0" encoding="utf-8"?>
             <dnsshim version="1.0">
                 <request>
                     <addUser>
                         <username>' . $this->username . '</username>
                         <password>' . $this->getHashPasswordLogin() . '</password>
                     </addUser>
                 </request>
             </dnsshim>');
     }
     $xmlFormat = new \Cityware\Format\Xml();
     $xsdSchemaFileSource = file_get_contents($this->schemaFolder . $this->schemaName . '.xsd');
     $isValid = $xmlFormat->xsdValidateBySource($this->getXml(), $xsdSchemaFileSource);
     if ($isValid) {
         $return = parent::communicate();
         $returnArray = json_decode(json_encode($return), true);
         return $returnArray['response'];
     }
 }
Exemple #4
0
 public function communicate()
 {
     if (empty($this->sessionId)) {
         throw new Exception('Nenhum sessionId foi definido', 500);
     }
     if (empty($this->zonename)) {
         throw new Exception('Nenhum dominio foi definido', 500);
     }
     if (empty($this->key)) {
         throw new Exception('Nenhuma chave foi definido', 500);
     }
     if (empty($this->newKeyStatus)) {
         $this->newKeyStatus = DnskeyStatus::getType('SIGN');
     }
     if (empty($this->oldKeyStatus)) {
         $this->oldKeyStatus = DnskeyStatus::getType('PUBLISH');
     }
     if (empty($this->getXml())) {
         $this->setXml('<?xml version="1.0" encoding="UTF-8"?>
             <dnsshim version="1.0">
                 <request>
                     <changeKeyStatus>
                         <sessionId>' . $this->sessionId . '</sessionId>
                         <zone>' . $this->zonename . '</zone>
                         <key>
                             <keyName>' . $this->key . '</keyName>
                             <oldStatus>' . $this->oldKeyStatus . '</oldStatus>
                             <newStatus>' . $this->newKeyStatus . '</newStatus>
                         </key>
                     </changeKeyStatus>
                 </request>
             </dnsshim>');
     }
     $xmlFormat = new \Cityware\Format\Xml();
     $xsdSchemaFileSource = file_get_contents($this->schemaFolder . $this->schemaName . '.xsd');
     $isValid = $xmlFormat->xsdValidateBySource($this->getXml(), $xsdSchemaFileSource);
     if ($isValid) {
         $return = parent::communicate();
         $returnArray = json_decode(json_encode($return), true);
         return $returnArray['response'];
     }
 }
Exemple #5
0
 public function communicate()
 {
     if (empty($this->sessionId)) {
         throw new Exception('Nenhum sessionId foi definido', 500);
     }
     if (empty($this->zonename)) {
         throw new Exception('Nenhum dominio foi definido', 500);
     }
     if (empty($this->rdata)) {
         throw new Exception('Nenhum dado foi definido', 500);
     }
     $typeRecord = empty($this->type) ? RrType::getType('NS') : RrType::getType($this->type);
     if (empty($this->dnsClass)) {
         $this->dnsClass = DnsClass::IN;
     }
     if (empty($this->getXml())) {
         $this->setXml('<?xml version="1.0" encoding="utf-8"?>
                 <dnsshim version="1.0">
                     <request>
                         <addRr>
                             <sessionId>' . $this->sessionId . '</sessionId>
                             <zone>' . $this->zonename . '</zone>
                             <rr>
                                 <ownername>' . $this->ownername . '</ownername>
                                 <ttl>' . $this->ttl . '</ttl>
                                 <type>' . $typeRecord . '</type>
                                 <dnsClass>' . $this->dnsClass . '</dnsClass>
                                 <rdata>' . $this->rdata . '</rdata>
                             </rr>
                         </addRr>
                     </request>
                 </dnsshim>');
     }
     $xmlFormat = new \Cityware\Format\Xml();
     $xsdSchemaFileSource = file_get_contents($this->schemaFolder . $this->schemaName . '.xsd');
     $isValid = $xmlFormat->xsdValidateBySource($this->getXml(), $xsdSchemaFileSource);
     if ($isValid) {
         $return = parent::communicate();
         $returnArray = json_decode(json_encode($return), true);
         return $returnArray['response'];
     }
 }
Exemple #6
0
 public function communicate()
 {
     if (empty($this->sessionId)) {
         throw new Exception('Nenhum sessionId foi definido', 500);
     }
     if (empty($this->zonename)) {
         throw new Exception('Nenhum dominio foi definido', 500);
     }
     if (empty($this->keyStatus)) {
         $this->keyStatus = DnskeyStatus::getType('SIGN');
     }
     if (empty($this->getXml())) {
         $this->setXml('<?xml version="1.0" encoding="UTF-8"?>
             <dnsshim version="1.0">
                 <request>
                     <importKey>
                         <sessionId>' . $this->sessionId . '</sessionId>
                         <zone>' . $this->zonename . '</zone>
                         <flags>' . $this->flags . '</flags>
                         <type>' . $this->keyType . '</type>
                         <status>' . $this->keyStatus . '</status>
                         <algorithm>' . $this->algorithm . '</algorithm>
                         <modulus>' . $this->modulus . '</modulus>
                         <publicExponent>' . $this->publicExponent . '</publicExponent>
                         <privateExponent>' . $this->privateExponent . '</privateExponent>
                         <prime1>' . $this->prime1 . '</prime1>
                         <prime2>' . $this->prime2 . '</prime2>
                         <exponent1>' . $this->exponent1 . '</exponent1>
                         <exponent2>' . $this->exponent2 . '</exponent2>
                         <coefficient>' . $this->coefficient . '</coefficient>
                     </importKey>
                 </request>
             </dnsshim>');
     }
     $xmlFormat = new \Cityware\Format\Xml();
     $xsdSchemaFileSource = file_get_contents($this->schemaFolder . $this->schemaName . '.xsd');
     $isValid = $xmlFormat->xsdValidateBySource($this->getXml(), $xsdSchemaFileSource);
     if ($isValid) {
         $return = parent::communicate();
         $returnArray = json_decode(json_encode($return), true);
         return $returnArray['response'];
     }
 }
Exemple #7
0
 public function communicate()
 {
     if (empty($this->sessionId)) {
         throw new Exception('Nenhum sessionId foi definido', 500);
     }
     if (empty($this->zonename)) {
         throw new Exception('Nenhum dominio foi definido', 500);
     }
     if (empty($this->mname)) {
         $this->setMname('ns1.' . $this->zonename);
     }
     if (empty($this->rname)) {
         $this->setRname('hostmaster.' . $this->zonename);
     }
     $xmlPartSlaveGroup = "";
     if ($this->slaveGroup != "") {
         $xmlPartSlaveGroup = '<slaveGroup>' . $this->slaveGroup . '</slaveGroup>';
     }
     $xmlPartAutoBalance = "";
     if ($this->autoBalance) {
         $xmlPartAutoBalance = '<autoBalance>' . $this->autoBalance . '</autoBalance>';
     }
     $xmlPartKey = "";
     if ($this->signed) {
         $xmlPartKey .= '<key>';
         $xmlPartKey .= '<size>' . $this->keySize . '</size>';
         $xmlPartKey .= '<algorithm>' . $this->algorithm . '</algorithm>';
         $xmlPartKey .= '<expirationPeriod>' . $this->expirationPeriod . '</expirationPeriod>';
         $xmlPartKey .= '</key>';
     }
     if (empty($this->getXml())) {
         $this->setXml('<?xml version="1.0" encoding="UTF-8"?>
             <dnsshim version="1.0">
                 <request>
                     <newZone>
                         <sessionId>' . $this->sessionId . '</sessionId>
                         <zone>' . $this->zonename . '</zone>
                         <dnssec>' . $this->signed . '</dnssec>
                         ' . $xmlPartSlaveGroup . '
                         ' . $xmlPartAutoBalance . '
                         <soa>
                             <ttl>' . $this->ttl . '</ttl>
                             <mname>' . $this->mname . '</mname>
                             <rname>' . $this->rname . '</rname>
                             <serial>' . $this->serial . '</serial>
                             <refresh>' . $this->refresh . '</refresh>
                             <retry>' . $this->retry . '</retry>
                             <expire>' . $this->expire . '</expire>
                             <minimum>' . $this->minimum . '</minimum>
                         </soa>
                         ' . $xmlPartKey . '
                     </newZone>
                 </request>
             </dnsshim>');
     }
     $xmlFormat = new \Cityware\Format\Xml();
     $xsdSchemaFileSource = file_get_contents($this->schemaFolder . $this->schemaName . '.xsd');
     $isValid = $xmlFormat->xsdValidateBySource($this->getXml(), $xsdSchemaFileSource);
     if ($isValid) {
         $return = parent::communicate();
         $returnArray = json_decode(json_encode($return), true);
         return $returnArray['response'];
     }
 }
Exemple #8
0
 public function communicate()
 {
     if (empty($this->getXml())) {
         $this->setXml('<?xml version="1.0" encoding="utf-8"?>
             <dnsshim version="1.0">
                 <request>
                     <pubZone>
                         <sessionId>' . $this->sessionId . '</sessionId>
                         <zone>' . $this->zonename . '</zone>
                         <serial>' . $this->serial . '</serial>
                         <type>' . $this->type . '</type>
                     </pubZone>
                 </request>
             </dnsshim>');
     }
     $xmlFormat = new \Cityware\Format\Xml();
     $xsdSchemaFileSource = file_get_contents($this->schemaFolder . $this->schemaName . '.xsd');
     $isValid = $xmlFormat->xsdValidateBySource($this->getXml(), $xsdSchemaFileSource);
     if ($isValid) {
         $return = parent::communicate();
         $returnArray = json_decode(json_encode($return), true);
         return $returnArray['response'];
     }
 }
Exemple #9
0
 public function communicate()
 {
     if (empty($this->sessionId)) {
         throw new Exception('Nenhum sessionId foi definido', 500);
     }
     if (empty($this->zonename)) {
         throw new Exception('Nenhum dominio foi definido', 500);
     }
     if (empty($this->serverIp)) {
         throw new Exception('Nenhum IP de servidor foi definido', 500);
     }
     if (empty($this->getXml())) {
         $this->setXml('<?xml version="1.0" encoding="utf-8"?>
             <dnsshim version="1.0">
                 <request>
                     <importZone>
                         <sessionId>' . $this->sessionId . '</sessionId>
                         <zone>' . $this->zonename . '</zone>
                         <server>' . $this->serverIp . '</server>
                         <port>' . $this->port . '</port>
                     </importZone>
                 </request>
             </dnsshim>');
     }
     $xmlFormat = new \Cityware\Format\Xml();
     $xsdSchemaFileSource = file_get_contents($this->schemaFolder . $this->schemaName . '.xsd');
     $isValid = $xmlFormat->xsdValidateBySource($this->getXml(), $xsdSchemaFileSource);
     if ($isValid) {
         $return = parent::communicate();
         $returnArray = json_decode(json_encode($return), true);
         return $returnArray['response'];
     }
 }