use of com.sequenceiq.cloudbreak.cloud.event.credential.InteractiveCredentialCreationRequest in project cloudbreak by hortonworks.
the class CredentialSender method createCredential.
@Override
public void createCredential(CloudContext cloudContext, ExtendedCloudCredential extendedCloudCredential) {
InteractiveCredentialCreationRequest credentialCreationRequest = new InteractiveCredentialCreationRequest(cloudContext, extendedCloudCredential);
LOGGER.info("Triggering event: {}", credentialCreationRequest);
eventBus.notify(credentialCreationRequest.selector(), eventFactory.createEvent(credentialCreationRequest));
}
use of com.sequenceiq.cloudbreak.cloud.event.credential.InteractiveCredentialCreationRequest in project cloudbreak by hortonworks.
the class InteractiveCredentialCreationHandler method accept.
@Override
public void accept(Event<InteractiveCredentialCreationRequest> interactiveCredentialCreationRequestEvent) {
InteractiveCredentialCreationRequest interactiveCredentialCreationRequest = interactiveCredentialCreationRequestEvent.getData();
ExtendedCloudCredential extendedCloudCredential = interactiveCredentialCreationRequest.getExtendedCloudCredential();
Credential credential = extendedCloudCredentialToCredentialConverter.convert(extendedCloudCredential);
try {
credentialService.createWithRetry(extendedCloudCredential.getOwner(), extendedCloudCredential.getAccount(), credential);
} catch (DuplicateKeyValueException e) {
sendErrorNotification(extendedCloudCredential.getOwner(), extendedCloudCredential.getAccount(), extendedCloudCredential.getCloudPlatform(), DuplicatedKeyValueExceptionMapper.errorMessage(e));
} catch (BadRequestException e) {
sendErrorNotification(extendedCloudCredential.getOwner(), extendedCloudCredential.getAccount(), extendedCloudCredential.getCloudPlatform(), e.getMessage());
}
}
Aggregations