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

Method GroupByOrgAndName

codersdk/groups.go:121–136  ·  view source on GitHub ↗
(ctx context.Context, orgID uuid.UUID, name string)

Source from the content-addressed store, hash-verified

119}
120
121func (c *Client) GroupByOrgAndName(ctx context.Context, orgID uuid.UUID, name string) (Group, error) {
122 res, err := c.Request(ctx, http.MethodGet,
123 fmt.Sprintf("/api/v2/organizations/%s/groups/%s", orgID.String(), name),
124 nil,
125 )
126 if err != nil {
127 return Group{}, xerrors.Errorf("make request: %w", err)
128 }
129 defer res.Body.Close()
130
131 if res.StatusCode != http.StatusOK {
132 return Group{}, ReadBodyAsError(res)
133 }
134 var resp Group
135 return resp, json.NewDecoder(res.Body).Decode(&resp)
136}
137
138type GroupRequest struct {
139 ExcludeMembers bool `json:"exclude_members"`

Callers 3

TestGroupFunction · 0.80
groupEditMethod · 0.80
groupDeleteMethod · 0.80

Calls 5

RequestMethod · 0.95
ReadBodyAsErrorFunction · 0.85
CloseMethod · 0.65
StringMethod · 0.45
ErrorfMethod · 0.45

Tested by 1

TestGroupFunction · 0.64