Search in sources :

Example 26 with OperationException

use of com.sequenceiq.cloudbreak.service.stack.connector.OperationException in project cloudbreak by hortonworks.

the class CloudParameterService method getPlatformParameters.

public Map<Platform, PlatformParameters> getPlatformParameters() {
    LOGGER.debug("Get platform parameters for");
    PlatformParametersRequest parametersRequest = new PlatformParametersRequest();
    eventBus.notify(parametersRequest.selector(), eventFactory.createEvent(parametersRequest));
    try {
        PlatformParametersResult res = parametersRequest.await();
        LOGGER.info("Platform parameter result: {}", res);
        if (res.getStatus().equals(EventStatus.FAILED)) {
            LOGGER.error("Failed to get platform parameters", res.getErrorDetails());
            throw new OperationException(res.getErrorDetails());
        }
        return res.getPlatformParameters();
    } catch (InterruptedException e) {
        LOGGER.error("Error while getting platform parameters", e);
        throw new OperationException(e);
    }
}
Also used : PlatformParametersRequest(com.sequenceiq.cloudbreak.cloud.event.platform.PlatformParametersRequest) PlatformParametersResult(com.sequenceiq.cloudbreak.cloud.event.platform.PlatformParametersResult) OperationException(com.sequenceiq.cloudbreak.service.stack.connector.OperationException)

Example 27 with OperationException

use of com.sequenceiq.cloudbreak.service.stack.connector.OperationException in project cloudbreak by hortonworks.

the class CloudParameterService method getGateways.

public CloudGateWays getGateways(Credential credential, String region, String variant, Map<String, String> filters) {
    LOGGER.debug("Get platform gateways");
    ExtendedCloudCredential cloudCredential = credentialToExtendedCloudCredentialConverter.convert(credential);
    GetPlatformCloudGatewaysRequest getPlatformCloudGatewaysRequest = new GetPlatformCloudGatewaysRequest(cloudCredential, cloudCredential, variant, region, filters);
    eventBus.notify(getPlatformCloudGatewaysRequest.selector(), Event.wrap(getPlatformCloudGatewaysRequest));
    try {
        GetPlatformCloudGatewaysResult res = getPlatformCloudGatewaysRequest.await();
        LOGGER.info("Platform gateways result: {}", res);
        if (res.getStatus().equals(EventStatus.FAILED)) {
            LOGGER.error("Failed to get platform gateways", res.getErrorDetails());
            throw new GetCloudParameterException("Failed to get gateways for the cloud provider", res.getErrorDetails());
        }
        return res.getCloudGateWays();
    } catch (InterruptedException e) {
        LOGGER.error("Error while getting the platform gateways", e);
        throw new OperationException(e);
    }
}
Also used : ExtendedCloudCredential(com.sequenceiq.cloudbreak.cloud.model.ExtendedCloudCredential) GetPlatformCloudGatewaysRequest(com.sequenceiq.cloudbreak.cloud.event.platform.GetPlatformCloudGatewaysRequest) GetPlatformCloudGatewaysResult(com.sequenceiq.cloudbreak.cloud.event.platform.GetPlatformCloudGatewaysResult) OperationException(com.sequenceiq.cloudbreak.service.stack.connector.OperationException)

Example 28 with OperationException

use of com.sequenceiq.cloudbreak.service.stack.connector.OperationException in project cloudbreak by hortonworks.

the class CloudParameterService method getCloudSshKeys.

public CloudSshKeys getCloudSshKeys(Credential credential, String region, String variant, Map<String, String> filters) {
    LOGGER.debug("Get platform sshkeys");
    ExtendedCloudCredential cloudCredential = credentialToExtendedCloudCredentialConverter.convert(credential);
    GetPlatformSshKeysRequest getPlatformSshKeysRequest = new GetPlatformSshKeysRequest(cloudCredential, cloudCredential, variant, region, filters);
    eventBus.notify(getPlatformSshKeysRequest.selector(), eventFactory.createEvent(getPlatformSshKeysRequest));
    try {
        GetPlatformSshKeysResult res = getPlatformSshKeysRequest.await();
        LOGGER.info("Platform sshkeys types result: {}", res);
        if (res.getStatus().equals(EventStatus.FAILED)) {
            LOGGER.error("Failed to get platform sshkeys", res.getErrorDetails());
            throw new GetCloudParameterException("Failed to get SSH keys for the cloud provider", res.getErrorDetails());
        }
        return res.getCloudSshKeys();
    } catch (InterruptedException e) {
        LOGGER.error("Error while getting the platform sshkeys", e);
        throw new OperationException(e);
    }
}
Also used : ExtendedCloudCredential(com.sequenceiq.cloudbreak.cloud.model.ExtendedCloudCredential) GetPlatformSshKeysRequest(com.sequenceiq.cloudbreak.cloud.event.platform.GetPlatformSshKeysRequest) GetPlatformSshKeysResult(com.sequenceiq.cloudbreak.cloud.event.platform.GetPlatformSshKeysResult) OperationException(com.sequenceiq.cloudbreak.service.stack.connector.OperationException)

Example 29 with OperationException

use of com.sequenceiq.cloudbreak.service.stack.connector.OperationException in project cloudbreak by hortonworks.

the class CloudParameterService method getVmTypesV2.

public CloudVmTypes getVmTypesV2(Credential credential, String region, String variant, Map<String, String> filters) {
    LOGGER.debug("Get platform vmtypes");
    ExtendedCloudCredential cloudCredential = credentialToExtendedCloudCredentialConverter.convert(credential);
    GetPlatformVmTypesRequest getPlatformVmTypesRequest = new GetPlatformVmTypesRequest(cloudCredential, cloudCredential, variant, region, filters);
    eventBus.notify(getPlatformVmTypesRequest.selector(), Event.wrap(getPlatformVmTypesRequest));
    try {
        GetPlatformVmTypesResult res = getPlatformVmTypesRequest.await();
        LOGGER.info("Platform vmtypes result: {}", res);
        if (res.getStatus().equals(EventStatus.FAILED)) {
            LOGGER.error("Failed to get platform vmtypes", res.getErrorDetails());
            throw new GetCloudParameterException("Failed to VM types for the cloud provider", res.getErrorDetails());
        }
        return res.getCloudVmTypes();
    } catch (InterruptedException e) {
        LOGGER.error("Error while getting the platform vmtypes", e);
        throw new OperationException(e);
    }
}
Also used : GetPlatformVmTypesResult(com.sequenceiq.cloudbreak.cloud.event.platform.GetPlatformVmTypesResult) ExtendedCloudCredential(com.sequenceiq.cloudbreak.cloud.model.ExtendedCloudCredential) GetPlatformVmTypesRequest(com.sequenceiq.cloudbreak.cloud.event.platform.GetPlatformVmTypesRequest) OperationException(com.sequenceiq.cloudbreak.service.stack.connector.OperationException)

Aggregations

OperationException (com.sequenceiq.cloudbreak.service.stack.connector.OperationException)29 CloudContext (com.sequenceiq.cloudbreak.cloud.context.CloudContext)12 ExtendedCloudCredential (com.sequenceiq.cloudbreak.cloud.model.ExtendedCloudCredential)11 CloudCredential (com.sequenceiq.cloudbreak.cloud.model.CloudCredential)9 Location (com.sequenceiq.cloudbreak.cloud.model.Location)8 CloudResource (com.sequenceiq.cloudbreak.cloud.model.CloudResource)3 BadRequestException (com.sequenceiq.cloudbreak.controller.BadRequestException)3 CheckImageRequest (com.sequenceiq.cloudbreak.cloud.event.setup.CheckImageRequest)2 CheckImageResult (com.sequenceiq.cloudbreak.cloud.event.setup.CheckImageResult)2 CloudInstance (com.sequenceiq.cloudbreak.cloud.model.CloudInstance)2 Image (com.sequenceiq.cloudbreak.cloud.model.Image)2 InstanceGroup (com.sequenceiq.cloudbreak.domain.InstanceGroup)2 InstanceMetaData (com.sequenceiq.cloudbreak.domain.InstanceMetaData)2 CredentialVerificationRequest (com.sequenceiq.cloudbreak.cloud.event.credential.CredentialVerificationRequest)1 CredentialVerificationResult (com.sequenceiq.cloudbreak.cloud.event.credential.CredentialVerificationResult)1 InteractiveLoginRequest (com.sequenceiq.cloudbreak.cloud.event.credential.InteractiveLoginRequest)1 InteractiveLoginResult (com.sequenceiq.cloudbreak.cloud.event.credential.InteractiveLoginResult)1 CollectMetadataRequest (com.sequenceiq.cloudbreak.cloud.event.instance.CollectMetadataRequest)1 CollectMetadataResult (com.sequenceiq.cloudbreak.cloud.event.instance.CollectMetadataResult)1 CheckPlatformVariantRequest (com.sequenceiq.cloudbreak.cloud.event.platform.CheckPlatformVariantRequest)1