use of com.sequenceiq.environment.platformresource.PlatformResourceRequest in project cloudbreak by hortonworks.
the class CredentialPlatformResourceController method getPrivateDnsZones.
@Override
@CustomPermissionCheck
public PlatformPrivateDnsZonesResponse getPrivateDnsZones(String credentialName, String credentialCrn, String platformVariant) {
customCheckUtil.run(() -> permissionCheckByCredential(credentialName, credentialCrn));
String accountId = getAccountId();
PlatformResourceRequest request = platformParameterService.getPlatformResourceRequest(accountId, credentialName, credentialCrn, platformVariant, CdpResourceType.DEFAULT);
LOGGER.debug("Get /platform_resources/private_dns_zones, request: {}", request);
CloudPrivateDnsZones privateDnsZones = platformParameterService.getPrivateDnsZones(request);
List<PlatformPrivateDnsZoneResponse> platformPrivateDnsZones = privateDnsZones.getPrivateDnsZones().stream().map(pdz -> new PlatformPrivateDnsZoneResponse(pdz.getPrivateDnsZoneId())).collect(Collectors.toList());
PlatformPrivateDnsZonesResponse response = new PlatformPrivateDnsZonesResponse(platformPrivateDnsZones);
LOGGER.debug("Resp /platform_resources/private_dns_zones, request: {}, privateDnsZones: {}, response: {}", request, privateDnsZones, response);
return response;
}
use of com.sequenceiq.environment.platformresource.PlatformResourceRequest in project cloudbreak by hortonworks.
the class CredentialPlatformResourceController method getResourceGroups.
@Override
@CustomPermissionCheck
public PlatformResourceGroupsResponse getResourceGroups(String credentialName, String credentialCrn, String region, String platformVariant, String availabilityZone) {
customCheckUtil.run(() -> permissionCheckByCredential(credentialName, credentialCrn));
String accountId = getAccountId();
PlatformResourceRequest request = platformParameterService.getPlatformResourceRequest(accountId, credentialName, credentialCrn, region, platformVariant, availabilityZone, CdpResourceType.DEFAULT);
LOGGER.info("Get /platform_resources/resource_groups, request: {}", request);
CloudResourceGroups resourceGroups = platformParameterService.getResourceGroups(request);
List<PlatformResourceGroupResponse> platformResourceGroups = resourceGroups.getResourceGroups().stream().map(rg -> new PlatformResourceGroupResponse(rg.getName())).collect(Collectors.toList());
PlatformResourceGroupsResponse response = new PlatformResourceGroupsResponse(platformResourceGroups);
LOGGER.info("Resp /platform_resources/resource_groups, request: {}, resourceGroups: {}, response: {}", request, resourceGroups, response);
return response;
}
use of com.sequenceiq.environment.platformresource.PlatformResourceRequest in project cloudbreak by hortonworks.
the class CredentialPlatformResourceController method getSecurityGroups.
@Override
@CustomPermissionCheck
public PlatformSecurityGroupsResponse getSecurityGroups(String credentialName, String credentialCrn, String region, String platformVariant, String availabilityZone, String sharedProjectId) {
customCheckUtil.run(() -> permissionCheckByCredential(credentialName, credentialCrn));
String accountId = getAccountId();
PlatformResourceRequest request = platformParameterService.getPlatformResourceRequest(accountId, credentialName, credentialCrn, region, platformVariant, availabilityZone, sharedProjectId);
LOGGER.info("Get /platform_resources/security_groups, request: {}", request);
CloudSecurityGroups securityGroups = platformParameterService.getSecurityGroups(request);
PlatformSecurityGroupsResponse response = cloudSecurityGroupsToPlatformSecurityGroupsV1ResponseConverter.convert(securityGroups);
LOGGER.info("Resp /platform_resources/security_groups, request: {}, securityGroups: {}, response: {}", request, securityGroups, response);
return response;
}
use of com.sequenceiq.environment.platformresource.PlatformResourceRequest in project cloudbreak by hortonworks.
the class EnvironmentPlatformResourceController method getVmTypesByCredential.
@Override
@CheckPermissionByResourceCrn(action = AuthorizationResourceAction.DESCRIBE_ENVIRONMENT)
public PlatformVmtypesResponse getVmTypesByCredential(@ResourceCrn String environmentCrn, String region, String platformVariant, String availabilityZone, CdpResourceType cdpResourceType) {
String accountId = getAccountId();
validateEnvironmentCrnPattern(environmentCrn);
PlatformResourceRequest request = platformParameterService.getPlatformResourceRequestByEnvironment(accountId, environmentCrn, region, platformVariant, availabilityZone, null, null, cdpResourceType);
LOGGER.info("Get /platform_resources/machine_types, request: {}", request);
CloudVmTypes cloudVmTypes = platformParameterService.getVmTypesByCredential(request);
PlatformVmtypesResponse response = cloudVmTypesToPlatformVmTypesV1ResponseConverter.convert(cloudVmTypes);
LOGGER.info("Resp /platform_resources/machine_types, request: {}, cloudVmTypes: {}, response: {}", request, cloudVmTypes, response);
return response;
}
use of com.sequenceiq.environment.platformresource.PlatformResourceRequest in project cloudbreak by hortonworks.
the class EnvironmentPlatformResourceController method getGatewaysCredentialId.
@Override
@CheckPermissionByResourceCrn(action = AuthorizationResourceAction.DESCRIBE_ENVIRONMENT)
public PlatformGatewaysResponse getGatewaysCredentialId(@ResourceCrn String environmentCrn, String region, String platformVariant, String availabilityZone) {
String accountId = getAccountId();
validateEnvironmentCrnPattern(environmentCrn);
PlatformResourceRequest request = platformParameterService.getPlatformResourceRequestByEnvironment(accountId, environmentCrn, region, platformVariant, availabilityZone, null);
LOGGER.info("Get /platform_resources/gateways, request: {}", request);
CloudGateWays gateways = platformParameterService.getGatewaysCredentialId(request);
PlatformGatewaysResponse response = cloudGatewayssToPlatformGatewaysV1ResponseConverter.convert(gateways);
LOGGER.info("Resp /platform_resources/gateways, request: {}, ipPools: {}, response: {}", request, gateways, response);
return response;
}
Aggregations