Go can't find sns.MessageAttributeValue #4528
Answered
by
thomasstep
thomasstep
asked this question in
Q&A
-
My code looks like this package adapters
import (
"context"
"encoding/json"
"github.com/aws/aws-sdk-go-v2/service/sns"
)
type ApplicationCreatedEvent struct {
ApplicationId string `json:applicationId`
}
func EmitApplicationCreated(applicationId string) (error) {
snsClient := GetSnsClient()
messageBytes, marshalErr := json.Marshal(&ApplicationCreatedEvent{
ApplicationId: applicationId,
})
if marshalErr != nil {
return marshalErr
}
message := string(messageBytes)
messageAttributes := make(map[string]*sns.MessageAttributeValue)
messageAttributes["operation"] = &sns.MessageAttributeValue{
DataType: "String",
StringValue: "applicationCreated",
}
_, publishErr := snsClient.Publish(context.TODO(), &sns.PublishInput{
MessageAttributes: messageAttributes,
Message: &message,
})
if publishErr != nil {
return publishErr
}
return nil
} Whenever I compile it, go can't find |
Beta Was this translation helpful? Give feedback.
Answered by
thomasstep
Aug 19, 2022
Replies: 2 comments
-
Never mind. I realized that I was looking at v1 docs. The solution was to import |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
thomasstep
-
Hello! Reopening this discussion to make it searchable. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Never mind. I realized that I was looking at v1 docs. The solution was to import
"github.com/aws/aws-sdk-go-v2/service/sns/types"
and then usetypes.MessageAttributeValue
.