use of com.sequenceiq.cloudbreak.cloud.event.platform.GetStackParamValidationRequest in project cloudbreak by hortonworks.
the class StackParameterService method getStackParams.
public List<StackParamValidation> getStackParams(String name, Credential credential) {
LOGGER.debug("Get stack params");
if (credential != null) {
CloudContext cloudContext = new CloudContext(null, name, credential.cloudPlatform(), credential.getOwner());
GetStackParamValidationRequest getStackParamValidationRequest = new GetStackParamValidationRequest(cloudContext);
eventBus.notify(getStackParamValidationRequest.selector(), eventFactory.createEvent(getStackParamValidationRequest));
try {
GetStackParamValidationResult res = getStackParamValidationRequest.await();
LOGGER.info("Get stack params result: {}", res);
if (res.getStatus().equals(EventStatus.FAILED)) {
LOGGER.error("Failed to get stack params", res.getErrorDetails());
throw new OperationException(res.getErrorDetails());
}
return res.getStackParamValidations();
} catch (InterruptedException e) {
LOGGER.error("Error while getting the stack params", e);
throw new OperationException(e);
}
} else {
return Collections.emptyList();
}
}
use of com.sequenceiq.cloudbreak.cloud.event.platform.GetStackParamValidationRequest in project cloudbreak by hortonworks.
the class GetStackParamValidationHandler method accept.
@Override
public void accept(Event<GetStackParamValidationRequest> getStackParametersRequestEvent) {
LOGGER.info("Received event: {}", getStackParametersRequestEvent);
GetStackParamValidationRequest request = getStackParametersRequestEvent.getData();
try {
CloudConnector aDefault = cloudPlatformConnectors.getDefault(request.getCloudContext().getPlatform());
GetStackParamValidationResult getStackParamValidationResult = new GetStackParamValidationResult(request, aDefault.parameters().additionalStackParameters());
request.getResult().onNext(getStackParamValidationResult);
LOGGER.info("Query platform stack parameters finished.");
} catch (RuntimeException e) {
request.getResult().onNext(new GetStackParamValidationResult(e.getMessage(), e, request));
}
}
Aggregations