Search in sources :

Example 1 with CloudPlatformVariant

use of com.sequenceiq.cloudbreak.cloud.model.CloudPlatformVariant in project cloudbreak by hortonworks.

the class GetPlatformGatewaysHandler method accept.

@Override
public void accept(Event<GetPlatformCloudGatewaysRequest> getPlatformCloudGatewaysRequest) {
    LOGGER.info("Received event: {}", getPlatformCloudGatewaysRequest);
    GetPlatformCloudGatewaysRequest request = getPlatformCloudGatewaysRequest.getData();
    try {
        CloudPlatformVariant cloudPlatformVariant = new CloudPlatformVariant(Platform.platform(request.getExtendedCloudCredential().getCloudPlatform()), Variant.variant(request.getVariant()));
        CloudGateWays cloudGateWays = cloudPlatformConnectors.get(cloudPlatformVariant).platformResources().gateways(request.getCloudCredential(), Region.region(request.getRegion()), request.getFilters());
        GetPlatformCloudGatewaysResult getPlatformCloudGatewaysResult = new GetPlatformCloudGatewaysResult(request, cloudGateWays);
        request.getResult().onNext(getPlatformCloudGatewaysResult);
        LOGGER.info("Query platform gateway types finished.");
    } catch (Exception e) {
        request.getResult().onNext(new GetPlatformCloudGatewaysResult(e.getMessage(), e, request));
    }
}
Also used : CloudGateWays(com.sequenceiq.cloudbreak.cloud.model.CloudGateWays) CloudPlatformVariant(com.sequenceiq.cloudbreak.cloud.model.CloudPlatformVariant) GetPlatformCloudGatewaysRequest(com.sequenceiq.cloudbreak.cloud.event.platform.GetPlatformCloudGatewaysRequest) GetPlatformCloudGatewaysResult(com.sequenceiq.cloudbreak.cloud.event.platform.GetPlatformCloudGatewaysResult)

Example 2 with CloudPlatformVariant

use of com.sequenceiq.cloudbreak.cloud.model.CloudPlatformVariant in project cloudbreak by hortonworks.

the class GetPlatformInstanceGroupParametersHandler method accept.

@Override
public void accept(Event<GetPlatformInstanceGroupParameterRequest> getPlatformInstanceGroupParameterRequestEvent) {
    LOGGER.info("Received event: {}", getPlatformInstanceGroupParameterRequestEvent);
    GetPlatformInstanceGroupParameterRequest request = getPlatformInstanceGroupParameterRequestEvent.getData();
    try {
        CloudPlatformVariant variant = new CloudPlatformVariant(platform(request.getExtendedCloudCredential().getCloudPlatform()), variant(request.getVariant()));
        Map<String, InstanceGroupParameterResponse> instanceGroupParameterResponses = cloudPlatformConnectors.get(variant).parameters().collectInstanceGroupParameters(request.getInstanceGroupParameterRequest());
        GetPlatformInstanceGroupParameterResult getPlatformInstanceGroupParameterResult = new GetPlatformInstanceGroupParameterResult(request, instanceGroupParameterResponses);
        request.getResult().onNext(getPlatformInstanceGroupParameterResult);
        LOGGER.info("Query platform instance group parameters finished.");
    } catch (Exception e) {
        request.getResult().onNext(new GetPlatformInstanceGroupParameterResult(e.getMessage(), e, request));
    }
}
Also used : GetPlatformInstanceGroupParameterRequest(com.sequenceiq.cloudbreak.cloud.event.platform.GetPlatformInstanceGroupParameterRequest) GetPlatformInstanceGroupParameterResult(com.sequenceiq.cloudbreak.cloud.event.platform.GetPlatformInstanceGroupParameterResult) InstanceGroupParameterResponse(com.sequenceiq.cloudbreak.cloud.model.InstanceGroupParameterResponse) CloudPlatformVariant(com.sequenceiq.cloudbreak.cloud.model.CloudPlatformVariant)

Example 3 with CloudPlatformVariant

use of com.sequenceiq.cloudbreak.cloud.model.CloudPlatformVariant in project cloudbreak by hortonworks.

the class GetPlatformSecurityGroupsHandler method accept.

@Override
public void accept(Event<GetPlatformSecurityGroupsRequest> getPlatformSecurityGroupsRequest) {
    LOGGER.info("Received event: {}", getPlatformSecurityGroupsRequest);
    GetPlatformSecurityGroupsRequest request = getPlatformSecurityGroupsRequest.getData();
    try {
        CloudPlatformVariant cloudPlatformVariant = new CloudPlatformVariant(Platform.platform(request.getExtendedCloudCredential().getCloudPlatform()), Variant.variant(request.getVariant()));
        CloudSecurityGroups securityGroups = cloudPlatformConnectors.get(cloudPlatformVariant).platformResources().securityGroups(request.getCloudCredential(), Region.region(request.getRegion()), request.getFilters());
        GetPlatformSecurityGroupsResult getPlatformSecurityGroupsResult = new GetPlatformSecurityGroupsResult(request, securityGroups);
        request.getResult().onNext(getPlatformSecurityGroupsResult);
        LOGGER.info("Query platform networks types finished.");
    } catch (Exception e) {
        request.getResult().onNext(new GetPlatformSecurityGroupsResult(e.getMessage(), e, request));
    }
}
Also used : GetPlatformSecurityGroupsRequest(com.sequenceiq.cloudbreak.cloud.event.platform.GetPlatformSecurityGroupsRequest) GetPlatformSecurityGroupsResult(com.sequenceiq.cloudbreak.cloud.event.platform.GetPlatformSecurityGroupsResult) CloudSecurityGroups(com.sequenceiq.cloudbreak.cloud.model.CloudSecurityGroups) CloudPlatformVariant(com.sequenceiq.cloudbreak.cloud.model.CloudPlatformVariant)

Example 4 with CloudPlatformVariant

use of com.sequenceiq.cloudbreak.cloud.model.CloudPlatformVariant in project cloudbreak by hortonworks.

the class GetRegionsV2Handler method accept.

@Override
public void accept(Event<GetPlatformRegionsRequestV2> getRegionsRequestEvent) {
    LOGGER.info("Received event: {}", getRegionsRequestEvent);
    GetPlatformRegionsRequestV2 request = getRegionsRequestEvent.getData();
    try {
        CloudPlatformVariant cloudPlatformVariant = new CloudPlatformVariant(Platform.platform(request.getExtendedCloudCredential().getCloudPlatform()), Variant.variant(request.getVariant()));
        CloudRegions cloudRegions = cloudPlatformConnectors.get(cloudPlatformVariant).platformResources().regions(request.getCloudCredential(), Region.region(request.getRegion()), request.getFilters());
        GetPlatformRegionsResultV2 getPlatformRegionsResultV2 = new GetPlatformRegionsResultV2(request, cloudRegions);
        request.getResult().onNext(getPlatformRegionsResultV2);
        LOGGER.info("Query platform regions types finished.");
    } catch (Exception e) {
        LOGGER.warn("Could not get regions from the cloud provider due to:", e);
        request.getResult().onNext(new GetPlatformRegionsResultV2(e.getMessage(), e, request));
    }
}
Also used : GetPlatformRegionsResultV2(com.sequenceiq.cloudbreak.cloud.event.platform.GetPlatformRegionsResultV2) GetPlatformRegionsRequestV2(com.sequenceiq.cloudbreak.cloud.event.platform.GetPlatformRegionsRequestV2) CloudRegions(com.sequenceiq.cloudbreak.cloud.model.CloudRegions) CloudPlatformVariant(com.sequenceiq.cloudbreak.cloud.model.CloudPlatformVariant)

Example 5 with CloudPlatformVariant

use of com.sequenceiq.cloudbreak.cloud.model.CloudPlatformVariant in project cloudbreak by hortonworks.

the class ResourceDefinitionService method getResourceDefinition.

@Cacheable("resourceDefinitionCache")
public String getResourceDefinition(String cloudPlatform, String resource) {
    LOGGER.debug("Sending request for {} {} resource property definition", cloudPlatform, resource);
    CloudPlatformVariant platformVariant = new CloudPlatformVariant(Platform.platform(cloudPlatform), Variant.EMPTY);
    ResourceDefinitionRequest request = new ResourceDefinitionRequest(platformVariant, resource);
    eventBus.notify(request.selector(), eventFactory.createEvent(request));
    try {
        ResourceDefinitionResult result = request.await();
        LOGGER.info("Resource property definition: {}", result);
        return result.getDefinition();
    } catch (InterruptedException e) {
        LOGGER.error("Error while sending resource definition request", e);
        throw new OperationException(e);
    }
}
Also used : CloudPlatformVariant(com.sequenceiq.cloudbreak.cloud.model.CloudPlatformVariant) ResourceDefinitionResult(com.sequenceiq.cloudbreak.cloud.event.platform.ResourceDefinitionResult) ResourceDefinitionRequest(com.sequenceiq.cloudbreak.cloud.event.platform.ResourceDefinitionRequest) OperationException(com.sequenceiq.cloudbreak.service.stack.connector.OperationException) Cacheable(org.springframework.cache.annotation.Cacheable)

Aggregations

CloudPlatformVariant (com.sequenceiq.cloudbreak.cloud.model.CloudPlatformVariant)11 CloudConnector (com.sequenceiq.cloudbreak.cloud.CloudConnector)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 GetPlatformNetworksRequest (com.sequenceiq.cloudbreak.cloud.event.platform.GetPlatformNetworksRequest)1 GetPlatformNetworksResult (com.sequenceiq.cloudbreak.cloud.event.platform.GetPlatformNetworksResult)1 GetPlatformRegionsRequestV2 (com.sequenceiq.cloudbreak.cloud.event.platform.GetPlatformRegionsRequestV2)1 GetPlatformRegionsResultV2 (com.sequenceiq.cloudbreak.cloud.event.platform.GetPlatformRegionsResultV2)1 GetPlatformSecurityGroupsRequest (com.sequenceiq.cloudbreak.cloud.event.platform.GetPlatformSecurityGroupsRequest)1 GetPlatformSecurityGroupsResult (com.sequenceiq.cloudbreak.cloud.event.platform.GetPlatformSecurityGroupsResult)1 GetPlatformSshKeysRequest (com.sequenceiq.cloudbreak.cloud.event.platform.GetPlatformSshKeysRequest)1 GetPlatformSshKeysResult (com.sequenceiq.cloudbreak.cloud.event.platform.GetPlatformSshKeysResult)1 GetPlatformVmTypesRequest (com.sequenceiq.cloudbreak.cloud.event.platform.GetPlatformVmTypesRequest)1 GetPlatformVmTypesResult (com.sequenceiq.cloudbreak.cloud.event.platform.GetPlatformVmTypesResult)1