Skip to content
This repository has been archived by the owner on May 29, 2024. It is now read-only.

Commit

Permalink
Fix linter
Browse files Browse the repository at this point in the history
  • Loading branch information
adrain-cb committed Jan 30, 2024
1 parent 999087e commit 557cfc0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
1 change: 0 additions & 1 deletion internal/alert/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,6 @@ func (am *alertManager) HandleAlert(alert core.Alert, policy *core.AlertPolicy)
if err := am.handleSNSPublish(alert, policy); err != nil {
am.logger.Error("could not publish to sns", zap.Error(err))
}

}

// Shutdown ... Shuts down the alert manager subsystem
Expand Down
11 changes: 7 additions & 4 deletions internal/client/sns.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@ package client

import (
"context"
"os"

"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/sns"
"github.com/base-org/pessimism/internal/core"
"github.com/base-org/pessimism/internal/logging"

"go.uber.org/zap"
"os"
)

// SNSClient ... An interface for SNS clients to implement
Expand All @@ -31,14 +33,15 @@ type snsClient struct {

// NewSNSClient ... Initializer
func NewSNSClient(cfg *SNSConfig, name string) SNSClient {

if cfg.TopicArn == "" {
logging.NoContext().Warn("No SNS topic ARN provided")
}

logging.NoContext().Debug("AWS Region", zap.String("region", os.Getenv("AWS_REGION")))

// Initialize a session that the SDK will use
// Initialize a session that the SDK will use to load configuration,
// credentials, and region. AWS_REGION, AWS_SECRET_ACCESS_KEY, and AWS_ACCESS_KEY_ID should be set in the
// environment's runtime
sess, err := session.NewSession()
if err != nil {
logging.NoContext().Error("Failed to create SNS session", zap.Error(err))
Expand All @@ -53,7 +56,7 @@ func NewSNSClient(cfg *SNSConfig, name string) SNSClient {
}

// PostEvent ... Posts an event to an SNS topic ARN
func (sc snsClient) PostEvent(ctx context.Context, event *AlertEventTrigger) (*AlertAPIResponse, error) {
func (sc snsClient) PostEvent(_ context.Context, event *AlertEventTrigger) (*AlertAPIResponse, error) {
// Publish a message to the topic
result, err := sc.svc.Publish(&sns.PublishInput{
MessageAttributes: getAttributesFromEvent(event),
Expand Down

0 comments on commit 557cfc0

Please sign in to comment.