use of com.sequenceiq.environment.api.v1.platformresource.model.PlatformSecurityGroupsResponse in project cloudbreak by hortonworks.
the class EnvironmentPlatformResourceController method getSecurityGroups.
@Override
@CheckPermissionByResourceCrn(action = AuthorizationResourceAction.DESCRIBE_ENVIRONMENT)
public PlatformSecurityGroupsResponse getSecurityGroups(@ResourceCrn String environmentCrn, String region, String platformVariant, String availabilityZone, String sharedProjectId) {
String accountId = getAccountId();
validateEnvironmentCrnPattern(environmentCrn);
PlatformResourceRequest request = platformParameterService.getPlatformResourceRequestByEnvironment(accountId, environmentCrn, 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.api.v1.platformresource.model.PlatformSecurityGroupsResponse 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.api.v1.platformresource.model.PlatformSecurityGroupsResponse in project cloudbreak by hortonworks.
the class CloudSecurityGroupsToPlatformSecurityGroupsV1ResponseConverter method convert.
public PlatformSecurityGroupsResponse convert(CloudSecurityGroups source) {
Map<String, Set<PlatformSecurityGroupResponse>> result = new HashMap<>();
for (Entry<String, Set<CloudSecurityGroup>> entry : source.getCloudSecurityGroupsResponses().entrySet()) {
Set<PlatformSecurityGroupResponse> securityGroupResponses = new HashSet<>();
for (CloudSecurityGroup securityGroup : entry.getValue()) {
PlatformSecurityGroupResponse actual = new PlatformSecurityGroupResponse(securityGroup.getGroupName(), securityGroup.getGroupId(), securityGroup.getProperties());
securityGroupResponses.add(actual);
}
result.put(entry.getKey(), securityGroupResponses);
}
return new PlatformSecurityGroupsResponse(result);
}
Aggregations