Skip to content

Commit 2e83a97

Browse files
committed
rename file
1 parent a8d1d50 commit 2e83a97

File tree

2 files changed

+36
-36
lines changed

2 files changed

+36
-36
lines changed

sqs_health_check.go

Lines changed: 0 additions & 36 deletions
This file was deleted.

sqs_health_checker.go

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
package sqs
2+
3+
import (
4+
"context"
5+
"github.com/aws/aws-sdk-go/service/sqs"
6+
)
7+
8+
type SQSHealthChecker struct {
9+
Client *sqs.SQS
10+
QueueName *string
11+
Service string
12+
}
13+
14+
func NewSQSHealthChecker(client *sqs.SQS, name string, queueName string) *SQSHealthChecker {
15+
return &SQSHealthChecker{client, &queueName, name}
16+
}
17+
18+
func (h *SQSHealthChecker) Name() string {
19+
return h.Service
20+
}
21+
22+
func (h *SQSHealthChecker) Check(ctx context.Context) (map[string]interface{}, error) {
23+
res := make(map[string]interface{})
24+
_, err := h.Client.GetQueueUrl(&sqs.GetQueueUrlInput{
25+
QueueName: h.QueueName,
26+
})
27+
return res, err
28+
}
29+
30+
func (h *SQSHealthChecker) Build(ctx context.Context, data map[string]interface{}, err error) map[string]interface{} {
31+
if err == nil {
32+
return data
33+
}
34+
data["error"] = err.Error()
35+
return data
36+
}

0 commit comments

Comments
 (0)