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 testThatGetCurrentlyBlockedIpsAndDateViolatedMapCanProperlyDeserialize() {
          String json = "{\"192.168.0.1\":{\"date\":1476224112155,\"maxRate\":10}}";
          S3Object object = new S3Object();
          object.setObjectContent(new ByteArrayInputStream(json.getBytes()));
          when(amazonS3.getObject(isA(GetObjectRequest.class))).thenReturn(object);
          Map<String, ViolationMetaData> map = processor.getCurrentlyBlockedIpsAndDateViolatedMap(FAKE_BUCKET_NAME);
          assertTrue("The map should have one element", map.size() == 1);
      }
test_case.class_method_signature: RateLimitingProcessorTest.testThatGetCurrentlyBlockedIpsAndDateViolatedMapCanProperlyDeserialize()
test_case.full_signature: @Test public void testThatGetCurrentlyBlockedIpsAndDateViolatedMapCanProperlyDeserialize()
test_case.identifier: testThatGetCurrentlyBlockedIpsAndDateViolatedMapCanProperlyDeserialize
test_case.invocations: setObjectContent getBytes thenReturn when getObject isA getCurrentlyBlockedIpsAndDateViolatedMap assertTrue size
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testThatGetCurrentlyBlockedIpsAndDateViolatedMapCanProperlyDeserialize()
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 Map<String, ViolationMetaData> getCurrentlyBlockedIpsAndDateViolatedMap(String bucketName) {
          S3Object s3Object = null;
          try {
               s3Object = amazonS3.getObject(new GetObjectRequest(bucketName, SERIALIZED_DATA_FILE_NAME));
          } catch (AmazonS3Exception e) {
              if (e.getErrorCode().equals("NoSuchKey")) {
                  return new HashMap<>();
              }
          }
  
          if (s3Object == null) {
              return new HashMap<>();
          }
  
          try {
              TypeReference<HashMap<String,ViolationMetaData>> typeRef = new TypeReference<HashMap<String,ViolationMetaData>>() {};
              return objectMapper.readValue(s3Object.getObjectContent(), typeRef);
          } catch (IOException e) {
              throw new RuntimeException("Failed to deserialize json data from previous runs", e);
          }
      }
focal_method.class_method_signature: RateLimitingProcessor.getCurrentlyBlockedIpsAndDateViolatedMap(String bucketName)
focal_method.full_signature: protected Map<String, ViolationMetaData> getCurrentlyBlockedIpsAndDateViolatedMap(String bucketName)
focal_method.identifier: getCurrentlyBlockedIpsAndDateViolatedMap
focal_method.invocations: getObject equals getErrorCode readValue getObjectContent
focal_method.modifiers: protected
focal_method.parameters: (String bucketName)
focal_method.return: Map<String, ViolationMetaData>
focal_method.signature: Map<String, ViolationMetaData> getCurrentlyBlockedIpsAndDateViolatedMap(String bucketName)