Search in sources :

Example 21 with OperationException

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

the class CloudParameterService method getRegionsV2.

public CloudRegions getRegionsV2(Credential credential, String region, String variant, Map<String, String> filters) {
    LOGGER.debug("Get platform regions");
    ExtendedCloudCredential cloudCredential = credentialToExtendedCloudCredentialConverter.convert(credential);
    GetPlatformRegionsRequestV2 getPlatformRegionsRequest = new GetPlatformRegionsRequestV2(cloudCredential, cloudCredential, variant, region, filters);
    eventBus.notify(getPlatformRegionsRequest.selector(), Event.wrap(getPlatformRegionsRequest));
    try {
        GetPlatformRegionsResultV2 res = getPlatformRegionsRequest.await();
        LOGGER.info("Platform regions result: {}", res);
        if (res.getStatus().equals(EventStatus.FAILED)) {
            throw new GetCloudParameterException("Failed to get regions from the cloud provider due to network issues or invalid credential", res.getErrorDetails());
        }
        return res.getCloudRegions();
    } catch (InterruptedException e) {
        LOGGER.error("Error while getting the platform regions", e);
        throw new OperationException(e);
    }
}
Also used : ExtendedCloudCredential(com.sequenceiq.cloudbreak.cloud.model.ExtendedCloudCredential) GetPlatformRegionsResultV2(com.sequenceiq.cloudbreak.cloud.event.platform.GetPlatformRegionsResultV2) GetPlatformRegionsRequestV2(com.sequenceiq.cloudbreak.cloud.event.platform.GetPlatformRegionsRequestV2) OperationException(com.sequenceiq.cloudbreak.service.stack.connector.OperationException)

Example 22 with OperationException

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

the class CloudParameterService method getPublicIpPools.

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

Example 23 with OperationException

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

the class CloudParameterService method getCloudNetworks.

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

Example 24 with OperationException

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

the class CloudParameterService method getSecurityGroups.

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

Example 25 with OperationException

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

the class CloudParameterService method getOrchestrators.

public PlatformOrchestrators getOrchestrators() {
    LOGGER.debug("Get platform orchestrators");
    GetPlatformOrchestratorsRequest getPlatformOrchestratorsRequest = new GetPlatformOrchestratorsRequest();
    eventBus.notify(getPlatformOrchestratorsRequest.selector(), eventFactory.createEvent(getPlatformOrchestratorsRequest));
    try {
        GetPlatformOrchestratorsResult res = getPlatformOrchestratorsRequest.await();
        LOGGER.info("Platform orchestrators result: {}", res);
        if (res.getStatus().equals(EventStatus.FAILED)) {
            LOGGER.error("Failed to get platform orchestrators", res.getErrorDetails());
            throw new OperationException(res.getErrorDetails());
        }
        return res.getPlatformOrchestrators();
    } catch (InterruptedException e) {
        LOGGER.error("Error while getting the platform orchestrators", e);
        throw new OperationException(e);
    }
}
Also used : GetPlatformOrchestratorsRequest(com.sequenceiq.cloudbreak.cloud.event.platform.GetPlatformOrchestratorsRequest) GetPlatformOrchestratorsResult(com.sequenceiq.cloudbreak.cloud.event.platform.GetPlatformOrchestratorsResult) 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