use of com.sequenceiq.cloudbreak.cloud.model.TlsInfo in project cloudbreak by hortonworks.
the class AwsResourceConnector method getTlsInfo.
@Override
public TlsInfo getTlsInfo(AuthenticatedContext authenticatedContext, CloudStack cloudStack) {
Network network = cloudStack.getNetwork();
AwsNetworkView networkView = new AwsNetworkView(network);
boolean sameVPC = deployingToSameVPC(networkView, networkView.isExistingVPC());
return new TlsInfo(sameVPC);
}
use of com.sequenceiq.cloudbreak.cloud.model.TlsInfo in project cloudbreak by hortonworks.
the class GetTlsInfoHandler method accept.
@Override
public void accept(Event<GetTlsInfoRequest> getTlsInfoRequestEvent) {
LOGGER.info("Received event: {}", getTlsInfoRequestEvent);
GetTlsInfoRequest<?> tlsInfoRequest = getTlsInfoRequestEvent.getData();
try {
CloudContext cloudContext = tlsInfoRequest.getCloudContext();
CloudCredential cloudCredential = tlsInfoRequest.getCloudCredential();
CloudConnector connector = cloudPlatformConnectors.get(cloudContext.getPlatformVariant());
CloudStack cloudStack = tlsInfoRequest.getCloudStack();
AuthenticatedContext ac = connector.authentication().authenticate(cloudContext, cloudCredential);
TlsInfo tlsInfo = connector.resources().getTlsInfo(ac, cloudStack);
GetTlsInfoResult getTlsInfoResult = new GetTlsInfoResult(tlsInfoRequest, tlsInfo);
tlsInfoRequest.getResult().onNext(getTlsInfoResult);
eventBus.notify(getTlsInfoResult.selector(), new Event<>(getTlsInfoRequestEvent.getHeaders(), getTlsInfoResult));
LOGGER.info("GetTlsInfoHandler finished.");
} catch (RuntimeException e) {
String errorMsg = "Failed to get Tls info from cloud connector!";
LOGGER.error(errorMsg, e);
GetTlsInfoResult failure = new GetTlsInfoResult(errorMsg, e, tlsInfoRequest);
tlsInfoRequest.getResult().onNext(failure);
eventBus.notify(failure.selector(), new Event<>(getTlsInfoRequestEvent.getHeaders(), failure));
}
}
Aggregations