cloudtrail

package
v1.10.0 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CloudTrailService

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

CloudTrailService is the cloudmock implementation of the AWS CloudTrail API.

func New

func New(accountID, region string) *CloudTrailService

New returns a new CloudTrailService for the given AWS account ID and region.

func NewWithBus

func NewWithBus(accountID, region string, bus *eventbus.Bus) *CloudTrailService

NewWithBus returns a new CloudTrailService wired to an event bus.

func (*CloudTrailService) Actions

func (s *CloudTrailService) Actions() []service.Action

Actions returns the list of CloudTrail API actions supported by this service.

func (*CloudTrailService) HandleRequest

func (s *CloudTrailService) HandleRequest(ctx *service.RequestContext) (*service.Response, error)

HandleRequest routes an incoming CloudTrail request to the appropriate handler.

func (*CloudTrailService) HealthCheck

func (s *CloudTrailService) HealthCheck() error

HealthCheck always returns nil.

func (*CloudTrailService) Name

func (s *CloudTrailService) Name() string

Name returns the AWS service name used for routing.

func (*CloudTrailService) SetEventBus

func (s *CloudTrailService) SetEventBus(bus *eventbus.Bus)

SetEventBus sets the event bus for cross-service event recording.

func (*CloudTrailService) StartRecording

func (s *CloudTrailService) StartRecording()

StartRecording subscribes to the event bus for all trails that have logging enabled. This is called externally after wiring up the bus.

type DataResource

type DataResource struct {
	Type   string
	Values []string
}

DataResource specifies data event logging.

type Event

type Event struct {
	EventId         string
	EventName       string
	EventTime       time.Time
	EventSource     string
	Username        string
	Resources       []EventResource
	CloudTrailEvent string
	ReadOnly        string
	AccessKeyId     string
}

Event represents a CloudTrail event.

type EventResource

type EventResource struct {
	ResourceType string
	ResourceName string
}

EventResource identifies an AWS resource in an event.

type EventSelector

type EventSelector struct {
	ReadWriteType                 string
	IncludeManagementEvents       bool
	DataResources                 []DataResource
	ExcludeManagementEventSources []string
}

EventSelector configures event filtering for a trail.

type InsightSelector

type InsightSelector struct {
	InsightType string
}

InsightSelector configures insight event collection.

type LookupAttribute

type LookupAttribute struct {
	AttributeKey   string
	AttributeValue string
}

LookupAttribute is a filter criterion for LookupEvents.

type Store

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

Store is the in-memory store for CloudTrail resources.

func NewStore

func NewStore(accountID, region string) *Store

NewStore creates an empty CloudTrail Store.

func (*Store) AddTags

func (s *Store) AddTags(arn string, tags []Tag) *service.AWSError

AddTags adds tags to a trail.

func (*Store) CreateTrail

func (s *Store) CreateTrail(name, s3Bucket, s3Prefix string, isMultiRegion, isOrg, logValidation, includeGlobal bool, tags []Tag) (*Trail, *service.AWSError)

CreateTrail creates a new trail.

func (*Store) DeleteTrail

func (s *Store) DeleteTrail(name string) *service.AWSError

DeleteTrail removes a trail by name.

func (*Store) GetTrail

func (s *Store) GetTrail(name string) (*Trail, *service.AWSError)

GetTrail returns a trail by name.

func (*Store) ListTagsByARN

func (s *Store) ListTagsByARN(arn string) ([]Tag, *service.AWSError)

ListTagsByARN returns tags for a trail by ARN.

func (*Store) ListTrails

func (s *Store) ListTrails() []*Trail

ListTrails returns all trails.

func (*Store) LookupEvents

func (s *Store) LookupEvents(maxResults int, startTime, endTime *time.Time, attributes []LookupAttribute) []Event

LookupEvents returns events matching the given lookup attributes.

func (*Store) PutEventSelectors

func (s *Store) PutEventSelectors(name string, selectors []EventSelector) *service.AWSError

PutEventSelectors sets event selectors for a trail.

func (*Store) PutInsightSelectors

func (s *Store) PutInsightSelectors(name string, selectors []InsightSelector) *service.AWSError

PutInsightSelectors sets insight selectors for a trail.

func (*Store) RecordEvent

func (s *Store) RecordEvent(eventName, eventSource, username string, resources []EventResource)

RecordEvent adds an event to the store (for cross-service logging).

func (*Store) RemoveTags

func (s *Store) RemoveTags(arn string, tags []Tag) *service.AWSError

RemoveTags removes tags from a trail.

func (*Store) StartLogging

func (s *Store) StartLogging(name string) *service.AWSError

StartLogging enables logging for a trail.

func (*Store) StopLogging

func (s *Store) StopLogging(name string) *service.AWSError

StopLogging disables logging for a trail.

func (*Store) UpdateTrail

func (s *Store) UpdateTrail(name string, updates map[string]any) (*Trail, *service.AWSError)

UpdateTrail updates a trail's configuration.

type Tag

type Tag struct {
	Key   string
	Value string
}

Tag represents a key-value tag.

type Trail

type Trail struct {
	Name                       string
	TrailARN                   string
	HomeRegion                 string
	S3BucketName               string
	S3KeyPrefix                string
	SnsTopicName               string
	SnsTopicARN                string
	IncludeGlobalServiceEvents bool
	IsMultiRegionTrail         bool
	IsOrganizationTrail        bool
	LogFileValidationEnabled   bool
	CloudWatchLogsLogGroupArn  string
	CloudWatchLogsRoleArn      string
	KmsKeyId                   string
	HasCustomEventSelectors    bool
	HasInsightSelectors        bool
	Tags                       []Tag
	IsLogging                  bool
	LatestDeliveryTime         *time.Time
	LatestNotificationTime     *time.Time
	StartLoggingTime           *time.Time
	StopLoggingTime            *time.Time
	EventSelectors             []EventSelector
	InsightSelectors           []InsightSelector
	// contains filtered or unexported fields
}

Trail holds all metadata for a CloudTrail trail.

Jump to

Keyboard shortcuts

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