Documentation
¶
Index ¶
- type Alarm
- type CloudWatchService
- func (s *CloudWatchService) Actions() []service.Action
- func (s *CloudWatchService) GetAlarmActionsSummary() (alarmNames, actionArns []string)
- func (s *CloudWatchService) GetAllAlarms() []*Alarm
- func (s *CloudWatchService) HandleRequest(ctx *service.RequestContext) (*service.Response, error)
- func (s *CloudWatchService) HealthCheck() error
- func (s *CloudWatchService) Name() string
- func (s *CloudWatchService) ResourceSchemas() []schema.ResourceSchema
- func (s *CloudWatchService) SetLocator(locator ServiceLocator)
- type Dimension
- type MetricDatum
- type SNSPublisher
- type ServiceLocator
- type Store
- func (s *Store) DeleteAlarms(names []string)
- func (s *Store) DescribeAlarms(names []string) []*Alarm
- func (s *Store) DescribeAlarmsForMetric(namespace, metricName string) []*Alarm
- func (s *Store) GetMetricData(namespace, metricName string, dims []Dimension, start, end time.Time) []*MetricDatum
- func (s *Store) ListMetrics(namespace, metricName string) []*MetricDatum
- func (s *Store) ListTagsForResource(resourceArn string) (map[string]string, bool)
- func (s *Store) PutAlarm(a *Alarm) *Alarm
- func (s *Store) PutMetricData(namespace string, data []*MetricDatum)
- func (s *Store) SetAlarmState(name, stateValue, stateReason string) bool
- func (s *Store) TagResource(resourceArn string, tags map[string]string) bool
- func (s *Store) UntagResource(resourceArn string, tagKeys []string) bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Alarm ¶
type Alarm struct {
AlarmName string
AlarmArn string
Namespace string
MetricName string
ComparisonOperator string
Threshold float64
EvaluationPeriods int
Period int
Statistic string
StateValue string
StateReason string
AlarmActions []string
Dimensions []Dimension
Tags map[string]string
}
Alarm represents a CloudWatch metric alarm definition.
type CloudWatchService ¶
type CloudWatchService struct {
// contains filtered or unexported fields
}
CloudWatchService is the cloudmock implementation of the AWS CloudWatch Metrics API.
func New ¶
func New(accountID, region string) *CloudWatchService
New returns a new CloudWatchService for the given AWS account ID and region.
func (*CloudWatchService) Actions ¶
func (s *CloudWatchService) Actions() []service.Action
Actions returns the list of CloudWatch API actions supported by this service.
func (*CloudWatchService) GetAlarmActionsSummary ¶
func (s *CloudWatchService) GetAlarmActionsSummary() (alarmNames, actionArns []string)
GetAlarmActionsSummary returns parallel slices of alarm names and action ARNs for topology.
func (*CloudWatchService) GetAllAlarms ¶
func (s *CloudWatchService) GetAllAlarms() []*Alarm
GetAllAlarms returns all alarms for topology queries.
func (*CloudWatchService) HandleRequest ¶
func (s *CloudWatchService) HandleRequest(ctx *service.RequestContext) (*service.Response, error)
HandleRequest routes an incoming CloudWatch request to the appropriate handler. CloudWatch uses form-encoded POST bodies; the Action is found in the form body. Newer AWS SDKs use Smithy RPC-v2 CBOR over the /service/.../operation/{name} path.
func (*CloudWatchService) HealthCheck ¶
func (s *CloudWatchService) HealthCheck() error
HealthCheck always returns nil (no external dependencies).
func (*CloudWatchService) Name ¶
func (s *CloudWatchService) Name() string
Name returns the AWS service name used for routing. CloudWatch Metrics uses "monitoring" in the credential scope.
func (*CloudWatchService) ResourceSchemas ¶
func (s *CloudWatchService) ResourceSchemas() []schema.ResourceSchema
ResourceSchemas returns the schema for CloudWatch resource types.
func (*CloudWatchService) SetLocator ¶
func (s *CloudWatchService) SetLocator(locator ServiceLocator)
SetLocator sets the service locator for cross-service delivery (alarm → SNS).
type MetricDatum ¶
type MetricDatum struct {
Namespace string
MetricName string
Value float64
Unit string
Timestamp time.Time
Dimensions []Dimension
}
MetricDatum is a single data point stored for a metric.
type SNSPublisher ¶
SNSPublisher is an interface for directly publishing messages to SNS topics.
type ServiceLocator ¶
ServiceLocator provides access to other services for cross-service communication.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store holds all CloudWatch metric data points and alarms in memory.
func (*Store) DeleteAlarms ¶
DeleteAlarms removes alarms by name. Silently ignores non-existent names.
func (*Store) DescribeAlarms ¶
DescribeAlarms returns alarms, optionally filtered by name.
func (*Store) DescribeAlarmsForMetric ¶
DescribeAlarmsForMetric returns alarms matching a namespace + metric name.
func (*Store) GetMetricData ¶
func (s *Store) GetMetricData(namespace, metricName string, dims []Dimension, start, end time.Time) []*MetricDatum
GetMetricData returns data points matching a query within a time window.
func (*Store) ListMetrics ¶
func (s *Store) ListMetrics(namespace, metricName string) []*MetricDatum
ListMetrics returns unique (Namespace, MetricName, Dimensions) combinations. If namespace or metricName filters are set, only matching metrics are returned.
func (*Store) ListTagsForResource ¶
ListTagsForResource returns tags for an alarm identified by its ARN. The second return value is false if not found.
func (*Store) PutMetricData ¶
func (s *Store) PutMetricData(namespace string, data []*MetricDatum)
PutMetricData stores one or more metric data points.
func (*Store) SetAlarmState ¶
SetAlarmState updates the StateValue and StateReason on an alarm. Returns false if the alarm does not exist.
func (*Store) TagResource ¶
TagResource sets tags on an alarm identified by its ARN. Returns false if not found.