Sha256: 801892ef97a26bc6f0c189fd018c9f1c0291f44c534819f6b61410e6bddc6902

Contents?: true

Size: 673 Bytes

Versions: 1

Compression:

Stored size: 673 Bytes

Contents

class Sysdig::CreateAlert < Sysdig::Request
  def self.params
    %w[name description enabled filter type condition timespan severity notify segmentBy segmentCondition groupCondition groupBy groupAggregations]
  end

  def real(alert)
    service.request(
      :method => :post,
      :path   => "/api/alerts",
      :body   => { "alert" => alert },
    )
  end

  def mock(alert)
    alert_id = service.serial_id
    body     = Cistern::Hash.slice(Cistern::Hash.stringify_keys(alert), *self.class.params)

    service.data[:alerts][alert_id] = body.merge!("id" => alert_id)

    service.response(
      :status => 201,
      :body   => {"alert" => body},
    )
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
sysdig-0.2.0 lib/sysdig/create_alert.rb