use of com.vmware.flowgate.common.model.IntegrationStatus in project flowgate by vmware.
the class SDDCSoftwareController method createServer.
@ResponseStatus(HttpStatus.CREATED)
@RequestMapping(method = RequestMethod.POST)
public void createServer(@RequestBody SDDCSoftwareConfig server, HttpServletRequest request) {
String ip = server.getServerURL();
SDDCSoftwareConfig example = sddcRepository.findOneByServerURL(ip);
if (example != null) {
String message = String.format("The server %s is already exsit.", ip);
throw new WormholeRequestException(message);
}
switch(server.getType()) {
case VRO:
serverValidationService.validateVROServer(server);
break;
case VCENTER:
serverValidationService.validVCServer(server);
break;
case VROPSMP:
break;
default:
throw WormholeRequestException.InvalidFiled("type", server.getType().toString());
}
WormholeUserDetails user = accessTokenService.getCurrentUser(request);
server.setUserId(user.getUserId());
IntegrationStatus integrationStatus = new IntegrationStatus();
integrationStatus.setRetryCounter(FlowgateConstant.DEFAULTNUMBEROFRETRIES);
integrationStatus.setStatus(IntegrationStatus.Status.ACTIVE);
server.setIntegrationStatus(integrationStatus);
// encrypt the password
encryptServerPassword(server);
BaseDocumentUtil.generateID(server);
sddcRepository.save(server);
// notify worker for the start jobs
decryptServerPassword(server);
notifySDDCWorker(server);
}
Aggregations