class InventoryUtil {

	public static Map<String,List<SecurityGroup>> fetchSecurityGroups(BasicSessionCredentials temporaryCredentials, String skipRegions,String accountId,String accountName){
		log.info("skipRegionseee" + skipRegions);
		Map<String,List<SecurityGroup>> secGrpList = new LinkedHashMap<>();
		AmazonEC2 ec2Client ;
		String expPrefix = InventoryConstants.ERROR_PREFIX_CODE+accountId + "\",\"Message\": \"Exception in fetching info for resource in specific region\" ,\"type\": \"Security Group\" , \"region\":\"" ;
		log.info("sgregion" + RegionUtils.getRegions().toString());
		for(Region region : RegionUtils.getRegions()) {
			try{
				if(!skipRegions.contains(region.getName())){
					ec2Client = AmazonEC2ClientBuilder.standard().withCredentials(new AWSStaticCredentialsProvider(temporaryCredentials)).withRegion(region.getName()).build();
					DescribeSecurityGroupsResult rslt =  ec2Client.describeSecurityGroups();
					List<SecurityGroup> secGrpListTemp = rslt.getSecurityGroups();
					if( !secGrpListTemp.isEmpty() ) {
						log.debug(InventoryConstants.ACCOUNT + accountId +" Type : Security Group "+region.getName()+" >> " + secGrpListTemp.size());
						secGrpList.put(accountId+delimiter+accountName+delimiter+region.getName(),secGrpListTemp);
					}

				}
			}catch(Exception e){
				log.warn(expPrefix+ region.getName()+InventoryConstants.ERROR_CAUSE +e.getMessage()+"\"}");
				ErrorManageUtil.uploadError(accountId,region.getName(),"sg",e.getMessage());
			}
		}
		return secGrpList;
	}

	private  InventoryUtil();

}