OCSF.Severity (OCSF v0.1.0)

Copy Markdown View Source

OCSF severity levels.

Maps human-readable severity names to their OCSF 1.8 numeric identifiers. Used by event builders to resolve the :severity keyword into the severity_id field.

See the OCSF severity_id definition.

Values

NameID
:Unknown0
:Informational1
:Low2
:Medium3
:High4
:Critical5
:Fatal6
:Other99

See OCSF.Status for event outcome status.

Summary

Functions

Return values formatted for Ecto.Enum.

Return the name atom for the given numeric identifier.

Return the numeric identifier for the given name atom.

Return true if the given name or identifier is valid.

Return all values as a keyword list.

Functions

ecto_values()

@spec ecto_values() :: keyword()

Return values formatted for Ecto.Enum.

Examples

iex> OCSF.Severity.ecto_values()
[Unknown: 0, Informational: 1, Low: 2, Medium: 3, High: 4, Critical: 5, Fatal: 6, Other: 99]

name(uid)

@spec name(integer()) :: atom() | nil

Return the name atom for the given numeric identifier.

Examples

iex> OCSF.Severity.name(1)
:Informational

iex> OCSF.Severity.name(42)
nil

uid(name)

@spec uid(atom()) :: integer() | nil

Return the numeric identifier for the given name atom.

Examples

iex> OCSF.Severity.uid(:Informational)
1

iex> OCSF.Severity.uid(:NonExistent)
nil

valid?(name)

@spec valid?(atom() | integer()) :: boolean()

Return true if the given name or identifier is valid.

Examples

iex> OCSF.Severity.valid?(:Informational)
true

iex> OCSF.Severity.valid?(1)
true

iex> OCSF.Severity.valid?(:NonExistent)
false

values()

@spec values() :: [{atom(), integer()}]

Return all values as a keyword list.

Examples

iex> OCSF.Severity.values()
[Unknown: 0, Informational: 1, Low: 2, Medium: 3, High: 4, Critical: 5, Fatal: 6, Other: 99]