From 3aeb9aa314360f4ae3e86c0e485020f43fed42e9 Mon Sep 17 00:00:00 2001 From: Jeff Schnitter Date: Thu, 1 Oct 2026 14:33:12 -0700 Subject: [PATCH] feat: add integrations status command Adds `cortex integrations status` which calls the new GET /api/v1/integrations/status endpoint to list all installed integrations with their connection health (VALID, INVALID, UNKNOWN). Supports --table, --csv, --filter, --sort output options. Co-Authored-By: Claude Sonnet 4.6 --- cortexapps_cli/commands/integrations.py | 31 +++++++++++++++++++++++++ tests/test_integrations_status.py | 7 ++++++ 2 files changed, 38 insertions(+) create mode 100644 tests/test_integrations_status.py diff --git a/cortexapps_cli/commands/integrations.py b/cortexapps_cli/commands/integrations.py index 3d576507..5de82515 100644 --- a/cortexapps_cli/commands/integrations.py +++ b/cortexapps_cli/commands/integrations.py @@ -3,6 +3,9 @@ import typer from typing_extensions import Annotated +from cortexapps_cli.command_options import ListCommandOptions +from cortexapps_cli.utils import print_output_with_context + import cortexapps_cli.commands.integrations_commands.apiiro as apiiro import cortexapps_cli.commands.integrations_commands.argocd as argocd import cortexapps_cli.commands.integrations_commands.aws as aws @@ -101,3 +104,31 @@ app.add_typer(wiz.app, name="wiz") app.add_typer(workday.app, name="workday") app.add_typer(xmatters.app, name="xmatters") + +@app.command() +def status( + ctx: typer.Context, + table_output: ListCommandOptions.table_output = False, + csv_output: ListCommandOptions.csv_output = False, + columns: ListCommandOptions.columns = [], + no_headers: ListCommandOptions.no_headers = False, + filters: ListCommandOptions.filters = [], + sort: ListCommandOptions.sort = [], +): + """ + List all installed integrations and their connection status + """ + + client = ctx.obj["client"] + + if (table_output or csv_output) and not ctx.params.get('columns'): + ctx.params['columns'] = [ + "Type=integrationType", + "Alias=alias", + "Status=validation.status", + "LastValidatedAt=validation.lastValidatedAt", + "Message=validation.message", + ] + + r = client.get("api/v1/integrations/status") + print_output_with_context(ctx, r) diff --git a/tests/test_integrations_status.py b/tests/test_integrations_status.py new file mode 100644 index 00000000..4e3c3850 --- /dev/null +++ b/tests/test_integrations_status.py @@ -0,0 +1,7 @@ +from tests.helpers.utils import * + +@responses.activate +def test_integrations_status(): + responses.add(responses.GET, os.getenv("CORTEX_BASE_URL") + "/api/v1/integrations/status", json={"integrations": []}, status=200) + result = cli(["integrations", "status"]) + assert "integrations" in result