diff options
| author | Soren Hansen <soren.hansen@rackspace.com> | 2010-11-29 13:14:26 +0100 |
|---|---|---|
| committer | Soren Hansen <soren.hansen@rackspace.com> | 2010-11-29 13:14:26 +0100 |
| commit | c5d3e310376b3fb5c548e1d2e70c5ce7a489bb9f (patch) | |
| tree | 15a73446e1daa6829a68e05a3cef862924428473 /nova/adminclient.py | |
| parent | b65b41e5957d5ded516343b3611292c9744d169f (diff) | |
| parent | 4f92d1d39fcfda4dad73e6e0339351f0d7d00d61 (diff) | |
| download | nova-c5d3e310376b3fb5c548e1d2e70c5ce7a489bb9f.tar.gz nova-c5d3e310376b3fb5c548e1d2e70c5ce7a489bb9f.tar.xz nova-c5d3e310376b3fb5c548e1d2e70c5ce7a489bb9f.zip | |
Merge trunk.
Diffstat (limited to 'nova/adminclient.py')
| -rw-r--r-- | nova/adminclient.py | 92 |
1 files changed, 58 insertions, 34 deletions
diff --git a/nova/adminclient.py b/nova/adminclient.py index b7a3d2c32..5a62cce7d 100644 --- a/nova/adminclient.py +++ b/nova/adminclient.py @@ -22,25 +22,28 @@ Nova User API client library. import base64 import boto import httplib + +from nova import flags from boto.ec2.regioninfo import RegionInfo +FLAGS = flags.FLAGS + DEFAULT_CLC_URL = 'http://127.0.0.1:8773' DEFAULT_REGION = 'nova' -DEFAULT_ACCESS_KEY = 'admin' -DEFAULT_SECRET_KEY = 'admin' class UserInfo(object): """ - Information about a Nova user, as parsed through SAX - fields include: - username - accesskey - secretkey - - and an optional field containing a zip with X509 cert & rc - file + Information about a Nova user, as parsed through SAX. + + **Fields Include** + + * username + * accesskey + * secretkey + * file (optional) containing zip of X509 cert & rc file + """ def __init__(self, connection=None, username=None, endpoint=None): @@ -68,9 +71,13 @@ class UserInfo(object): class UserRole(object): """ Information about a Nova user's role, as parsed through SAX. - Fields include: - role + + **Fields include** + + * role + """ + def __init__(self, connection=None): self.connection = connection self.role = None @@ -90,12 +97,15 @@ class UserRole(object): class ProjectInfo(object): """ - Information about a Nova project, as parsed through SAX - Fields include: - projectname - description - projectManagerId - memberIds + Information about a Nova project, as parsed through SAX. + + **Fields include** + + * projectname + * description + * projectManagerId + * memberIds + """ def __init__(self, connection=None): @@ -127,8 +137,11 @@ class ProjectInfo(object): class ProjectMember(object): """ Information about a Nova project member, as parsed through SAX. - Fields include: - memberId + + **Fields include** + + * memberId + """ def __init__(self, connection=None): @@ -150,14 +163,18 @@ class ProjectMember(object): class HostInfo(object): """ - Information about a Nova Host, as parsed through SAX: - Disk stats - Running Instances - Memory stats - CPU stats - Network address info - Firewall info - Bridge and devices + Information about a Nova Host, as parsed through SAX. + + **Fields Include** + + * Disk stats + * Running Instances + * Memory stats + * CPU stats + * Network address info + * Firewall info + * Bridge and devices + """ def __init__(self, connection=None): @@ -177,9 +194,13 @@ class HostInfo(object): class NovaAdminClient(object): - def __init__(self, clc_url=DEFAULT_CLC_URL, region=DEFAULT_REGION, - access_key=DEFAULT_ACCESS_KEY, secret_key=DEFAULT_SECRET_KEY, - **kwargs): + def __init__( + self, + clc_url=DEFAULT_CLC_URL, + region=DEFAULT_REGION, + access_key=FLAGS.aws_access_key_id, + secret_key=FLAGS.aws_secret_access_key, + **kwargs): parts = self.split_clc_url(clc_url) self.clc_url = clc_url @@ -257,9 +278,12 @@ class NovaAdminClient(object): [('item', UserRole)]) def get_user_roles(self, user, project=None): - """Returns a list of roles for the given user. Omitting project will - return any global roles that the user has. Specifying project will - return only project specific roles.""" + """Returns a list of roles for the given user. + + Omitting project will return any global roles that the user has. + Specifying project will return only project specific roles. + + """ params = {'User': user} if project: params['Project'] = project |
