Skip to content
This repository was archived by the owner on Jun 27, 2025. It is now read-only.

Commit bb4ecd3

Browse files
authored
Rack elevation API call (#15)
1 parent d94a96c commit bb4ecd3

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

netbox_python/api/dcim.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from netbox_python.baseapi import APIResource, CreateableAPIResource
1+
from netbox_python.baseapi import APIResource, CreateableAPIResource, ElevationAPIResource
22
from netbox_python.rest import Result
33

44

@@ -156,6 +156,13 @@ class _rack_roles(APIResource):
156156
class _racks(APIResource):
157157
path = "dcim/racks/"
158158

159+
def __init__(self, client):
160+
self.elevation = self._elevation(client)
161+
super().__init__(client)
162+
163+
class _elevation(ElevationAPIResource):
164+
path = "dcim/racks/{id}/elevation/"
165+
159166
class _rear_port_templates(APIResource):
160167
path = "dcim/rear-port-templates/"
161168

netbox_python/baseapi.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,3 +113,15 @@ def list(self, id: str | int, **kwargs) -> Result:
113113
def all(self, id: str | int, **kwargs):
114114
path = self.path.format(id=id)
115115
return self._all(path, **kwargs)
116+
117+
class ElevationAPIResource(
118+
baseapi,
119+
ListableAPIResource
120+
):
121+
def list(self, id: str | int, **kwargs) -> Result:
122+
path = self.path.format(id=id)
123+
return self._list(path, **kwargs)
124+
125+
def all(self, id: str | int, **kwargs):
126+
path = self.path.format(id=id)
127+
return self._all(path, **kwargs)

0 commit comments

Comments
 (0)