auditevents

package
v1.4.2 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package auditevents implements MCP tool handlers for GitLab audit event operations including list and get at instance, group, and project levels. It wraps the AuditEvents service from client-go v2.

markdown.go provides Markdown formatting for audit event outputs.

register.go wires audit event MCP tools to the MCP server.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatListMarkdown

func FormatListMarkdown(out ListOutput) string

FormatListMarkdown renders a paginated list of audit events as Markdown.

func FormatMarkdown

func FormatMarkdown(e Output) string

FormatMarkdown renders a single audit event as Markdown.

func RegisterTools

func RegisterTools(server *mcp.Server, client *gitlabclient.Client)

RegisterTools registers audit event tools on the MCP server.

Types

type DetailsOutput

type DetailsOutput struct {
	CustomMessage string `json:"custom_message,omitempty"`
	AuthorName    string `json:"author_name,omitempty"`
	TargetID      string `json:"target_id,omitempty"`
	TargetType    string `json:"target_type,omitempty"`
	TargetDetails string `json:"target_details,omitempty"`
	IPAddress     string `json:"ip_address,omitempty"`
	EntityPath    string `json:"entity_path,omitempty"`
}

DetailsOutput represents the details of an audit event.

type GetGroupInput

type GetGroupInput struct {
	GroupID toolutil.StringOrInt `json:"group_id" jsonschema:"Group ID or URL-encoded path,required"`
	EventID int64                `json:"event_id" jsonschema:"Audit event ID,required"`
}

GetGroupInput defines parameters for retrieving a single group audit event.

type GetInstanceInput

type GetInstanceInput struct {
	EventID int64 `json:"event_id" jsonschema:"Audit event ID,required"`
}

GetInstanceInput defines parameters for retrieving a single instance audit event.

type GetProjectInput

type GetProjectInput struct {
	ProjectID toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or URL-encoded path,required"`
	EventID   int64                `json:"event_id"   jsonschema:"Audit event ID,required"`
}

GetProjectInput defines parameters for retrieving a single project audit event.

type ListGroupInput

type ListGroupInput struct {
	GroupID       toolutil.StringOrInt `json:"group_id"                 jsonschema:"Group ID or URL-encoded path,required"`
	CreatedAfter  string               `json:"created_after,omitempty"  jsonschema:"Return events created after this date (ISO 8601 YYYY-MM-DD)"`
	CreatedBefore string               `json:"created_before,omitempty" jsonschema:"Return events created before this date (ISO 8601 YYYY-MM-DD)"`
	toolutil.PaginationInput
}

ListGroupInput defines parameters for listing group-level audit events.

type ListInstanceInput

type ListInstanceInput struct {
	CreatedAfter  string `json:"created_after,omitempty"  jsonschema:"Return events created after this date (ISO 8601 YYYY-MM-DD)"`
	CreatedBefore string `json:"created_before,omitempty" jsonschema:"Return events created before this date (ISO 8601 YYYY-MM-DD)"`
	toolutil.PaginationInput
}

ListInstanceInput defines parameters for listing instance-level audit events.

type ListOutput

type ListOutput struct {
	toolutil.HintableOutput
	AuditEvents []Output                  `json:"audit_events"`
	Pagination  toolutil.PaginationOutput `json:"pagination"`
}

ListOutput holds a paginated list of audit events.

func ListGroup

func ListGroup(ctx context.Context, client *gitlabclient.Client, input ListGroupInput) (ListOutput, error)

ListGroup lists group-level audit events.

func ListInstance

func ListInstance(ctx context.Context, client *gitlabclient.Client, input ListInstanceInput) (ListOutput, error)

ListInstance lists instance-level audit events (admin only).

func ListProject

func ListProject(ctx context.Context, client *gitlabclient.Client, input ListProjectInput) (ListOutput, error)

ListProject lists project-level audit events.

type ListProjectInput

type ListProjectInput struct {
	ProjectID     toolutil.StringOrInt `json:"project_id"               jsonschema:"Project ID or URL-encoded path,required"`
	CreatedAfter  string               `json:"created_after,omitempty"  jsonschema:"Return events created after this date (ISO 8601 YYYY-MM-DD)"`
	CreatedBefore string               `json:"created_before,omitempty" jsonschema:"Return events created before this date (ISO 8601 YYYY-MM-DD)"`
	toolutil.PaginationInput
}

ListProjectInput defines parameters for listing project-level audit events.

type Output

type Output struct {
	toolutil.HintableOutput
	ID         int64         `json:"id"`
	AuthorID   int64         `json:"author_id"`
	EntityID   int64         `json:"entity_id"`
	EntityType string        `json:"entity_type"`
	EventName  string        `json:"event_name"`
	EventType  string        `json:"event_type"`
	Details    DetailsOutput `json:"details"`
	CreatedAt  string        `json:"created_at"`
}

Output represents a single audit event.

func GetGroup

func GetGroup(ctx context.Context, client *gitlabclient.Client, input GetGroupInput) (Output, error)

GetGroup retrieves a single group-level audit event.

func GetInstance

func GetInstance(ctx context.Context, client *gitlabclient.Client, input GetInstanceInput) (Output, error)

GetInstance retrieves a single instance-level audit event.

func GetProject

func GetProject(ctx context.Context, client *gitlabclient.Client, input GetProjectInput) (Output, error)

GetProject retrieves a single project-level audit event.

Jump to

Keyboard shortcuts

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