Help us shape the future of Go! Take the 2026 Go Developer Survey

cloudtrail

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package cloudtrail emulates AWS CloudTrail (JSON 1.1): trails with event and insight selectors, event data stores as metadata, LookupEvents built from pogi's request log, and logging trails that deliver gzipped log files to S3 and CloudWatch Logs.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DataResource

type DataResource struct {
	Type   string
	Values []string
}

DataResource names data events of an event selector (kept, not logged).

type Event

type Event struct {
	EventId         string
	EventName       string
	ReadOnly        string
	AccessKeyId     string `json:",omitempty"`
	EventTime       core.Time
	EventSource     string
	Username        string     `json:",omitempty"`
	Resources       []Resource `json:",omitempty"`
	CloudTrailEvent string
}

Event is one LookupEvents result.

type EventSelector

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

EventSelector picks the events a trail logs.

type Resource

type Resource struct{ ResourceType, ResourceName string }

Resource is a resource an event refers to.

type Service

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

Service is the CloudTrail emulator.

func New

func New(hub *core.Hub) *Service

New creates the CloudTrail service: it follows the request log and delivers the logs of logging trails every minute.

func (*Service) Close

func (s *Service) Close() error

Close stops following the request log and delivering.

func (*Service) Info

func (s *Service) Info() core.Info

func (*Service) Inspect

func (s *Service) Inspect(table, id string) any

func (*Service) Load

func (s *Service) Load(b []byte) error

func (*Service) Reset

func (s *Service) Reset()

func (*Service) Resources

func (s *Service) Resources() []core.Table

func (*Service) Save

func (s *Service) Save() ([]byte, error)

func (*Service) ServeHTTP

func (s *Service) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP accepts both targets SDKs send: CloudTrail_20131101.Op and com.amazonaws.cloudtrail.v20131101.CloudTrail_20131101.Op (routed here by its signing name). core.TargetOp reads the operation from either.

func (*Service) Tick

func (s *Service) Tick(now time.Time)

Tick delivers what logging trails have not delivered yet: per trail and region a gzipped {"Records":[…]} file to S3, and each record to the trail's CloudWatch Logs group.

type Store

type Store struct {
	EventDataStoreArn            string
	Name                         string
	Status                       string
	AdvancedEventSelectors       json.RawMessage
	MultiRegionEnabled           bool
	OrganizationEnabled          bool
	RetentionPeriod              int
	TerminationProtectionEnabled bool
	BillingMode                  string
	KmsKeyId                     string `json:",omitempty"`
	CreatedTimestamp             core.Time
	UpdatedTimestamp             core.Time
}

Store is an event data store (CloudTrail Lake), as metadata.

type Tag

type Tag struct {
	Key   string
	Value string `json:",omitempty"`
}

Tag is a resource tag.

type Trail

type Trail struct {
	Name                       string
	S3BucketName               string
	S3KeyPrefix                string `json:",omitempty"`
	SnsTopicName               string `json:",omitempty"`
	SnsTopicARN                string `json:",omitempty"`
	IncludeGlobalServiceEvents bool
	IsMultiRegionTrail         bool
	HomeRegion                 string
	TrailARN                   string
	LogFileValidationEnabled   bool
	CloudWatchLogsLogGroupArn  string `json:",omitempty"`
	CloudWatchLogsRoleArn      string `json:",omitempty"`
	KmsKeyId                   string `json:",omitempty"`
	HasCustomEventSelectors    bool
	HasInsightSelectors        bool
	IsOrganizationTrail        bool
}

Trail is a trail in the API's shape.

Jump to

Keyboard shortcuts

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