Search in sources :

Example 1 with PlatformNetworkResponse

use of com.sequenceiq.environment.api.v1.platformresource.model.PlatformNetworkResponse in project cloudbreak by hortonworks.

the class CloudNetworksToPlatformNetworksV1ResponseConverter method convert.

public PlatformNetworksResponse convert(CloudNetworks source) {
    Map<String, Set<PlatformNetworkResponse>> result = new HashMap<>();
    for (Entry<String, Set<CloudNetwork>> entry : source.getCloudNetworkResponses().entrySet()) {
        Set<PlatformNetworkResponse> networks = new HashSet<>();
        for (CloudNetwork cloudNetwork : entry.getValue()) {
            PlatformNetworkResponse actual = new PlatformNetworkResponse(cloudNetwork.getName(), cloudNetwork.getId(), cloudNetwork.getSubnets(), cloudNetwork.getSubnetsWithMetadata(), cloudNetwork.getProperties());
            networks.add(actual);
        }
        result.put(entry.getKey(), networks);
    }
    return new PlatformNetworksResponse(result);
}
Also used : HashSet(java.util.HashSet) Set(java.util.Set) HashMap(java.util.HashMap) PlatformNetworkResponse(com.sequenceiq.environment.api.v1.platformresource.model.PlatformNetworkResponse) PlatformNetworksResponse(com.sequenceiq.environment.api.v1.platformresource.model.PlatformNetworksResponse) CloudNetwork(com.sequenceiq.cloudbreak.cloud.model.CloudNetwork) HashSet(java.util.HashSet)

Aggregations

CloudNetwork (com.sequenceiq.cloudbreak.cloud.model.CloudNetwork)1 PlatformNetworkResponse (com.sequenceiq.environment.api.v1.platformresource.model.PlatformNetworkResponse)1 PlatformNetworksResponse (com.sequenceiq.environment.api.v1.platformresource.model.PlatformNetworksResponse)1 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 Set (java.util.Set)1