Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
package io.openaev.healthcheck.dto;

import static java.time.Instant.now;

import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotNull;
import java.time.Instant;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.Setter;
import lombok.*;
import lombok.extern.slf4j.Slf4j;

@Getter
@Setter
@Data
@AllArgsConstructor
@Slf4j
public class HealthCheck {

public enum Status {
Expand All @@ -22,17 +23,45 @@ public enum Detail {
SERVICE_UNAVAILABLE,
NOT_READY,
EMPTY,
MANDATORY_CONTENT,
}

public enum Type {
SMTP,
IMAP,
AGENT_OR_EXECUTOR,
SECURITY_SYSTEM_COLLECTOR,
INJECT,
TEAMS,
NMAP,
NUCLEI,
SMTP("smtp"),
IMAP("imap"),
AGENT_OR_EXECUTOR("agent_or_executor"),
SECURITY_SYSTEM_COLLECTOR("security_system_collector"),
INJECT("inject"),
TEAMS("teams"),
NMAP("nmap"),
NUCLEI("nuclei"),
INJECTOR_CONTRACT("injector_contract"),
ASSETS("assets"),
ASSET_GROUPS("asset_groups"),
SUBJECT("subject"),
BODY("body"),
OPTIONAL_ARGS("optional_args"),
UNKNOWN("unknown");

private final String value;

public String getValue() {
return value;
}

Type(String value) {
this.value = value;
}

public static Type fromValue(String value) {
for (Type type : Type.values()) {
if (type.value.equalsIgnoreCase(value)) {
return type;
}
}
log.warn(String.format("Unknown HealthCheck Type: %s", value));
return UNKNOWN;
}
}

@Schema(description = "Type of the check, could be a service, an attribute, etc")
Expand All @@ -53,5 +82,5 @@ public enum Type {
@Schema(description = "Date when the failure have been found")
@JsonProperty("creation_date")
@NotNull
private Instant creationDate;
private final Instant creationDate = now();
}
Loading