use of com.sequenceiq.freeipa.api.v1.freeipa.stack.model.rebuild.RebuildRequest in project cloudbreak by hortonworks.
the class RepairInstancesService method rebuild.
public DescribeFreeIpaResponse rebuild(String accountId, RebuildRequest rebuildRequest) {
if (!entitlementService.isFreeIpaRebuildEnabled(accountId)) {
throw new BadRequestException("The FreeIPA rebuild capability is disabled.");
}
Stack stack = stackService.getByCrnAndAccountIdEvenIfTerminated(rebuildRequest.getEnvironmentCrn(), accountId, rebuildRequest.getSourceCrn());
Optional<Stack> nonTerminatedStack = stackService.findByEnvironmentCrnAndAccountId(rebuildRequest.getEnvironmentCrn(), accountId);
if (nonTerminatedStack.isPresent()) {
String error = "There is a stack which hasn't been terminated.";
LOGGER.error(error);
throw new BadRequestException(error);
}
renameStackIfNeeded(stack);
CreateFreeIpaRequest createFreeIpaRequest = stackToCreateFreeIpaRequestConverter.convert(stack);
return freeIpaCreationService.launchFreeIpa(createFreeIpaRequest, accountId);
}
Aggregations