commonevent

package
v0.0.0-...-9e8e647 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 16, 2025 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterResolver

func RegisterResolver(urlPattern string, resolver Resolver)

RegisterResolver register a resolver for a specific URL pattern

func Resolvers

func Resolvers() map[string]Resolver

Resolvers get map of resolvers

Types

type Metadata

type Metadata struct {
	// Ctx ...
	Ctx context.Context
	// Username requester username
	Username string
	// RequestPayload http request payload
	RequestPayload string
	// RequestMethod
	RequestMethod string
	// ResponseCode response code
	ResponseCode int
	// RequestURL request URL
	RequestURL string
	// IPAddress IP address of the request
	IPAddress string
	// ResponseLocation response location
	ResponseLocation string
	// ResourceName
	ResourceName string
}

Metadata the raw data of event

func (*Metadata) PreCheckMetadata

func (c *Metadata) PreCheckMetadata() (bool, string)

PreCheck check if current event is matched and return the prefetched resource name when it is delete operation

func (*Metadata) Resolve

func (c *Metadata) Resolve(event *event.Event) error

Resolve parse the audit information from CommonEventMetadata

type Resolver

type Resolver interface {
	Resolve(*Metadata, *event.Event) error
	PreCheck(ctx context.Context, url string, method string) (bool, string)
}

Resolver the interface to resolve Metadata to CommonEvent

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL