Hi,
That’s mainly the reason i opened this for discussion before doing the PR to discuss the “interface”.
i used “action” instead of “state” because present/absent didn’t make sense for most of the api usage, if the state parameter is standard maybe we could just rename “action” to “state” while keeping the same choices.
here is a list of actions we have in the module :
‘create’,
‘delete’,
‘get’,
‘list’,
‘request’,
‘resolve’,
‘history’,
‘silence’,
‘unsilence’,
if this was changed into state, we could probably have “create” changed to present, and “delete” changed to absent, not sure how would they fit for the other actions : list,get,request,resolve,history,silence,unsilence - unless we add these as states as well.
stashes in sensu are essentially a way to save some json data, it’s main and i think only good usage so far is to silence clients/checks. so we really only need the silencing function here, but i made the whole stashes endpoint available just in case someone has other uses for it.
this is why i separated silencing/unsilencing with it’s own actions, because it has a specific way of creating the stash path, so you would only have to provide client/check parameters with it, as opposed to using the “create” action on the “stashes” endpoint and building your own path with templated vars, like so “path: ‘silence/’{{ host }}‘/’{{ check_name }}”
for silencing you don’t really need to use the “content” parameter, it’s optional and you can use it in cases where you need to add any info on the stash, maybe for some dashboard… so “reason” in my example, is just an example… people can have any sort of data there so i don’t see why we would limit this to a “reason” parameter since it’s not needed.
i will keep thinking of ways to interface this better, but i think i initially got the “action” parameter idea from the nagios plugin since it’s what relates to sensu usage most.
hopefully we will get input from other people who use sensu.
Thanks