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

add sort and filter to admin/workspaces#list-all-workspaces #641

Merged
merged 2 commits into from
Feb 15, 2023

Conversation

laurenolivia
Copy link
Contributor

@laurenolivia laurenolivia commented Jan 24, 2023

Description

The Admin Workspace API includes a sort and filter feature. There was a request to expose this in go-tfe.

Testing plan

  1. Create more than one workspace
  2. With admin credentials, make an API call to either sort or filter
  3. Sort only accepts name or current-run.created-at
  4. Filter only accepts a run status

External links

API Docs

Output from tests

Including output from tests may require access to a TFE instance. Ignore this section if you have no environment to test against.

$ TFE_ADDRESS="https://example" TFE_TOKEN="example" go test ./... -v -run TestFunctionsAffectedByChange

...

@laurenolivia laurenolivia requested a review from a team as a code owner January 24, 2023 07:29
@laurenolivia laurenolivia force-pushed the laurenolivia/admin-list-options branch 2 times, most recently from 453afa8 to b29ee76 Compare February 2, 2023 21:13
@laurenolivia laurenolivia marked this pull request as draft February 7, 2023 20:54
@laurenolivia laurenolivia marked this pull request as ready for review February 7, 2023 20:54
@laurenolivia laurenolivia marked this pull request as draft February 7, 2023 20:54
@laurenolivia laurenolivia force-pushed the laurenolivia/admin-list-options branch from d4b068c to e8d58eb Compare February 9, 2023 18:28
@laurenolivia laurenolivia marked this pull request as ready for review February 9, 2023 18:28
@laurenolivia laurenolivia force-pushed the laurenolivia/admin-list-options branch from e8d58eb to 6ebe908 Compare February 13, 2023 22:18
brandonc
brandonc previously approved these changes Feb 14, 2023
sebasslash
sebasslash previously approved these changes Feb 14, 2023

require.NoError(t, err)
require.NotEmpty(t, wl.Items)
assert.Equal(t, wl.Items[0].CurrentRun.Status, RunApplied)
Copy link
Member

Choose a reason for hiding this comment

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

Oh, now that I think this through an extra step, this is fine and doesn't need to be changed to an assert.Contains with our run. I got all turned around! But because the filter is limiting runs to the RunApplied status, the first run definitely has to be in status RunApplied, even if it's not the run we created. 👍🏼

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok!

@laurenolivia laurenolivia merged commit aa61d1b into main Feb 15, 2023
@laurenolivia laurenolivia deleted the laurenolivia/admin-list-options branch February 15, 2023 11:38
@github-actions
Copy link

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.

[Feature] AdminWorkspaceListOptions - Add Sort and Filter capabilities
4 participants