Skip to content

feat: add CLI commands for fetching parent and descendant keys#153

Merged
jithinkunjachan merged 2 commits into
mainfrom
feat/fetch-key-4
Jun 12, 2026
Merged

feat: add CLI commands for fetching parent and descendant keys#153
jithinkunjachan merged 2 commits into
mainfrom
feat/fetch-key-4

Conversation

@jithinkunjachan

@jithinkunjachan jithinkunjachan commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

This covers the main intent of the changes:

  • New get parent-keys and get descendant-keys CLI commands (cli/cmd/key.go)
  • Extracted tenant commands to their own file (cli/cmd/tenant.go)

parent-key out

Kind ID ParentID Name ManagedBy Status
K0 4b3d8e00-b738-442d-b604-5d63f853dca5 A root pending
K1 0d17767d-1bea-4ed6-9355-b0dd57f6767c 4b3d8e00-b738-442d-b604-5d63f853dca5 B root pending
K2 9559b92f-a607-4e80-b748-c459cbad4126 0d17767d-1bea-4ed6-9355-b0dd57f6767c E agent-azure pending

decendant-key out

Kind ID ParentID Name ManagedBy Status
K0 9e266dfe-5e89-46e1-9e63-d7766f0debc4 A root pending
K1 1f66e984-f67d-4cc1-93b9-1956b25d727d 9e266dfe-5e89-46e1-9e63-d7766f0debc4 B root pending
K1 87c3af89-e582-4a44-97e6-dd14879558e0 9e266dfe-5e89-46e1-9e63-d7766f0debc4 C root pending
K2 f85e863f-2f04-49b9-9bc5-adc3229c650d 1f66e984-f67d-4cc1-93b9-1956b25d727d D agent-aws pending
K2 d0f2dcef-7016-4465-9226-90667ca1ec1c 1f66e984-f67d-4cc1-93b9-1956b25d727d E agent-azure pending
K2 b6b304ff-079f-4aaa-8bfe-06a9601df3af 87c3af89-e582-4a44-97e6-dd14879558e0 F agent-gcp pending
K2 4af17e52-54eb-4278-8d4e-ef283a8a9ba2 87c3af89-e582-4a44-97e6-dd14879558e0 G agent-onprem pending
K3 ede5ac88-733a-4df0-bdd0-2b3e5c88d212 4af17e52-54eb-4278-8d4e-ef283a8a9ba2 H agent-onprem-2 pending

@jithinkunjachan jithinkunjachan marked this pull request as ready for review June 8, 2026 15:26
Signed-off-by: jK <33685667+jithinkunjachan@users.noreply.github.com>

@apatsap apatsap 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.

nice!

@jithinkunjachan jithinkunjachan self-assigned this Jun 9, 2026
Comment thread cli/cmd/key.go Outdated
totalLen := 0
trees := resp.GetKeyTree()
for i := range trees {
totalLen += len(trees[i].GetKeys()) + 1

@jithinkunjachan jithinkunjachan Jun 10, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

NP
The empty separator row (keyTreeRow{}) is also included in --json output, resulting in objects with all empty fields. Should we only insert separators for tabular format and omit them from JSON?

{
Kind: "K1"
...
},
{Kind:""},
{
Kind: "K2"
...
},
{
Kind: "K2"
...
},
{Kind:""},
{
Kind.:"K3"
}

We could also remove this empty {} if required for json output any suggestions.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think it is fine for now. We could also revisit output.Format, convert it to an interface and only the tabular implementation has a field separateAfter []RowIndex which is taken into account when the rows will be rendered.

Signed-off-by: jK <33685667+jithinkunjachan@users.noreply.github.com>
@jithinkunjachan jithinkunjachan merged commit ce8fbd2 into main Jun 12, 2026
5 checks passed
@jithinkunjachan jithinkunjachan deleted the feat/fetch-key-4 branch June 12, 2026 08:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants