public void unimplemented(String msg) { if (!_unimplementedRecord) { return; } _unimplementedWarnings.add(new Warning(msg, TAG_UNIMPLEMENTED)); }
public void redFlag(String msg, String tag) { if (!_redFlagRecord) { return; } _redFlagWarnings.add(new Warning(msg, tag)); }
public void pedantic(String msg, String tag) { _pedanticWarnings.add(new Warning(msg, tag)); }
@VisibleForTesting public static AwsConfiguration parseAwsConfigurations( Map<Path, String> configurationData, ParseVendorConfigurationAnswerElement pvcae) { AwsConfiguration config = new AwsConfiguration(); for (Entry<Path, String> configFile : configurationData.entrySet()) { Path path = configFile.getKey(); int pathLength = configFile.getKey().getNameCount(); String fileText = configFile.getValue(); String regionName = path.getName(pathLength - 2).toString(); // parent dir name String fileName = path.subpath(pathLength - 3, pathLength).toString(); pvcae.getFileMap().put(BfConsts.RELPATH_AWS_CONFIGS_FILE, fileName); JSONObject jsonObj = null; try { jsonObj = new JSONObject(fileText); } catch (JSONException e) { pvcae.addRedFlagWarning( BfConsts.RELPATH_AWS_CONFIGS_FILE, new Warning(String.format("AWS file %s is not valid JSON", fileName), "AWS")); } if (jsonObj != null) { try { config.addConfigElement(regionName, jsonObj, fileName, pvcae); } catch (JSONException e) { throw new BatfishException("Problems parsing JSON in " + fileName, e); } } } return config; }
public void addConfigElement( JSONObject jsonObj, String sourceFileName, ParseVendorConfigurationAnswerElement pvcae) throws JSONException { Iterator<?> keys = jsonObj.keys(); while (keys.hasNext()) { String key = (String) keys.next(); if (ignoreElement(key)) { continue; } // All objects nested under the current key will be subjected to this function, which will // integrate them appropriately into this Region. Returns null on unrecognized keys. ThrowingConsumer<JSONObject, JSONException> integratorFunction = getChildConsumer(key); if (integratorFunction == null) { // Add warning for unrecognized key in AWS file pvcae.addUnimplementedWarning( BfConsts.RELPATH_AWS_CONFIGS_FILE, new Warning( String.format("Unrecognized element '%s' in AWS file %s", key, sourceFileName), "AWS")); } else { JSONArray jsonArray = jsonObj.getJSONArray(key); for (int index = 0; index < jsonArray.length(); index++) { integratorFunction.accept(jsonArray.getJSONObject(index)); } } } }
answerElement.addRedFlagWarning( name, new Warning( "Cannot serialize network config. Bad hostname " + name.replace("\\", "/"), "MISCELLANEOUS"));