use of com.sequenceiq.environment.credential.exception.CredentialOperationException in project cloudbreak by hortonworks.
the class CredentialPrerequisiteService method getExperiencePrerequisites.
public Map<String, String> getExperiencePrerequisites(String cloudPlatform) {
CloudContext cloudContext = CloudContext.Builder.builder().withPlatform(cloudPlatform).withWorkspaceId(TEMP_WORKSPACE_ID).build();
CredentialExperiencePolicyRequest request = new CredentialExperiencePolicyRequest(cloudContext);
LOGGER.debug("Triggering event: {}", request);
eventBus.notify(request.selector(), eventFactory.createEvent(request));
String message = String.format("Failed to get experience policies for platform '%s': ", cloudPlatform);
try {
CredentialExperiencePolicyResult res = request.await();
LOGGER.debug("Result: {}", res);
if (res.getStatus() != EventStatus.OK) {
LOGGER.warn(message, res.getErrorDetails());
throw new BadRequestException(message + res.getErrorDetails(), res.getErrorDetails());
}
return res.getPolicies();
} catch (InterruptedException e) {
LOGGER.error(message, e);
throw new CredentialOperationException(e);
}
}
use of com.sequenceiq.environment.credential.exception.CredentialOperationException in project cloudbreak by hortonworks.
the class CredentialService method getCodeGrantFlowAppLoginUrl.
private String getCodeGrantFlowAppLoginUrl(Credential credential) {
CodeGrantFlowAttributes azureCodeGrantFlowAttributes = getAzureCodeGrantFlowAttributes(credential);
Object appLoginUrl = Optional.ofNullable(azureCodeGrantFlowAttributes.getAppLoginUrl()).orElseThrow(() -> new CredentialOperationException("Unable to obtain App login url!"));
return String.valueOf(appLoginUrl);
}
Aggregations