Skip to content

Commit ba0fdcd

Browse files
committed
document query params in search.go
1 parent 469e2cd commit ba0fdcd

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

coderd/searchquery/search.go

+14
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,20 @@ import (
1919

2020
// AuditLogs requires the database to fetch an organization by name
2121
// to convert to organization uuid.
22+
//
23+
// Supported query parameters:
24+
//
25+
// - request_id: UUID (can be used to search for associated audits e.g. connect/disconnect or open/close)
26+
// - resource_id: UUID
27+
// - resource_target: string
28+
// - username: string
29+
// - email: string
30+
// - date_from: string (date in format "2006-01-02")
31+
// - date_to: string (date in format "2006-01-02")
32+
// - organization: string (organization UUID or name)
33+
// - resource_type: string (enum)
34+
// - action: string (enum)
35+
// - build_reason: string (enum)
2236
func AuditLogs(ctx context.Context, db database.Store, query string) (database.GetAuditLogsOffsetParams, []codersdk.ValidationError) {
2337
// Always lowercase for all searches.
2438
query = strings.ToLower(query)

coderd/searchquery/search_test.go

+5
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,11 @@ func TestSearchAudit(t *testing.T) {
344344
ResourceTarget: "foo",
345345
},
346346
},
347+
{
348+
Name: "RequestID",
349+
Query: "request_id:foo",
350+
ExpectedErrorContains: "valid uuid",
351+
},
347352
}
348353

349354
for _, c := range testCases {

0 commit comments

Comments
 (0)