   [ecr]
   (delete-doc ecr))
 
+;; Registry Azure ACR
+
+(defn registries-acr
+  [owner]
+  (if (nil? owner)
+    (find-docs "acr")
+    (find-docs {"$or" [{:owner {"$eq" owner}}
+                       {:public {"$eq" true}}]} "acr")))
+
+(defn registry-acr
+  ([id]
+   (get-doc id))
+  ([user owner]
+   (find-doc {:user  user
+              :owner owner} "acr")))
+
+(defn create-acr-registry
+  [acr]
+  (-> (assoc acr :type "acr")
+      (create-doc)))
+
+(defn update-acr-registry
+  [acr delta]
+  (let [allowed-delta (dissoc delta :_id :_rev)]
+    (update-doc acr allowed-delta)))
+
+(defn delete-acr-registry
+  [acr]
+  (delete-doc acr))
+
 ;; User
 
 (defn users

   (find-doc {:name  name
              :owner owner} "v2")))

(defn registry-v2-exist?
  [registry]
  (some? (find-doc {:name  {"$eq" (:name registry)}
                    :owner {"$eq" (:owner registry)}} "v2")))

(defn create-v2-registry
  [registry]
  (-> (assoc registry :type "v2")

   (find-doc {:username username
              :owner    owner} "dockerhub")))

(defn create-dockerhub
  [docker-user]
  (-> (assoc docker-user :type "dockerhub")
