CloudTrailEventSupport { public static List<String> getInstances(final CloudTrailEvent event) { final CloudTrailEventData eventData = getEventData(event); final ObjectMapper mapper = new ObjectMapper(); final List<String> instances = newArrayList(); final String responseElements = eventData.getResponseElements(); if (isNullOrEmpty(responseElements)) { return newArrayList(); } final JSONArray items = JsonPath.read(responseElements, INSTANCE_JSON_PATH); for (final Object item : items) { try { instances.add(mapper.writeValueAsString(item)); } catch (final JsonProcessingException e) { LOG.warn(e.getMessage(), e); } } return instances; }  static List<String> getInstanceIds(final CloudTrailEvent event); static String getEventId(final CloudTrailEvent event); static String getAccountId(final CloudTrailEvent event); static List<String> read(final String responseElements, final String pattern,
                                    final boolean emptyListOnNullOrEmptyResponse); static List<String> read(final String responseElements, final String pattern); static List<String> read(final CloudTrailEvent cloudTrailEvent, final String pattern,
                                    final boolean emptyListOnNullOrEmptyResponse); static List<String> getInstanceLaunchTime(CloudTrailEvent cloudTrailEvent); static Region getRegion(final CloudTrailEvent cloudTrailEvent); static String getRegionAsString(final CloudTrailEvent event); static ViolationBuilder violationFor(final CloudTrailEvent cloudTrailEvent); static String getUsernameAsString(final CloudTrailEvent cloudTrailEvent); static List<String> getInstances(final CloudTrailEvent event); static DateTime getRunInstanceTime(final String instance); static DateTime getEventTime(CloudTrailEvent event); static List<String> readSecurityGroupIds(final CloudTrailEvent cloudTrailEvent); static final String INSTANCE_ID_JSON_PATH; static final String INSTANCE_JSON_PATH; static final String RUN_INSTANCE_DATE_JSON_PATH; static final String SECURITY_GROUP_IDS_JSON_PATH; static final String INSTANCES_SECURITY_GROUP_IDS_JSON_PATH; static final String INSTANCE_LAUNCH_TIME; }
@Test public void getInstancesTest() { final CloudTrailEvent cloudTrailEvent = createCloudTrailEvent("/responseElements.json"); final List<String> instances = getInstances(cloudTrailEvent); assertThat(instances).isNotEmpty(); }