fix doc, add aws permissions for sns topics
parent
740b872e01
commit
dad6bbff73
|
@ -130,6 +130,9 @@ As AWS documentation recommends, the below policy is granting only the permissio
|
||||||
"sqs:GetQueueAttributes",
|
"sqs:GetQueueAttributes",
|
||||||
"sqs:ListQueueTags",
|
"sqs:ListQueueTags",
|
||||||
"sqs:ListQueues"
|
"sqs:ListQueues"
|
||||||
|
"sns:ListTopics",
|
||||||
|
"sns:GetTopicAttributes",
|
||||||
|
"sns:ListTagsForResource"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
@ -245,3 +248,10 @@ As AWS documentation recommends, the below policy is granting only the permissio
|
||||||
|
|
||||||
- [x] aws_sqs_queue
|
- [x] aws_sqs_queue
|
||||||
- [x] aws_sqs_queue_policy
|
- [x] aws_sqs_queue_policy
|
||||||
|
|
||||||
|
## SNS
|
||||||
|
- [x] aws_sns_topic
|
||||||
|
- [ ] aws_sns_topic_policy
|
||||||
|
- [ ] aws_sns_topic_subscription
|
||||||
|
- [ ] aws_sns_platform_application
|
||||||
|
- [ ] aws_sns_sms_preferences
|
||||||
|
|
|
@ -10,17 +10,17 @@ type SNSRepository interface {
|
||||||
ListAllTopics() ([]*sns.Topic, error)
|
ListAllTopics() ([]*sns.Topic, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
type snsRepositoryImpl struct {
|
type snsRepository struct {
|
||||||
client snsiface.SNSAPI
|
client snsiface.SNSAPI
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewSNSClient(session *session.Session) *snsRepositoryImpl {
|
func NewSNSClient(session *session.Session) *snsRepository {
|
||||||
return &snsRepositoryImpl{
|
return &snsRepository{
|
||||||
sns.New(session),
|
sns.New(session),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *snsRepositoryImpl) ListAllTopics() ([]*sns.Topic, error) {
|
func (r *snsRepository) ListAllTopics() ([]*sns.Topic, error) {
|
||||||
var topics []*sns.Topic
|
var topics []*sns.Topic
|
||||||
input := &sns.ListTopicsInput{}
|
input := &sns.ListTopicsInput{}
|
||||||
err := r.client.ListTopicsPages(input, func(res *sns.ListTopicsOutput, lastPage bool) bool {
|
err := r.client.ListTopicsPages(input, func(res *sns.ListTopicsOutput, lastPage bool) bool {
|
||||||
|
|
|
@ -15,7 +15,7 @@ import (
|
||||||
"github.com/aws/aws-sdk-go/service/sns"
|
"github.com/aws/aws-sdk-go/service/sns"
|
||||||
)
|
)
|
||||||
|
|
||||||
func Test_snsRepositoryImpl_ListAllTopics(t *testing.T) {
|
func Test_snsRepository_ListAllTopics(t *testing.T) {
|
||||||
|
|
||||||
tests := []struct {
|
tests := []struct {
|
||||||
name string
|
name string
|
||||||
|
@ -60,7 +60,7 @@ func Test_snsRepositoryImpl_ListAllTopics(t *testing.T) {
|
||||||
t.Run(tt.name, func(t *testing.T) {
|
t.Run(tt.name, func(t *testing.T) {
|
||||||
client := &mocks.SNSClient{}
|
client := &mocks.SNSClient{}
|
||||||
tt.mocks(client)
|
tt.mocks(client)
|
||||||
r := &snsRepositoryImpl{
|
r := &snsRepository{
|
||||||
client: client,
|
client: client,
|
||||||
}
|
}
|
||||||
got, err := r.ListAllTopics()
|
got, err := r.ListAllTopics()
|
||||||
|
|
Loading…
Reference in New Issue