@@ -74,6 +74,15 @@ def update_ip(self, ip_address, **kwargs):
7474 raise exceptions .NotFoundException ('ip: {}' .format (ip_address )) from None
7575 return self .netbox_con .patch ('/ipam/ip-addresses/' , ip_id , ** kwargs )
7676
77+ def update_ip_by_id (self , ip_id , ** kwargs ):
78+ """Update ip address
79+
80+ :param ip_id: ip id to update
81+ :param kwargs: requests body dict
82+ :return: bool True if successful otherwise raise UpdateException
83+ """
84+ return self .netbox_con .patch ('/ipam/ip-addresses/' , ip_id , ** kwargs )
85+
7786 def delete_ip_address (self , ip_address ):
7887 """Delete IP address
7988
@@ -122,6 +131,14 @@ def delete_ip_prefix(self, **kwargs):
122131 raise exceptions .NotFoundException ('ip-prefix' ) from None
123132 return self .netbox_con .delete ('/ipam/prefixes/' , ip_prefix_id )
124133
134+ def delete_ip_prefix_by_id (self , ip_prefix_id ):
135+ """Delete IP prefix
136+
137+ :param ip_prefix_id: Delete prefix based on id
138+ :return: bool True if successful otherwise raise DeleteException
139+ """
140+ return self .netbox_con .delete ('/ipam/prefixes/' , ip_prefix_id )
141+
125142 def update_ip_prefix (self , ip_prefix , ** kwargs ):
126143 """Update ip address
127144
@@ -135,6 +152,15 @@ def update_ip_prefix(self, ip_prefix, **kwargs):
135152 raise exceptions .NotFoundException ('ip-prefix: {}' .format (ip_prefix )) from None
136153 return self .netbox_con .patch ('/ipam/prefixes/' , ip_prefix_id , ** kwargs )
137154
155+ def update_ip_prefix_by_id (self , ip_prefix_id , ** kwargs ):
156+ """Update ip address
157+
158+ :param ip_prefix_id: ip prefix to update
159+ :param kwargs: requests body dict
160+ :return: bool True if successful otherwise raise UpdateException
161+ """
162+ return self .netbox_con .patch ('/ipam/prefixes/' , ip_prefix_id , ** kwargs )
163+
138164 def get_next_available_ip (self , ** kwargs ):
139165 """Return next available ip in prefix
140166
@@ -176,6 +202,14 @@ def delete_vrf(self, vrf_name):
176202 raise exceptions .NotFoundException ('vrf: {}' .format (vrf_name )) from None
177203 return self .netbox_con .delete ('/ipam/vrfs/' , vrf_id )
178204
205+ def delete_vrf_by_id (self , vrf_id ):
206+ """Delete vrf
207+
208+ :param vrf_id: vrf to delete
209+ :return: bool True if successful otherwise raise DeleteException
210+ """
211+ return self .netbox_con .delete ('/ipam/vrfs/' , vrf_id )
212+
179213 def update_vrf (self , vrf_name , ** kwargs ):
180214 """Update vrf
181215
@@ -189,6 +223,15 @@ def update_vrf(self, vrf_name, **kwargs):
189223 raise exceptions .NotFoundException ('vrf: {}' .format (vrf_name )) from None
190224 return self .netbox_con .patch ('/ipam/vrfs/' , vrf_id , ** kwargs )
191225
226+ def update_vrf_by_id (self , vrf_id , ** kwargs ):
227+ """Update vrf
228+
229+ :param vrf_id: vrf to update
230+ :param kwargs: requests body dict
231+ :return: bool True if successful otherwise raise UpdateException
232+ """
233+ return self .netbox_con .patch ('/ipam/vrfs/' , vrf_id , ** kwargs )
234+
192235 def get_aggregates (self , ** kwargs ):
193236 """Return all aggregates"""
194237 return self .netbox_con .get ('/ipam/aggregates/' , ** kwargs )
@@ -220,6 +263,15 @@ def update_aggregate(self, prefix, **kwargs):
220263 raise exceptions .NotFoundException ('aggregate: {}' .format (prefix )) from None
221264 return self .netbox_con .patch ('/ipam/aggregates/' , aggregate_id , ** kwargs )
222265
266+ def update_aggregate_by_id (self , aggregate_id , ** kwargs ):
267+ """Update aggregate
268+
269+ :param aggregate_id: aggregate to update
270+ :param kwargs: requests body dict
271+ :return: bool True if successful otherwise raise UpdateException
272+ """
273+ return self .netbox_con .patch ('/ipam/aggregates/' , aggregate_id , ** kwargs )
274+
223275 def get_rirs (self , ** kwargs ):
224276 """Return all rirs"""
225277 return self .netbox_con .get ('/ipam/rirs/' , ** kwargs )
@@ -246,6 +298,14 @@ def delete_rir(self, rir_name):
246298 raise exceptions .NotFoundException ('rir: {}' .format (rir_name )) from None
247299 return self .netbox_con .delete ('/ipam/rirs/' , rir_id )
248300
301+ def delete_rir_by_id (self , rir_id ):
302+ """Delete rir
303+
304+ :param rir_id: rir to delete
305+ :return: bool True if successful otherwise raise DeleteException
306+ """
307+ return self .netbox_con .delete ('/ipam/rirs/' , rir_id )
308+
249309 def update_rir (self , rir_name , ** kwargs ):
250310 """Update rir
251311
@@ -259,6 +319,15 @@ def update_rir(self, rir_name, **kwargs):
259319 raise exceptions .NotFoundException ('rir: {}' .format (rir_name )) from None
260320 return self .netbox_con .patch ('/ipam/rirs/' , rir_id , ** kwargs )
261321
322+ def update_rir_by_id (self , rir_id , ** kwargs ):
323+ """Update rir
324+
325+ :param rir_id: rir to update
326+ :param kwargs: requests body dict
327+ :return: bool True if successful otherwise raise UpdateException
328+ """
329+ return self .netbox_con .patch ('/ipam/rirs/' , rir_id , ** kwargs )
330+
262331 def get_roles (self , ** kwargs ):
263332 """Return all roles"""
264333 return self .netbox_con .get ('/ipam/roles/' , ** kwargs )
@@ -285,6 +354,14 @@ def delete_role(self, role_name):
285354 raise exceptions .NotFoundException ('prefix/vlan role: {}' .format (role_name )) from None
286355 return self .netbox_con .delete ('/ipam/roles/' , role_id )
287356
357+ def delete_role_by_id (self , role_id ):
358+ """Delete prefix/vlan role
359+
360+ :param role_id: prefix/vlan role to delete
361+ :return: bool True if successful otherwise raise DeleteException
362+ """
363+ return self .netbox_con .delete ('/ipam/roles/' , role_id )
364+
288365 def update_role (self , role_name , ** kwargs ):
289366 """Update prefix role
290367
@@ -298,6 +375,15 @@ def update_role(self, role_name, **kwargs):
298375 raise exceptions .NotFoundException ('prefix/vlan role: {}' .format (role_name )) from None
299376 return self .netbox_con .patch ('/ipam/roles/' , prefix_role_id , ** kwargs )
300377
378+ def update_role_by_id (self , role_id , ** kwargs ):
379+ """Update prefix role
380+
381+ :param role_id: role to update
382+ :param kwargs: requests body dict
383+ :return: bool True if successful otherwise raise UpdateException
384+ """
385+ return self .netbox_con .patch ('/ipam/roles/' , role_id , ** kwargs )
386+
301387 def get_vlans (self , ** kwargs ):
302388 """Return all vlans"""
303389 return self .netbox_con .get ('/ipam/vlans/' , ** kwargs )
@@ -325,6 +411,14 @@ def delete_vlan(self, vid):
325411 raise exceptions .NotFoundException ('vlan: {}' .format (vid )) from None
326412 return self .netbox_con .delete ('/ipam/vlans/' , vid_id )
327413
414+ def delete_vlan_by_id (self , vlan_id ):
415+ """Delete VLAN based on VLAN ID
416+
417+ :param vlan_id: vlan id to delete
418+ :return: bool True if successful otherwise raise DeleteException
419+ """
420+ return self .netbox_con .delete ('/ipam/vlans/' , vlan_id )
421+
328422 def update_vlan (self , vlan_name , ** kwargs ):
329423 """Update vlan
330424
@@ -338,6 +432,15 @@ def update_vlan(self, vlan_name, **kwargs):
338432 raise exceptions .NotFoundException ('vlan: {}' .format (vlan_name )) from None
339433 return self .netbox_con .patch ('/ipam/vlans/' , vlan_id , ** kwargs )
340434
435+ def update_vlan_by_id (self , vlan_id , ** kwargs ):
436+ """Update vlan
437+
438+ :param vlan_id: vlan to update
439+ :param kwargs: requests body dict
440+ :return: bool True if successful otherwise raise UpdateException
441+ """
442+ return self .netbox_con .patch ('/ipam/vlans/' , vlan_id , ** kwargs )
443+
341444 def get_vlan_groups (self , ** kwargs ):
342445 """Return all vlan groups"""
343446 return self .netbox_con .get ('/ipam/vlan-groups/' , ** kwargs )
@@ -365,6 +468,14 @@ def delete_vlan_group(self, name):
365468 raise exceptions .NotFoundException ('vlan: {}' .format (name )) from None
366469 return self .netbox_con .delete ('/ipam/vlan-groups/' , vgrp_id )
367470
471+ def delete_vlan_group_by_id (self , vlan_group_id ):
472+ """Delete VLAN group
473+
474+ :param vlan_group_id: vlan-group to delete
475+ :return: bool True if successful otherwise raise DeleteException
476+ """
477+ return self .netbox_con .delete ('/ipam/vlan-groups/' , vlan_group_id )
478+
368479 def update_vlan_group (self , name , ** kwargs ):
369480 """Update vlan-group
370481
@@ -377,3 +488,12 @@ def update_vlan_group(self, name, **kwargs):
377488 except IndexError :
378489 raise exceptions .NotFoundException ('name: {}' .format (name )) from None
379490 return self .netbox_con .patch ('/ipam/vlan-groups/' , vgrp_ip , ** kwargs )
491+
492+ def update_vlan_group_by_id (self , vlan_group_id , ** kwargs ):
493+ """Update vlan-group
494+
495+ :param vlan_group_id: vlan group to update
496+ :param kwargs: arguments
497+ :return: bool True if successful otherwise raise UpdateException
498+ """
499+ return self .netbox_con .patch ('/ipam/vlan-groups/' , vlan_group_id , ** kwargs )
0 commit comments