Search in sources :

Example 6 with ExtendedCloudCredential

use of com.sequenceiq.cloudbreak.cloud.model.ExtendedCloudCredential 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 7 with ExtendedCloudCredential

use of com.sequenceiq.cloudbreak.cloud.model.ExtendedCloudCredential 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 8 with ExtendedCloudCredential

use of com.sequenceiq.cloudbreak.cloud.model.ExtendedCloudCredential 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 9 with ExtendedCloudCredential

use of com.sequenceiq.cloudbreak.cloud.model.ExtendedCloudCredential 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 10 with ExtendedCloudCredential

use of com.sequenceiq.cloudbreak.cloud.model.ExtendedCloudCredential 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)

Aggregations

ExtendedCloudCredential (com.sequenceiq.cloudbreak.cloud.model.ExtendedCloudCredential)13 OperationException (com.sequenceiq.cloudbreak.service.stack.connector.OperationException)10 BadRequestException (com.sequenceiq.cloudbreak.controller.BadRequestException)2 Credential (com.sequenceiq.cloudbreak.domain.Credential)2 JsonProcessingException (com.fasterxml.jackson.core.JsonProcessingException)1 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 ServicePrincipalInner (com.microsoft.azure.management.graphrbac.implementation.ServicePrincipalInner)1 AzureCredentialView (com.sequenceiq.cloudbreak.cloud.azure.view.AzureCredentialView)1 CloudContext (com.sequenceiq.cloudbreak.cloud.context.CloudContext)1 InteractiveCredentialCreationRequest (com.sequenceiq.cloudbreak.cloud.event.credential.InteractiveCredentialCreationRequest)1 InteractiveLoginRequest (com.sequenceiq.cloudbreak.cloud.event.credential.InteractiveLoginRequest)1 InteractiveLoginResult (com.sequenceiq.cloudbreak.cloud.event.credential.InteractiveLoginResult)1 GetPlatformCloudAccessConfigsRequest (com.sequenceiq.cloudbreak.cloud.event.platform.GetPlatformCloudAccessConfigsRequest)1 GetPlatformCloudAccessConfigsResult (com.sequenceiq.cloudbreak.cloud.event.platform.GetPlatformCloudAccessConfigsResult)1 GetPlatformCloudGatewaysRequest (com.sequenceiq.cloudbreak.cloud.event.platform.GetPlatformCloudGatewaysRequest)1 GetPlatformCloudGatewaysResult (com.sequenceiq.cloudbreak.cloud.event.platform.GetPlatformCloudGatewaysResult)1 GetPlatformCloudIpPoolsRequest (com.sequenceiq.cloudbreak.cloud.event.platform.GetPlatformCloudIpPoolsRequest)1 GetPlatformCloudIpPoolsResult (com.sequenceiq.cloudbreak.cloud.event.platform.GetPlatformCloudIpPoolsResult)1 GetPlatformInstanceGroupParameterRequest (com.sequenceiq.cloudbreak.cloud.event.platform.GetPlatformInstanceGroupParameterRequest)1 GetPlatformInstanceGroupParameterResult (com.sequenceiq.cloudbreak.cloud.event.platform.GetPlatformInstanceGroupParameterResult)1