Skip to content

Commit

Permalink
Add notifications to README.md
Browse files Browse the repository at this point in the history
Format with black
  • Loading branch information
dlopes7 committed May 5, 2021
1 parent ddff680 commit 3ed4514
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ Frequent issue detection | :x: | |
Kubernetes credentials configuration | :x: | |
Maintenance windows | :x: | |
Management zones | :warning: | |
Notifications | :x: | |
Notifications | :warning: | `dt.notifications` |
OneAgent - Environment-wide configuration | :x: | |
OneAgent in a host group | :x: | |
OneAgent on a host | :x: | |
Expand Down
15 changes: 15 additions & 0 deletions dynatrace/configuration_v1/notifications.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ def _create_from_raw_data(self, raw_element):
self.alerting_profile: AlertingProfile = AlertingProfile(raw_element=self._http_client.make_request(f"/api/config/v1/alertingProfiles/{raw_element.get('alertingProfile')}").json())
self.active: bool = raw_element.get("active")


class AnsibleTowerNotificationConfig(Notification):
def _create_from_raw_data(self, raw_element):
self.id: str = raw_element.get("id")
Expand All @@ -29,6 +30,7 @@ def _create_from_raw_data(self, raw_element):
self.job_template_id: str = raw_element.get("jobTemplateID")
self.custom_message: str = raw_element.get("customMessage")


class EmailNotificationConfig(Notification):
def _create_from_raw_data(self, raw_element):
self.id: str = raw_element.get("id")
Expand All @@ -42,6 +44,7 @@ def _create_from_raw_data(self, raw_element):
self.cc_receivers: List[str] = raw_element.get("ccReceivers")
self.bcc_receivers: List[str] = raw_element.get("bccReceivers")


class HipChatNotificationConfig(Notification):
def _create_from_raw_data(self, raw_element):
self.id: str = raw_element.get("id")
Expand All @@ -52,6 +55,7 @@ def _create_from_raw_data(self, raw_element):
self.url: str = raw_element.get("url")
self.message: str = raw_element.get("message")


class JiraNotificationConfig(Notification):
def _create_from_raw_data(self, raw_element):
self.id: str = raw_element.get("id")
Expand All @@ -67,6 +71,7 @@ def _create_from_raw_data(self, raw_element):
self.summary: str = raw_element.get("summary")
self.description: str = raw_element.get("description")


class OpsGenieNotificationConfig(Notification):
def _create_from_raw_data(self, raw_element):
self.id: str = raw_element.get("id")
Expand All @@ -78,6 +83,7 @@ def _create_from_raw_data(self, raw_element):
self.domain: str = raw_element.get("domain")
self.message: str = raw_element.get("message")


class PagerDutyNotificationConfig(Notification):
def _create_from_raw_data(self, raw_element):
self.id: str = raw_element.get("id")
Expand All @@ -89,6 +95,7 @@ def _create_from_raw_data(self, raw_element):
self.service_api_key: str = raw_element.get("serviceApiKey")
self.service_name: str = raw_element.get("serviceName")


class ServiceNowNotificationConfig(Notification):
def _create_from_raw_data(self, raw_element):
self.id: str = raw_element.get("id")
Expand All @@ -104,6 +111,7 @@ def _create_from_raw_data(self, raw_element):
self.send_incidents: bool = raw_element.get("sendIncidents")
self.send_events: bool = raw_element.get("sendEvents")


class SlackNotificationConfig(Notification):
def _create_from_raw_data(self, raw_element):
self.id: str = raw_element.get("id")
Expand All @@ -115,6 +123,7 @@ def _create_from_raw_data(self, raw_element):
self.channel: str = raw_element.get("channel")
self.title: str = raw_element.get("title")


class TrelloNotificationConfig(Notification):
def _create_from_raw_data(self, raw_element):
self.id: str = raw_element.get("id")
Expand All @@ -130,6 +139,7 @@ def _create_from_raw_data(self, raw_element):
self.text: str = raw_element.get("text")
self.description: str = raw_element.get("description")


class VictorOpsNotificationConfig(Notification):
def _create_from_raw_data(self, raw_element):
self.id: str = raw_element.get("id")
Expand All @@ -141,11 +151,13 @@ def _create_from_raw_data(self, raw_element):
self.routing_key: str = raw_element.get("routingKey")
self.message: str = raw_element.get("message")


class HttpHeader(DynatraceObject):
def _create_from_raw_data(self, raw_element):
self.name: str = raw_element.get("name")
self.value: str = raw_element.get("value")


class WebHookNotificationConfig(Notification):
def _create_from_raw_data(self, raw_element):
self.id: str = raw_element.get("id")
Expand All @@ -159,6 +171,7 @@ def _create_from_raw_data(self, raw_element):
self.headers: List[HttpHeader] = [HttpHeader(raw_element=header) for header in raw_element.get("headers", {})]
self.notify_event_merges_enabled: bool = raw_element.get("notifyEventMergesEnabled")


class XMattersNotificationConfig(Notification):
def _create_from_raw_data(self, raw_element):
self.id: str = raw_element.get("id")
Expand All @@ -171,6 +184,7 @@ def _create_from_raw_data(self, raw_element):
self.headers: List[HttpHeader] = [HttpHeader(raw_element=header) for header in raw_element.get("headers", {})]
self.payload: str = raw_element.get("payload")


class NotificationConfigStub(DynatraceObject):
def get_full_configuration(self) -> Notification:
"""
Expand Down Expand Up @@ -217,6 +231,7 @@ def _create_from_raw_data(self, raw_element):
self.description = raw_element.get("description")
self.notification_type = raw_element.get("type")


class NotificationService:
def __init__(self, http_client: HttpClient):
self.__http_client = http_client
Expand Down
2 changes: 1 addition & 1 deletion dynatrace/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,4 @@ def __init__(
self.third_part_synthetic_tests: ThirdPartySyntheticTestsService = ThirdPartySyntheticTestsService(self.__http_client)
self.tokens: TokenService = TokenService(self.__http_client)
self.maintenance_windows = MaintenanceWindowService(self.__http_client)
self.anomaly_detection_metric_events = MetricEventService(self.__http_client)
self.anomaly_detection_metric_events = MetricEventService(self.__http_client)

0 comments on commit 3ed4514

Please sign in to comment.