class ClusterTerminationService {

    public void finalizeClusterTermination(Long clusterId, boolean force) throws TransactionExecutionException {
        Cluster cluster = clusterService.findOneWithLists(clusterId)
                .orElseThrow(NotFoundException.notFound("cluster", clusterId));
        Set<RDSConfig> rdsConfigs = cluster.getRdsConfigs();
        Long stackId = cluster.getStack().getId();
        String terminatedName = cluster.getName() + DELIMITER + new Date().getTime();
        cluster.setName(terminatedName);
        clusterService.cleanupCluster(stackId);
        FileSystem fs = cluster.getFileSystem();
        if (fs != null) {
            deleteFileSystemResources(stackId, fs, force);
        }
        cluster.setBlueprint(null);
        cluster.setStatus(DELETE_COMPLETED);
        cluster.setFileSystem(null);
        transactionService.required(() -> {
            deleteClusterHostGroupsWithItsMetadata(cluster);
            rdsConfigService.deleteDefaultRdsConfigs(rdsConfigs);
            componentConfigProviderService.deleteComponentsForStack(stackId);
            return null;
        });
    }

}