protected function execute(InputInterface $input, OutputInterface $output) { $rage4 = $this->getRage4DNS($input->getOption('credentials')); $records = $rage4->records->getRecords($input->getArgument('id')); $full = $input->getOption('full'); $content = array(); foreach ($records as $type) { $content[] = $type->getTableRow($full); } $this->renderTable(Record::getTableHeaders($full), $content, $output); }
protected function execute(InputInterface $input, OutputInterface $output) { $rage4 = $this->getRage4DNS($input->getOption('credentials')); $record = new Record(); $record->setId($input->getArgument('id')); $record->setName($input->getArgument('name')); $record->setContent($input->getArgument('content')); $record->setType($input->getArgument('type')); $record->setPriority($input->getOption('priority')); $record->setFailoverEnabled($input->getOption('enable-failover') ? true : false); $record->setFailoverContent($input->getOption('failover-content')); $record->setTtl($input->getOption('ttl')); $record->setGeoRegionId($input->getOption('geozone')); $record->setGeoLock($input->getOption('lock-geo') ? true : false); $record->setGeoLong($input->getOption('geo-long')); $record->setGeoLat($input->getOption('geo-lat')); $status = $rage4->records->updateRecord($record); $content[] = $status->getTableRow(); $this->renderTable(Status::getTableHeaders(), $content, $output); }
/** * @param Record $record * * @return Status * @throws \Exception */ public function updateRecord(Record $record) { if (!$record->getId()) { throw new \Exception('Cannot create record. Record ID is missing'); } $url = sprintf("%s/%s/%d", $this->apiUrl, self::URL_UPDATE_RECORD, $record->getId()); $response = $this->processQuery($url, null, array('query' => $record->toArray())); return Status::createFromArray($response); }