class AwsCreatedSubnetProvider {

    Set<CreatedSubnet> provide(Map<String, String> output, List<SubnetRequest> subnetRequests, boolean privateSubnetEnabled) {
        Set<CreatedSubnet> subnets = new HashSet<>();
        for (SubnetRequest subnetRequest : subnetRequests) {
            CreatedSubnet createdPublicSubnet = new CreatedSubnet();
            createdPublicSubnet.setSubnetId(getValue(output, "id" + subnetRequest.getIndex()));
            createdPublicSubnet.setAvailabilityZone(subnetRequest.getAvailabilityZone());
            if (!Strings.isNullOrEmpty(subnetRequest.getPrivateSubnetCidr()) && privateSubnetEnabled) {
                createdPublicSubnet.setCidr(subnetRequest.getPrivateSubnetCidr());
                createdPublicSubnet.setPublicSubnet(false);
                createdPublicSubnet.setMapPublicIpOnLaunch(false);
                createdPublicSubnet.setIgwAvailable(false);
            } else {
                createdPublicSubnet.setCidr(subnetRequest.getPublicSubnetCidr());
                createdPublicSubnet.setPublicSubnet(true);
                createdPublicSubnet.setMapPublicIpOnLaunch(true);
                createdPublicSubnet.setIgwAvailable(true);
            }
            createdPublicSubnet.setType(subnetRequest.getType());
            subnets.add(createdPublicSubnet);
        }
        return subnets;
    }

}