chore: create workspaces and templates for multiple orgs (#13866)

* chore: creating workspaces and templates to work with orgs
* handle wrong org selected
* create org member in coderdtest helper
This commit is contained in:
Steven Masley
2024-07-12 15:47:28 -05:00
committed by GitHub
parent e4aef272fa
commit 9cbe2b27e7
9 changed files with 312 additions and 16 deletions
+5
View File
@@ -365,6 +365,7 @@ func (c *Client) TemplatesByOrganization(ctx context.Context, organizationID uui
type TemplateFilter struct {
OrganizationID uuid.UUID
ExactName string
}
// asRequestOption returns a function that can be used in (*Client).Request.
@@ -378,6 +379,10 @@ func (f TemplateFilter) asRequestOption() RequestOption {
params = append(params, fmt.Sprintf("organization:%q", f.OrganizationID.String()))
}
if f.ExactName != "" {
params = append(params, fmt.Sprintf("exact_name:%q", f.ExactName))
}
q := r.URL.Query()
q.Set("q", strings.Join(params, " "))
r.URL.RawQuery = q.Encode()