Search in sources :

Example 11 with AuditEventName

use of com.sequenceiq.cloudbreak.audit.model.AuditEventName in project cloudbreak by hortonworks.

the class EnvironmentRestResourceAuditEventConverter 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_ENVIRONMENT;
        } else {
            eventName = updateRest(resourceEvent);
        }
    } else if ("DELETE".equals(method)) {
        eventName = deletionRest(resourceEvent, structuredEvent.getOperation());
    }
    return eventName;
}
Also used : AuditEventName(com.sequenceiq.cloudbreak.audit.model.AuditEventName)

Example 12 with AuditEventName

use of com.sequenceiq.cloudbreak.audit.model.AuditEventName in project cloudbreak by hortonworks.

the class FlowLegacyEventDataExtractor method eventName.

@Override
public AuditEventName eventName(StructuredFlowEvent structuredEvent) {
    FlowDetails flow = structuredEvent.getFlow();
    String flowEvent = flow.getFlowEvent();
    AuditEventName eventName = null;
    String resourceType = structuredEvent.getOperation().getResourceType();
    FlowResourceAuditEventConverter 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) FlowResourceAuditEventConverter(com.sequenceiq.cloudbreak.structuredevent.auditeventname.flow.FlowResourceAuditEventConverter) FlowDetails(com.sequenceiq.cloudbreak.structuredevent.event.FlowDetails)

Example 13 with AuditEventName

use of com.sequenceiq.cloudbreak.audit.model.AuditEventName in project cloudbreak by hortonworks.

the class RestLegacyEventDataExtractor method eventName.

@Override
public AuditEventName eventName(StructuredRestCallEvent 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));
}
Also used : AuditEventName(com.sequenceiq.cloudbreak.audit.model.AuditEventName)

Example 14 with AuditEventName

use of com.sequenceiq.cloudbreak.audit.model.AuditEventName in project cloudbreak by hortonworks.

the class LdapRestResourceAuditEventConverter 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_LDAP_CONFIG;
        }
    } else if ("DELETE".equals(method)) {
        eventName = deletionRest(resourceEvent, structuredEvent.getOperation());
    }
    return eventName;
}
Also used : AuditEventName(com.sequenceiq.cloudbreak.audit.model.AuditEventName)

Example 15 with AuditEventName

use of com.sequenceiq.cloudbreak.audit.model.AuditEventName in project cloudbreak by hortonworks.

the class FreeIpaRestResourceAuditEventConverter 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_FREEIPA;
        } else {
            eventName = updateRest(resourceEvent);
        }
    } else if ("DELETE".equals(method)) {
        eventName = deletionRest(resourceEvent, structuredEvent.getOperation());
    }
    return eventName;
}
Also used : AuditEventName(com.sequenceiq.cloudbreak.audit.model.AuditEventName)

Aggregations

AuditEventName (com.sequenceiq.cloudbreak.audit.model.AuditEventName)15 FlowDetails (com.sequenceiq.cloudbreak.structuredevent.event.FlowDetails)2 Json (com.sequenceiq.cloudbreak.common.json.Json)1 Stack (com.sequenceiq.cloudbreak.domain.stack.Stack)1 HostGroup (com.sequenceiq.cloudbreak.domain.stack.cluster.host.HostGroup)1 FlowResourceAuditEventConverter (com.sequenceiq.cloudbreak.structuredevent.auditeventname.flow.FlowResourceAuditEventConverter)1 OperationDetails (com.sequenceiq.cloudbreak.structuredevent.event.legacy.OperationDetails)1 CDPFlowResourceAuditEventConverter (com.sequenceiq.cloudbreak.structuredevent.service.audit.auditeventname.flow.CDPFlowResourceAuditEventConverter)1