diff --git a/src/Commands/VanityDomainDeleteCommand.php b/src/Commands/VanityDomainDeleteCommand.php new file mode 100644 index 00000000..44abae6e --- /dev/null +++ b/src/Commands/VanityDomainDeleteCommand.php @@ -0,0 +1,46 @@ +setName('vanity-domain:delete') + ->addArgument('environment', InputArgument::REQUIRED, 'The environment name') + ->setDescription('Delete the vanity domain associated with the given environment'); + } + + /** + * Execute the command. + * + * @return void + */ + public function handle() + { + $environment = $this->argument('environment'); + + if (! Helpers::confirm("Are you sure you want to delete the vanity domain of the [{$environment}] environment", false)) { + Helpers::abort('Action cancelled.'); + } + + $this->vapor->deleteVanityDomain( + Manifest::id(), + $environment + ); + + Helpers::info('Vanity domain deletion initiated successfully.'); + Helpers::line(); + Helpers::line('The process may take several seconds to complete.'); + } +} diff --git a/src/ConsoleVaporClient.php b/src/ConsoleVaporClient.php index 7316c77a..fd52da57 100644 --- a/src/ConsoleVaporClient.php +++ b/src/ConsoleVaporClient.php @@ -924,6 +924,21 @@ public function deleteEnvironment($projectId, $environment) ); } + /** + * Delete the vanity domain of given environment. + * + * @param string $projectId + * @param string $environment + * @return void + */ + public function deleteVanityDomain($projectId, $environment) + { + return $this->requestWithErrorHandling( + 'delete', + 'api/projects/'.$projectId.'/environments/'.$environment.'/vanity-domain' + ); + } + /** * Get all of the secrets for the given environment. * diff --git a/vapor b/vapor index a4d883b7..06f87fce 100755 --- a/vapor +++ b/vapor @@ -167,6 +167,9 @@ $app->add(new Commands\EnvCloneCommand); $app->add(new Commands\EnvDeleteCommand); $app->add(new Commands\OpenCommand); +// Vanity Domains... +$app->add(new Commands\VanityDomainDeleteCommand); + // Secrets $app->add(new Commands\SecretListCommand); $app->add(new Commands\SecretCommand);