55from nisystemlink .clients import core
66from nisystemlink .clients .core ._uplink ._base_client import BaseClient
77from nisystemlink .clients .core ._uplink ._methods import delete , get , post
8- from uplink import retry
8+ from uplink import Field , retry
99
1010from . import models
1111
1616 on_exception = retry .CONNECTION_ERROR ,
1717)
1818class AlarmClient (BaseClient ):
19+
1920 def __init__ (self , configuration : Optional [core .HttpConfiguration ] = None ):
2021 """Initialize an instance.
2122
@@ -26,92 +27,107 @@ def __init__(self, configuration: Optional[core.HttpConfiguration] = None):
2627 is used to obtain the configuration.
2728
2829 Raises:
29- ApiException: if unable to communicate with the Alarm Service.
30+ ApiException: if unable to communicate with the `/nialarm` Service.
3031 """
3132 if configuration is None :
3233 configuration = core .HttpConfigurationManager .get_configuration ()
34+
3335 super ().__init__ (configuration , base_path = "/nialarm/v1/" )
3436
35- @post ("acknowledge-instances-by-instance-id" )
36- def acknowledge_instances_by_instance_id (
37- self , request : models .AcknowledgeByInstanceIdRequest
37+ @post (
38+ "acknowledge-instances-by-instance-id" ,
39+ args = [Field ("instanceIds" ), Field ("forceClear" )],
40+ )
41+ def acknowledge_alarm (
42+ self , instance_ids : list [str ], force_clear : bool = False
3843 ) -> models .AcknowledgeByInstanceIdResponse :
3944 """Acknowledges one or more alarm instances by their instance IDs.
4045
4146 Args:
42- request: The request containing instance IDs to acknowledge and optional force clear flag.
47+ instance_ids: List of instance IDs (unique occurrence identifiers) of the alarms to acknowledge.
48+ These are the server-generated IDs returned when creating/updating alarms,
49+ not the user-defined alarm_id.
50+ force_clear: Whether or not the affected alarms should have their clear field set to true.
51+ Defaults to False.
4352
4453 Returns:
4554 A response containing the instance IDs that were successfully acknowledged,
4655 the instance IDs that failed, and error details for failures.
4756
4857 Raises:
49- ApiException: if unable to communicate with the Alarm Service or provided invalid arguments.
58+ ApiException: if unable to communicate with the `/nialarm` Service or provided invalid arguments.
5059 """
5160 ...
5261
53- @post ("instances" )
54- def create_or_update_alarm (
55- self , request : models .CreateOrUpdateAlarmRequest
56- ) -> models .CreateOrUpdateAlarmResponse :
62+ @post ("instances" , return_key = "instanceId" )
63+ def create_or_update_alarm (self , request : models .CreateOrUpdateAlarmRequest ) -> str :
5764 """Creates or updates an instance, or occurrence, of an alarm.
5865
5966 Creates or updates an alarm based on the requested transition and the state
60- of the current active alarm with the given alarmId.
67+ of the current active alarm with the given alarm_id (specified in the request).
68+ Multiple calls with the same alarm_id will update the same alarm instance.
6169
6270 Args:
63- request: The request containing alarm information and transition details.
71+ request: The request containing alarm_id (user-defined identifier),
72+ transition details, and other alarm properties.
6473
6574 Returns:
66- A response containing the ID of the created or modified alarm.
75+ The instance_id (unique occurrence identifier) of the created or modified alarm.
76+ Use this ID for operations like get_alarm(), delete_alarm(), or acknowledge.
6777
6878 Raises:
69- ApiException: if unable to communicate with the Alarm Service or provided invalid arguments.
79+ ApiException: if unable to communicate with the `/nialarm` Service or provided invalid arguments.
7080 """
7181 ...
7282
7383 @get ("instances/{instance_id}" )
7484 def get_alarm (self , instance_id : str ) -> models .Alarm :
75- """Gets an alarm by its instanceId .
85+ """Gets an alarm by its instance_id .
7686
7787 Args:
78- instance_id: Unique ID of a particular instance, or occurrence, of an alarm.
88+ instance_id: The unique instance ID (occurrence identifier) of the alarm to retrieve.
89+ This is the server-generated ID returned from create_or_update_alarm(),
90+ not the user-defined alarm_id.
7991
8092 Returns:
81- The alarm with the specified instance ID .
93+ The alarm with the specified instance_id .
8294
8395 Raises:
84- ApiException: if unable to communicate with the Alarm Service or provided invalid arguments.
96+ ApiException: if unable to communicate with the `/nialarm` Service or provided invalid arguments.
8597 """
8698 ...
8799
88100 @delete ("instances/{instance_id}" )
89101 def delete_alarm (self , instance_id : str ) -> None :
90- """Deletes an alarm by its instanceId .
102+ """Deletes an alarm by its instance_id .
91103
92104 Args:
93- instance_id: Unique ID of a particular instance, or occurrence, of an alarm.
105+ instance_id: The unique instance ID (occurrence identifier) of the alarm to delete.
106+ This is the server-generated ID returned from create_or_update_alarm(),
107+ not the user-defined alarm_id.
94108
95109 Raises:
96- ApiException: if unable to communicate with the Alarm Service or provided invalid arguments.
110+ ApiException: if unable to communicate with the `/nialarm` Service or provided invalid arguments.
97111 """
98112 ...
99113
100- @post ("delete-instances-by-instance-id" )
114+ @post ("delete-instances-by-instance-id" , args = [ Field ( "instanceIds" )] )
101115 def delete_instances_by_instance_id (
102- self , request : models . DeleteByInstanceIdRequest
116+ self , instance_ids : list [ str ]
103117 ) -> models .DeleteByInstanceIdResponse :
104- """Deletes multiple alarm instances by their instanceIds .
118+ """Deletes multiple alarm instances by their instance IDs .
105119
106120 Args:
107- request: Contains the instanceIds of the alarms to delete.
121+ instance_ids: List of instance IDs (unique occurrence identifiers) of the alarms to delete.
122+ These are the server-generated IDs returned when creating/updating alarms,
123+ not the user-defined alarm_id.
108124
109125 Returns:
110- A response containing lists of successfully deleted and failed instanceIds ,
126+ A response containing lists of successfully deleted and failed instance IDs ,
111127 along with error information for failures.
112128
113129 Raises:
114- ApiException: if unable to communicate with the Alarm Service or provided invalid arguments.
130+ ApiException: if unable to communicate with the `/nialarm` Service or provided invalid arguments.
115131 """
116132 ...
117133
@@ -131,6 +147,6 @@ def query_alarms(
131147 optional total count and continuation token for pagination.
132148
133149 Raises:
134- ApiException: if unable to communicate with the Alarm Service or provided invalid arguments.
150+ ApiException: if unable to communicate with the `/nialarm` Service or provided invalid arguments.
135151 """
136152 ...
0 commit comments