From 0cd4708ce737f231020000c80c9c6523df88cbcf Mon Sep 17 00:00:00 2001
From: wanghao <sxmatch1986@gmail.com>
Date: Mon, 30 Dec 2019 10:16:12 +0800
Subject: [PATCH] Support to query queues with count for ussuri

Zaqar will support query queues with 'with_count' to
return the amount of the queues. This will help users to
quickly get the exact total number of queues which they own.

Change-Id: Ic1ff218e4e975b4f6e16ebe4192f406efaeb94fe
Implements: blueprint query-queues-with-count
Signed-off-by: wanghao <sxmatch1986@gmail.com>
---
 specs/ussuri/index.rst                   |  9 +++
 specs/ussuri/query-queues-with-count.rst | 96 ++++++++++++++++++++++++
 2 files changed, 105 insertions(+)
 create mode 100644 specs/ussuri/index.rst
 create mode 100644 specs/ussuri/query-queues-with-count.rst

diff --git a/specs/ussuri/index.rst b/specs/ussuri/index.rst
new file mode 100644
index 0000000..7129c2a
--- /dev/null
+++ b/specs/ussuri/index.rst
@@ -0,0 +1,9 @@
+=======================
+ Ussuri Specifications
+=======================
+
+.. toctree::
+   :glob:
+   :maxdepth: 2
+
+   query-queues-with-count.rst
diff --git a/specs/ussuri/query-queues-with-count.rst b/specs/ussuri/query-queues-with-count.rst
new file mode 100644
index 0000000..66d8414
--- /dev/null
+++ b/specs/ussuri/query-queues-with-count.rst
@@ -0,0 +1,96 @@
+..
+  This template should be in ReSTructured text. The filename in the git
+  repository should match the launchpad URL, for example a URL of
+  https://blueprints.launchpad.net/zaqar/+spec/awesome-thing should be named
+  awesome-thing.rst.
+
+  Please do not delete any of the sections in this
+  template.  If you have nothing to say for a whole section, just write: None
+
+  For help with syntax, see http://sphinx-doc.org/rest.html
+  To test out your formatting, see http://www.tele3.cz/jbar/rest/rest.html
+
+=======================
+Query Queues With Count
+=======================
+
+https://blueprints.launchpad.net/zaqar/+spec/query-queues-with-count
+
+This will support query queues with 'with_count=true' filter, Zaqar will return
+the amount of queues in backend storage. This feature will be very convenient
+to users to know how many resources they own.
+
+Problem description
+===================
+
+Currently, Zaqar can't return the amount of queues when querying the queue.
+It depends on users themselves to calculate the number one by one. For other
+clients or applications also need to do it after invoking Zaqar's API. Its
+quite inconvenient for users or developers.
+
+Proposed change
+===============
+
+Add a new query filter item named ``with_count``, default value is ``False``.
+When querying queues with "with_count=true" in url, Zaqar will add the
+function to calculate total number of queus in backend storage and
+return the amount of queues in response body like "count=100".
+
+API Impact
+-----------
+Query queue list
+GET: /v2/queues?with_count=true
+
+  RESPONSE CODE: 200
+  RESPONSE BODY:
+  {
+    "count": 100,
+    "queues": [...]
+  }
+
+Drawbacks
+---------
+
+None
+
+Alternatives
+------------
+
+None
+
+Implementation
+==============
+
+Assignee(s)
+-----------
+
+Primary assignee:
+  wanghao <sxmatch1986@gmail.com>
+
+Secondary assignee:
+  None
+
+Milestones
+----------
+
+Target Milestone for completion:
+  ussuri RC2
+
+Work Items
+----------
+
+#. Modify transport code.
+#. Add release note for this feature.
+#. Update API reference.
+#. Change unit, functional and tempest tests accordingly.
+#. Add client support.
+
+Dependencies
+============
+
+None
+
+References
+==========
+
+None
\ No newline at end of file