list all accounts with non-deleted instances
This commit is contained in:
@@ -14,6 +14,7 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
from reddwarfclient import base
|
from reddwarfclient import base
|
||||||
|
from reddwarfclient.common import check_for_exceptions
|
||||||
|
|
||||||
|
|
||||||
class Account(base.Resource):
|
class Account(base.Resource):
|
||||||
@@ -37,6 +38,16 @@ class Accounts(base.ManagerWithFind):
|
|||||||
raise Exception("Call to " + url + " did not return a body.")
|
raise Exception("Call to " + url + " did not return a body.")
|
||||||
return self.resource_class(self, body[response_key])
|
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):
|
def show(self, account):
|
||||||
"""
|
"""
|
||||||
Get details of one account.
|
Get details of one account.
|
||||||
|
|||||||
@@ -90,6 +90,14 @@ class AccountCommands(object):
|
|||||||
def __init__(self):
|
def __init__(self):
|
||||||
pass
|
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):
|
def get(self, acct):
|
||||||
"""List details for the account provided"""
|
"""List details for the account provided"""
|
||||||
dbaas = common.get_client()
|
dbaas = common.get_client()
|
||||||
|
|||||||
Reference in New Issue
Block a user