Class: Infrawrench::AlertRulesNamespace
- Inherits:
-
Object
- Object
- Infrawrench::AlertRulesNamespace
- Defined in:
- lib/infrawrench/client.rb,
sig/infrawrench/sdk.rbs
Overview
client.alert_rules
Instance Attribute Summary collapse
-
#deliveries ⇒ AlertRulesDeliveriesNamespace
readonly
client.alert_rules.deliveries.
Instance Method Summary collapse
-
#adopt_defaults(org_id: nil, request_options: nil) ⇒ Hash
Persist the default rule so it can be edited.
-
#get(org_id: nil, request_options: nil) ⇒ Hash
Get the organization's alert routing rules.
-
#initialize(transport) ⇒ AlertRulesNamespace
constructor
private
A new instance of AlertRulesNamespace.
-
#update(org_id: nil, body: nil, request_options: nil) ⇒ Hash
Replace the organization's alert routing rules.
Constructor Details
#initialize(transport) ⇒ AlertRulesNamespace
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of AlertRulesNamespace.
1171 1172 1173 1174 |
# File 'lib/infrawrench/client.rb', line 1171 def initialize(transport) @transport = transport @deliveries = AlertRulesDeliveriesNamespace.new(@transport) end |
Instance Attribute Details
#deliveries ⇒ AlertRulesDeliveriesNamespace (readonly)
Returns client.alert_rules.deliveries.
1167 1168 1169 |
# File 'lib/infrawrench/client.rb', line 1167 def deliveries @deliveries end |
Instance Method Details
#adopt_defaults(org_id: nil, request_options: nil) ⇒ Hash
Persist the default rule so it can be edited
A no-op when the organization already has rules.
POST /api/org/orgId/alert-rules/adopt-defaults
Raises on 403: Forbidden
1189 1190 1191 1192 1193 1194 1195 1196 |
# File 'lib/infrawrench/client.rb', line 1189 def adopt_defaults(org_id: nil, request_options: nil) @transport.request( http_method: "POST", path: "/api/org/{orgId}/alert-rules/adopt-defaults", path_params: { "orgId" => org_id }, request_options: ) end |
#get(org_id: nil, request_options: nil) ⇒ Hash
Get the organization's alert routing rules
Returns the rules in evaluation order, plus the channels and accounts a
rule can name so a client can render destinations by name. An organization
that has saved no rules gets the synthesized default with usingDefaults: true.
GET /api/org/orgId/alert-rules
Raises on 403: Forbidden
1215 1216 1217 1218 1219 1220 1221 1222 |
# File 'lib/infrawrench/client.rb', line 1215 def get(org_id: nil, request_options: nil) @transport.request( http_method: "GET", path: "/api/org/{orgId}/alert-rules", path_params: { "orgId" => org_id }, request_options: ) end |
#update(org_id: nil, body: nil, request_options: nil) ⇒ Hash
Replace the organization's alert routing rules
Whole-list replacement in one transaction. Order is part of the meaning — a rule is only correct relative to the ones above it — so a reorder applied as several requests would leave a window in which alerts route somewhere nobody asked for. Positions are re-derived from array order.
PUT /api/org/orgId/alert-rules
Raises on 400: Bad request
Raises on 403: Forbidden
1243 1244 1245 1246 1247 1248 1249 1250 1251 |
# File 'lib/infrawrench/client.rb', line 1243 def update(org_id: nil, body: nil, request_options: nil) @transport.request( http_method: "PUT", path: "/api/org/{orgId}/alert-rules", path_params: { "orgId" => org_id }, body: body, request_options: ) end |