Class: Sysdig::CreateAlert
- Inherits:
-
Request
- Object
- Request
- Sysdig::CreateAlert
- Defined in:
- lib/sysdig/create_alert.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.params ⇒ Object
2 3 4 |
# File 'lib/sysdig/create_alert.rb', line 2 def self.params %w[condition createdOn description enabled filter modifiedOn name notify segmentBy segmentCondition severity timespan type version] end |
.slice(alert) ⇒ Object
6 7 8 |
# File 'lib/sysdig/create_alert.rb', line 6 def self.slice(alert) Cistern::Hash.slice(Cistern::Hash.stringify_keys(alert), *self.params) end |
Instance Method Details
#mock(alert) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/sysdig/create_alert.rb', line 18 def mock(alert) alert_id = service.serial_id body = self.class.slice(alert).merge!("id" => alert_id) service.data[:alerts][alert_id] = body service.response( :status => 201, :body => {"alert" => body}, ) end |
#real(alert) ⇒ Object
10 11 12 13 14 15 16 |
# File 'lib/sysdig/create_alert.rb', line 10 def real(alert) service.request( :method => :post, :path => "/api/alerts", :body => { "alert" => self.class.slice(alert) }, ) end |