use of com.sequenceiq.cloudbreak.cloud.event.setup.ValidationResult in project cloudbreak by hortonworks.
the class ProvisionValidationHandler method accept.
@Override
public void accept(Event<ValidationRequest> event) {
LOGGER.info("Received event: {}", event);
ValidationRequest request = event.getData();
CloudContext cloudContext = request.getCloudContext();
ValidationResult result;
try {
CloudConnector connector = cloudPlatformConnectors.get(cloudContext.getPlatformVariant());
AuthenticatedContext ac = connector.authentication().authenticate(request.getCloudContext(), request.getCloudCredential());
CloudStack cloudStack = request.getCloudStack();
for (Validator v : connector.validators()) {
v.validate(ac, cloudStack);
}
result = new ValidationResult(request);
} catch (RuntimeException e) {
result = new ValidationResult(e, request);
}
request.getResult().onNext(result);
eventBus.notify(result.selector(), new Event<>(event.getHeaders(), result));
}
Aggregations