Search in sources :

Example 1 with PlatformSecurityGroupResponse

use of com.sequenceiq.environment.api.v1.platformresource.model.PlatformSecurityGroupResponse 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);
}
Also used : HashSet(java.util.HashSet) Set(java.util.Set) HashMap(java.util.HashMap) PlatformSecurityGroupsResponse(com.sequenceiq.environment.api.v1.platformresource.model.PlatformSecurityGroupsResponse) PlatformSecurityGroupResponse(com.sequenceiq.environment.api.v1.platformresource.model.PlatformSecurityGroupResponse) CloudSecurityGroup(com.sequenceiq.cloudbreak.cloud.model.CloudSecurityGroup) HashSet(java.util.HashSet)

Aggregations

CloudSecurityGroup (com.sequenceiq.cloudbreak.cloud.model.CloudSecurityGroup)1 PlatformSecurityGroupResponse (com.sequenceiq.environment.api.v1.platformresource.model.PlatformSecurityGroupResponse)1 PlatformSecurityGroupsResponse (com.sequenceiq.environment.api.v1.platformresource.model.PlatformSecurityGroupsResponse)1 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 Set (java.util.Set)1