use of com.sequenceiq.cloudbreak.cloud.event.validation.ParametersValidationResult in project cloudbreak by hortonworks.
the class ParametersValidationHandler method accept.
@Override
public void accept(Event<ParametersValidationRequest> requestEvent) {
LOGGER.debug("Received event: {}", requestEvent);
ParametersValidationRequest request = requestEvent.getData();
try {
CloudConnector<Object> connector = cloudPlatformConnectors.get(request.getCloudContext().getPlatformVariant());
AuthenticatedContext auth = connector.authentication().authenticate(request.getCloudContext(), request.getCloudCredential());
connector.setup().validateParameters(auth, request.getParameters());
request.getResult().onNext(new ParametersValidationResult(request.getResourceId()));
} catch (Exception e) {
request.getResult().onNext(new ParametersValidationResult(e.getMessage(), e, request.getResourceId()));
}
}
use of com.sequenceiq.cloudbreak.cloud.event.validation.ParametersValidationResult in project cloudbreak by hortonworks.
the class ParametersValidator method waitResult.
public void waitResult(ParametersValidationRequest parametersValidationRequest, ValidationResult.ValidationResultBuilder validationBuilder) {
if (parametersValidationRequest != null) {
try {
ParametersValidationResult result = parametersValidationRequest.await();
LOGGER.info("Parameter validation result: {}", result);
Exception exception = result.getErrorDetails();
if (exception != null) {
validationBuilder.error(result.getStatusReason());
}
} catch (InterruptedException e) {
LOGGER.error("Error while sending the parameters validation request", e);
validationBuilder.error(e.getMessage());
}
}
}
Aggregations