list all accounts with non-deleted instances

This commit is contained in:
Paul Marshall
2012-07-11 10:24:57 -05:00
parent 4b73dbccf4
commit 20f1611fa7
2 changed files with 19 additions and 0 deletions

View File

@@ -14,6 +14,7 @@
# under the License.
from reddwarfclient import base
from reddwarfclient.common import check_for_exceptions
class Account(base.Resource):
@@ -37,6 +38,16 @@ class Accounts(base.ManagerWithFind):
raise Exception("Call to " + url + " did not return a body.")
return self.resource_class(self, body[response_key])
def index(self):
"""Get a list of all accounts with non-deleted instances"""
url = "/mgmt/accounts"
resp, body = self.api.client.get(url)
check_for_exceptions(resp, body)
if not body:
raise Exception("Call to " + url + " did not return a body.")
return base.Resource(self, body)
def show(self, account):
"""
Get details of one account.

View File

@@ -90,6 +90,14 @@ class AccountCommands(object):
def __init__(self):
pass
def list(self):
"""List all accounts with non-deleted instances"""
dbaas = common.get_client()
try:
_pretty_print(dbaas.accounts.index()._info)
except:
print sys.exc_info()[1]
def get(self, acct):
"""List details for the account provided"""
dbaas = common.get_client()