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));
}
}
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));
}
}
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));
}
}
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));
}
}
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);
}
}
Aggregations