Class: Hivehook::Resources::AlertRuleService
Constant Summary
collapse
- FRAGMENT =
"id name conditionType threshold webhookUrl channel emailConfig { to subjectTemplate } slackConfig { webhookUrl channel } cooldown enabled createdAt"
Instance Method Summary
collapse
Methods inherited from BaseService
#initialize
Instance Method Details
#create(input) ⇒ Object
23
24
25
26
|
# File 'lib/hivehook/resources/alert_rule_service.rb', line 23
def create(input)
query = "mutation($input: CreateAlertRuleInput!) { createAlertRule(input: $input) { #{FRAGMENT} } }"
@transport.execute(query, { "input" => input })["createAlertRule"]
end
|
#delete(id) ⇒ Object
33
34
35
36
|
# File 'lib/hivehook/resources/alert_rule_service.rb', line 33
def delete(id)
query = "mutation($id: UUID!) { deleteAlertRule(id: $id) }"
@transport.execute(query, { "id" => id })["deleteAlertRule"]
end
|
#get(id) ⇒ Object
18
19
20
21
|
# File 'lib/hivehook/resources/alert_rule_service.rb', line 18
def get(id)
query = "query($id: UUID!) { alertRule(id: $id) { #{FRAGMENT} } }"
@transport.execute(query, { "id" => id })["alertRule"]
end
|
#list(options = {}) ⇒ Object
8
9
10
11
12
13
14
15
16
|
# File 'lib/hivehook/resources/alert_rule_service.rb', line 8
def list(options = {})
query = "query($enabled: Boolean, $search: String, $limit: Int, $offset: Int, $after: String, $first: Int) {
alertRules(enabled: $enabled, search: $search, limit: $limit, offset: $offset, after: $after, first: $first) {
nodes { #{FRAGMENT} }
pageInfo { total limit offset endCursor hasNextPage }
}
}"
@transport.execute(query, build_variables(options, %w[enabled search limit offset after first]))["alertRules"]
end
|
#test(id) ⇒ Object
38
39
40
41
|
# File 'lib/hivehook/resources/alert_rule_service.rb', line 38
def test(id)
query = "mutation($id: UUID!) { testAlertRule(id: $id) }"
@transport.execute(query, { "id" => id })["testAlertRule"]
end
|
#update(id, input) ⇒ Object
28
29
30
31
|
# File 'lib/hivehook/resources/alert_rule_service.rb', line 28
def update(id, input)
query = "mutation($id: UUID!, $input: UpdateAlertRuleInput!) { updateAlertRule(id: $id, input: $input) { #{FRAGMENT} } }"
@transport.execute(query, { "id" => id, "input" => input })["updateAlertRule"]
end
|