use of com.sequenceiq.cloudbreak.api.endpoint.v4.audits.responses.AuditEventV4Responses in project cloudbreak by hortonworks.
the class SdxTestDto method investigate.
@Override
public Clue investigate() {
if (getResponse() == null || getResponse().getCrn() == null) {
return null;
}
AuditEventV4Responses auditEvents = AuditUtil.getAuditEvents(getTestContext().getMicroserviceClient(CloudbreakClient.class), CloudbreakEventService.DATAHUB_RESOURCE_TYPE, null, getResponse().getCrn());
boolean hasSpotTermination = (getResponse().getStackV4Response() == null) ? false : getResponse().getStackV4Response().getInstanceGroups().stream().flatMap(ig -> ig.getMetadata().stream()).anyMatch(metadata -> InstanceStatus.DELETED_BY_PROVIDER == metadata.getInstanceStatus());
return new Clue("SDX", auditEvents, getResponse(), hasSpotTermination);
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.audits.responses.AuditEventV4Responses in project cloudbreak by hortonworks.
the class AuditEventV4Controller method getAuditEventsZipResponse.
private Response getAuditEventsZipResponse(Collection<AuditEventV4Response> auditEventV4Responses, String resourceType) {
StreamingOutput streamingOutput = output -> {
try (ZipOutputStream zipOutputStream = new ZipOutputStream(output)) {
zipOutputStream.putNextEntry(new ZipEntry("struct-events.json"));
zipOutputStream.write(JsonUtil.writeValueAsString(auditEventV4Responses).getBytes());
zipOutputStream.closeEntry();
}
};
String fileName = String.format("audit-%s.zip", resourceType);
return Response.ok(streamingOutput).header("content-disposition", String.format("attachment; filename = %s", fileName)).build();
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.audits.responses.AuditEventV4Responses in project cloudbreak by hortonworks.
the class AuditEventService method getAuditEventsByWorkspaceId.
public List<AuditEventV4Response> getAuditEventsByWorkspaceId(Long workspaceId, String resourceType, Long resourceId, String resourceCrn) {
User user = userService.getOrCreate(legacyRestRequestThreadLocalService.getCloudbreakUser());
Workspace workspace = getWorkspaceService().get(workspaceId, user);
List<AuditEventV4Response> auditEventV4Responses = getEventsForUserWithTypeAndResourceIdByWorkspace(workspace, resourceType, resourceId, resourceCrn);
auditEventV4Responses.sort(new AuditEventComparator().reversed());
return auditEventV4Responses;
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.audits.responses.AuditEventV4Responses in project cloudbreak by hortonworks.
the class SdxCustomTestDto method investigate.
@Override
public Clue investigate() {
if (getResponse() == null || getResponse().getCrn() == null) {
return null;
}
AuditEventV4Responses auditEvents = AuditUtil.getAuditEvents(getTestContext().getMicroserviceClient(CloudbreakClient.class), CloudbreakEventService.DATAHUB_RESOURCE_TYPE, null, getResponse().getCrn());
boolean hasSpotTermination = (getResponse().getStackV4Response() == null) ? false : getResponse().getStackV4Response().getInstanceGroups().stream().flatMap(ig -> ig.getMetadata().stream()).anyMatch(metadata -> InstanceStatus.DELETED_BY_PROVIDER == metadata.getInstanceStatus());
return new Clue("SDX", auditEvents, getResponse(), hasSpotTermination);
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.audits.responses.AuditEventV4Responses in project cloudbreak by hortonworks.
the class SdxInternalTestDto method investigate.
@Override
public Clue investigate() {
if (getResponse() == null || getResponse().getCrn() == null) {
return null;
}
AuditEventV4Responses auditEvents = AuditUtil.getAuditEvents(getTestContext().getMicroserviceClient(CloudbreakClient.class), CloudbreakEventService.DATAHUB_RESOURCE_TYPE, null, getResponse().getCrn());
boolean hasSpotTermination = (getResponse().getStackV4Response() == null) ? false : getResponse().getStackV4Response().getInstanceGroups().stream().flatMap(ig -> ig.getMetadata().stream()).anyMatch(metadata -> InstanceStatus.DELETED_BY_PROVIDER == metadata.getInstanceStatus());
return new Clue("SDX", auditEvents, getResponse(), hasSpotTermination);
}
Aggregations