Documentation
¶
Index ¶
- type AuditRecordCursor
- type Controller
- func (c *Controller) CleanupAuditRecordsHandler(w http.ResponseWriter, r *http.Request)
- func (c *Controller) GetAuditRecordHandler(w http.ResponseWriter, r *http.Request)
- func (c *Controller) GetCleanupStatusHandler(w http.ResponseWriter, r *http.Request)
- func (c *Controller) QueryAuditRecordsHandler(w http.ResponseWriter, r *http.Request)
- type QueryAuditRecordsResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AuditRecordCursor ¶
type AuditRecordCursor struct {
AfterTimestamp int64 `json:"afterTimestamp"`
AfterID string `json:"afterId"`
}
AuditRecordCursor resumes an audit trail listing after a record.
type Controller ¶
type Controller struct {
// contains filtered or unexported fields
}
Controller handles HTTP requests for reading the audit trail.
Read and clean up only. There is no endpoint that writes or amends a record. Records are made by the middleware that observes the actions, and a trail the callers being audited can write to is not one.
The engine authenticates but does not authorise, so these endpoints are open to any principal it accepts, and the trail names every other principal along with their source addresses. Of everything the engine serves, this is the surface the authorisation layer above it most needs to gate.
func NewController ¶
func NewController( auditRecordRetentionPeriod time.Duration, deps *typesv1.Dependencies, ) *Controller
NewController creates a new audit Controller instance with the provided dependencies.
func (*Controller) CleanupAuditRecordsHandler ¶
func (c *Controller) CleanupAuditRecordsHandler( w http.ResponseWriter, r *http.Request, )
CleanupAuditRecordsHandler is the handler for the POST /audit/records/cleanup endpoint that cleans up audit records that are older than the configured retention period.
func (*Controller) GetAuditRecordHandler ¶
func (c *Controller) GetAuditRecordHandler( w http.ResponseWriter, r *http.Request, )
GetAuditRecordHandler is the handler for the GET /audit/records/{id} endpoint that retrieves a single audit record.
func (*Controller) GetCleanupStatusHandler ¶
func (c *Controller) GetCleanupStatusHandler( w http.ResponseWriter, r *http.Request, )
GetCleanupStatusHandler is the handler for the GET /audit/records/cleanup/{id} endpoint that retrieves the status of a cleanup operation.
func (*Controller) QueryAuditRecordsHandler ¶
func (c *Controller) QueryAuditRecordsHandler( w http.ResponseWriter, r *http.Request, )
QueryAuditRecordsHandler is the handler for the GET /audit/records endpoint that reads the audit trail, narrowed by the `from`, `to`, `afterTimestamp`, `afterId`, `action`, `principalSubject`, `outcome` and `limit` query parameters.
This is what makes the trail extractable without reaching into the state backend.
type QueryAuditRecordsResponse ¶
type QueryAuditRecordsResponse struct {
// Records are the matching records, oldest first.
Records []*manage.AuditRecord `json:"records"`
// HasMore says whether the trail holds further records matching the query beyond
// this page.
//
// Reported rather than left to be inferred. A page of a trail is easily mistaken
// for the whole answer to "what did this principal do", and a partial trail read
// as a complete one is the one failure this endpoint must not have.
HasMore bool `json:"hasMore"`
// NextCursor resumes the listing immediately after this page, and is absent when
// nothing follows it.
//
// Supplied ready to use rather than left for a caller to assemble out of the last
// record, so that how this trail is paged is something the response states.
NextCursor *AuditRecordCursor `json:"nextCursor,omitempty"`
}
QueryAuditRecordsResponse holds a page of the audit trail.