MCPcopy Index your code
hub / github.com/coder/coder / TemplateACLAvailable

Method TemplateACLAvailable

codersdk/templates.go:382–400  ·  view source on GitHub ↗

TemplateACLAvailable returns available users + groups that can be assigned template perms. The optional req controls the q/limit/offset query parameters applied server-side; pass codersdk.UsersRequest{} when no filtering is desired.

(ctx context.Context, templateID uuid.UUID, req UsersRequest)

Source from the content-addressed store, hash-verified

380// parameters applied server-side; pass codersdk.UsersRequest{} when no
381// filtering is desired.
382func (c *Client) TemplateACLAvailable(ctx context.Context, templateID uuid.UUID, req UsersRequest) (ACLAvailable, error) {
383 res, err := c.Request(
384 ctx,
385 http.MethodGet,
386 fmt.Sprintf("/api/v2/templates/%s/acl/available", templateID),
387 nil,
388 req.Pagination.asRequestOption(),
389 req.asRequestOption(),
390 )
391 if err != nil {
392 return ACLAvailable{}, err
393 }
394 defer res.Body.Close()
395 if res.StatusCode != http.StatusOK {
396 return ACLAvailable{}, ReadBodyAsError(res)
397 }
398 var acl ACLAvailable
399 return acl, json.NewDecoder(res.Body).Decode(&acl)
400}
401
402func (c *Client) TemplateACL(ctx context.Context, templateID uuid.UUID) (TemplateACL, error) {
403 res, err := c.Request(ctx, http.MethodGet, fmt.Sprintf("/api/v2/templates/%s/acl", templateID), nil)

Callers 2

TestTemplateACLFunction · 0.80
TestUpdateTemplateACLFunction · 0.80

Calls 4

RequestMethod · 0.95
ReadBodyAsErrorFunction · 0.85
CloseMethod · 0.65
asRequestOptionMethod · 0.45

Tested by 2

TestTemplateACLFunction · 0.64
TestUpdateTemplateACLFunction · 0.64