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

Method CreateOrganization

codersdk/organizations.go:287–300  ·  view source on GitHub ↗

CreateOrganization creates an organization and adds the user making the request as an owner.

(ctx context.Context, req CreateOrganizationRequest)

Source from the content-addressed store, hash-verified

285
286// CreateOrganization creates an organization and adds the user making the request as an owner.
287func (c *Client) CreateOrganization(ctx context.Context, req CreateOrganizationRequest) (Organization, error) {
288 res, err := c.Request(ctx, http.MethodPost, "/api/v2/organizations", req)
289 if err != nil {
290 return Organization{}, err
291 }
292 defer res.Body.Close()
293
294 if res.StatusCode != http.StatusCreated {
295 return Organization{}, ReadBodyAsError(res)
296 }
297
298 var org Organization
299 return org, json.NewDecoder(res.Body).Decode(&org)
300}
301
302// UpdateOrganization will update information about the corresponding organization, based on
303// the UUID/name provided as `orgID`.

Callers 15

TestWorkspaceFilterFunction · 0.80
RunFunction · 0.80
createOrganizationMethod · 0.80
setupMultiOrgFunction · 0.80
TestUserOIDCFunction · 0.80
TestCreateWorkspaceFunction · 0.80
TestCreateUserWorkspaceFunction · 0.80
TestTemplateAccessFunction · 0.80
TestEnterpriseAuditLogsFunction · 0.80
TestMultiOrgFetchFunction · 0.80
TestOrganizationsByUserFunction · 0.80

Calls 3

RequestMethod · 0.95
ReadBodyAsErrorFunction · 0.85
CloseMethod · 0.65

Tested by 12

TestWorkspaceFilterFunction · 0.64
TestUserOIDCFunction · 0.64
TestCreateWorkspaceFunction · 0.64
TestCreateUserWorkspaceFunction · 0.64
TestTemplateAccessFunction · 0.64
TestEnterpriseAuditLogsFunction · 0.64
TestMultiOrgFetchFunction · 0.64
TestOrganizationsByUserFunction · 0.64
TestShowOrganizationsFunction · 0.64