Go can't find sns.MessageAttributeValue #4528
-
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.
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.
-
Hello! Reopening this discussion to make it searchable. |
Beta Was this translation helpful? Give feedback.
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
.