Skip to content

Commit 636d67d

Browse files
authored
Merge pull request #168 from netboxlabs/0.2.0-docs
Update docs for 0.2.0
2 parents 1178246 + 1bc72cd commit 636d67d

File tree

4 files changed

+83
-65
lines changed

4 files changed

+83
-65
lines changed

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ You can find further documentation [here](https://github.com/netboxlabs/netbox-c
66

77
## Requirements
88

9-
* NetBox v4.2 or later
9+
* NetBox v4.4-beta or later
1010

1111
## Installation
1212

@@ -30,11 +30,12 @@ PLUGINS = [
3030
```
3131
$ ./manage.py migrate
3232
```
33+
3334
4. Restart NetBox
3435
```
3536
sudo systemctl restart netbox netbox-rq
3637
```
3738

3839
## Known Limitations
3940

40-
The Public Preview of NetBox Custom Objects is under active development as we proceed towards the General Availability release around NetBox 4.4. The best place to look for the latest list of known limitations is the [issues](https://github.com/netboxlabs/netbox-custom-objects/issues) list on the GitHub repository. These include features like Tags, Import/Export, Bulk Edit, Text Search and Branching.
41+
The Public Preview of NetBox Custom Objects is under active development as we proceed towards the General Availability release around NetBox 4.4. The best place to look for the latest list of known limitations is the [issues](https://github.com/netboxlabs/netbox-custom-objects/issues) list on the GitHub repository.

SECURITY.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33
## Reporting a Vulnerability
44

5-
Please send any suspected vulnerability report to [email protected]
5+
Please send any suspected vulnerability report to [[email protected]](mailto:[email protected])

docs/api.md

Lines changed: 39 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ similar to the following:
2828
### Custom Object Type Fields
2929

3030
Define the schema of the Custom Object Type by creating fields of various types, with POST requests to
31-
`/api/plugins/custom-objects/custom-object-type-fields/`:
31+
`/api/plugins/custom-objects/custom-object-type-fields/`, referencing the ID of the Custom Object Type you just created:
3232

3333
```json
3434
{
@@ -166,8 +166,44 @@ The response will include the created object with its assigned ID and additional
166166
}
167167
```
168168

169-
PATCH requests can be used to update all the above objects, as well as DELETE and GET operations, using the detail
170-
URL for each model:
169+
### API output in the browser
170+
171+
As with other NetBox objects, you can also view the API output for given Custom Objects by prepending `api/` to the URL, e.g. `api/plugins/custom-objects/dhcp_scope/`
172+
173+
```
174+
HTTP 200 OK
175+
Allow: GET, POST, HEAD, OPTIONS
176+
Content-Type: application/json
177+
Vary: Accept
178+
179+
{
180+
"count": 1,
181+
"next": null,
182+
"previous": null,
183+
"results": [
184+
{
185+
"id": 1,
186+
"url": "http://localhost:8001/api/plugins/custom-objects/dhcp_scope/1/",
187+
"range": {
188+
"id": 1,
189+
"url": "http://localhost:8001/api/ipam/ip-ranges/1/",
190+
"display": "192.168.0.1-100/24",
191+
"family": {
192+
"value": 4,
193+
"label": "IPv4"
194+
},
195+
"start_address": "192.168.0.1/24",
196+
"end_address": "192.168.0.100/24",
197+
"description": ""
198+
}
199+
}
200+
]
201+
}
202+
```
203+
204+
### Other operations
205+
206+
`PATCH`, `DELETE` and `GET` requests can be used on all of the above, using the detail URL for each model:
171207
- Custom Object Types: `/api/plugins/custom-objects/custom-object-types/15/`
172208
- Custom Object Type Fields: `/api/plugins/custom-objects/custom-object-type-fields/23/`
173209
- Custom Objects: `/api/plugins/custom-objects/<custom-object-type>/15/`

docs/index.md

Lines changed: 40 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,36 @@
11
# NetBox Custom Objects
22

3-
[NetBox](https://github.com/netbox-community/netbox) is the world's leading source of truth for infrastructure, featuring an extensive and complex data model. But sometimes it can be useful to extend the NetBox data model to fit specific organizational needs. This plugin introduces a new paradigm for NetBox to help overcome these challenges: custom objects.
3+
[NetBox](https://github.com/netbox-community/netbox) is the world's leading source of truth for infrastructure, featuring an extensive data model. Sometimes it can be useful to extend the NetBox data model to fit specific organizational needs. The Custom Objects plugin introduces a new paradigm for NetBox to help overcome these challenges, allowing NetBox adminstrators to extend the NetBox data model without writing a line of code.
44

55
For additional documentation on the REST API, go [here](api.md).
66

7-
## Features
8-
9-
* Easily create new objects in NetBox - via the GUI, the REST API or `pynetbox`
10-
11-
* Each custom object inherits standard NetBox model functionality like REST APIs, list views, detail views and more
7+
> [!TIP]
8+
> NetBox Custom Objects is still in Public Preview. If you hit any problems please check the [exiting issues](https://github.com/netboxlabs/netbox-custom-objects/issues) before creating a new one. If you're unsure, start a [discussion](https://github.com/netboxlabs/netbox-custom-objects/discussions).
129
13-
* Custom Objects can include fields of all standard types, like text, decimal, integer, boolean, choicesets, and more, but can also have 1-1 and 1-many fields to core NetBox models, plugin models and other Custom Object Types you have created.
10+
## Features
1411

15-
* Fields on Custom Objects can model additional behaviour like uniqueness, default values, layout hints, required fields, and more.
12+
* Easily create new object types in NetBox - via the GUI, the REST API or `pynetbox`
13+
14+
* Each Custom Object Type inherits standard NetBox model functionality including:
15+
* List views, details views, etc
16+
* Group-able fields
17+
* An entry in the left pane for intuitive navigation
18+
* Create Custom Fields that point to Custom Object Types
19+
* REST APIs
20+
* Search
21+
* Changelogging
22+
* Bookmarks
23+
* Custom Links
24+
* Cloning
25+
* Import/Export
26+
* EventRules
27+
* Notifications
28+
* Journaling
29+
* Tags
30+
31+
* Custom Object Types can include 1-1 and 1-many Custom Object Type Fields of all standard types, like text, decimal, integer, boolean, etc, and can also include fields of choiceset, core NetBox models, plugin models and other Custom Object Types you have created.
32+
33+
* Custom Object Type Fields can model additional behaviour like uniqueness, default values, layout hints, required fields, and more.
1634

1735
## Terminology
1836

@@ -33,7 +51,7 @@ Let's walk through the above DHCP Scope example, to highlight the steps involved
3351
2. Choose a name for your Custom Object Type. In this case we will choose `dhcp_scope`
3452

3553
> [!TIP]
36-
> Give your Custom Object Types URL friendly names
54+
> Give your Custom Object Types URL friendly names
3755
3856
> [!TIP]
3957
> By default the plural name for your Custom Object Type will be its name with `s` appended. So for example, multiple `dhcp_scope` Custom Objects will be referred to as `dhcp_scopes`.
@@ -49,83 +67,46 @@ Let's walk through the above DHCP Scope example, to highlight the steps involved
4967
> The `Primary` flag on Custom Object Type Fields is used for Custom Object naming. By default when you create a Custom Object it will be called `<Custom Object Type Name> <Custom Object ID>`. So in this example the first `dhcp_scope` we create would be called `dhcp_scope 1` and so on.
5068
> Setting `Primary` to `true` on a Custom Object Type Field causes the value of that field to be used as the name for the Custom Object.
5169
70+
> [!TIP]
71+
> Uniqueness cannot be enforced for Custom Object Type Fields of type `MultiObject` or `boolean`
72+
73+
5274
2. Specify a `Name` for your field, in this case we'll choose a URL friendly value: `range`.
5375
3. Specify the `Label` for your field. This is a human readable name that will be used in the GUI. In this case we'll choose `DHCP Range`.
5476
4. Choose a `Type` for your field. In this case we want our `range` field to be a 1-1 reference to a built-in NetBox object type, so we choose `Object`.
5577
5. Then we need to specify which type of built-in object our `range` field will reference. Scroll down to `Related object type` and choose `IPAM > IP Range`.
5678
6. Then click `Create`.
5779

58-
> [!NOTE]
59-
> Some behaviour on Custom Object Type Fields is still under active development during the Public Preview. Please check the outstanding [issues](https://github.com/netboxlabs/netbox-custom-objects/issues) and [discussions](https://github.com/netboxlabs/netbox-custom-objects/discussions) before creating a new one.
80+
6081

6182
### Interacting with Custom Objects
6283

6384
Typically, NetBox admins would be responsible for thinking through modelling requirements, and creating new Custom Object Types for other users to use in their day to day work. You have now created a new `DHCP Scope` Custom Object Type, so let's look at how others would interact with them.
6485

65-
> [!NOTE]
66-
> When NetBox Custom Objects reaches General Availability, it will be possible to add new Custom Object Types in the left navigation pane, like other core NetBox or Plugin objects. Until then the instructions below outline the correct approach.
67-
6886
#### Creating a new Custom Object
6987

7088
Now that you've created your `DHCP Scope` Custom Object Type, let's go ahead and create a new `DHCP Scope`.
7189

72-
1. On the DHCP Scope detail view, click `+ Add` in the bottom right
90+
1. Under the NetBox Custom Objects plugin in the left side navigation you will now see `Dhcp_scopes`. Click on `+` next to your new Custom Object Type.
7391
2. As you added a single field, called `Range` of type `IPAM > IP Range` you are prompted to specify a range. Go and ahead and select one, then click `Create`.
74-
3. You'll now see that your new `dhcp_scope` has been added into the list view at the bottom of the `DHCP Scope` Custom Object Type page.
92+
3. You're now taken to the detail view for your new `DHCP Scope` object.
7593

7694
#### Standard list views for Custom Objects
7795

78-
As you saw in the previous step, all Custom Objects of a given Custom Object Type are viewable at the bottom of the Custom Object Type's detail page, but you can also view standard list views:
79-
80-
1. On the `DHCP Scope` detail view page, right click on `Dhcp_scopes` (you can also navigate to `plugins/custom-objects/dhcp_scope/`)
81-
2. Now you will see a standard NetBox list view of your `dhcp_scopes` with the standard options including `Configure Table`, `+ Add`, etc
82-
83-
> [!NOTE]
84-
> When NetBox Custom Objects reaches General Availability, it will be possible to navigate to Custom Object list views in the left navigation pane, as with core NetBox or Plugin objects. Until then the instructions above outline the correct approach.
85-
86-
3. As with other NetBox objects, you can also view the API output for given Custom Objects by prepending `api/` to the URL, e.g. `api/plugins/custom-objects/dhcp_scope/`
87-
88-
```
89-
HTTP 200 OK
90-
Allow: GET, POST, HEAD, OPTIONS
91-
Content-Type: application/json
92-
Vary: Accept
93-
94-
{
95-
"count": 1,
96-
"next": null,
97-
"previous": null,
98-
"results": [
99-
{
100-
"id": 1,
101-
"url": "http://localhost:8001/api/plugins/custom-objects/dhcp_scope/1/",
102-
"range": {
103-
"id": 1,
104-
"url": "http://localhost:8001/api/ipam/ip-ranges/1/",
105-
"display": "192.168.0.1-100/24",
106-
"family": {
107-
"value": 4,
108-
"label": "IPv4"
109-
},
110-
"start_address": "192.168.0.1/24",
111-
"end_address": "192.168.0.100/24",
112-
"description": ""
113-
}
114-
}
115-
]
116-
}
117-
```
96+
As with core NetBox objects, Custom Objects have their own list views. To see all your `DHCP Scopes` you can just click on your Custom Object Type in the Custom Object plugin section in the left side navigation. In the example above, click on `Custom Objects` -> `OBJECTS` -> `Dhcp_scopes`
97+
98+
You will now see a standard NetBox list view for your new Custom Objects with the standard options including `Configure Table`, `+ Add`, Import, Export, etc
11899

119100
### Deletions
120101

121102
#### Deleting Custom Object Types
122103

123-
When deleting a Custom Object Type, you are in effect, deleting an entire table in the database and should be done with caution. You will be warned about the impact of before you proceed, and this is why we suggest that only admins should be allowed to interact with Custom Objects Types.
104+
When deleting a Custom Object Type, you are in effect, deleting an entire table in the database and this should be done with caution. You will be warned about the impact of before you proceed, and this is why we suggest that only admins should be allowed to interact with Custom Objects Types.
124105

125106
#### Deleting Custom Object Type Fields
126107

127-
When deleting a Custom Object Type Field, you are in effect, deleting an entire column in the database and should be done with caution. You will be warned about the impact of before you proceed, and this is why we suggest that only admins should be allowed to interact with Custom Objects Type Fields.
108+
When deleting a Custom Object Type Field, you are in effect, deleting an entire column in the database and this should be done with caution. You will be warned about the impact of before you proceed, and this is why we suggest that only admins should be allowed to interact with Custom Objects Type Fields.
128109

129110
#### Deleting Custom Objects
130111

131-
Deleting Custom Objects, like a specific DHCP Scope object you have created, works just like it does for normal NetBox objects. You can delete a Custom Object on the Custom Object's detail view, or via one of the two list views. We recommend that you follow your usual permissions practices here.
112+
Deleting Custom Objects, like a specific DHCP Scope object you have created, works just like it does for normal NetBox objects. You can delete a Custom Object on the Custom Object's detail view, or via the list view. We recommend that you follow your usual permissions practices here.

0 commit comments

Comments
 (0)