String eventType = getStringField(input, "eventType");
String groupType = getStringField(input, "groupType");
String groupName = getStringField(input, "groupName");
String chaosTypeName = getStringField(input, "chaosType");
ChaosType chaosType;
if (!Strings.isNullOrEmpty(chaosTypeName)) {
chaosType = ChaosType.parse(this.monkey.getChaosTypes(), chaosTypeName);
} else {
chaosType = new ShutdownInstanceChaosType(monkey.context().configuration());
}
Response.Status responseStatus;
ByteArrayOutputStream baos = new ByteArrayOutputStream();
JsonGenerator gen = JSON_FACTORY.createJsonGenerator(baos, JsonEncoding.UTF8);
gen.writeStartObject();
gen.writeStringField("eventType", eventType);
gen.writeStringField("groupType", groupType);
gen.writeStringField("groupName", groupName);
gen.writeStringField("chaosType", chaosType.getKey());
if (StringUtils.isEmpty(eventType) || StringUtils.isEmpty(groupType) || StringUtils.isEmpty(groupName)) {
responseStatus = Response.Status.BAD_REQUEST;
gen.writeStringField("message", "eventType, groupType, and groupName parameters are all required");
} else {