Package com.suse.salt.netapi.event
Class ResultEvent
java.lang.Object
com.suse.salt.netapi.event.ResultEvent
Represents an event containing the result of some function call
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionResultEvent(String jid, String minionId, com.google.gson.JsonElement data) Creates a new ResultEvent -
Method Summary
Modifier and TypeMethodDescriptiongetData()Return event data as Map<R> RgetData(com.google.gson.reflect.TypeToken<R> type) Return the event data parsed into the given type.<R> RReturn this event's data parsed into the given type.getJid()The job id to which the result belongsThe id of the minion from which the result camestatic Optional<ResultEvent> Utility method to parse e generic event to a more specific one
-
Field Details
-
PATTERN
-
GSON
private static final com.google.gson.Gson GSON -
jid
-
minionId
-
data
private final com.google.gson.JsonElement data
-
-
Constructor Details
-
ResultEvent
Creates a new ResultEvent- Parameters:
jid- the id of the job this event is aboutminionId- the id of the minion sending the eventdata- data containing more information about this event
-
-
Method Details
-
getJid
The job id to which the result belongs- Returns:
- the job id
-
getMinionId
The id of the minion from which the result came- Returns:
- the minion id
-
getData
Return event data as Map- Returns:
- event data as map
-
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
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
-
parse
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
-