diff options
author | James Forsyth <jf2512@att.com> | 2018-04-19 13:22:42 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2018-04-19 13:22:42 +0000 |
commit | 8e52114cf9289dd85c8838bf0eb8c24f5e2c7f99 (patch) | |
tree | 9810e6db0a6f8dc167bd23ca3db4a24f15939490 /src/chameleon/route.clj | |
parent | a99f8b47866dbdd0afd5a563ef9f8896501f62e6 (diff) | |
parent | f796373d7de201c0a46f06b3155b1734b9872bb3 (diff) |
Merge "Fix graphwalk capabilities"
Diffstat (limited to 'src/chameleon/route.clj')
-rw-r--r-- | src/chameleon/route.clj | 41 |
1 files changed, 21 insertions, 20 deletions
diff --git a/src/chameleon/route.clj b/src/chameleon/route.clj index 2b30f42..30a2199 100644 --- a/src/chameleon/route.clj +++ b/src/chameleon/route.clj @@ -12,23 +12,22 @@ "Retrieve an entity referenced by id at the provided host. Optionally provide a time 't-k' that defines a query based on when the system knew about the state of the entity." - [host key & [k]] + [host key type & [gallifrey-params]] @(kitclient/request { - :url (str "https://" host "/entity/" key) + :url (str "https://" host "/" type "/" key) :method :get - :query-params (if-let [t-k k] {"t-k" t-k}) + :query-params gallifrey-params :insecure? true :keepalive 300 - :timeout 1000})) + :timeout 20000})) (defn assert-create "Creates an entity in Gallifrey with an initial set of assertions coming from the provided payload" - [host actor key payload] - (print "Final: " payload) + [host actor type key payload & [time-dimensions]] (kitclient/request { - :url (str "https://" host "/entity/" key) + :url (str "https://" host "/" type "/" key) :method :put - :query-params {"actor" actor "create" "true"} + :query-params (into {"actor" actor "create" "true"} time-dimensions) :body payload :insecure? true :keepalive 300 @@ -36,11 +35,11 @@ (defn assert-update "Update an entity in Gallifrey with a set of assertions coming from the provided payload" - [host actor key payload] + [host actor type key payload & [time-dimensions]] (kitclient/request { - :url (str "https://" host "/entity/" key) + :url (str "https://" host "/" type "/" key) :method :put - :query-params {"actor" actor "changes-only" "true"} + :query-params (into {"actor" actor "changes-only" "true"} time-dimensions) :body payload :insecure? true :keepalive 300 @@ -48,24 +47,26 @@ (defn assert-delete "Assert a deletion for an entity in Gallifrey based on the provided key." - [host actor key] + [host actor type key & [time-dimensions]] (kitclient/request { - :url (str "https://" host "/entity/" key) + :url (str "https://" host "/" type "/" key) :method :delete - :query-params {"actor" actor} + :query-params (into {"actor" actor} time-dimensions) :insecure? true :keepalive 300 :timeout 1000})) -(defn assert-gallifrey [host actor payload] +(defn assert-gallifrey [host actor type payload] "Propagates an assertion to Gallifrey based off of an event payload coming in from the event service." (let [{:keys [meta body]} payload - {:keys [key operation]} meta] - (println operation " entity with key " key) + {:keys [key operation time]} meta + time-map (filter val time)] + (println time-map) + (println operation " " type " with key " key) (interpret-response key (case operation "CREATE" - (assert-create host actor key body) + (assert-create host actor type key body time-map) "UPDATE" - (assert-update host actor key body) + (assert-update host actor type key body time-map) "DELETE" - (assert-delete host actor key))))) + (assert-delete host actor type key time-map))))) |