class DirectConnectionInventoryUtil {

	public static Map<String,List<Connection>> fetchDirectConnections(BasicSessionCredentials temporaryCredentials, String skipRegions,String accountId,String accountName) {
		
		Map<String,List<Connection>> connectionMap = new LinkedHashMap<>();
		String expPrefix = "{\"errcode\": \"NO_RES_REG\" ,\"accountId\": \""+accountId + "\",\"Message\": \"Exception in fetching info for resource in specific region\" ,\"type\": \"Direct Connections\" , \"region\":\"" ;
	
		for(Region region : RegionUtils.getRegions()) { 
			try{
				if(!skipRegions.contains(region.getName())){ 
					AmazonDirectConnectClient directConnectClient = (AmazonDirectConnectClient) AmazonDirectConnectClientBuilder.standard().withCredentials(new AWSStaticCredentialsProvider(temporaryCredentials)).withRegion(region.getName()).build();
					List<Connection> connectionList = directConnectClient.describeConnections().getConnections();
					
					if(!connectionList.isEmpty() ) {
						log.debug("Account : " + accountId + " Type : Direct Connections "+ region.getName()+" >> " + connectionList.size());
						connectionMap.put(accountId+delimiter+accountName+delimiter+region.getName(), connectionList);
					}
			   	}
				
			}catch(Exception e){
		   		log.warn(expPrefix+ region.getName()+"\", \"cause\":\"" +e.getMessage()+"\"}");
				ErrorManageUtil.uploadError(accountId,region.getName(),"directconnect",e.getMessage());
		   	}
		}
		return connectionMap;
	}

	private  DirectConnectionInventoryUtil();

}