Search in sources :

Example 1 with CDPFlowResourceAuditEventConverter

use of com.sequenceiq.cloudbreak.structuredevent.service.audit.auditeventname.flow.CDPFlowResourceAuditEventConverter 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));
}
Also used : AuditEventName(com.sequenceiq.cloudbreak.audit.model.AuditEventName) CDPFlowResourceAuditEventConverter(com.sequenceiq.cloudbreak.structuredevent.service.audit.auditeventname.flow.CDPFlowResourceAuditEventConverter) FlowDetails(com.sequenceiq.cloudbreak.structuredevent.event.FlowDetails)

Example 2 with CDPFlowResourceAuditEventConverter

use of com.sequenceiq.cloudbreak.structuredevent.service.audit.auditeventname.flow.CDPFlowResourceAuditEventConverter in project cloudbreak by hortonworks.

the class FlowCDPEventDataExtractor method shouldAudit.

@Override
public boolean shouldAudit(CDPStructuredEvent structuredEvent) {
    CDPOperationDetails operation = structuredEvent.getOperation();
    CDPFlowResourceAuditEventConverter flowResourceAuditEventConverter = getConverter(operation.getResourceType());
    if (flowResourceAuditEventConverter == null) {
        return false;
    }
    boolean crn = Crn.isCrn(operation.getResourceCrn());
    return crn && flowResourceAuditEventConverter.shouldAudit((CDPStructuredFlowEvent) structuredEvent);
}
Also used : CDPStructuredFlowEvent(com.sequenceiq.cloudbreak.structuredevent.event.cdp.CDPStructuredFlowEvent) CDPFlowResourceAuditEventConverter(com.sequenceiq.cloudbreak.structuredevent.service.audit.auditeventname.flow.CDPFlowResourceAuditEventConverter) CDPOperationDetails(com.sequenceiq.cloudbreak.structuredevent.event.cdp.CDPOperationDetails)

Aggregations

CDPFlowResourceAuditEventConverter (com.sequenceiq.cloudbreak.structuredevent.service.audit.auditeventname.flow.CDPFlowResourceAuditEventConverter)2 AuditEventName (com.sequenceiq.cloudbreak.audit.model.AuditEventName)1 FlowDetails (com.sequenceiq.cloudbreak.structuredevent.event.FlowDetails)1 CDPOperationDetails (com.sequenceiq.cloudbreak.structuredevent.event.cdp.CDPOperationDetails)1 CDPStructuredFlowEvent (com.sequenceiq.cloudbreak.structuredevent.event.cdp.CDPStructuredFlowEvent)1