protected function execute(InputInterface $input, OutputInterface $output)
{
$this->validateInput($input);
if (!$this->validateDomainInput($input)) {
return 1;
}
$project = $this->getSelectedProject();
try {
$this->stdErr->writeln("Adding the domain <info>{$this->domainName}</info>");
$result = $project->addDomain($this->domainName, $this->sslOptions);
} catch (ClientException $e) {
// Catch 409 Conflict errors.
$response = $e->getResponse();
if ($response && $response->getStatusCode() === 409) {
$this->stdErr->writeln("The domain <error>{$this->domainName}</error> already exists on the project.");
$this->stdErr->writeln("Use <info>domain:delete</info> to delete an existing domain");
} else {
$this->handleApiException($e, $project);
}
return 1;
}
if (!$input->getOption('no-wait')) {
ActivityUtil::waitMultiple($result->getActivities(), $this->stdErr, $project);
}
return 0;
}