cloudwatch

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2026 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AlarmStateOK               = "OK"
	AlarmStateAlarm            = "ALARM"
	AlarmStateInsufficientData = "INSUFFICIENT_DATA"
)
View Source
const (
	CreateAlarmPayloadType = "aws.cloudwatch.alarm"
	UpdateAlarmPayloadType = "aws.cloudwatch.alarm"
	GetAlarmPayloadType    = "aws.cloudwatch.alarm"
	DeleteAlarmPayloadType = "aws.cloudwatch.alarm.deleted"
)
View Source
const (
	Source                     = "aws.cloudwatch"
	DetailTypeAlarmStateChange = "CloudWatch Alarm State Change"
)
View Source
const AddLogEventPayloadType = "aws.cloudwatch.logEvent"
View Source
const (
	QueryLogsPayloadType = "aws.cloudwatch.queryResult"
)
View Source
const (
	StatisticAverage = "Average"
)
View Source
const UnitUnsetValue = "unset"

UnitUnsetValue removes an alarm's unit. CloudWatch has no "no unit" unit — omitting the parameter is what clears it — but a select cannot submit a blank value, so the option carries this sentinel and the components map it to empty. Note this is distinct from the real "None" unit, which still filters datapoints.

Variables

View Source
var AlarmComparisonOperatorOptions = []configuration.FieldOption{
	{Label: "Greater Than Threshold", Value: "GreaterThanThreshold"},
	{Label: "Greater Than Or Equal To Threshold", Value: "GreaterThanOrEqualToThreshold"},
	{Label: "Less Than Threshold", Value: "LessThanThreshold"},
	{Label: "Less Than Or Equal To Threshold", Value: "LessThanOrEqualToThreshold"},
}
View Source
var AlarmEC2ActionOptions = []configuration.FieldOption{
	{Label: "Recover", Value: "recover"},
	{Label: "Reboot", Value: "reboot"},
	{Label: "Stop", Value: "stop"},
	{Label: "Terminate", Value: "terminate"},
}

AlarmEC2ActionOptions are the EC2 automations CloudWatch can run itself when an alarm fires. Each value maps to arn:aws:automate:<region>:ec2:<value>.

View Source
var AlarmStatisticOptions = []configuration.FieldOption{
	{Label: "Average", Value: StatisticAverage},
	{Label: "Sum", Value: "Sum"},
	{Label: "Minimum", Value: "Minimum"},
	{Label: "Maximum", Value: "Maximum"},
	{Label: "Sample Count", Value: "SampleCount"},
}
View Source
var AlarmTreatMissingDataOptions = []configuration.FieldOption{
	{Label: "Missing", Value: "missing"},
	{Label: "Ignore", Value: "ignore"},
	{Label: "Breaching", Value: "breaching"},
	{Label: "Not Breaching", Value: "notBreaching"},
}
View Source
var AlarmUnitClearOption = configuration.FieldOption{
	Label:       "No unit",
	Value:       UnitUnsetValue,
	Description: "Remove the unit so the alarm matches datapoints of any unit",
}

AlarmUnitClearOption lets an update remove a unit that matches no datapoints.

View Source
var AlarmUnitOptions = []configuration.FieldOption{
	{Label: "None", Value: "None", Description: "The literal None unit, not the absence of one"},
	{Label: "Percent", Value: "Percent"},
	{Label: "Count", Value: "Count"},
	{Label: "Count/Second", Value: "Count/Second"},
	{Label: "Seconds", Value: "Seconds"},
	{Label: "Microseconds", Value: "Microseconds"},
	{Label: "Milliseconds", Value: "Milliseconds"},
	{Label: "Bytes", Value: "Bytes"},
	{Label: "Kilobytes", Value: "Kilobytes"},
	{Label: "Megabytes", Value: "Megabytes"},
	{Label: "Gigabytes", Value: "Gigabytes"},
	{Label: "Terabytes", Value: "Terabytes"},
	{Label: "Bits", Value: "Bits"},
	{Label: "Kilobits", Value: "Kilobits"},
	{Label: "Megabits", Value: "Megabits"},
	{Label: "Gigabits", Value: "Gigabits"},
	{Label: "Terabits", Value: "Terabits"},
	{Label: "Bytes/Second", Value: "Bytes/Second"},
	{Label: "Kilobytes/Second", Value: "Kilobytes/Second"},
	{Label: "Megabytes/Second", Value: "Megabytes/Second"},
	{Label: "Gigabytes/Second", Value: "Gigabytes/Second"},
	{Label: "Terabytes/Second", Value: "Terabytes/Second"},
	{Label: "Bits/Second", Value: "Bits/Second"},
	{Label: "Kilobits/Second", Value: "Kilobits/Second"},
	{Label: "Megabits/Second", Value: "Megabits/Second"},
	{Label: "Gigabits/Second", Value: "Gigabits/Second"},
	{Label: "Terabits/Second", Value: "Terabits/Second"},
}

AlarmUnitOptions are the metric units accepted by PutMetricAlarm.

View Source
var AllAlarmStates = []configuration.FieldOption{
	{
		Label: "OK",
		Value: AlarmStateOK,
	},
	{
		Label: "ALARM",
		Value: AlarmStateAlarm,
	},
	{
		Label: "INSUFFICIENT_DATA",
		Value: AlarmStateInsufficientData,
	},
}

Functions

func APIDNSSuffix

func APIDNSSuffix(region string) string

APIDNSSuffix returns the domain AWS service endpoints hang off in a region. GovCloud shares the default suffix; only China differs.

func AlarmConsoleURL

func AlarmConsoleURL(region, alarmName string) string

AlarmConsoleURL builds the CloudWatch console link for an alarm.

func ConsoleHost

func ConsoleHost(region string) string

ConsoleHost returns the AWS console host serving a region.

func EC2AutomationARN

func EC2AutomationARN(region, action string) string

EC2AutomationARN builds the ARN for an EC2 automation action.

func EncodeDimensions

func EncodeDimensions(dimensions []Dimension) (string, error)

EncodeDimensions serializes a dimension set into the value stored in the component configuration. JSON keeps values with separators unambiguous.

func FormatDimensions

func FormatDimensions(dimensions []Dimension) string

func ListAlarms

func ListAlarms(ctx core.ListResourcesContext, resourceType string) ([]core.IntegrationResource, error)

func ListLogGroups

func ListLogGroups(ctx core.ListResourcesContext, resourceType string) ([]core.IntegrationResource, error)

func ListMetricDimensions

func ListMetricDimensions(ctx core.ListResourcesContext, resourceType string) ([]core.IntegrationResource, error)

ListMetricDimensions lists the dimension sets a metric is published with. A metric is identified by its namespace, name and full dimension set, so each resource carries the whole set, JSON-encoded.

func ListMetricNames

func ListMetricNames(ctx core.ListResourcesContext, resourceType string) ([]core.IntegrationResource, error)

func ListNamespaces

func ListNamespaces(ctx core.ListResourcesContext, resourceType string) ([]core.IntegrationResource, error)

func PartitionForRegion

func PartitionForRegion(region string) string

PartitionForRegion returns the ARN partition a region belongs to.

Types

type AddLogEvent

type AddLogEvent struct{}

func (*AddLogEvent) Cancel

func (c *AddLogEvent) Cancel(ctx core.ExecutionContext) error

func (*AddLogEvent) Cleanup

func (c *AddLogEvent) Cleanup(ctx core.SetupContext) error

func (*AddLogEvent) Color

func (c *AddLogEvent) Color() string

func (*AddLogEvent) Configuration

func (c *AddLogEvent) Configuration() []configuration.Field

func (*AddLogEvent) Description

func (c *AddLogEvent) Description() string

func (*AddLogEvent) Documentation

func (c *AddLogEvent) Documentation() string

func (*AddLogEvent) ExampleOutput

func (c *AddLogEvent) ExampleOutput() map[string]any

func (*AddLogEvent) Execute

func (c *AddLogEvent) Execute(ctx core.ExecutionContext) error

func (*AddLogEvent) HandleHook

func (c *AddLogEvent) HandleHook(ctx core.ActionHookContext) error

func (*AddLogEvent) HandleWebhook

func (*AddLogEvent) Hooks

func (c *AddLogEvent) Hooks() []core.Hook

func (*AddLogEvent) Icon

func (c *AddLogEvent) Icon() string

func (*AddLogEvent) Label

func (c *AddLogEvent) Label() string

func (*AddLogEvent) Name

func (c *AddLogEvent) Name() string

func (*AddLogEvent) OutputChannels

func (c *AddLogEvent) OutputChannels(configuration any) []core.OutputChannel

func (*AddLogEvent) Setup

func (c *AddLogEvent) Setup(ctx core.SetupContext) error

type AddLogEventConfiguration

type AddLogEventConfiguration struct {
	Region    string `json:"region" mapstructure:"region"`
	LogGroup  string `json:"logGroup" mapstructure:"logGroup"`
	LogStream string `json:"logStream" mapstructure:"logStream"`
	Message   string `json:"message" mapstructure:"message"`
	Timestamp string `json:"timestamp" mapstructure:"timestamp"`
	Timezone  string `json:"timezone" mapstructure:"timezone"`
}

type AlarmState

type AlarmState struct {
	Value     string `json:"value" mapstructure:"value"`
	Reason    string `json:"reason" mapstructure:"reason"`
	Timestamp string `json:"timestamp" mapstructure:"timestamp"`
}

type AlarmStateChangeDetail

type AlarmStateChangeDetail struct {
	AlarmName     string     `json:"alarmName" mapstructure:"alarmName"`
	State         AlarmState `json:"state" mapstructure:"state"`
	PreviousState AlarmState `json:"previousState" mapstructure:"previousState"`
}

type Client

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

Client provides CloudWatch alarm and metric operations through signed HTTP requests.

func NewClient

func NewClient(httpCtx core.HTTPContext, credentials *aws.Credentials, region string) *Client

NewClient creates a region-scoped CloudWatch client.

func (*Client) DeleteAlarms

func (c *Client) DeleteAlarms(alarmNames ...string) error

DeleteAlarms removes the named alarms. CloudWatch accepts up to 100 per call and deletes none of them if any name is syntactically invalid.

func (*Client) DescribeAlarm

func (c *Client) DescribeAlarm(alarmName string) (*MetricAlarm, error)

func (*Client) ListAlarms

func (c *Client) ListAlarms() ([]MetricAlarm, error)

func (*Client) ListMetrics

func (c *Client) ListMetrics(namespace, metricName string) ([]Metric, error)

ListMetrics returns the metrics available in the region, optionally narrowed down to a namespace and a metric name.

func (*Client) PutMetricAlarm

func (c *Client) PutMetricAlarm(input PutMetricAlarmInput) error

type CreateAlarm

type CreateAlarm struct{}

func (*CreateAlarm) Cancel

func (c *CreateAlarm) Cancel(_ core.ExecutionContext) error

func (*CreateAlarm) Cleanup

func (c *CreateAlarm) Cleanup(_ core.SetupContext) error

func (*CreateAlarm) Color

func (c *CreateAlarm) Color() string

func (*CreateAlarm) Configuration

func (c *CreateAlarm) Configuration() []configuration.Field

func (*CreateAlarm) Description

func (c *CreateAlarm) Description() string

func (*CreateAlarm) Documentation

func (c *CreateAlarm) Documentation() string

func (*CreateAlarm) ExampleOutput

func (c *CreateAlarm) ExampleOutput() map[string]any

func (*CreateAlarm) Execute

func (c *CreateAlarm) Execute(ctx core.ExecutionContext) error

func (*CreateAlarm) HandleHook

func (c *CreateAlarm) HandleHook(_ core.ActionHookContext) error

func (*CreateAlarm) HandleWebhook

func (*CreateAlarm) Hooks

func (c *CreateAlarm) Hooks() []core.Hook

func (*CreateAlarm) Icon

func (c *CreateAlarm) Icon() string

func (*CreateAlarm) Label

func (c *CreateAlarm) Label() string

func (*CreateAlarm) Name

func (c *CreateAlarm) Name() string

func (*CreateAlarm) OutputChannels

func (c *CreateAlarm) OutputChannels(_ any) []core.OutputChannel

func (*CreateAlarm) Setup

func (c *CreateAlarm) Setup(ctx core.SetupContext) error

type CreateAlarmConfiguration

type CreateAlarmConfiguration struct {
	Region                  string   `json:"region" mapstructure:"region"`
	AlarmName               string   `json:"alarmName" mapstructure:"alarmName"`
	Namespace               string   `json:"namespace" mapstructure:"namespace"`
	MetricName              string   `json:"metricName" mapstructure:"metricName"`
	Dimensions              string   `json:"dimensions" mapstructure:"dimensions"`
	Statistic               string   `json:"statistic" mapstructure:"statistic"`
	ComparisonOperator      string   `json:"comparisonOperator" mapstructure:"comparisonOperator"`
	Threshold               float64  `json:"threshold" mapstructure:"threshold"`
	Period                  int      `json:"period" mapstructure:"period"`
	EvaluationPeriods       int      `json:"evaluationPeriods" mapstructure:"evaluationPeriods"`
	DatapointsToAlarm       int      `json:"datapointsToAlarm" mapstructure:"datapointsToAlarm"`
	AlarmDescription        string   `json:"alarmDescription" mapstructure:"alarmDescription"`
	TreatMissingData        string   `json:"treatMissingData" mapstructure:"treatMissingData"`
	Unit                    string   `json:"unit" mapstructure:"unit"`
	ActionsEnabled          bool     `json:"actionsEnabled" mapstructure:"actionsEnabled"`
	AlarmActions            []string `json:"alarmActions" mapstructure:"alarmActions"`
	EC2Action               string   `json:"ec2Action" mapstructure:"ec2Action"`
	OKActions               []string `json:"okActions" mapstructure:"okActions"`
	InsufficientDataActions []string `json:"insufficientDataActions" mapstructure:"insufficientDataActions"`
}

type CreateAlarmNodeMetadata

type CreateAlarmNodeMetadata struct {
	Region     string `json:"region" mapstructure:"region"`
	AlarmName  string `json:"alarmName" mapstructure:"alarmName"`
	Namespace  string `json:"namespace" mapstructure:"namespace"`
	MetricName string `json:"metricName" mapstructure:"metricName"`
	Dimensions string `json:"dimensions" mapstructure:"dimensions"`
}

type DeleteAlarm

type DeleteAlarm struct{}

func (*DeleteAlarm) Cancel

func (c *DeleteAlarm) Cancel(_ core.ExecutionContext) error

func (*DeleteAlarm) Cleanup

func (c *DeleteAlarm) Cleanup(_ core.SetupContext) error

func (*DeleteAlarm) Color

func (c *DeleteAlarm) Color() string

func (*DeleteAlarm) Configuration

func (c *DeleteAlarm) Configuration() []configuration.Field

func (*DeleteAlarm) Description

func (c *DeleteAlarm) Description() string

func (*DeleteAlarm) Documentation

func (c *DeleteAlarm) Documentation() string

func (*DeleteAlarm) ExampleOutput

func (c *DeleteAlarm) ExampleOutput() map[string]any

func (*DeleteAlarm) Execute

func (c *DeleteAlarm) Execute(ctx core.ExecutionContext) error

func (*DeleteAlarm) HandleHook

func (c *DeleteAlarm) HandleHook(_ core.ActionHookContext) error

func (*DeleteAlarm) HandleWebhook

func (*DeleteAlarm) Hooks

func (c *DeleteAlarm) Hooks() []core.Hook

func (*DeleteAlarm) Icon

func (c *DeleteAlarm) Icon() string

func (*DeleteAlarm) Label

func (c *DeleteAlarm) Label() string

func (*DeleteAlarm) Name

func (c *DeleteAlarm) Name() string

func (*DeleteAlarm) OutputChannels

func (c *DeleteAlarm) OutputChannels(_ any) []core.OutputChannel

func (*DeleteAlarm) Setup

func (c *DeleteAlarm) Setup(ctx core.SetupContext) error

type DeleteAlarmConfiguration

type DeleteAlarmConfiguration struct {
	Region    string `json:"region" mapstructure:"region"`
	AlarmName string `json:"alarm" mapstructure:"alarm"`
}

type DeleteAlarmNodeMetadata

type DeleteAlarmNodeMetadata struct {
	Region    string `json:"region" mapstructure:"region"`
	AlarmName string `json:"alarmName" mapstructure:"alarmName"`
}

type Dimension

type Dimension struct {
	Name  string `json:"name" mapstructure:"name"`
	Value string `json:"value" mapstructure:"value"`
}

func DecodeDimensions

func DecodeDimensions(value string) ([]Dimension, error)

type GetAlarm

type GetAlarm struct{}

func (*GetAlarm) Cancel

func (c *GetAlarm) Cancel(_ core.ExecutionContext) error

func (*GetAlarm) Cleanup

func (c *GetAlarm) Cleanup(_ core.SetupContext) error

func (*GetAlarm) Color

func (c *GetAlarm) Color() string

func (*GetAlarm) Configuration

func (c *GetAlarm) Configuration() []configuration.Field

func (*GetAlarm) Description

func (c *GetAlarm) Description() string

func (*GetAlarm) Documentation

func (c *GetAlarm) Documentation() string

func (*GetAlarm) ExampleOutput

func (c *GetAlarm) ExampleOutput() map[string]any

func (*GetAlarm) Execute

func (c *GetAlarm) Execute(ctx core.ExecutionContext) error

func (*GetAlarm) HandleHook

func (c *GetAlarm) HandleHook(_ core.ActionHookContext) error

func (*GetAlarm) HandleWebhook

func (*GetAlarm) Hooks

func (c *GetAlarm) Hooks() []core.Hook

func (*GetAlarm) Icon

func (c *GetAlarm) Icon() string

func (*GetAlarm) Label

func (c *GetAlarm) Label() string

func (*GetAlarm) Name

func (c *GetAlarm) Name() string

func (*GetAlarm) OutputChannels

func (c *GetAlarm) OutputChannels(_ any) []core.OutputChannel

func (*GetAlarm) Setup

func (c *GetAlarm) Setup(ctx core.SetupContext) error

type GetAlarmConfiguration

type GetAlarmConfiguration struct {
	Region    string `json:"region" mapstructure:"region"`
	AlarmName string `json:"alarm" mapstructure:"alarm"`
}

type GetAlarmNodeMetadata

type GetAlarmNodeMetadata struct {
	Region    string `json:"region" mapstructure:"region"`
	AlarmName string `json:"alarmName" mapstructure:"alarmName"`
}

type LogEvent

type LogEvent struct {
	Message   string
	Timestamp time.Time
}

type LogGroup

type LogGroup struct {
	Name string
	Arn  string
}

type LogsClient

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

LogsClient talks to the CloudWatch Logs API.

func NewLogsClient

func NewLogsClient(httpCtx core.HTTPContext, credentials *aws.Credentials, region string) *LogsClient

func (*LogsClient) CreateLogStream

func (c *LogsClient) CreateLogStream(logGroupName, logStreamName string) error

CreateLogStream creates a log stream in a log group. Callers should treat common.IsAlreadyExistsErr(err) as success since streams only need to exist once.

func (*LogsClient) DescribeLogGroups

func (c *LogsClient) DescribeLogGroups(namePrefix string) ([]LogGroup, error)

DescribeLogGroups lists log groups whose name starts with namePrefix (all log groups when empty).

func (*LogsClient) GetQueryResults

func (c *LogsClient) GetQueryResults(queryID string) (*QueryResults, error)

GetQueryResults retrieves the current status and rows for a Logs Insights query.

func (*LogsClient) PutLogEvents

func (c *LogsClient) PutLogEvents(logGroupName, logStreamName string, events []LogEvent) error

PutLogEvents uploads a batch of log events to a log stream. Events must be in chronological order, per the CloudWatch Logs API contract.

func (*LogsClient) StartQuery

func (c *LogsClient) StartQuery(input StartQueryInput) (string, error)

StartQuery starts a CloudWatch Logs Insights query and returns its query ID.

func (*LogsClient) StopQuery

func (c *LogsClient) StopQuery(queryID string) error

StopQuery cancels a running Logs Insights query so it stops consuming the account's concurrent query quota.

type Metric

type Metric struct {
	Namespace  string      `json:"namespace" mapstructure:"namespace"`
	MetricName string      `json:"metricName" mapstructure:"metricName"`
	Dimensions []Dimension `json:"dimensions" mapstructure:"dimensions"`
}

Metric identifies a CloudWatch metric: a namespace, a name and a dimension set.

type MetricAlarm

type MetricAlarm struct {
	AlarmName                          string      `json:"alarmName" mapstructure:"alarmName"`
	AlarmArn                           string      `json:"alarmArn" mapstructure:"alarmArn"`
	AlarmDescription                   string      `json:"alarmDescription" mapstructure:"alarmDescription"`
	AlarmConfigurationUpdatedTimestamp string      `json:"alarmConfigurationUpdatedTimestamp" mapstructure:"alarmConfigurationUpdatedTimestamp"`
	ActionsEnabled                     bool        `json:"actionsEnabled" mapstructure:"actionsEnabled"`
	Namespace                          string      `json:"namespace" mapstructure:"namespace"`
	MetricName                         string      `json:"metricName" mapstructure:"metricName"`
	Dimensions                         []Dimension `json:"dimensions" mapstructure:"dimensions"`
	Statistic                          string      `json:"statistic" mapstructure:"statistic"`
	ExtendedStatistic                  string      `json:"extendedStatistic" mapstructure:"extendedStatistic"`
	Unit                               string      `json:"unit" mapstructure:"unit"`
	Period                             int         `json:"period" mapstructure:"period"`
	EvaluationPeriods                  int         `json:"evaluationPeriods" mapstructure:"evaluationPeriods"`
	DatapointsToAlarm                  int         `json:"datapointsToAlarm" mapstructure:"datapointsToAlarm"`
	Threshold                          float64     `json:"threshold" mapstructure:"threshold"`
	ThresholdMetricID                  string      `json:"thresholdMetricId" mapstructure:"thresholdMetricId"`
	ComparisonOperator                 string      `json:"comparisonOperator" mapstructure:"comparisonOperator"`
	TreatMissingData                   string      `json:"treatMissingData" mapstructure:"treatMissingData"`
	EvaluateLowSampleCountPercentile   string      `json:"evaluateLowSampleCountPercentile" mapstructure:"evaluateLowSampleCountPercentile"`
	StateValue                         string      `json:"stateValue" mapstructure:"stateValue"`
	StateReason                        string      `json:"stateReason" mapstructure:"stateReason"`
	StateReasonData                    string      `json:"stateReasonData" mapstructure:"stateReasonData"`
	StateUpdatedTimestamp              string      `json:"stateUpdatedTimestamp" mapstructure:"stateUpdatedTimestamp"`
	StateTransitionedTimestamp         string      `json:"stateTransitionedTimestamp" mapstructure:"stateTransitionedTimestamp"`
	AlarmActions                       []string    `json:"alarmActions" mapstructure:"alarmActions"`
	OKActions                          []string    `json:"okActions" mapstructure:"okActions"`
	InsufficientDataActions            []string    `json:"insufficientDataActions" mapstructure:"insufficientDataActions"`
	Region                             string      `json:"region" mapstructure:"region"`
	ConsoleURL                         string      `json:"consoleUrl" mapstructure:"consoleUrl"`

	// HasMetricQueries marks an alarm defined by a Metrics array — metric math,
	// anomaly detection or a Metrics Insights query. Those cannot be expressed
	// with the single-metric fields, so they are never rewritten.
	HasMetricQueries bool `json:"-" mapstructure:"-"`
}

type OnAlarm

type OnAlarm struct{}

func (*OnAlarm) Cleanup

func (p *OnAlarm) Cleanup(ctx core.TriggerContext) error

func (*OnAlarm) Color

func (p *OnAlarm) Color() string

func (*OnAlarm) Configuration

func (p *OnAlarm) Configuration() []configuration.Field

func (*OnAlarm) Description

func (p *OnAlarm) Description() string

func (*OnAlarm) Documentation

func (p *OnAlarm) Documentation() string

func (*OnAlarm) ExampleData

func (t *OnAlarm) ExampleData() map[string]any

func (*OnAlarm) HandleHook added in v0.18.0

func (p *OnAlarm) HandleHook(ctx core.TriggerHookContext) (map[string]any, error)

func (*OnAlarm) HandleWebhook

func (p *OnAlarm) HandleWebhook(ctx core.WebhookRequestContext) (int, *core.WebhookResponseBody, error)

func (*OnAlarm) Hooks added in v0.18.0

func (p *OnAlarm) Hooks() []core.Hook

func (*OnAlarm) Icon

func (p *OnAlarm) Icon() string

func (*OnAlarm) Label

func (p *OnAlarm) Label() string

func (*OnAlarm) Name

func (p *OnAlarm) Name() string

func (*OnAlarm) OnIntegrationMessage

func (p *OnAlarm) OnIntegrationMessage(ctx core.IntegrationMessageContext) error

func (*OnAlarm) Setup

func (p *OnAlarm) Setup(ctx core.TriggerContext) error

type OnAlarmConfiguration

type OnAlarmConfiguration struct {
	Region string                    `json:"region" mapstructure:"region"`
	Alarms []configuration.Predicate `json:"alarms" mapstructure:"alarms"`
	State  string                    `json:"state" mapstructure:"state"`
}

type OnAlarmMetadata

type OnAlarmMetadata struct {
	Region         string `json:"region" mapstructure:"region"`
	SubscriptionID string `json:"subscriptionId" mapstructure:"subscriptionId"`
}

type PutMetricAlarmInput

type PutMetricAlarmInput struct {
	AlarmName          string
	AlarmDescription   string
	Namespace          string
	MetricName         string
	Dimensions         []Dimension
	Statistic          string
	ExtendedStatistic  string
	Unit               string
	Period             int
	EvaluationPeriods  int
	DatapointsToAlarm  int
	Threshold          float64
	ComparisonOperator string
	TreatMissingData   string
	ActionsEnabled     bool

	// EvaluateLowSampleCountPercentile applies to percentile alarms only.
	// It must be carried over on update, or CloudWatch resets it to its default.
	EvaluateLowSampleCountPercentile string

	// Action ARNs executed on each state transition. A nil slice clears the actions.
	AlarmActions            []string
	OKActions               []string
	InsufficientDataActions []string

	// IncludeAlarmDescription sends AlarmDescription even when empty, to clear an existing description.
	IncludeAlarmDescription bool
}

PutMetricAlarmInput carries the full desired alarm state. CloudWatch replaces the whole alarm configuration on every PutMetricAlarm call, so callers updating an existing alarm must seed this from the current alarm.

type QueryLogs

type QueryLogs struct{}

func (*QueryLogs) Cancel

func (c *QueryLogs) Cancel(ctx core.ExecutionContext) error

func (*QueryLogs) Cleanup

func (c *QueryLogs) Cleanup(ctx core.SetupContext) error

func (*QueryLogs) Color

func (c *QueryLogs) Color() string

func (*QueryLogs) Configuration

func (c *QueryLogs) Configuration() []configuration.Field

func (*QueryLogs) Description

func (c *QueryLogs) Description() string

func (*QueryLogs) Documentation

func (c *QueryLogs) Documentation() string

func (*QueryLogs) ExampleOutput

func (c *QueryLogs) ExampleOutput() map[string]any

func (*QueryLogs) Execute

func (c *QueryLogs) Execute(ctx core.ExecutionContext) error

func (*QueryLogs) HandleHook

func (c *QueryLogs) HandleHook(ctx core.ActionHookContext) error

func (*QueryLogs) HandleWebhook

func (*QueryLogs) Hooks

func (c *QueryLogs) Hooks() []core.Hook

func (*QueryLogs) Icon

func (c *QueryLogs) Icon() string

func (*QueryLogs) Label

func (c *QueryLogs) Label() string

func (*QueryLogs) Name

func (c *QueryLogs) Name() string

func (*QueryLogs) OutputChannels

func (c *QueryLogs) OutputChannels(configuration any) []core.OutputChannel

func (*QueryLogs) Setup

func (c *QueryLogs) Setup(ctx core.SetupContext) error

type QueryLogsConfiguration

type QueryLogsConfiguration struct {
	Region         string   `json:"region" mapstructure:"region"`
	LogGroups      []string `json:"logGroups" mapstructure:"logGroups"`
	QueryString    string   `json:"queryString" mapstructure:"queryString"`
	LookbackPeriod string   `json:"lookbackPeriod" mapstructure:"lookbackPeriod"`
	Limit          int      `json:"limit" mapstructure:"limit"`
}

type QueryLogsExecutionMetadata

type QueryLogsExecutionMetadata struct {
	QueryID      string   `json:"queryId" mapstructure:"queryId"`
	Region       string   `json:"region" mapstructure:"region"`
	LogGroups    []string `json:"logGroups" mapstructure:"logGroups"`
	QueryString  string   `json:"queryString" mapstructure:"queryString"`
	Start        string   `json:"start" mapstructure:"start"`
	End          string   `json:"end" mapstructure:"end"`
	PollAttempts int      `json:"pollAttempts" mapstructure:"pollAttempts"`
}

type QueryResults

type QueryResults struct {
	Status     string          `json:"status"`
	Results    [][]ResultField `json:"results"`
	Statistics QueryStatistics `json:"statistics"`
}

type QueryStatistics

type QueryStatistics struct {
	BytesScanned   float64 `json:"bytesScanned"`
	RecordsMatched float64 `json:"recordsMatched"`
	RecordsScanned float64 `json:"recordsScanned"`
}

type ResultField

type ResultField struct {
	Field string `json:"field"`
	Value string `json:"value"`
}

type StartQueryInput

type StartQueryInput struct {
	LogGroupNames []string
	QueryString   string
	StartTime     time.Time
	EndTime       time.Time
	Limit         int
}

type ThresholdCondition

type ThresholdCondition struct {
	Threshold          float64 `json:"threshold" mapstructure:"threshold"`
	ComparisonOperator string  `json:"comparisonOperator" mapstructure:"comparisonOperator"`
}

type UpdateAlarm

type UpdateAlarm struct{}

func (*UpdateAlarm) Cancel

func (c *UpdateAlarm) Cancel(_ core.ExecutionContext) error

func (*UpdateAlarm) Cleanup

func (c *UpdateAlarm) Cleanup(_ core.SetupContext) error

func (*UpdateAlarm) Color

func (c *UpdateAlarm) Color() string

func (*UpdateAlarm) Configuration

func (c *UpdateAlarm) Configuration() []configuration.Field

func (*UpdateAlarm) Description

func (c *UpdateAlarm) Description() string

func (*UpdateAlarm) Documentation

func (c *UpdateAlarm) Documentation() string

func (*UpdateAlarm) ExampleOutput

func (c *UpdateAlarm) ExampleOutput() map[string]any

func (*UpdateAlarm) Execute

func (c *UpdateAlarm) Execute(ctx core.ExecutionContext) error

func (*UpdateAlarm) HandleHook

func (c *UpdateAlarm) HandleHook(_ core.ActionHookContext) error

func (*UpdateAlarm) HandleWebhook

func (*UpdateAlarm) Hooks

func (c *UpdateAlarm) Hooks() []core.Hook

func (*UpdateAlarm) Icon

func (c *UpdateAlarm) Icon() string

func (*UpdateAlarm) Label

func (c *UpdateAlarm) Label() string

func (*UpdateAlarm) Name

func (c *UpdateAlarm) Name() string

func (*UpdateAlarm) OutputChannels

func (c *UpdateAlarm) OutputChannels(_ any) []core.OutputChannel

func (*UpdateAlarm) Setup

func (c *UpdateAlarm) Setup(ctx core.SetupContext) error

type UpdateAlarmConfiguration

type UpdateAlarmConfiguration struct {
	Region                  string             `json:"region" mapstructure:"region"`
	AlarmName               string             `json:"alarm" mapstructure:"alarm"`
	ThresholdCondition      ThresholdCondition `json:"thresholdCondition" mapstructure:"thresholdCondition"`
	Statistic               string             `json:"statistic" mapstructure:"statistic"`
	Period                  int                `json:"period" mapstructure:"period"`
	EvaluationPeriods       int                `json:"evaluationPeriods" mapstructure:"evaluationPeriods"`
	DatapointsToAlarm       int                `json:"datapointsToAlarm" mapstructure:"datapointsToAlarm"`
	AlarmDescription        string             `json:"alarmDescription" mapstructure:"alarmDescription"`
	TreatMissingData        string             `json:"treatMissingData" mapstructure:"treatMissingData"`
	Unit                    string             `json:"unit" mapstructure:"unit"`
	ActionsEnabled          string             `json:"actionsEnabled" mapstructure:"actionsEnabled"`
	AlarmActions            []string           `json:"alarmActions" mapstructure:"alarmActions"`
	EC2Action               string             `json:"ec2Action" mapstructure:"ec2Action"`
	OKActions               []string           `json:"okActions" mapstructure:"okActions"`
	InsufficientDataActions []string           `json:"insufficientDataActions" mapstructure:"insufficientDataActions"`
}

type UpdateAlarmNodeMetadata

type UpdateAlarmNodeMetadata struct {
	Region        string   `json:"region" mapstructure:"region"`
	AlarmName     string   `json:"alarmName" mapstructure:"alarmName"`
	UpdatedFields []string `json:"updatedFields" mapstructure:"updatedFields"`
}

Jump to

Keyboard shortcuts

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