import com.google.gson.annotations.Expose;
import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.List;
+import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
return (new Yaml()).dump(jsonMap);
}
- public List<String> createGuardPolicyPayloads() {
- List<String> result = new ArrayList<>();
+ /**
+ * Return a map containing all Guard policies indexed by Guard policy Name.
+ *
+ * @return The Guards map
+ */
+ public Map<String, String> createGuardPolicyPayloads() {
+ Map<String, String> result = new HashMap<>();
JsonObject guard = new JsonObject();
JsonElement guardsList = this.getConfigurationsJson().get("guard_policies");
for (Entry<String, JsonElement> guardElem : guardsList.getAsJsonObject().entrySet()) {
guard.addProperty("policy-id", guardElem.getKey());
guard.add("contents", guardElem.getValue());
- result.add(new GsonBuilder().create().toJson(guard));
+ result.put(guardElem.getKey(), new GsonBuilder().create().toJson(guard));
}
return result;
}