-
Notifications
You must be signed in to change notification settings - Fork 102
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
Filtering by and updating tag-bindings #987
Conversation
brandonc
commented
Oct 16, 2024
•
edited
Loading
edited
- Filter workspaces and projects by kv tags
- Fetch tags on workspaces and projects
- Create workspaces and projects with kv tags
- Replace kv tags on workspace and projects
993c619
to
28cbb9a
Compare
2b3f087
to
89f0127
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great, just a few minor comments but no blockers.
Do we want to test around including both kinds of filters in the same request? Or enforce mutually exclusivity?
return createProjectWithOptions(t, client, org, ProjectCreateOptions{ | ||
Name: randomStringWithoutSpecialChar(t), | ||
}) | ||
} | ||
|
||
func createProjectWithOptions(t *testing.T, client *Client, org *Organization, options ProjectCreateOptions) (*Project, func()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❤️
} | ||
|
||
var list struct { | ||
*Pagination |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe we chose not to paginate the list tag bindings results because of the maximum tags constraint.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I should have highlighted this in the notes. Proper decoding inside go-tfe depends on the collection being this type, but there is no pagination. That's why I kind of hid it inside this anonymous type and didn't return a List type with pagination.
@@ -610,6 +621,10 @@ type WorkspaceUpdateOptions struct { | |||
// Associated Project with the workspace. If not provided, default project | |||
// of the organization will be assigned to the workspace | |||
Project *Project `jsonapi:"relation,project,omitempty"` | |||
|
|||
// Associated TagBindings of the project. Note that this will replace |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: consider "Note that populating this field will..."?
} | ||
|
||
var list struct { | ||
*Pagination |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above, I don't think we are paginating the api response.
@@ -1436,7 +1481,7 @@ func (o WorkspaceCreateOptions) valid() error { | |||
if o.AgentPoolID == nil && (o.ExecutionMode != nil && *o.ExecutionMode == "agent") { | |||
return ErrRequiredAgentPoolID | |||
} | |||
if o.TriggerPrefixes != nil && len(o.TriggerPrefixes) > 0 && | |||
if len(o.TriggerPrefixes) > 0 && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change had me do a double take. I didn't realize nil slices allowed calls to len
!
You can't do that with other nils. TIL.
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. |