class SNSInventoryUtil {

	public static Map<String,List<Topic>> fetchSNSTopics(BasicSessionCredentials temporaryCredentials, String skipRegions,String accountId,String accountName) {
		
		Map<String,List<Topic>> topicMap = new LinkedHashMap<>();
		AmazonSNSClient snsClient ;
		String expPrefix = "{\"errcode\": \"NO_RES_REG\" ,\"accountId\": \""+accountId + "\",\"Message\": \"Exception in fetching info for resource in specific region\" ,\"type\": \"snstopic\" , \"region\":\"" ;
	
		for(Region region : RegionUtils.getRegions()) { 
			try{
				if(!skipRegions.contains(region.getName())){ 
					List<Topic> topiList = new ArrayList<>();
					snsClient = (AmazonSNSClient) AmazonSNSClientBuilder.standard().withCredentials(new AWSStaticCredentialsProvider(temporaryCredentials)).withRegion(region.getName()).build();
					String nextToken = null;
					ListTopicsResult listTopicResult;
					do {
						
						listTopicResult = snsClient.listTopics(new ListTopicsRequest().withNextToken(nextToken));
						topiList.addAll(listTopicResult.getTopics());
						nextToken = listTopicResult.getNextToken();
					}while(nextToken!=null);
					
					if(!topiList.isEmpty() ) {
						log.debug("Account : " + accountId + " Type : SNS Topics "+ region.getName()+" >> " + topiList.size());
						topicMap.put(accountId+delimiter+accountName+delimiter+region.getName(), topiList);
					}
			   	}
				
			}catch(Exception e){
		   		log.warn(expPrefix+ region.getName()+"\", \"cause\":\"" +e.getMessage()+"\"}");
				ErrorManageUtil.uploadError(accountId,region.getName(),"snstopic",e.getMessage());
		   	}
		}
		return topicMap;
	}

	private  SNSInventoryUtil();

}