8000 Support for listing team tokens of an organization by mkam · Pull Request #1109 · hashicorp/go-tfe · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Support for listing team tokens of an organization #1109

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

Merged
merged 3 commits into from
Jun 9, 2025

Conversation

mkam
Copy link
Contributor
@mkam mkam commented May 16, 2025

Description

This PR adds support for listing the team tokens of an organization with the option to filter by team via a query parameter.

Testing plan

  1. Create multiple teams
  2. Create multiple tokens under the teams
  3. List the organization's tokens
  4. Confirm that all tokens are returned as expected
  5. List by querying for a specific team
  6. Confirm only the specified team's tokens are returned

External links

Output from tests

Test output of all team token tests
-> % ENABLE_BETA=1 go test ./... -v -run "TestTeamTokens"
?   	github.com/hashicorp/go-tfe/examples/backing_data	[no test files]
?   	github.com/hashicorp/go-tfe/examples/configuration_versions	[no test files]
?   	github.com/hashicorp/go-tfe/examples/organizations	[no test files]
?   	github.com/hashicorp/go-tfe/examples/projects	[no test files]
?   	github.com/hashicorp/go-tfe/examples/registry_modules	[no test files]
?   	github.com/hashicorp/go-tfe/examples/run_errors	[no test files]
?   	github.com/hashicorp/go-tfe/examples/state_versions	[no test files]
?   	github.com/hashicorp/go-tfe/examples/users	[no test files]
?   	github.com/hashicorp/go-tfe/examples/workspaces	[no test files]
?   	github.com/hashicorp/go-tfe/mocks	[no test files]
=== RUN   TestTeamTokensCreate
=== RUN   TestTeamTokensCreate/with_valid_options
=== RUN   TestTeamTokensCreate/when_a_token_already_exists
=== RUN   TestTeamTokensCreate/without_valid_team_ID
--- PASS: TestTeamTokensCreate (2.96s)
    --- PASS: TestTeamTokensCreate/with_valid_options (0.24s)
    --- PASS: TestTeamTokensCreate/when_a_token_already_exists (0.49s)
    --- PASS: TestTeamTokensCreate/without_valid_team_ID (0.00s)
=== RUN   TestTeamTokens_CreateWithOptions
=== RUN   TestTeamTokens_CreateWithOptions/with_valid_options
=== RUN   TestTeamTokens_CreateWithOptions/when_a_token_already_exists
=== RUN   TestTeamTokens_CreateWithOptions/without_valid_team_ID
=== RUN   TestTeamTokens_CreateWithOptions/without_an_expiration_date
=== RUN   TestTeamTokens_CreateWithOptions/with_an_expiration_date
--- PASS: TestTeamTokens_CreateWithOptions (4.21s)
    --- PASS: TestTeamTokens_CreateWithOptions/with_valid_options (0.24s)
    --- PASS: TestTeamTokens_CreateWithOptions/when_a_token_already_exists (0.63s)
    --- PASS: TestTeamTokens_CreateWithOptions/without_valid_team_ID (0.00s)
    --- PASS: TestTeamTokens_CreateWithOptions/without_an_expiration_date (0.64s)
    --- PASS: TestTeamTokens_CreateWithOptions/with_an_expiration_date (0.98s)
=== RUN   TestTeamTokens_CreateWithOptions_MultipleTokens
=== RUN   TestTeamTokens_CreateWithOptions_MultipleTokens/with_multiple_tokens
=== RUN   TestTeamTokens_CreateWithOptions_MultipleTokens/with_an_expiration_date
=== RUN   TestTeamTokens_CreateWithOptions_MultipleTokens/without_an_expiration_date
=== RUN   TestTeamTokens_CreateWithOptions_MultipleTokens/when_a_token_already_exists_with_the_same_description
=== RUN   TestTeamTokens_CreateWithOptions_MultipleTokens/without_valid_team_ID
--- PASS: TestTeamTokens_CreateWithOptions_MultipleTokens (5.69s)
    --- PASS: TestTeamTokens_CreateWithOptions_MultipleTokens/with_multiple_tokens (2.22s)
    --- PASS: TestTeamTokens_CreateWithOptions_MultipleTokens/with_an_expiration_date (0.55s)
    --- PASS: TestTeamTokens_CreateWithOptions_MultipleTokens/without_an_expiration_date (0.63s)
    --- PASS: TestTeamTokens_CreateWithOptions_MultipleTokens/when_a_token_already_exists_with_the_same_description (0.94s)
    --- PASS: TestTeamTokens_CreateWithOptions_MultipleTokens/without_valid_team_ID (0.00s)
=== RUN   TestTeamTokensRead
=== RUN   TestTeamTokensRead/with_valid_options
=== RUN   TestTeamTokensRead/with_an_expiration_date_passed_as_a_valid_option
=== RUN   TestTeamTokensRead/when_a_token_doesn't_exists
=== RUN   TestTeamTokensRead/without_valid_organization
--- PASS: TestTeamTokensRead (3.76s)
    --- PASS: TestTeamTokensRead/with_valid_options (1.06s)
    --- PASS: TestTeamTokensRead/with_an_expiration_date_passed_as_a_valid_option (1.14s)
    --- PASS: TestTeamTokensRead/when_a_token_doesn't_exists (0.22s)
    --- PASS: TestTeamTokensRead/without_valid_organization (0.00s)
=== RUN   TestTeamTokensReadByID
=== RUN   TestTeamTokensReadByID/with_legacy,_descriptionless_tokens
=== RUN   TestTeamTokensReadByID/with_multiple_team_tokens
=== RUN   TestTeamTokensReadByID/when_a_token_doesn't_exists
--- PASS: TestTeamTokensReadByID (4.87s)
    --- PASS: TestTeamTokensReadByID/with_legacy,_descriptionless_tokens (1.09s)
    --- PASS: TestTeamTokensReadByID/with_multiple_team_tokens (2.22s)
    --- PASS: TestTeamTokensReadByID/when_a_token_doesn't_exists (0.21s)
=== RUN   TestTeamTokensList
=== RUN   TestTeamTokensList/with_team_tokens_across_multiple_teams
=== RUN   TestTeamTokensList/with_filtering_by_team_name
=== RUN   TestTeamTokensList/with_sorting
=== RUN   TestTeamTokensList/with_multiple_team_tokens_in_a_single_team
--- PASS: TestTeamTokensList (6.42s)
    --- PASS: TestTeamTokensList/with_team_tokens_across_multiple_teams (0.70s)
    --- PASS: TestTeamTokensList/with_filtering_by_team_name (0.27s)
    --- PASS: TestTeamTokensList/with_sorting (0.53s)
    --- PASS: TestTeamTokensList/with_multiple_team_tokens_in_a_single_team (1.82s)
=== RUN   TestTeamTokensDelete
=== RUN   TestTeamTokensDelete/with_valid_options
=== RUN   TestTeamTokensDelete/when_a_token_does_not_exist
=== RUN   TestTeamTokensDelete/without_valid_team_ID
--- PASS: TestTeamTokensDelete (2.46s)
    --- PASS: TestTeamTokensDelete/with_valid_options (0.58s)
    --- PASS: TestTeamTokensDelete/when_a_token_does_not_exist (0.22s)
    --- PASS: TestTeamTokensDelete/without_valid_team_ID (0.00s)
=== RUN   TestTeamTokensDeleteByID
=== RUN   TestTeamTokensDeleteByID/with_legacy,_descriptionless_tokens
=== RUN   TestTeamTokensDeleteByID/with_multiple_team_tokens
=== RUN   TestTeamTokensDeleteByID/when_a_token_does_not_exist
=== RUN   TestTeamTokensDeleteByID/with_invalid_token_ID
--- PASS: TestTeamTokensDeleteByID (4.18s)
    --- PASS: TestTeamTokensDeleteByID/with_legacy,_descriptionless_tokens (0.77s)
    --- PASS: TestTeamTokensDeleteByID/with_multiple_team_tokens (1.64s)
    --- PASS: TestTeamTokensDeleteByID/when_a_token_does_not_exist (0.25s)
    --- PASS: TestTeamTokensDeleteByID/with_invalid_token_ID (0.00s)
PASS
ok  	github.com/hashicorp/go-tfe	35.060s

Rollback Plan

Revert PR.

Changes to Security Controls

N/A

@mkam mkam force-pushed the mkam/TF-26314/list-team-tokens branch 2 times, most recently from db83122 to 8d9f805 Compare May 16, 2025 18:46
@mkam mkam force-pushed the mkam/TF-26314/list-team-tokens branch from 8d9f805 to d843e60 Compare May 27, 2025 15:08
@datadog-terraform-cloud-hashicorp
Copy link
datadog-terraform-cloud-hashicorp bot commented May 27, 2025

Datadog Report

Branch report: mkam/TF-26314/list-team-tokens
Commit report: db071e9
Test service: hashicorp/go-tfe

✅ 0 Failed, 1448 Passed, 174 Skipped, 14m 41.52s Total Time
⬆️ Test Sessions change in coverage: 1 increased (+0.1%)

@mkam mkam marked this pull request as ready for review May 30, 2025 16:22
@mkam mkam requested a review from a team as a code owner May 30, 2025 16:22
brandonc
brandonc previously approved these changes Jun 5, 2025
@mkam mkam force-pushed the mkam/TF-26314/list-team-tokens branch from d843e60 to 3e1a2e2 Compare June 9, 2025 20:34
@mkam
Copy link
Contributor Author
mkam commented Jun 9, 2025

Rebased to get the lint fix and did a merge conflict on the changelog.

@mkam mkam merged commit 1bb5ca5 into main Jun 9, 2025
8 checks passed
@mkam mkam deleted the mkam/TF-26314/list-team-tokens branch June 9, 2025 22:04
Copy link
github-actions bot commented Jun 9, 2025

Reminder to the contributor that merged this PR: if your changes have added important functionality or fixed a relevant bug, open a follow-up PR to update CHANGELOG.md with a note on your changes.

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
0