Skip to content

Commit dfd9d52

Browse files
authored
Virtualization endpoint actions (#8)
* added limit and offset params to all actions * bump pack version * added changes file * POST Request Support and new actions for netbox 2.1.0 (#4) * Added action to get available IPs within a prefix * Added action for available IP POST request * Bumped version number to 0.2.1 * changed version number as per request * minor documentation fixes * minor fixes for circleci * removed extraneous whitespace * removed more extraneous whitespace * removed all of the extraneous whitespace * 'fixed' email address * removed email address * added role to devices (#5) * first pass on storing results in keystore * updated keynames * added params to all get actions * added changelog entry and version bumb * added virtualization endpoints and id detail routes * updated readme * added put, post, patch for virtual machine interfaces * added interface connections to readme * changed status to type integer * fix clusters typo
1 parent 55c55a9 commit dfd9d52

27 files changed

+588
-6
lines changed

CHANGES.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
# Change Log
2+
## 0.4.0
3+
- Added support for virtualization enpoints
4+
- GET: clusters, cluster groups, cluster types, virtual machine interfaces, virtual machines
5+
- POST, PUT, PATCH: virtual machines, virtual machine interfaces
6+
- Added support for converting to the detail route by passing the `id` parameter on all applicable endpoints. This converts the api route to `<endpoint_uri>/<id>/` which will always return a max of one entity, instead of a list of zero or more entities.
27
## 0.3.2
38
- Added new action for getting device interface connections.
49
## 0.3.0

README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ is loaded.
2626
### DCIM
2727
- **dcim\_get\_devices**: Get device(s) via optional parameters
2828
- **dcim\_get\_interfaces**: Get interface(s) via optional parameters
29+
- **dcim\_get\_interface_connections**: Get interface connection(s) via optional parameters
2930
- **dcim\_get\_sites**: Get site(s) via optional parameters
3031

3132
### IPAM
@@ -36,3 +37,16 @@ is loaded.
3637
- **ipam\_get\_prefixes**: Get Prefix(es) via optional parameters
3738
- **ipam\_get\_available_ips**: Get available IP Address(es) within a prefix
3839
- **ipam\_post\_available_ips**: POST request to create an object assigned to the first available IP address within a given prefix
40+
41+
### Virtualization
42+
- **virtualization\_get\_cluster\_groups**: Get Cluster Group(s) via optional parameters
43+
- **virtualization\_get\_cluster\_types**: Get Cluster Type(s) via optional parameters
44+
- **virtualization\_get\_clusters**: Get Cluster(s) via optional parameters
45+
- **virtualization\_get\_interfaces**: Get Virtual Machine Interface(s) via optional parameters
46+
- **virtualization\_post\_interfaces**: POST request to create a new Virtual Machine Inteface
47+
- **virtualization\_put\_interfaces**: PUT request to replace a Virtual Machine Interface
48+
- **virtualization\_patch\_interfaces**: PATCH request to update a Virtual Machine Interface
49+
- **virtualization\_get\_virtual_machines**: Get Virtual Machine(s) via optional parameters
50+
- **virtualization\_post\_virtual_machines**: POST request to create a new Virtual Machine
51+
- **virtualization\_put\_virtual_machines**: PUT request to replace a Virtual Machine
52+
- **virtualization\_patch\_virtual_machines**: PATCH request to update a Virtual Machine

actions/base_patch_action.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
2+
from lib.action import NetboxBaseAction
3+
4+
5+
class NetboxBasePatchAction(NetboxBaseAction):
6+
"""Base patch action"""
7+
8+
def run(self, endpoint_uri, **kwargs):
9+
"""Base patch action
10+
endpoint_uri is pased from metadata file
11+
"""
12+
return self.patch(endpoint_uri, **kwargs)

actions/base_post_action.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33

44

55
class NetboxBasePostAction(NetboxBaseAction):
6-
"""Base get action"""
6+
"""Base post action"""
77

88
def run(self, endpoint_uri, **kwargs):
9-
"""Base get action
9+
"""Base post action
1010
endpoint_uri is pased from metadata file
1111
"""
1212
return self.post(endpoint_uri, **kwargs)

actions/base_put_action.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
2+
from lib.action import NetboxBaseAction
3+
4+
5+
class NetboxBasePutAction(NetboxBaseAction):
6+
"""Base put action"""
7+
8+
def run(self, endpoint_uri, **kwargs):
9+
"""Base put action
10+
endpoint_uri is pased from metadata file
11+
"""
12+
return self.put(endpoint_uri, **kwargs)

actions/dcim_get_devices.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ parameters:
99
endpoint_uri:
1010
immutable: true
1111
default: /api/dcim/devices/
12+
id:
13+
type: integer
14+
description: "If provided, will convert to using the detail route. I.e., <endpoint_uri>/<id>/, meaning a max of one entity will be returned and all other entity query parameters will be ignored."
1215
name:
1316
type: string
1417
description: Name of the device

actions/dcim_get_interfaces.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ parameters:
99
endpoint_uri:
1010
immutable: true
1111
default: /api/dcim/interfaces/
12+
id:
13+
type: integer
14+
description: "If provided, will convert to using the detail route. I.e., <endpoint_uri>/<id>/, meaning a max of one entity will be returned and all other entity query parameters will be ignored."
1215
form_factor:
1316
type: integer
1417
description: Form factor value

actions/dcim_get_sites.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ parameters:
99
endpoint_uri:
1010
immutable: true
1111
default: /api/dcim/sites/
12+
id:
13+
type: integer
14+
description: "If provided, will convert to using the detail route. I.e., <endpoint_uri>/<id>/, meaning a max of one entity will be returned and all other entity query parameters will be ignored."
1215
name:
1316
type: string
1417
description: Name of the site

actions/ipam_get_ip_addresses.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ parameters:
99
endpoint_uri:
1010
immutable: true
1111
default: /api/ipam/ip-addresses/
12+
id:
13+
type: integer
14+
description: "If provided, will convert to using the detail route. I.e., <endpoint_uri>/<id>/, meaning a max of one entity will be returned and all other entity query parameters will be ignored."
1215
family:
1316
type: string
1417
description: IP Address family

actions/ipam_get_prefixes.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ parameters:
99
endpoint_uri:
1010
immutable: true
1111
default: /api/ipam/prefixes/
12+
id:
13+
type: integer
14+
description: "If provided, will convert to using the detail route. I.e., <endpoint_uri>/<id>/, meaning a max of one entity will be returned and all other entity query parameters will be ignored."
1215
family:
1316
type: string
1417
description: Prefix family

0 commit comments

Comments
 (0)