Class: Infrawrench::MetricAlertsNamespace
- Inherits:
-
Object
- Object
- Infrawrench::MetricAlertsNamespace
- Defined in:
- lib/infrawrench/client.rb,
sig/infrawrench/sdk.rbs
Overview
client.metric_alerts
Instance Method Summary collapse
-
#create(body:, org_id: nil, request_options: nil) ⇒ Hash
Create a metric alert rule.
-
#delete(id:, org_id: nil, request_options: nil) ⇒ Hash
Delete a metric alert rule.
-
#events(org_id: nil, rule_id: nil, limit: nil, request_options: nil) ⇒ Array<Hash>
Recent metric alert firings.
-
#get(id:, org_id: nil, request_options: nil) ⇒ Hash
Get a metric alert rule.
-
#initialize(transport) ⇒ MetricAlertsNamespace
constructor
private
A new instance of MetricAlertsNamespace.
-
#list(org_id: nil, request_options: nil) ⇒ Array<Hash>
List metric alert rules with live firing status.
-
#metric_keys(org_id: nil, plugin_id: nil, resource_type_id: nil, request_options: nil) ⇒ Array<Hash>
List metric series that actually exist.
-
#selector_options(org_id: nil, request_options: nil) ⇒ Hash
List what the organization's resources offer to select on.
-
#selector_preview(org_id: nil, plugin_id: nil, resource_type_id: nil, tag_key: nil, tag_value: nil, request_options: nil) ⇒ Hash
Preview which resources a selector matches right now.
-
#update(id:, body:, org_id: nil, request_options: nil) ⇒ Hash
Update a metric alert rule.
Constructor Details
#initialize(transport) ⇒ MetricAlertsNamespace
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 MetricAlertsNamespace.
4018 4019 4020 |
# File 'lib/infrawrench/client.rb', line 4018 def initialize(transport) @transport = transport end |
Instance Method Details
#create(body:, org_id: nil, request_options: nil) ⇒ Hash
Create a metric alert rule
Rules select resources by query (plugin + resource type + tag), never by id list, so a rule automatically covers resources created after it was written. The poller evaluates enabled rules about once a minute and alerts when the condition held for the whole trailing window.
POST /api/org/orgId/metric-alerts
Raises on 400: Bad request
4039 4040 4041 4042 4043 4044 4045 4046 4047 |
# File 'lib/infrawrench/client.rb', line 4039 def create(body:, org_id: nil, request_options: nil) @transport.request( http_method: "POST", path: "/api/org/{orgId}/metric-alerts", path_params: { "orgId" => org_id }, body: body, request_options: ) end |
#delete(id:, org_id: nil, request_options: nil) ⇒ Hash
Delete a metric alert rule
Soft delete. The rule's firing history stays readable via /metric-alerts/events.
DELETE /api/org/orgId/metric-alerts/id
Raises on 404: Not found
4064 4065 4066 4067 4068 4069 4070 4071 |
# File 'lib/infrawrench/client.rb', line 4064 def delete(id:, org_id: nil, request_options: nil) @transport.request( http_method: "DELETE", path: "/api/org/{orgId}/metric-alerts/{id}", path_params: { "orgId" => org_id, "id" => id }, request_options: ) end |
#events(org_id: nil, rule_id: nil, limit: nil, request_options: nil) ⇒ Array<Hash>
Recent metric alert firings
GET /api/org/orgId/metric-alerts/events
4085 4086 4087 4088 4089 4090 4091 4092 4093 |
# File 'lib/infrawrench/client.rb', line 4085 def events(org_id: nil, rule_id: nil, limit: nil, request_options: nil) @transport.request( http_method: "GET", path: "/api/org/{orgId}/metric-alerts/events", path_params: { "orgId" => org_id }, query: { "ruleId" => rule_id, "limit" => limit }, request_options: ) end |
#get(id:, org_id: nil, request_options: nil) ⇒ Hash
Get a metric alert rule
GET /api/org/orgId/metric-alerts/id
Raises on 404: Not found
4107 4108 4109 4110 4111 4112 4113 4114 |
# File 'lib/infrawrench/client.rb', line 4107 def get(id:, org_id: nil, request_options: nil) @transport.request( http_method: "GET", path: "/api/org/{orgId}/metric-alerts/{id}", path_params: { "orgId" => org_id, "id" => id }, request_options: ) end |
#list(org_id: nil, request_options: nil) ⇒ Array<Hash>
List metric alert rules with live firing status
GET /api/org/orgId/metric-alerts
4126 4127 4128 4129 4130 4131 4132 4133 |
# File 'lib/infrawrench/client.rb', line 4126 def list(org_id: nil, request_options: nil) @transport.request( http_method: "GET", path: "/api/org/{orgId}/metric-alerts", path_params: { "orgId" => org_id }, request_options: ) end |
#metric_keys(org_id: nil, plugin_id: nil, resource_type_id: nil, request_options: nil) ⇒ Array<Hash>
List metric series that actually exist
The series labels resources reported in the last 7 days, optionally narrowed to one plugin and resource type — what the rule builder's metric picker is fed from.
GET /api/org/orgId/metric-alerts/metric-keys
4151 4152 4153 4154 4155 4156 4157 4158 4159 |
# File 'lib/infrawrench/client.rb', line 4151 def metric_keys(org_id: nil, plugin_id: nil, resource_type_id: nil, request_options: nil) @transport.request( http_method: "GET", path: "/api/org/{orgId}/metric-alerts/metric-keys", path_params: { "orgId" => org_id }, query: { "pluginId" => plugin_id, "resourceTypeId" => resource_type_id }, request_options: ) end |
#selector_options(org_id: nil, request_options: nil) ⇒ Hash
List what the organization's resources offer to select on
GET /api/org/orgId/metric-alerts/selector-options
4171 4172 4173 4174 4175 4176 4177 4178 |
# File 'lib/infrawrench/client.rb', line 4171 def (org_id: nil, request_options: nil) @transport.request( http_method: "GET", path: "/api/org/{orgId}/metric-alerts/selector-options", path_params: { "orgId" => org_id }, request_options: ) end |
#selector_preview(org_id: nil, plugin_id: nil, resource_type_id: nil, tag_key: nil, tag_value: nil, request_options: nil) ⇒ Hash
Preview which resources a selector matches right now
GET /api/org/orgId/metric-alerts/selector-preview
Raises on 400: Bad request
4196 4197 4198 4199 4200 4201 4202 4203 4204 4205 4206 4207 4208 4209 4210 4211 4212 4213 4214 4215 4216 |
# File 'lib/infrawrench/client.rb', line 4196 def selector_preview( org_id: nil, plugin_id: nil, resource_type_id: nil, tag_key: nil, tag_value: nil, request_options: nil ) @transport.request( http_method: "GET", path: "/api/org/{orgId}/metric-alerts/selector-preview", path_params: { "orgId" => org_id }, query: { "pluginId" => plugin_id, "resourceTypeId" => resource_type_id, "tagKey" => tag_key, "tagValue" => tag_value }, request_options: ) end |
#update(id:, body:, org_id: nil, request_options: nil) ⇒ Hash
Update a metric alert rule
PUT /api/org/orgId/metric-alerts/id
Raises on 400: Bad request
Raises on 404: Not found
4233 4234 4235 4236 4237 4238 4239 4240 4241 |
# File 'lib/infrawrench/client.rb', line 4233 def update(id:, body:, org_id: nil, request_options: nil) @transport.request( http_method: "PUT", path: "/api/org/{orgId}/metric-alerts/{id}", path_params: { "orgId" => org_id, "id" => id }, body: body, request_options: ) end |