reporter

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 15, 2024 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type App

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

func NewApp

func NewApp(ctx context.Context, slackBotToken string, slackChannel string, opts ...AppOption) (*App, error)

func NewAppWithClient

func NewAppWithClient(redshiftClient GetUsageLimitAPIClient, slackClient PostMessageAPIClient, slackChannel string, opts ...AppOption) *App

func (*App) Handler

func (app *App) Handler(ctx context.Context, raw json.RawMessage) (interface{}, error)

func (*App) SendReport

func (app *App) SendReport(ctx context.Context, message CloudWatchAlermMessage) error

type AppOption

type AppOption func(*App)

func WithLogger

func WithLogger(logger *slog.Logger) AppOption

func WithReportTemplate

func WithReportTemplate(tmpl *template.Template) AppOption

func WithRetryCount

func WithRetryCount(count int) AppOption

type CloudWatchAlermMessage

type CloudWatchAlermMessage struct {
	AlarmName                          string                        `json:"AlarmName"`
	AlarmDescription                   *string                       `json:"AlarmDescription"`
	AWSAccountID                       string                        `json:"AWSAccountId"`
	AlarmConfigurationUpdatedTimestamp string                        `json:"AlarmConfigurationUpdatedTimestamp"`
	NewStateValue                      string                        `json:"NewStateValue"`
	NewStateReason                     string                        `json:"NewStateReason"`
	OldStateValue                      string                        `json:"OldStateValue"`
	StateChangeTime                    string                        `json:"StateChangeTime"`
	AWSRegion                          string                        `json:"Region"`
	AlarmArn                           string                        `json:"AlarmArn"`
	Trigger                            CloudWatchAlermMessageTrigger `json:"Trigger"`
}

func (*CloudWatchAlermMessage) IsRedshiftServerlessLimitUsage

func (m *CloudWatchAlermMessage) IsRedshiftServerlessLimitUsage() bool

func (*CloudWatchAlermMessage) UsageLimitID

func (m *CloudWatchAlermMessage) UsageLimitID() string

func (*CloudWatchAlermMessage) WorkgroupName

func (m *CloudWatchAlermMessage) WorkgroupName() string

type CloudWatchAlermMessageTrigger

type CloudWatchAlermMessageTrigger struct {
	MetricName                       string                                   `json:"MetricName"`
	Namespace                        string                                   `json:"Namespace"`
	StatisticType                    string                                   `json:"StatisticType"`
	Statistic                        string                                   `json:"Statistic"`
	Unit                             any                                      `json:"Unit"`
	Dimensions                       []CloudWatchAlermMessageTriggerDimension `json:"Dimensions"`
	Period                           int                                      `json:"Period"`
	EvaluationPeriods                int                                      `json:"EvaluationPeriods"`
	ComparisonOperator               string                                   `json:"ComparisonOperator"`
	Threshold                        float64                                  `json:"Threshold"`
	TreatMissingData                 string                                   `json:"TreatMissingData"`
	EvaluateLowSampleCountPercentile string                                   `json:"EvaluateLowSampleCountPercentile"`
}

type CloudWatchAlermMessageTriggerDimension

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

type GetUsageLimitAPIClient

type GetUsageLimitAPIClient interface {
	GetUsageLimit(ctx context.Context, params *redshiftserverless.GetUsageLimitInput, optFns ...func(*redshiftserverless.Options)) (*redshiftserverless.GetUsageLimitOutput, error)
}

type PostMessageAPIClient

type PostMessageAPIClient interface {
	PostMessageContext(ctx context.Context, channel string, opts ...slack.MsgOption) (string, string, error)
}

Jump to

Keyboard shortcuts

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