use of com.sequenceiq.cloudbreak.audit.model.AuditEventName in project cloudbreak by hortonworks.
the class FlowCDPEventDataExtractor method eventName.
@Override
public AuditEventName eventName(CDPStructuredFlowEvent structuredEvent) {
FlowDetails flow = structuredEvent.getFlow();
String flowEvent = flow.getFlowEvent();
AuditEventName eventName = null;
String resourceType = structuredEvent.getOperation().getResourceType();
CDPFlowResourceAuditEventConverter flowResourceAuditEventConverter = getConverter(resourceType);
if (flowResourceAuditEventConverter != null) {
eventName = flowResourceAuditEventConverter.auditEventName(structuredEvent);
}
if (eventName != null) {
LOGGER.info("Flow event name: {}", eventName);
return eventName;
}
String flowState = flow.getFlowState();
String flowType = flow.getFlowType();
throw new UnsupportedOperationException(String.format("The %s, %s and %s does not support for auditing for %s", flowType, flowEvent, flowState, resourceType));
}
use of com.sequenceiq.cloudbreak.audit.model.AuditEventName in project cloudbreak by hortonworks.
the class RestCDPEventDataExtractor method eventName.
@Override
public AuditEventName eventName(CDPStructuredRestCallEvent structuredEvent) {
AuditEventName auditEventName = determineEventName(structuredEvent);
if (auditEventName != null) {
LOGGER.info("Determined event name: {}", auditEventName);
return auditEventName;
}
String resourceType = structuredEvent.getOperation().getResourceType();
String method = structuredEvent.getRestCall().getRestRequest().getMethod();
throw new UnsupportedOperationException(String.format("The `%s` with `%s` does not support for auditing", resourceType, method));
}
use of com.sequenceiq.cloudbreak.audit.model.AuditEventName in project cloudbreak by hortonworks.
the class KerberosRestResourceAuditEventConverter method auditEventName.
@Override
public AuditEventName auditEventName(CDPStructuredRestCallEvent structuredEvent) {
String method = structuredEvent.getRestCall().getRestRequest().getMethod();
AuditEventName eventName = null;
String resourceEvent = structuredEvent.getOperation().getResourceEvent();
if ("POST".equals(method) || "PUT".equals(method)) {
if (resourceEvent == null) {
eventName = AuditEventName.CREATE_KERBEROS_CONFIG;
}
} else if ("DELETE".equals(method)) {
eventName = deletionRest(resourceEvent, structuredEvent.getOperation());
}
return eventName;
}
use of com.sequenceiq.cloudbreak.audit.model.AuditEventName in project cloudbreak by hortonworks.
the class DatahubRestResourceAuditEventConverter method requestParameters.
@Override
public Map<String, Object> requestParameters(StructuredRestCallEvent structuredEvent) {
Map<String, Object> params = legacyRestCommonService.addClusterCrnAndNameIfPresent(structuredEvent);
OperationDetails operation = structuredEvent.getOperation();
Optional<Stack> stack = stackService.findStackByNameAndWorkspaceId(operation.getResourceName(), operation.getWorkspaceId());
AuditEventName auditEventName = auditEventName(structuredEvent);
if (stack.isPresent() && auditEventName == AuditEventName.RESIZE_DATAHUB_CLUSTER) {
Json json = new Json(structuredEvent.getRestCall().getRestRequest().getBody());
String group = json.getValue("group");
HostGroup hostGroup = hostGroupService.getByClusterIdAndNameWithRecipes(stack.get().getCluster().getId(), group);
Integer desiredCount = json.getValue("desiredCount");
Integer originalNodeCount = hostGroup.getInstanceGroup().getNodeCount();
params.put("desiredCount", desiredCount);
params.put("originalCount", originalNodeCount);
params.put("hostGroup", group);
}
return params;
}
use of com.sequenceiq.cloudbreak.audit.model.AuditEventName in project cloudbreak by hortonworks.
the class BlueprintsRestResourceAuditEventConverter method auditEventName.
@Override
public AuditEventName auditEventName(StructuredRestCallEvent structuredEvent) {
String method = structuredEvent.getRestCall().getRestRequest().getMethod();
AuditEventName eventName = null;
String resourceEvent = structuredEvent.getOperation().getResourceEvent();
if ("POST".equals(method) && resourceEvent == null) {
eventName = AuditEventName.CREATE_BLUEPRINT;
} else if ("DELETE".equals(method)) {
eventName = AuditEventName.DELETE_BLUEPRINT;
}
return eventName;
}
Aggregations