feat(feature_flags): support gitlabUserList and strategy removal
What does this MR do?
Adds two fields the GitLab Feature Flags API already supports but that FeatureFlagStrategyOptions didn't expose:
UserListID *int64(user_list_id) — binds a strategy to agitlabUserListuser list.Destroy *bool(_destroy) — Rails-style nested-attributes flag to remove a strategy on update.
Also adds a UserList *FeatureFlagUserList field to the response type ProjectFeatureFlagStrategy, populated by the API's user_list response field when a strategy uses gitlabUserList.
Precedent for the _destroy pattern already exists in this codebase (protected_environments.go, group_protected_environments.go, protected_branches.go, group_protected_branches.go), so this follows the same *bool + `url:"_destroy,omitempty" json:"_destroy,omitempty"` shape.
Why?
This came up while implementing gitlab_project_feature_flag in terraform-provider-gitlab (see !3209). Without these fields, the Terraform resource had to reject the gitlabUserList strategy entirely and make the whole strategies attribute RequiresReplace (destroying and recreating the flag for any strategy change), since there was no way to remove a single strategy or bind a user list through the client. This unblocks a proper, non-destructive implementation there.
References
- GitLab API docs: https://docs.gitlab.com/api/feature_flags/
terraform-provider-gitlabMR: gitlab-org/terraform-provider-gitlab!3209
Testing
go build ./...go test ./... -racemise exec -- make fmt(no diff)mise exec -- golangci-lint run ./...(0 issues)- Added
TestUpdateProjectFeatureFlag_gitlabUserListAndDestroy, which asserts the outgoing JSON request body shape and the decoded response (including the newUserListfield).