-
Notifications
You must be signed in to change notification settings - Fork 2
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
feat: OBS-397 - [NetBox Diode Plugin] create API endpoint for retrieving NetBox object state #44
feat: OBS-397 - [NetBox Diode Plugin] create API endpoint for retrieving NetBox object state #44
Conversation
Julio-Oliveira-Encora
commented
Feb 23, 2024
•
edited
Loading
edited
- Add endpoint "/api/plugins/diode/object-state/";
- Parameter object_type is mandatory.
- Parameters must have q or ID.
- Endpoint returns only one object per request.
- The q parameter uses CachedValue to get the object ID, and then the cache must be updated.
- If there is any error in the payload, return 400.
- If the query is empty, the endpoint returns 200 and an empty list.
…g-netbox-object-state
…g-netbox-object-state
- Some tests with parameters.
…g-netbox-object-state
- Some tests with parameters.
Added obj_type verification (required)
Updated view to use the models according to object type
…g-netbox-object-state
Added some initial tests.
OBS-397 Create API endpoint for retrieving NetBox object state
In the NetBox diode plugin, create API endpoint We want to utilise existing NetBox core search functionality (see: https://github.com/netbox-community/netbox/blob/develop/netbox/netbox/views/misc.py#L65), so we should be able to support following query params:
The endpoint should return single exact object state (if found) or an empty result (200 OK in both cases, unless it's a server side error then 5xx). We should use The response containing found object, should also include its latest known Response structure:
Example for
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @Julio-Oliveira-Encora, to start with, could you please resolve linting issues detected by ruff and commented here https://github.com/netboxlabs/diode/pull/44/files?
Can you also add instructions how do you run these tests on local environment, i.e. add instruction in the diode-netbox-plugin/README.md
?