Closed kouvas closed 2 years ago
The error you posted says \"hostname\" must be an object or an array
, but you supplied the String "example.com"
. Unfortunately, I'm struggling to find any AWS documentation for what the "hostname"
object or array should contain. I'll keep looking, but that's what you want to look for. I'll leave this open until one of us finds the answer.
I don't have anything set up that I can test right now, but I found the following in this doc about FilterPolicy
in the aws cli:
--attribute-name FilterPolicy --attribute-value '{"store":["example_corp"],"event":["order_placed"]}'
This suggests that this might work for :Attributes
:
{"FilterPolicy" (clojure.data.json/json-str {"hostname" ["example.com"]})}
Can you give that a shot and report back, please?
I realized from your example and other cli examples that the values in the stringified json need to be in a vector.
Also, the are two ways to actually do this
FilterPolicy
, your example will work like so (aws/invoke aws-client {:op :Subscribe
:request {:TopicArn (:iad (:topic params))
:Protocol "sqs"
:Endpoint "arn:aws:sqs:eu-west-1:******"
:ReturnSubscriptionArn true
:AttributeName "FilterPolicy"
:AttributeValue (clojure.data.json/json-str {"hostname" ["hostname", "anotherhost"],
"anotherKey" ["somevalue"]})}})
(aws/invoke aws-client {:op :Subscribe
:request {:TopicArn (:iad (:topic params))
:Protocol "sqs"
:Endpoint "arn:aws:sqs:eu-west-1:105769927945:LensTesting5"
:ReturnSubscriptionArn true
:Attributes {"FilterPolicy" (clojure.data.json/json-str {"hostname" ["hostname"]
"anotherKey" ["somevalue"]})
"DeliveryPolicy" (clojure.data.json/json-str {"key" ["value"]})}}})
Thanks for taking a look. I think it can be resolved now.
Dependencies
Description with failing test case
Trying to create an SNS subscription with a
FilterPolicy
passed to:Attribues
as per documentation:I tried:
If I pass an empty map to
:Attributes
it works:But when i pass map with keys and values it fails even when using
json-str
I need to know how to pass multiple attributes at one when creating a subscription as per https://docs.aws.amazon.com/sns/latest/api/API_Subscribe.html#API_Subscribe_RequestParameters