Documentation
¶
Index ¶
- Constants
- Variables
- func GetRealIP(ctx context.Context) string
- func GetRequestID(ctx context.Context) string
- func GetRequestMethod(ctx context.Context) string
- func Middleware() func(next http.Handler) http.Handler
- type Action
- type DiffObject
- type Event
- type FuncOption
- type Noop
- type Option
- type RepositoryObject
- type Resource
- type ResourceType
- type Service
Constants ¶
View Source
const (
RepoName = "repoName"
)
Variables ¶
View Source
var ( ErrActionUndefined = errors.New("undefined action") ErrResourceTypeUndefined = errors.New("undefined resource type") ErrResourceIdentifierIsRequired = errors.New("resource identifier is required") ErrUserIsRequired = errors.New("user is required") ErrSpacePathIsRequired = errors.New("space path is required") )
View Source
var WireSet = wire.NewSet( ProvideAuditService, )
Functions ¶
func GetRequestID ¶
GetRequestID returns requestID from context.
func GetRequestMethod ¶
GetRequestMethod returns http method from context.
Types ¶
type DiffObject ¶
type Event ¶
type Event struct { ID string Timestamp int64 Action Action // example: ActionCreated User types.Principal // example: Admin SpacePath string // example: /root/projects Resource Resource DiffObject DiffObject ClientIP string RequestMethod string Data map[string]string // internal data like correlationID/requestID }
type FuncOption ¶
type FuncOption func(e *Event)
func WithClientIP ¶
func WithClientIP(value string) FuncOption
func WithData ¶
func WithData(keyValues ...string) FuncOption
func WithID ¶
func WithID(value string) FuncOption
func WithNewObject ¶
func WithNewObject(value any) FuncOption
func WithOldObject ¶
func WithOldObject(value any) FuncOption
func WithRequestMethod ¶
func WithRequestMethod(value string) FuncOption
func (FuncOption) Apply ¶
func (f FuncOption) Apply(event *Event)
type RepositoryObject ¶
type RepositoryObject struct { types.Repository IsPublic bool `yaml:"is_public"` }
RepositoryObject is the object used for emitting repository related audits. TODO: ensure audit only takes audit related objects?
type Resource ¶
type Resource struct { Type ResourceType Identifier string Data map[string]string }
func NewResource ¶
func NewResource(rtype ResourceType, identifier string, keyValues ...string) Resource
func (Resource) DataAsSlice ¶
type ResourceType ¶
type ResourceType string
const ( ResourceTypeRepository ResourceType = "repository" ResourceTypeBranchRule ResourceType = "branch_rule" ResourceTypeRepositorySettings ResourceType = "repository_settings" )
func (ResourceType) Validate ¶
func (a ResourceType) Validate() error
Click to show internal directories.
Click to hide internal directories.