audit

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2021 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	UserIDKey      = "userId"
	OrgIDKey       = "orgId"
	OrgNameKey     = "orgName"
	ProjectIDKey   = "projectId"
	ProjectNameKey = "projectName"
	AppIDKey       = "appId"
	AppNameKey     = "appName"
)

special keys

View Source
const AuditServiceName = "audit"

AuditServiceName .

Variables

This section is empty.

Functions

This section is empty.

Types

type Auditor

type Auditor interface {
	Recorder
	Begin() Recorder
	ScopeQueryer
	Audit(auditors ...*MethodAuditor) transport.ServiceOption
}

Auditor .

func GetAuditor

func GetAuditor(ctx servicehub.Context) Auditor

GetAuditor .

type GetScopeIDAndEntries

type GetScopeIDAndEntries func(ctx context.Context, req, resp interface{}, err error) (interface{}, map[string]interface{}, error)

GetScopeIDAndEntries .

type MethodAuditor

type MethodAuditor struct {
	// contains filtered or unexported fields
}

MethodAuditor .

func Method

func Method(method interface{}, scope ScopeType, template string, getter GetScopeIDAndEntries, options ...Option) *MethodAuditor

Method .

func MethodWithError

func MethodWithError(method interface{}, scope ScopeType, template string, getter GetScopeIDAndEntries, options ...Option) *MethodAuditor

MethodWithError .

type NopAuditor

type NopAuditor struct{}

NopAuditor .

func (*NopAuditor) Audit

func (a *NopAuditor) Audit(auditors ...*MethodAuditor) transport.ServiceOption

Audit .

func (*NopAuditor) Begin

func (a *NopAuditor) Begin() Recorder

Begin .

func (*NopAuditor) GetApp

func (a *NopAuditor) GetApp(idObject interface{}) (*apistructs.ApplicationDTO, error)

GetApp .

func (*NopAuditor) GetOrg

func (a *NopAuditor) GetOrg(id interface{}) (*apistructs.OrgDTO, error)

GetOrg .

func (*NopAuditor) GetProject

func (a *NopAuditor) GetProject(id interface{}) (*apistructs.ProjectDTO, error)

GetProject .

func (*NopAuditor) Record

func (a *NopAuditor) Record(ctx context.Context, scope ScopeType, scopeID interface{}, template string, options ...Option)

Record .

func (*NopAuditor) RecordError

func (a *NopAuditor) RecordError(ctx context.Context, scope ScopeType, scopeID interface{}, template string, options ...Option)

RecordError .

type Option

type Option func(opts *options)

Option .

func Entries

func Entries(h func(ctx context.Context) (map[string]interface{}, error)) Option

Entries .

func Entry

func Entry(key string, val interface{}) Option

Entry .

func OrgID

func OrgID(id interface{}) Option

OrgID .

func UserID

func UserID(id interface{}) Option

UserID .

type Recorder

type Recorder interface {
	Record(ctx context.Context, scope ScopeType, scopeID interface{}, template string, options ...Option)
	RecordError(ctx context.Context, scope ScopeType, scopeID interface{}, template string, options ...Option)
}

Recorder .

type ScopeQueryer

type ScopeQueryer interface {
	GetOrg(id interface{}) (*apistructs.OrgDTO, error)
	GetProject(id interface{}) (*apistructs.ProjectDTO, error)
	GetApp(idObject interface{}) (*apistructs.ApplicationDTO, error)
}

ScopeQueryer .

type ScopeType

type ScopeType string

ScopeType .

const (
	SysScope       ScopeType = "sys"
	OrgScope       ScopeType = "org"
	ProjectScope   ScopeType = "project"
	AppScope       ScopeType = "app"
	PublisherScope ScopeType = "publisher"
)

ScopeType values

type ValueFetcher

type ValueFetcher func() interface{}

ValueFetcher .

type ValueFetcherWithContext

type ValueFetcherWithContext func(ctx context.Context) (interface{}, error)

ValueFetcherWithContext .

Jump to

Keyboard shortcuts

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