class InventoryUtil {

	public static Map<String,List<AutoScalingGroup>> fetchAsg(BasicSessionCredentials temporaryCredentials, String skipRegions,String accountId,String accountName){

		AmazonAutoScaling asgClient;
		Map<String,List<AutoScalingGroup>> asgList = new LinkedHashMap<>();

		String expPrefix = InventoryConstants.ERROR_PREFIX_CODE+accountId + "\",\"Message\": \"Exception in fetching info for resource in specific region\" ,\"type\": \"ASG\" , \"region\":\"" ;
		for(Region region : RegionUtils.getRegions()){
			try{
				if(!skipRegions.contains(region.getName())){
					List<AutoScalingGroup> asgListTemp = new ArrayList<>();
					asgClient = AmazonAutoScalingClientBuilder.standard().withCredentials(new AWSStaticCredentialsProvider(temporaryCredentials)).withRegion(region.getName()).build();
					String nextToken = null;
					DescribeAutoScalingGroupsResult  describeResult ;
					do{
						describeResult =  asgClient.describeAutoScalingGroups(new DescribeAutoScalingGroupsRequest().withNextToken(nextToken).withMaxRecords(asgMaxRecord));
						asgListTemp.addAll(describeResult.getAutoScalingGroups());
						nextToken = describeResult.getNextToken();
					}while(nextToken!=null);

					if(!asgListTemp.isEmpty() ){
						log.debug(InventoryConstants.ACCOUNT + accountId + " Type : ASG "+region.getName()+" >> " + asgListTemp.size());
						asgList.put(accountId+delimiter+accountName+delimiter+region.getName(), asgListTemp);
					}
			   	}
			}catch(Exception e){
				log.warn(expPrefix+ region.getName()+InventoryConstants.ERROR_CAUSE +e.getMessage()+"\"}");
				ErrorManageUtil.uploadError(accountId,region.getName(),"asg",e.getMessage());
			}
		}
		return asgList;
	}

	private  InventoryUtil();

}