-
Notifications
You must be signed in to change notification settings - Fork 974
feat(coderd): update endpoint to allow filtering provisioner daemons by tags #15448
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
Changes from 1 commit
3d45f55
92b9d25
e68a8fc
93058e6
a2bfae3
39ab8a0
8bf79c8
86f7dab
bd6f3ed
a2476dc
e835326
23bd23f
9985ef6
a173bfb
70c7ea9
1c57bd2
ebb716d
96b64f4
5941dc3
ff75f5e
85b1ef4
071fdc4
78abf67
d1c7d3e
38d77cf
1c64353
8508cd8
9dcbb83
4c1fc0d
fbd70f3
69126f4
e109caf
f10561e
a56b130
2bce007
2860f5d
d6f26df
1ce410f
c065742
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,7 @@ import ( | |
"encoding/json" | ||
"fmt" | ||
"net/http" | ||
"net/url" | ||
"strings" | ||
"time" | ||
|
||
|
@@ -314,11 +315,21 @@ func (c *Client) ProvisionerDaemons(ctx context.Context) ([]ProvisionerDaemon, e | |
return daemons, json.NewDecoder(res.Body).Decode(&daemons) | ||
} | ||
|
||
func (c *Client) OrganizationProvisionerDaemons(ctx context.Context, organizationID uuid.UUID) ([]ProvisionerDaemon, error) { | ||
res, err := c.Request(ctx, http.MethodGet, | ||
fmt.Sprintf("/api/v2/organizations/%s/provisionerdaemons", organizationID.String()), | ||
nil, | ||
) | ||
func (c *Client) OrganizationProvisionerDaemons(ctx context.Context, organizationID uuid.UUID, tags []string) ([]ProvisionerDaemon, error) { | ||
baseURL := fmt.Sprintf("/api/v2/organizations/%s/provisionerdaemons", organizationID.String()) | ||
|
||
queryParams := url.Values{} | ||
if len(tags) > 0 { | ||
for _, tag := range tags { | ||
SasSwart marked this conversation as resolved.
Show resolved
Hide resolved
|
||
queryParams.Add("tags", tag) | ||
} | ||
} | ||
|
||
if len(queryParams) > 0 { | ||
baseURL = fmt.Sprintf("%s?%s", baseURL, queryParams.Encode()) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It'd be less pithy but more durable if you used the |
||
} | ||
|
||
res, err := c.Request(ctx, http.MethodGet, baseURL, nil) | ||
if err != nil { | ||
return nil, xerrors.Errorf("execute request: %w", err) | ||
} | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Uh oh!
There was an error while loading. Please reload this page.