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

Function parseOrganization

coderd/searchquery/search.go:686–703  ·  view source on GitHub ↗
(ctx context.Context, db database.Store, parser *httpapi.QueryParamParser, vals url.Values, queryParam string)

Source from the content-addressed store, hash-verified

684}
685
686func parseOrganization(ctx context.Context, db database.Store, parser *httpapi.QueryParamParser, vals url.Values, queryParam string) uuid.UUID {
687 return httpapi.ParseCustom(parser, vals, uuid.Nil, queryParam, func(v string) (uuid.UUID, error) {
688 if v == "" {
689 return uuid.Nil, nil
690 }
691 organizationID, err := uuid.Parse(v)
692 if err == nil {
693 return organizationID, nil
694 }
695 organization, err := db.GetOrganizationByName(ctx, database.GetOrganizationByNameParams{
696 Name: v, Deleted: false,
697 })
698 if err != nil {
699 return uuid.Nil, xerrors.Errorf("organization %q either does not exist, or you are unauthorized to view it", v)
700 }
701 return organization.ID, nil
702 })
703}
704
705// parseAIProviderName resolves a "provider_name" filter param against
706// ai_providers.name. Unknown names produce a validation error so typos

Callers 5

AuditLogsFunction · 0.85
ConnectionLogsFunction · 0.85
WorkspacesFunction · 0.85
TemplatesFunction · 0.85
TasksFunction · 0.85

Calls 4

ParseCustomFunction · 0.92
ParseMethod · 0.65
GetOrganizationByNameMethod · 0.65
ErrorfMethod · 0.45

Tested by

no test coverage detected