-
Notifications
You must be signed in to change notification settings - Fork 165
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Moved the message building part of the Teams alerting to a seperate c…
…lass
- Loading branch information
Frank Tubbing
committed
Feb 8, 2024
1 parent
cd17dc3
commit a7278c4
Showing
3 changed files
with
85 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
elementary/monitor/data_monitoring/alerts/integrations/teams/message_builder.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
from pymsteams import cardsection, potentialaction # type: ignore | ||
|
||
from elementary.clients.teams.client import TeamsClient | ||
|
||
|
||
class TeamsAlertMessageBuilder: | ||
def __init__(self, client: TeamsClient) -> None: | ||
self.client = client | ||
|
||
def title(self, title: str): | ||
self.client.title(title) | ||
|
||
def text(self, text: str): | ||
self.client.text(text) | ||
|
||
def addSection(self, section: cardsection): | ||
self.client.addSection(section) | ||
|
||
def addPotentialAction(self, action: potentialaction): | ||
self.client.addPotentialAction(action) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters