This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-05-06
Channels
- # announcements (7)
- # aws (8)
- # babashka (9)
- # babashka-sci-dev (11)
- # beginners (37)
- # calva (50)
- # cider (15)
- # clj-kondo (30)
- # clj-otel (3)
- # cljdoc (16)
- # cljs-dev (26)
- # cljsrn (4)
- # clojure (168)
- # clojure-doc (1)
- # clojure-europe (17)
- # clojure-gamedev (4)
- # clojure-nl (3)
- # clojure-norway (1)
- # clojure-spec (17)
- # clojure-uk (16)
- # clojurescript (27)
- # community-development (3)
- # css (3)
- # cursive (9)
- # datomic (25)
- # emacs (1)
- # events (4)
- # fulcro (2)
- # google-cloud (2)
- # graphql (11)
- # gratitude (9)
- # humbleui (16)
- # hyperfiddle (2)
- # jobs (1)
- # london-clojurians (1)
- # lsp (16)
- # malli (2)
- # off-topic (71)
- # pedestal (4)
- # polylith (9)
- # portal (94)
- # reagent (6)
- # reitit (2)
- # releases (1)
- # remote-jobs (2)
- # sci (9)
- # shadow-cljs (49)
- # spacemacs (8)
- # tools-build (2)
- # tools-deps (39)
- # vim (7)
- # xtdb (6)
Hi. I am trying to set a filter on an sns subscription but i get the following error message. The doc says :Attributes must be map of sting, string.
:Message "Invalid parameter: Attributes Reason: FilterPolicy: \"test\" must be an object or an array
at [Source: (String)\"{\"test\":\"this\"}\"; line: 1, column: 15]",
(aws/invoke aws-client {:op :Subscribe
:request {:TopicArn topic
:Protocol "sqs"
:Endpoint "arn:aws:sqs:eu-west-1:44444:queueue"
:ReturnSubscriptionArn true
:Attributes {"FilterPolicy" (clojure.data.json/json-str {"test" "this"})}}})
Haven't done anything with sns filter policies but based on https://docs.aws.amazon.com/sns/latest/dg/example-filter-policies.html it seems like you need the values in your Json maps to be sequential, representing sets of values you'll accept. So in your case the Json should be
{"test":["test"]}
Regarding https://github.com/cognitect-labs/aws-api Assuming things like region/creds are constant throughout my app (and/or use defaults), is it reasonable to do something like:
(def get-client (memoize (fn [api] (aws/client {:api api}))))
(defn get-object [bucket key]
(aws/invoke (get-client :s3)
{:op :GetObject
:request {:Bucket bucket
:Key key}}))
or even:
(defn invoke [api op-map]
(aws/invoke (get-client api) op-map))
clients can be memoized but I'd always pass them explicitly to functions
wrappers like get-object
above don't add value (they're just taking positional syntax, making a map, then calling invoke)
since there's only one function to invoke clients aws/invoke, such wrappers all have the same shape: form a request, then invoke it.
Instead, make functions that simply form the request.