cloudwatchlogs

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: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CloudWatchLogsService

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

CloudWatchLogsService is the cloudmock implementation of the AWS CloudWatch Logs API.

func New

func New(accountID, region string) *CloudWatchLogsService

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

func (*CloudWatchLogsService) Actions

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

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

func (*CloudWatchLogsService) ExportState

func (s *CloudWatchLogsService) ExportState() (json.RawMessage, error)

ExportState returns a JSON snapshot of all CloudWatch Logs log groups.

func (*CloudWatchLogsService) HandleRequest

HandleRequest routes an incoming CloudWatch Logs request to the appropriate handler. CloudWatch Logs uses the JSON protocol with X-Amz-Target: Logs_20140328.<Action>.

func (*CloudWatchLogsService) HealthCheck

func (s *CloudWatchLogsService) HealthCheck() error

HealthCheck always returns nil (no external dependencies).

func (*CloudWatchLogsService) ImportState

func (s *CloudWatchLogsService) ImportState(data json.RawMessage) error

ImportState restores CloudWatch Logs state from a JSON snapshot.

func (*CloudWatchLogsService) Name

func (s *CloudWatchLogsService) Name() string

Name returns the AWS service name used for routing. CloudWatch Logs uses "logs" in the credential scope and X-Amz-Target prefix.

func (*CloudWatchLogsService) ResourceSchemas

func (s *CloudWatchLogsService) ResourceSchemas() []schema.ResourceSchema

ResourceSchemas returns the schema for CloudWatch Logs resource types.

type LogEvent

type LogEvent struct {
	Timestamp     int64
	Message       string
	IngestionTime int64
}

LogEvent is a single log event with timestamp (epoch millis) and message.

type LogGroup

type LogGroup struct {
	Name          string
	ARN           string
	CreationTime  int64
	RetentionDays int
	StoredBytes   int64
	Tags          map[string]string
	Streams       map[string]*LogStream
}

LogGroup holds metadata and streams for a single log group.

type LogStream

type LogStream struct {
	Name                string
	ARN                 string
	CreationTime        int64
	FirstEventTimestamp int64
	LastEventTimestamp  int64
	LastIngestionTime   int64
	UploadSequenceToken string
	Events              []LogEvent
}

LogStream holds metadata and events for a single log stream.

type Store

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

Store is the in-memory store for CloudWatch Logs resources.

func NewStore

func NewStore(accountID, region string) *Store

NewStore creates an empty CloudWatch Logs Store.

func (*Store) CreateLogGroup

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

CreateLogGroup creates a new log group. Returns AlreadyExistsException if it exists.

func (*Store) CreateLogStream

func (s *Store) CreateLogStream(groupName, streamName string) *service.AWSError

CreateLogStream creates a new stream inside a group.

func (*Store) DeleteLogGroup

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

DeleteLogGroup removes a log group and all its streams.

func (*Store) DeleteLogStream

func (s *Store) DeleteLogStream(groupName, streamName string) *service.AWSError

DeleteLogStream removes a stream from a group.

func (*Store) DeleteRetentionPolicy

func (s *Store) DeleteRetentionPolicy(groupName string) *service.AWSError

DeleteRetentionPolicy removes the retention policy from a log group.

func (*Store) DescribeLogGroups

func (s *Store) DescribeLogGroups(prefix string) []*LogGroup

DescribeLogGroups returns log groups, optionally filtered by prefix.

func (*Store) DescribeLogStreams

func (s *Store) DescribeLogStreams(groupName, prefix string) ([]*LogStream, *service.AWSError)

DescribeLogStreams returns streams for a group, optionally filtered by prefix.

func (*Store) FilterLogEvents

func (s *Store) FilterLogEvents(groupName string, streamNames []string, filterPattern string, startTime, endTime int64) ([]LogEvent, *service.AWSError)

FilterLogEvents searches across one or more streams for events matching a substring pattern.

func (*Store) GetLogEvents

func (s *Store) GetLogEvents(groupName, streamName string, startTime, endTime int64, limit int) ([]LogEvent, string, string, *service.AWSError)

GetLogEvents retrieves events from a stream with optional time filtering and limit.

func (*Store) ListTagsLogGroup

func (s *Store) ListTagsLogGroup(groupName string) (map[string]string, *service.AWSError)

ListTagsLogGroup returns the tags for a log group.

func (*Store) PutLogEvents

func (s *Store) PutLogEvents(groupName, streamName string, events []LogEvent) (string, *service.AWSError)

PutLogEvents appends events to a stream and returns the next sequence token.

func (*Store) PutRetentionPolicy

func (s *Store) PutRetentionPolicy(groupName string, retentionDays int) *service.AWSError

PutRetentionPolicy sets retentionInDays on a log group.

func (*Store) TagLogGroup

func (s *Store) TagLogGroup(groupName string, tags map[string]string) *service.AWSError

TagLogGroup adds or updates tags on a log group.

func (*Store) UntagLogGroup

func (s *Store) UntagLogGroup(groupName string, tagKeys []string) *service.AWSError

UntagLogGroup removes the specified tag keys from a log group.

Jump to

Keyboard shortcuts

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