runWithConfig method
Runs this command with prepared configuration (options). Subclasses should override this method.
Implementation
@override
Future<void> runWithConfig(
final Configuration<DetachCustomDomainCommandConfig> commandConfig,
) async {
final projectId = commandConfig.value(
DetachCustomDomainCommandConfig.projectId,
);
final domainName = commandConfig.value(
DetachCustomDomainCommandConfig.domainName,
);
final shouldDelete = await logger.confirm(
'Are you sure you want to delete the custom domain "$domainName"?',
defaultValue: false,
);
if (!shouldDelete) {
throw UserAbortException();
}
final apiCloudClient = runner.serviceProvider.cloudApiClient;
try {
await apiCloudClient.customDomainName.remove(
cloudCapsuleId: projectId,
domainName: domainName,
);
} on Exception catch (e, stackTrace) {
throw FailureException.nested(
e,
stackTrace,
'Failed to remove custom domain',
);
}
logger.success('Successfully detached custom domain: $domainName.');
}