Skip to content

Commit 894f9cb

Browse files
committed
add teamID to trigger model
1 parent 3618d02 commit 894f9cb

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

moira_client/models/trigger.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ class Trigger(Base):
2222
def __init__(
2323
self,
2424
client,
25+
team_id,
2526
name,
2627
tags,
2728
targets,
@@ -42,6 +43,7 @@ def __init__(
4243
"""
4344
4445
:param client: api client
46+
:param team_id: id of a team that owns the trigger
4547
:param name: str trigger name
4648
:param tags: list of str tags for trigger
4749
:param targets: list of str targets
@@ -63,6 +65,7 @@ def __init__(
6365
self._client = client
6466

6567
self._id = kwargs.get('id', None)
68+
self.team_id = team_id
6669
self.name = name
6770
self.tags = tags
6871
self.targets = targets
@@ -338,13 +341,14 @@ def fetch_by_id(self, trigger_id):
338341
elif not 'trigger_id' in result:
339342
raise ResponseStructureError("invalid api response", result)
340343

341-
def search(self, only_problems, page, text):
344+
def search(self, only_problems, page, text, team_id):
342345
"""
343346
Search triggers
344347
345348
:param only_problems: Restricts the result to errors only. Example: false
346349
:param page: Defines the number of the displayed page. E.g, page=2 would display the 2nd page. Example: 1
347350
:param text: Query to perform a search for. Example: cpu
351+
:param team_id: id of a team that owns the trigger
348352
349353
:return: matching triggers list
350354
@@ -354,6 +358,7 @@ def search(self, only_problems, page, text):
354358
'onlyProblems': only_problems,
355359
'page': page,
356360
'text': text,
361+
'teamID': team_id,
357362
}
358363
result = self._client.get(self._full_path(), params=params)
359364
if 'list' not in result:
@@ -519,6 +524,7 @@ def set_maintenance(self, trigger_id, end_time, metrics=None):
519524

520525
def create(
521526
self,
527+
team_id,
522528
name,
523529
tags,
524530
targets,
@@ -540,6 +546,7 @@ def create(
540546
"""
541547
Creates new trigger. To save it call save() method of Trigger.
542548
:param name: str trigger name
549+
:param team_id: str team id of a team that owns this trigger
543550
:param tags: list of str tags for trigger
544551
:param targets: list of str targets
545552
:param warn_value: float warning value (if T1 <= warn_value)
@@ -560,6 +567,7 @@ def create(
560567
"""
561568
return Trigger(
562569
client=self._client,
570+
team_id=team_id,
563571
name=name,
564572
tags=tags,
565573
targets=targets,

0 commit comments

Comments
 (0)