From 71ae37fef1e02e486997aaddd48ee5606c19ea7b Mon Sep 17 00:00:00 2001 From: Douglas Mendizabal Date: Thu, 5 Sep 2013 13:13:42 -0500 Subject: [PATCH] Add total() to both secrets and orders. --- barbicanclient/base.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/barbicanclient/base.py b/barbicanclient/base.py index 0736e5f9..c0b07a48 100644 --- a/barbicanclient/base.py +++ b/barbicanclient/base.py @@ -26,3 +26,13 @@ class BaseEntityManager(object): for k in dictionary.keys(): if dictionary[k] is None: dictionary.pop(k) + + def total(self): + """ + Returns the toatl number of entities stored in Barbican. + """ + href = '{0}/{1}'.format(self.api.base_url, self.entity) + params ={'limit': 0, 'offset': 0} + resp = self.api.get(href, params) + + return resp['total']