Search in sources :

Example 1 with TlsInfo

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);
}
Also used : AwsNetworkView(com.sequenceiq.cloudbreak.cloud.aws.view.AwsNetworkView) Network(com.sequenceiq.cloudbreak.cloud.model.Network) TlsInfo(com.sequenceiq.cloudbreak.cloud.model.TlsInfo)

Example 2 with TlsInfo

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));
    }
}
Also used : CloudConnector(com.sequenceiq.cloudbreak.cloud.CloudConnector) CloudCredential(com.sequenceiq.cloudbreak.cloud.model.CloudCredential) CloudContext(com.sequenceiq.cloudbreak.cloud.context.CloudContext) TlsInfo(com.sequenceiq.cloudbreak.cloud.model.TlsInfo) GetTlsInfoResult(com.sequenceiq.cloudbreak.cloud.event.instance.GetTlsInfoResult) Event(reactor.bus.Event) AuthenticatedContext(com.sequenceiq.cloudbreak.cloud.context.AuthenticatedContext) CloudStack(com.sequenceiq.cloudbreak.cloud.model.CloudStack)

Aggregations

TlsInfo (com.sequenceiq.cloudbreak.cloud.model.TlsInfo)2 CloudConnector (com.sequenceiq.cloudbreak.cloud.CloudConnector)1 AwsNetworkView (com.sequenceiq.cloudbreak.cloud.aws.view.AwsNetworkView)1 AuthenticatedContext (com.sequenceiq.cloudbreak.cloud.context.AuthenticatedContext)1 CloudContext (com.sequenceiq.cloudbreak.cloud.context.CloudContext)1 GetTlsInfoResult (com.sequenceiq.cloudbreak.cloud.event.instance.GetTlsInfoResult)1 CloudCredential (com.sequenceiq.cloudbreak.cloud.model.CloudCredential)1 CloudStack (com.sequenceiq.cloudbreak.cloud.model.CloudStack)1 Network (com.sequenceiq.cloudbreak.cloud.model.Network)1 Event (reactor.bus.Event)1