auditevents

package
v2.5.2 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package auditevents implements MCP tools for GitLab audit event operations.

The package wraps the GitLab Audit events API:

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ActionSpecs

func ActionSpecs(client *gitlabclient.Client) []toolutil.ActionSpec

ActionSpecs returns canonical specs for audit event actions. The instance/group/project list and get routes are projected into the dynamic, meta, individual, and audit surfaces by the action catalog (ADR-0004). Each spec carries action-specific usage guidance, natural-language aliases, canonical related actions, and a "Returns: … See also: …" individual-tool description so the 1:1 discovery metadata mirrors the GitLab audit_events API surface.

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.

Types

type ChangeEntry added in v2.5.1

type ChangeEntry struct {
	Change string `json:"change,omitempty" jsonschema:"The setting or attribute that was changed"`
	From   string `json:"from,omitempty"   jsonschema:"Previous value before the change"`
	To     string `json:"to,omitempty"     jsonschema:"New value after the change"`
}

ChangeEntry mirrors a single entry in the client-go AuditEventChange struct, i.e. one element of the plural "changes" array that some audit events emit.

type DetailsOutput

type DetailsOutput struct {
	With          string        `json:"with,omitempty"`
	Add           string        `json:"add,omitempty"`
	As            string        `json:"as,omitempty"`
	Change        string        `json:"change,omitempty"`
	ChangeObject  any           `` /* 258-byte string literal not displayed */
	Changes       []ChangeEntry `` /* 172-byte string literal not displayed */
	From          string        `json:"from,omitempty"`
	To            string        `json:"to,omitempty"`
	Remove        string        `json:"remove,omitempty"`
	CustomMessage string        `json:"custom_message,omitempty"`
	AuthorName    string        `json:"author_name,omitempty"`
	AuthorEmail   string        `json:"author_email,omitempty"`
	AuthorClass   string        `json:"author_class,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"`
	FailedLogin   string        `json:"failed_login,omitempty"`
	EventName     string        `json:"event_name,omitempty"`
}

DetailsOutput represents the details of an audit event. The exact fields returned depend on the action being recorded; this mirrors every field of the client-go AuditEventDetails struct for 1:1 API fidelity.

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