66from linode_api4 .objects import (
77 AlertChannel ,
88 AlertDefinition ,
9+ AlertDefinitionEntity ,
910 MonitorDashboard ,
1011 MonitorMetricsDefinition ,
1112 MonitorService ,
@@ -219,6 +220,8 @@ def create_alert_definition(
219220 channel_ids : list [int ],
220221 rule_criteria : dict ,
221222 trigger_conditions : dict ,
223+ scope : Optional [str ] = None ,
224+ regions : Optional [list [str ]] = None ,
222225 entity_ids : Optional [list [str ]] = None ,
223226 description : Optional [str ] = None ,
224227 ) -> AlertDefinition :
@@ -248,6 +251,10 @@ def create_alert_definition(
248251 :param trigger_conditions: Trigger conditions that define when
249252 the alert should transition state.
250253 :type trigger_conditions: dict
254+ :param scope: (Optional) Alert scope (for example: `account`, `entity`, or `region`). Defaults to `entity`.
255+ :type scope: Optional[str]
256+ :param regions: (Optional) Regions to monitor.
257+ :type regions: Optional[list[str]]
251258 :param entity_ids: (Optional) Restrict the alert to a subset of entity IDs.
252259 :type entity_ids: Optional[list[str]]
253260 :param description: (Optional) Longer description for the alert definition.
@@ -267,6 +274,10 @@ def create_alert_definition(
267274 "rule_criteria" : rule_criteria ,
268275 "trigger_conditions" : trigger_conditions ,
269276 }
277+ if scope is not None :
278+ params ["scope" ] = scope
279+ if regions is not None :
280+ params ["regions" ] = regions
270281 if description is not None :
271282 params ["description" ] = description
272283 if entity_ids is not None :
@@ -284,3 +295,38 @@ def create_alert_definition(
284295 )
285296
286297 return AlertDefinition (self .client , result ["id" ], service_type , result )
298+
299+ def alert_definition_entities (
300+ self ,
301+ service_type : str ,
302+ id : int ,
303+ * filters ,
304+ ) -> PaginatedList :
305+ """
306+ List entities associated with a specific alert definition.
307+
308+ This endpoint supports pagination fields (`page`, `page_size`) in the API.
309+
310+ .. note:: This endpoint is in beta and requires using the v4beta base URL.
311+
312+ API Documentation: <todo: add link to techdocs>
313+
314+ :param service_type: Service type for the alert definition (e.g. `dbaas`).
315+ :type service_type: str
316+ :param id: Alert definition identifier.
317+ :type id: int
318+ :param filters: Optional filter expressions to apply to the collection.
319+ See :doc:`Filtering Collections</linode_api4/objects/filtering>`.
320+
321+ :returns: A paginated list of entities associated with the alert definition.
322+ :rtype: PaginatedList[AlertDefinitionEntity]
323+ """
324+
325+ endpoint = (
326+ f"/monitor/services/{ service_type } /alert-definitions/{ id } /entities"
327+ )
328+ return self .client ._get_and_filter (
329+ AlertDefinitionEntity ,
330+ * filters ,
331+ endpoint = endpoint ,
332+ )
0 commit comments