Skip to content
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

Support listing organizations #6

Merged
merged 4 commits into from
Dec 29, 2024
Merged

Support listing organizations #6

merged 4 commits into from
Dec 29, 2024

Conversation

scotwells
Copy link
Contributor

This introduces a new command that can be used to list organizations the user has access to based on their Personal Access Token. This command will not work with service account based authentication.

Supports table, yaml, and json output.

$ go run . organizations list --hostname api.poc-1.env.datum.net --output table
DISPLAY NAME  RESOURCE ID
Organic Teal  izd57tciizfydaewnpa7xoe4ry

$ go run . organizations list --hostname api.poc-1.env.datum.net --output yaml
organizations:
  - name: organizations/izd57tciizfydaewnpa7xoe4ry
    organizationId: izd57tciizfydaewnpa7xoe4ry
    uid: 01JGA1QZ1W2VSFGNCV2CZD6RRT
    displayName: Organic Teal
    annotations:
      meta.datum.net/description: 'Personal Organization -  '
    createTime: "2024-12-29T20:29:25.948702Z"

$ go run . organizations list --hostname api.poc-1.env.datum.net --output json | jq
{
  "organizations": [
    {
      "name": "organizations/izd57tciizfydaewnpa7xoe4ry",
      "organizationId": "izd57tciizfydaewnpa7xoe4ry",
      "uid": "01JGA1QZ1W2VSFGNCV2CZD6RRT",
      "displayName": "Organic Teal",
      "annotations": {
        "meta.datum.net/description": "Personal Organization -  "
      },
      "createTime": "2024-12-29T20:29:25.948702Z"
    }
  ]
}

@scotwells scotwells requested a review from joshlreese December 29, 2024 22:30
Copy link
Contributor

@joshlreese joshlreese left a comment

Choose a reason for hiding this comment

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

Found an unused struct. Otherwise LGTM.

internal/cmd/organizations/list.go Outdated Show resolved Hide resolved
@scotwells scotwells requested a review from joshlreese December 29, 2024 22:57
@scotwells scotwells merged commit a942a02 into main Dec 29, 2024
1 check failed
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.

2 participants