Skip to content

Feat/initialize api - #208

Merged
untergeek merged 10 commits into
release/0.5.3from
feat/initialize_api
Sep 10, 2026
Merged

untergeek merged 10 commits into
release/0.5.3from
feat/initialize_api

Conversation

@Codyjackson0321

Copy link
Copy Markdown
Collaborator

Added REST API, REST API documentation, and extensive tests

Includes:

  • Pipelines CRUD + Simulate
  • Policies CRUD + Deploy
  • SNMP CRUD + Deploy
  • Connections CRD + Testing connections

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

There are a few concrete correctness/contract issues (notably request body parsing for form-encoded inputs, deploy atomicity, and tests/docs that currently permit or describe incorrect behavior) that should be fixed before approval.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

This PR introduces a new Django API app that exposes a REST API surface for LogstashUI (connections, pipelines/policies, SNMP CRUD/deploy, and security/bootstrap/users/API keys), updates UI copy around API tokens to point to REST docs, and adds extensive unit test coverage for the new endpoints.

Changes:

  • Added REST API routing (/api/) and a new API Django app with auth helpers and endpoint implementations.
  • Added comprehensive unit tests for REST endpoints (security, connections, pipelines, policies, SNMP).
  • Updated API-token UI/UX and documentation structure to reference the new REST API reference.
File summaries
File Description
tests/Management/unit/test_api_tokens.py Adjusts token UI expectations to link to REST docs and validates no legacy endpoint copy leaks.
tests/API/unit/test_snmp_views.py Adds REST SNMP device endpoint tests (list/create/read/update/delete + edge cases).
tests/API/unit/test_snmp_templates.py Adds REST SNMP template endpoint tests.
tests/API/unit/test_snmp_profiles.py Adds REST SNMP profile endpoint tests.
tests/API/unit/test_snmp_networks.py Adds REST SNMP network endpoint tests.
tests/API/unit/test_snmp_credentials.py Adds REST SNMP credential endpoint tests (including secret-masking expectations).
tests/API/unit/test_security_views.py Adds REST security endpoint tests (bootstrap/me/users/keys).
tests/API/unit/test_policies_views.py Adds REST policy endpoint tests (CRUD/deploy/clone/diff/tokens).
tests/API/unit/test_pipelines_views.py Adds REST pipeline endpoint tests (agent pipelines, ES pipelines, simulate).
tests/API/unit/test_connections_views.py Adds REST connection endpoint tests (CRUD + test connectivity).
tests/API/unit/init.py Establishes API test package structure.
tests/API/init.py Establishes API test package structure.
src/logstashui/SNMP/snmp_crud.py Updates SNMP deploy stamping so “no changes” deploys still clear undeployed state.
src/logstashui/PipelineManager/models.py Updates Connection validation to tolerate partial updates without resubmitted credentials.
src/logstashui/PipelineManager/forms.py Preserves encrypted credentials across partial updates by snapshotting originals pre-clean.
src/logstashui/Management/templates/components/api_token_created.html Replaces inline curl example with link to REST API documentation.
src/logstashui/Management/templates/api_tokens.html Moves token copy logic onto the page so it works after HTMX swaps.
src/logstashui/LogstashUI/urls.py Adds /api/ route inclusion for the new REST API app.
src/logstashui/LogstashUI/settings.py Registers API app and whitelists /api/ in unauthenticated path handling.
src/logstashui/Documentation/views.py Renames docs nav entry to “REST API Reference”.
src/logstashui/API/urls.py Defines REST API URL patterns for connections, pipelines, policies, SNMP, and security.
src/logstashui/API/security_views.py Implements bootstrap/me/users/keys REST endpoints with JSON-only auth behaviors.
src/logstashui/API/pipelines_views.py Implements pipeline REST endpoints (agent + ES + simulate) and deploy logic.
src/logstashui/API/models.py Placeholder models module for the new API app.
src/logstashui/API/migrations/init.py Establishes migrations package for the new API app.
src/logstashui/API/connections_views.py Implements connection REST endpoints and partial-update support.
src/logstashui/API/auth.py Adds API auth decorators and request-body parsing helper.
src/logstashui/API/apps.py Adds Django app config for API.
src/logstashui/API/api.http Adds example REST requests for manual testing / documentation.
src/logstashui/API/admin.py Placeholder admin module for the new API app.
src/logstashui/API/init.py Establishes API app package.
docs/docs/logstashui/index.md Updates docs index to point to REST API reference.
docs/docs/logstashui/api_access.md Removes legacy “API Access” doc in favor of REST API reference.
Review details

Suppressed comments (3)

tests/API/unit/test_snmp_views.py:429

  • Same issue as above: allowing 500 here can mask an unhandled IntegrityError/ValueError path. If the API guarantees JSON errors, assert a non-500 client error status.
    tests/API/unit/test_snmp_views.py:438
  • Same issue as above: allowing 500 here can mask an unhandled FK error. Tests should fail on 500 to enforce graceful error handling.
    tests/API/unit/test_snmp_views.py:446
  • Same issue as above: allowing 500 here can hide an unhandled exception path. This should assert the API returns a handled client error, not 500.
  • Files reviewed: 32/36 changed files
  • Comments generated: 6
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/logstashui/API/pipelines_views.py
Comment thread src/logstashui/API/auth.py Outdated
Comment thread tests/API/unit/test_snmp_credentials.py
Comment thread tests/API/unit/test_snmp_views.py
Comment thread src/logstashui/API/api.http Outdated
}

###
# Update a connection (credentials must be re-supplied; connectivity is re-tested)
Comment thread src/logstashui/API/api.http Outdated
Codyjackson0321 and others added 5 commits September 10, 2026 17:40
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Comment thread src/logstashui/API/pipelines_views.py

@untergeek untergeek left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM™

@untergeek
untergeek merged commit 925347e into release/0.5.3 Sep 10, 2026
1 of 2 checks passed
@untergeek
untergeek deleted the feat/initialize_api branch September 10, 2026 22:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants