@@ -4,13 +4,15 @@ package client
4
4
5
5
import (
6
6
"context"
7
+ "os"
8
+
7
9
"github.com/aws/aws-sdk-go/aws"
8
10
"github.com/aws/aws-sdk-go/aws/session"
9
11
"github.com/aws/aws-sdk-go/service/sns"
10
12
"github.com/base-org/pessimism/internal/core"
11
13
"github.com/base-org/pessimism/internal/logging"
14
+
12
15
"go.uber.org/zap"
13
- "os"
14
16
)
15
17
16
18
// SNSClient ... An interface for SNS clients to implement
@@ -31,14 +33,15 @@ type snsClient struct {
31
33
32
34
// NewSNSClient ... Initializer
33
35
func NewSNSClient (cfg * SNSConfig , name string ) SNSClient {
34
-
35
36
if cfg .TopicArn == "" {
36
37
logging .NoContext ().Warn ("No SNS topic ARN provided" )
37
38
}
38
39
39
40
logging .NoContext ().Debug ("AWS Region" , zap .String ("region" , os .Getenv ("AWS_REGION" )))
40
41
41
- // Initialize a session that the SDK will use
42
+ // Initialize a session that the SDK will use to load configuration,
43
+ // credentials, and region. AWS_REGION, AWS_SECRET_ACCESS_KEY, and AWS_ACCESS_KEY_ID should be set in the
44
+ // environment's runtime
42
45
sess , err := session .NewSession ()
43
46
if err != nil {
44
47
logging .NoContext ().Error ("Failed to create SNS session" , zap .Error (err ))
@@ -53,7 +56,7 @@ func NewSNSClient(cfg *SNSConfig, name string) SNSClient {
53
56
}
54
57
55
58
// PostEvent ... Posts an event to an SNS topic ARN
56
- func (sc snsClient ) PostEvent (ctx context.Context , event * AlertEventTrigger ) (* AlertAPIResponse , error ) {
59
+ func (sc snsClient ) PostEvent (_ context.Context , event * AlertEventTrigger ) (* AlertAPIResponse , error ) {
57
60
// Publish a message to the topic
58
61
result , err := sc .svc .Publish (& sns.PublishInput {
59
62
MessageAttributes : getAttributesFromEvent (event ),
0 commit comments