test_class.declarator: CHANGE_TOKEN = "DOES NOT MATTER"
test_class.modifier: public static final
test_class.original_string: public static final String CHANGE_TOKEN = "DOES NOT MATTER";
test_class.type: String
test_class.var_name: CHANGE_TOKEN
test_class.declarator: processor
test_class.original_string: RateLimitingProcessor processor;
test_class.type: RateLimitingProcessor
test_class.var_name: processor
test_class.declarator: config
test_class.original_string: LogProcessorLambdaConfig config;
test_class.type: LogProcessorLambdaConfig
test_class.var_name: config
test_class.declarator: FAKE_BUCKET_NAME = "blah"
test_class.modifier: private static final
test_class.original_string: private static final String FAKE_BUCKET_NAME = "blah";
test_class.type: String
test_class.var_name: FAKE_BUCKET_NAME
test_class.declarator: awswaf
test_class.modifier: @Mock
test_class.original_string: @Mock
      AWSWAFRegional awswaf;
test_class.type: AWSWAFRegional
test_class.var_name: awswaf
test_class.declarator: amazonS3
test_class.modifier: @Mock
test_class.original_string: @Mock
      AmazonS3 amazonS3;
test_class.type: AmazonS3
test_class.var_name: amazonS3
test_class.declarator: logProcessorLambdaConfig
test_class.modifier: @Mock
test_class.original_string: @Mock
      LogProcessorLambdaConfig logProcessorLambdaConfig;
test_class.type: LogProcessorLambdaConfig
test_class.var_name: logProcessorLambdaConfig
test_class.file: cerberus-log-processor-lambda/src/test/java/com/nike/cerberus/lambda/waf/processor/RateLimitingProcessorTest.java
test_class.identifier: RateLimitingProcessorTest
test_case.body: @Test
      public void testThatGetIpSetReturnsAListOfSubNetInfoObjects() {
          GetIPSetResult result = mock(GetIPSetResult.class);
          IPSet ipSet = mock(IPSet.class);
          when(result.getIPSet()).thenReturn(ipSet);
  
          List<IPSetDescriptor> descriptors = new LinkedList<>();
          descriptors.add(new IPSetDescriptor().withType(IPSetDescriptorType.IPV4).withValue("192.168.0.1/32"));
          descriptors.add(new IPSetDescriptor().withType(IPSetDescriptorType.IPV4).withValue("192.168.0.2/32"));
          descriptors.add(new IPSetDescriptor().withType(IPSetDescriptorType.IPV4).withValue("192.168.0.3/32"));
  
          when(ipSet.getIPSetDescriptors()).thenReturn(descriptors);
          when(awswaf.getIPSet(isA(GetIPSetRequest.class))).thenReturn(result);
  
          List<SubnetUtils.SubnetInfo> list = processor.getIpSet("DOES NOT MATTER", 0);
          assertTrue("The list should contain 3 items", list.size() == 3);
      }
test_case.class_method_signature: RateLimitingProcessorTest.testThatGetIpSetReturnsAListOfSubNetInfoObjects()
test_case.full_signature: @Test public void testThatGetIpSetReturnsAListOfSubNetInfoObjects()
test_case.identifier: testThatGetIpSetReturnsAListOfSubNetInfoObjects
test_case.invocations: mock mock thenReturn when getIPSet add withValue withType add withValue withType add withValue withType thenReturn when getIPSetDescriptors thenReturn when getIPSet isA getIpSet assertTrue size
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testThatGetIpSetReturnsAListOfSubNetInfoObjects()
focal_class.declarator: log = Logger.getLogger(getClass())
focal_class.modifier: private final
focal_class.original_string: private final Logger log = Logger.getLogger(getClass());
focal_class.type: Logger
focal_class.var_name: log
focal_class.declarator: SERIALIZED_DATA_FILE_NAME = "rate_limit_processor_blacklist_data.json"
focal_class.modifier: protected static final
focal_class.original_string: protected static final String SERIALIZED_DATA_FILE_NAME = "rate_limit_processor_blacklist_data.json";
focal_class.type: String
focal_class.var_name: SERIALIZED_DATA_FILE_NAME
focal_class.declarator: LIMIT_IP_ADDRESS_RANGES_PER_IP_MATCH_CONDITION = 1000
focal_class.modifier: private static final
focal_class.original_string: private static final int LIMIT_IP_ADDRESS_RANGES_PER_IP_MATCH_CONDITION = 1000;
focal_class.type: int
focal_class.var_name: LIMIT_IP_ADDRESS_RANGES_PER_IP_MATCH_CONDITION
focal_class.declarator: NETMASK_FOR_SINGLE_IP = "255.255.255.255"
focal_class.modifier: private static final
focal_class.original_string: private static final String NETMASK_FOR_SINGLE_IP = "255.255.255.255";
focal_class.type: String
focal_class.var_name: NETMASK_FOR_SINGLE_IP
focal_class.declarator: objectMapper
focal_class.modifier: private final
focal_class.original_string: private final ObjectMapper objectMapper;
focal_class.type: ObjectMapper
focal_class.var_name: objectMapper
focal_class.declarator: awsWaf
focal_class.modifier: private final
focal_class.original_string: private final AWSWAFRegional awsWaf;
focal_class.type: AWSWAFRegional
focal_class.var_name: awsWaf
focal_class.declarator: amazonS3
focal_class.modifier: private final
focal_class.original_string: private final AmazonS3 amazonS3;
focal_class.type: AmazonS3
focal_class.var_name: amazonS3
focal_class.declarator: cidrLimitForIpSet = LIMIT_IP_ADDRESS_RANGES_PER_IP_MATCH_CONDITION
focal_class.modifier: private
focal_class.original_string: private int cidrLimitForIpSet = LIMIT_IP_ADDRESS_RANGES_PER_IP_MATCH_CONDITION;
focal_class.type: int
focal_class.var_name: cidrLimitForIpSet
focal_class.file: cerberus-log-processor-lambda/src/main/java/com/nike/cerberus/lambda/waf/processor/RateLimitingProcessor.java
focal_class.identifier: RateLimitingProcessor
focal_class.interfaces: implements Processor
focal_class.class_method_signature: RateLimitingProcessor.RateLimitingProcessor(ObjectMapper objectMapper, AWSWAFRegional awsWaf, AmazonS3 amazonS3)
focal_class.full_signature: public  RateLimitingProcessor(ObjectMapper objectMapper, AWSWAFRegional awsWaf, AmazonS3 amazonS3)
focal_class.identifier: RateLimitingProcessor
focal_class.modifiers: public
focal_class.parameters: (ObjectMapper objectMapper, AWSWAFRegional awsWaf, AmazonS3 amazonS3)
focal_class.signature:  RateLimitingProcessor(ObjectMapper objectMapper, AWSWAFRegional awsWaf, AmazonS3 amazonS3)
focal_class.class_method_signature: RateLimitingProcessor.setCidrLimitForIpSetOverride(int limitOverride)
focal_class.full_signature: public void setCidrLimitForIpSetOverride(int limitOverride)
focal_class.identifier: setCidrLimitForIpSetOverride
focal_class.modifiers: public
focal_class.parameters: (int limitOverride)
focal_class.return: void
focal_class.signature: void setCidrLimitForIpSetOverride(int limitOverride)
focal_class.class_method_signature: RateLimitingProcessor.processLogEvents(List<ALBAccessLogEvent> events, LogProcessorLambdaConfig config, String bucketName)
focal_class.full_signature: @Override public void processLogEvents(List<ALBAccessLogEvent> events, LogProcessorLambdaConfig config, String bucketName)
focal_class.identifier: processLogEvents
focal_class.modifiers: @Override public
focal_class.parameters: (List<ALBAccessLogEvent> events, LogProcessorLambdaConfig config, String bucketName)
focal_class.return: void
focal_class.signature: void processLogEvents(List<ALBAccessLogEvent> events, LogProcessorLambdaConfig config, String bucketName)
focal_class.class_method_signature: RateLimitingProcessor.logSummary(Map<String, List<String>> summary, LogProcessorLambdaConfig config)
focal_class.full_signature: protected void logSummary(Map<String, List<String>> summary, LogProcessorLambdaConfig config)
focal_class.identifier: logSummary
focal_class.modifiers: protected
focal_class.parameters: (Map<String, List<String>> summary, LogProcessorLambdaConfig config)
focal_class.return: void
focal_class.signature: void logSummary(Map<String, List<String>> summary, LogProcessorLambdaConfig config)
focal_class.class_method_signature: RateLimitingProcessor.getHostnameForIp(String ip)
focal_class.full_signature: private String getHostnameForIp(String ip)
focal_class.identifier: getHostnameForIp
focal_class.modifiers: private
focal_class.parameters: (String ip)
focal_class.return: String
focal_class.signature: String getHostnameForIp(String ip)
focal_class.class_method_signature: RateLimitingProcessor.getDoNotBlockRangeSet(LogProcessorLambdaConfig config)
focal_class.full_signature: protected RangeSet<Integer> getDoNotBlockRangeSet(LogProcessorLambdaConfig config)
focal_class.identifier: getDoNotBlockRangeSet
focal_class.modifiers: protected
focal_class.parameters: (LogProcessorLambdaConfig config)
focal_class.return: RangeSet<Integer>
focal_class.signature: RangeSet<Integer> getDoNotBlockRangeSet(LogProcessorLambdaConfig config)
focal_class.class_method_signature: RateLimitingProcessor.filterAndTruncateViolators(LogProcessorLambdaConfig params,
                                                                          RangeSet<Integer> doNotAutoBlockIpRangeSet,
                                                                          Map<String, ViolationMetaData> violators)
focal_class.full_signature: protected Map<String, ViolationMetaData> filterAndTruncateViolators(LogProcessorLambdaConfig params,
                                                                          RangeSet<Integer> doNotAutoBlockIpRangeSet,
                                                                          Map<String, ViolationMetaData> violators)
focal_class.identifier: filterAndTruncateViolators
focal_class.modifiers: protected
focal_class.parameters: (LogProcessorLambdaConfig params,
                                                                          RangeSet<Integer> doNotAutoBlockIpRangeSet,
                                                                          Map<String, ViolationMetaData> violators)
focal_class.return: Map<String, ViolationMetaData>
focal_class.signature: Map<String, ViolationMetaData> filterAndTruncateViolators(LogProcessorLambdaConfig params,
                                                                          RangeSet<Integer> doNotAutoBlockIpRangeSet,
                                                                          Map<String, ViolationMetaData> violators)
focal_class.class_method_signature: RateLimitingProcessor.processViolators(LogProcessorLambdaConfig config, Map<String, ViolationMetaData> violators)
focal_class.full_signature: protected Map<String, List<String>> processViolators(LogProcessorLambdaConfig config, Map<String, ViolationMetaData> violators)
focal_class.identifier: processViolators
focal_class.modifiers: protected
focal_class.parameters: (LogProcessorLambdaConfig config, Map<String, ViolationMetaData> violators)
focal_class.return: Map<String, List<String>>
focal_class.signature: Map<String, List<String>> processViolators(LogProcessorLambdaConfig config, Map<String, ViolationMetaData> violators)
focal_class.class_method_signature: RateLimitingProcessor.getCurrentlyBlockedIpsAndDateViolatedMap(String bucketName)
focal_class.full_signature: protected Map<String, ViolationMetaData> getCurrentlyBlockedIpsAndDateViolatedMap(String bucketName)
focal_class.identifier: getCurrentlyBlockedIpsAndDateViolatedMap
focal_class.modifiers: protected
focal_class.parameters: (String bucketName)
focal_class.return: Map<String, ViolationMetaData>
focal_class.signature: Map<String, ViolationMetaData> getCurrentlyBlockedIpsAndDateViolatedMap(String bucketName)
focal_class.class_method_signature: RateLimitingProcessor.saveCurrentViolators(Map<String, ViolationMetaData> violators, String bucketName)
focal_class.full_signature: protected void saveCurrentViolators(Map<String, ViolationMetaData> violators, String bucketName)
focal_class.identifier: saveCurrentViolators
focal_class.modifiers: protected
focal_class.parameters: (Map<String, ViolationMetaData> violators, String bucketName)
focal_class.return: void
focal_class.signature: void saveCurrentViolators(Map<String, ViolationMetaData> violators, String bucketName)
focal_class.class_method_signature: RateLimitingProcessor.getIpSet(String ipSetId, int retryCount)
focal_class.full_signature: protected List<SubnetUtils.SubnetInfo> getIpSet(String ipSetId, int retryCount)
focal_class.identifier: getIpSet
focal_class.modifiers: protected
focal_class.parameters: (String ipSetId, int retryCount)
focal_class.return: List<SubnetUtils.SubnetInfo>
focal_class.signature: List<SubnetUtils.SubnetInfo> getIpSet(String ipSetId, int retryCount)
focal_class.class_method_signature: RateLimitingProcessor.sleep(int time, TimeUnit timeUnit)
focal_class.full_signature: private void sleep(int time, TimeUnit timeUnit)
focal_class.identifier: sleep
focal_class.modifiers: private
focal_class.parameters: (int time, TimeUnit timeUnit)
focal_class.return: void
focal_class.signature: void sleep(int time, TimeUnit timeUnit)
focal_class.class_method_signature: RateLimitingProcessor.processRequest(ALBAccessLogEvent event, Map<String, Integer> reqIdCountMap)
focal_class.full_signature: protected void processRequest(ALBAccessLogEvent event, Map<String, Integer> reqIdCountMap)
focal_class.identifier: processRequest
focal_class.modifiers: protected
focal_class.parameters: (ALBAccessLogEvent event, Map<String, Integer> reqIdCountMap)
focal_class.return: void
focal_class.signature: void processRequest(ALBAccessLogEvent event, Map<String, Integer> reqIdCountMap)
focal_class.class_method_signature: RateLimitingProcessor.getCurrentViolators(Map<String, Integer> reqIdCountMap, LogProcessorLambdaConfig params)
focal_class.full_signature: protected Map<String, ViolationMetaData> getCurrentViolators(Map<String, Integer> reqIdCountMap, LogProcessorLambdaConfig params)
focal_class.identifier: getCurrentViolators
focal_class.modifiers: protected
focal_class.parameters: (Map<String, Integer> reqIdCountMap, LogProcessorLambdaConfig params)
focal_class.return: Map<String, ViolationMetaData>
focal_class.signature: Map<String, ViolationMetaData> getCurrentViolators(Map<String, Integer> reqIdCountMap, LogProcessorLambdaConfig params)
focal_class.class_method_signature: RateLimitingProcessor.canAddToAutoBlackList(RangeSet<Integer> doNotAutoBlockIpRangeSet, String ipFromAccessLog)
focal_class.full_signature: protected boolean canAddToAutoBlackList(RangeSet<Integer> doNotAutoBlockIpRangeSet, String ipFromAccessLog)
focal_class.identifier: canAddToAutoBlackList
focal_class.modifiers: protected
focal_class.parameters: (RangeSet<Integer> doNotAutoBlockIpRangeSet, String ipFromAccessLog)
focal_class.return: boolean
focal_class.signature: boolean canAddToAutoBlackList(RangeSet<Integer> doNotAutoBlockIpRangeSet, String ipFromAccessLog)
focal_method.body: protected List<SubnetUtils.SubnetInfo> getIpSet(String ipSetId, int retryCount) {
          List<SubnetUtils.SubnetInfo> ips = new LinkedList<>();
  
          GetIPSetResult result = null;
          try {
              result = awsWaf.getIPSet(new GetIPSetRequest().withIPSetId(ipSetId));
          } catch (AWSWAFException e) {
              if (retryCount < 10) {
                  sleep(1, TimeUnit.SECONDS);
                  return getIpSet(ipSetId, retryCount + 1);
              }
              throw e;
          }
          result.getIPSet().getIPSetDescriptors().forEach(ipSetDescriptor -> {
              if (IPSetDescriptorType.IPV4.toString().equals(ipSetDescriptor.getType())) {
                  SubnetUtils subnetUtils = new SubnetUtils(ipSetDescriptor.getValue());
                  subnetUtils.setInclusiveHostCount(true);
                  ips.add(subnetUtils.getInfo());
              }
          });
  
          return ips;
      }
focal_method.class_method_signature: RateLimitingProcessor.getIpSet(String ipSetId, int retryCount)
focal_method.full_signature: protected List<SubnetUtils.SubnetInfo> getIpSet(String ipSetId, int retryCount)
focal_method.identifier: getIpSet
focal_method.invocations: getIPSet withIPSetId sleep getIpSet forEach getIPSetDescriptors getIPSet equals toString getType getValue setInclusiveHostCount add getInfo
focal_method.modifiers: protected
focal_method.parameters: (String ipSetId, int retryCount)
focal_method.return: List<SubnetUtils.SubnetInfo>
focal_method.signature: List<SubnetUtils.SubnetInfo> getIpSet(String ipSetId, int retryCount)