class InventoryUtil {

	public static Map<String,List<DBInstanceVH>> fetchRDSInstanceInfo(BasicSessionCredentials temporaryCredentials, String skipRegions,String accountId,String accountName){
		Map<String,List<DBInstanceVH>> dbInstMap =  new LinkedHashMap<>();
		AmazonRDS rdsClient ;
		String expPrefix = InventoryConstants.ERROR_PREFIX_CODE+accountId + "\",\"Message\": \"Exception in fetching info for resource in specific region\" ,\"type\": \"RDS Instance\" , \"region\":\"" ;
		for(Region region : RegionUtils.getRegions()){
			try{
				if(!skipRegions.contains(region.getName())){
					rdsClient = AmazonRDSClientBuilder.standard().withCredentials(new AWSStaticCredentialsProvider(temporaryCredentials)).withRegion(region.getName()).build();
					String nextMarker = null;
					DescribeDBInstancesResult rslt;
					List<DBInstanceVH> dbInstList = new ArrayList<>();
					do{
						rslt = rdsClient.describeDBInstances(new DescribeDBInstancesRequest().withMarker(nextMarker));
						List<DBInstance> dbInstListTemp = rslt.getDBInstances();
						for(DBInstance db : dbInstListTemp){
							DBInstanceVH vh = new DBInstanceVH(db, rdsClient.listTagsForResource(new ListTagsForResourceRequest().
														withResourceName(db.getDBInstanceArn())).
															getTagList(),
															db.getDBSubnetGroup().getSubnets().stream().map(subnet -> subnet.getSubnetIdentifier()).collect(Collectors.joining(",")),
															db.getVpcSecurityGroups().stream().map(group->group.getVpcSecurityGroupId()+":"+group.getStatus()).collect(Collectors.joining(","))
											);
							dbInstList.add(vh);
						}
						nextMarker = rslt.getMarker();
					}while(nextMarker!=null);

					if(! dbInstList.isEmpty() ){
						log.debug(InventoryConstants.ACCOUNT + accountId +" Type : RDS Instance" +region.getName() + " >> "+dbInstList.size());
						dbInstMap.put(accountId+delimiter+accountName+delimiter+region.getName(),  dbInstList);
					}
				}
			}catch(Exception e){
				if(region.isServiceSupported(AmazonRDS.ENDPOINT_PREFIX)){
					log.warn(expPrefix+ region.getName()+InventoryConstants.ERROR_CAUSE +e.getMessage()+"\"}");
					ErrorManageUtil.uploadError(accountId,region.getName(),"rdsdb",e.getMessage());
				}
			}
		}
		return dbInstMap;
	}

	private  InventoryUtil();

}