Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dashboard operations + add audit log enums #92

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

setup(
name="dt",
version="1.1.63",
version="1.1.65",
packages=find_packages(),
install_requires=["requests>=2.22"],
tests_require=["pytest", "mock", "tox"],
Expand Down
Loading