Skip to content

Commit

Permalink
Merge pull request #92 from Dynatrace-James-Kitson/kitson
Browse files Browse the repository at this point in the history
Dashboard operations + add audit log enums
  • Loading branch information
Dynatrace-James-Kitson authored Oct 30, 2024
2 parents 620213c + 667653b commit ccc9e28
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
10 changes: 9 additions & 1 deletion dynatrace/configuration_v1/dashboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def list(self, owner: str = None, tags: List[str] = None) -> PaginatedList["Dash
The dashboard must match all the specified tags.
"""
params = {"owner": owner, "tags": tags}
return PaginatedList(DashboardStub, self.__http_client, f"/api/config/v1/dashboards", params, list_item="dashboards")
return PaginatedList(DashboardStub, self.__http_client, "/api/config/v1/dashboards", params, list_item="dashboards")

def get(self, dashboard_id: str) -> "Dashboard":
"""
Expand All @@ -45,6 +45,13 @@ def get(self, dashboard_id: str) -> "Dashboard":
response = self.__http_client.make_request(f"/api/config/v1/dashboards/{dashboard_id}").json()
return Dashboard(self.__http_client, None, response)

def post(self, body: dict):
return self.__http_client.make_request("/api/config/v1/dashboards", params=body, method="POST")

def put(self, dashboard_id: str, body: dict):
params = {"id": dashboard_id, "body": body}
return self.__http_client.make_request(f"/api/config/v1/dashboards/{dashboard_id}", params=params, method="PUT")

def delete(self, dashboard_id: str) -> Response:
"""
Deletes the specified dashboard
Expand Down Expand Up @@ -80,6 +87,7 @@ def _create_from_raw_data(self, raw_element):
self.id: str = raw_element.get("id")
self.dashboard_metadata: DashboardMetadata = DashboardMetadata(self._http_client, None, raw_element.get("dashboardMetadata"))
self.tiles: List[Tile] = [Tile(self._http_client, None, raw_tile) for raw_tile in raw_element.get("tiles", [])]
self.raw_json: dict = raw_element


class DashboardStub(DynatraceObject):
Expand Down
6 changes: 6 additions & 0 deletions dynatrace/environment_v2/audit_logs.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,19 @@ class EventType(Enum):
POST = "POST"
PUT = "PUT"
READ = "READ"
REMOTE_CONFIGURATION_MANAGEMENT = "REMOTE_CONFIGURATION_MANAGEMENT"
REVOKE = "REVOKE"
TAG_ADD = "TAG_ADD"
TAG_REMOVE = "TAG_REMOVE"
TAG_UPDATE = "TAG_UPDATE"
UPDATE = "UPDATE"


class Category(Enum):
ACTIVEGATE_TOKEN = "ACTIVEGATE_TOKEN"
CONFIG = "CONFIG"
DEBUG_UI = "DEBUG_UI"
MANUAL_TAGGING_SERVICE = "MANUAL_TAGGING_SERVICE"
REST = "REST"
TOKEN = "TOKEN"
WEB_UI = "WEB_UI"
Expand Down

0 comments on commit ccc9e28

Please sign in to comment.