sensu-plugins / sensu-plugin

A framework for writing Sensu plugins & handlers with Ruby.
http://sensuapp.org
MIT License
126 stars 117 forks source link

Added stash_request function #130

Closed runningman84 closed 7 years ago

runningman84 commented 8 years ago

Description

This function allows handlers to implement stuff like this

    content = {
      'path' => "maintenance/#{@event['client']['name']}",
      'content' => {
        'reason' => "Maintenance requested by #{@event['check']['user']}",
        'source' => 'cli'
      },
      'expire' => @event['check']['expire'].to_i
    }
    response = stash_request(:POST, "/stashes", content.to_json.to_s).code

Motivation and Context

The normal api_request function does not allow post data.

How Has This Been Tested?

This function is used in an internal maintenance handler.

Types of changes

cwjohnston commented 8 years ago

Thanks for the PR @runningman84, I've made a few comments on the proposed changes.

majormoses commented 7 years ago

closing due to inactivity, please comment back if you intend to make the changes and I will re-open.