Module: Grafana::Modules::AlertNotificationChannel

Included in:
NotificationChannels
Defined in:
lib/grafana/modules/alert_notification_channel.rb

Instance Method Summary collapse

Instance Method Details

#create_notification_channel(channel) ⇒ Object



12
13
14
15
16
# File 'lib/grafana/modules/alert_notification_channel.rb', line 12

def create_notification_channel(channel)
  # TODO: verify channel is a hash and has the expected values

  post('/api/alert-notifications', channel)
end

#delete_notification_channel(uid:) ⇒ Object



24
25
26
# File 'lib/grafana/modules/alert_notification_channel.rb', line 24

def delete_notification_channel(uid:)
  @conn.delete("/api/alert-notifications/uid/#{uid}")
end

#notification_channel(uid:) ⇒ Object



8
9
10
# File 'lib/grafana/modules/alert_notification_channel.rb', line 8

def notification_channel(uid:)
  get("/api/alert-notifications/uid/#{uid}")
end

#notification_channelsObject



4
5
6
# File 'lib/grafana/modules/alert_notification_channel.rb', line 4

def notification_channels
  get('/api/alert-notifications')
end

#test_notification_channel(type:, settings:) ⇒ Object



28
29
30
31
32
33
# File 'lib/grafana/modules/alert_notification_channel.rb', line 28

def test_notification_channel(type:, settings:)
  # TODO: verify settings is a hash
  # TODO: verify type is supported notifier

  post('/api/alert-notifications/test', { type: type, settings: settings })
end

#update_notification_channel(channel, uid:) ⇒ Object



18
19
20
21
22
# File 'lib/grafana/modules/alert_notification_channel.rb', line 18

def update_notification_channel(channel, uid:)
  # TODO: verify channel is a hash and has the expected values

  post("/api/alert-notifications/uid/#{uid}", channel)
end