Search in sources :

Example 1 with PlatformSecurityGroupsResponse

use of com.sequenceiq.cloudbreak.api.model.PlatformSecurityGroupsResponse in project cloudbreak by hortonworks.

the class CloudSecurityGroupsToPlatformSecurityGroupsResponseConverter method convert.

@Override
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.cloudbreak.api.model.PlatformSecurityGroupsResponse) PlatformSecurityGroupResponse(com.sequenceiq.cloudbreak.api.model.PlatformSecurityGroupResponse) CloudSecurityGroup(com.sequenceiq.cloudbreak.cloud.model.CloudSecurityGroup) HashSet(java.util.HashSet)

Aggregations

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