Class EngineEvent

java.lang.Object
com.suse.salt.netapi.event.EngineEvent

public class EngineEvent extends Object
Represents an event fired by engines
  • Field Details

    • PATTERN

      private static final Pattern PATTERN
    • GSON

      private static final com.google.gson.Gson GSON
    • engine

      private final String engine
    • timestamp

      private final String timestamp
    • additional

      private final String additional
    • minionId

      private final Optional<String> minionId
    • data

      private final com.google.gson.JsonElement data
  • Constructor Details

    • EngineEvent

      private EngineEvent(String engine, String additional, String timestamp, Optional<String> minionId, com.google.gson.JsonElement data)
      Creates a new EngineEvent
      Parameters:
      engine - the engine name
      additional - additional information depending on the engine
      timestamp - datetime of the event
      minionId - minion id if the event comes from a minion, empty it comes from the master
      data - data containing more information about this event
  • Method Details

    • getEngine

      public String getEngine()
      Returns the engine name.
      Returns:
      the engine name
    • getAdditional

      public String getAdditional()
      Provides additional information from the tag depending on the type of engine
      Returns:
      additional information
    • getTimestamp

      public String getTimestamp()
      Returns the timestamp of the event
      Returns:
      the timestamp
    • getMinionId

      public Optional<String> getMinionId()
      Returns the id of the minion that triggered the engine event
      Returns:
      the minion id
    • getData

      public <R> R getData(com.google.gson.reflect.TypeToken<R> type)
      Return the event data parsed into the given type.
      Type Parameters:
      R - type to parse the data into
      Parameters:
      type - type token to parse data
      Returns:
      the event data
    • getData

      public <R> R getData(Class<R> type)
      Return this event's data parsed into the given type.
      Type Parameters:
      R - type to parse the data into
      Parameters:
      type - class to parse data
      Returns:
      the data
    • getData

      public Map<String,Object> getData()
      Return event data as Map
      Returns:
      event data as map
    • parse

      public static Optional<EngineEvent> parse(Event event)
      Utility method to parse e generic event to a more specific one
      Parameters:
      event - the generic event to parse
      Returns:
      an option containing the parsed value or non if it could not be parsed