10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
# File 'lib/sysdig/update_user_notifications.rb', line 10
def mock(notification)
user_notification = Cistern::Hash.slice(Cistern::Hash.stringify_keys(notification), "sns", "email", "pagerDuty")
schema = {
"sns" => %w[enabled topics],
"email" => %w[enabled recipients],
"pagerDuty" => %w[enabled integrated resolveOnOk connectUrl],
}
sliced = schema.each_with_object({}) { |(type, keys), r|
u = user_notification[type]
if u
r.merge!(type => Cistern::Hash.slice(u, *keys))
end
}
service.response(
:body => { "userNotification" => service.data[:user_notifications].merge!(sliced) },
)
end
|