use of com.sequenceiq.environment.api.v1.platformresource.model.PlatformResourceGroupResponse in project cloudbreak by hortonworks.
the class EnvironmentPlatformResourceController method getResourceGroups.
@Override
@CheckPermissionByResourceCrn(action = AuthorizationResourceAction.DESCRIBE_ENVIRONMENT)
public PlatformResourceGroupsResponse getResourceGroups(@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/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.api.v1.platformresource.model.PlatformResourceGroupResponse 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;
}
Aggregations