|
25 | 25 | keys manage ssh keys used for `git push` deployments |
26 | 26 | perms manage permissions for applications |
27 | 27 | git manage git for applications |
| 28 | + users manage users |
28 | 29 |
|
29 | 30 | Shortcut commands, use ``deis shortcuts`` to see all:: |
30 | 31 |
|
|
75 | 76 | __version__ = '1.6.0-dev' |
76 | 77 |
|
77 | 78 | # what version of the API is this client compatible with? |
78 | | -__api_version__ = '1.2' |
| 79 | +__api_version__ = '1.3' |
79 | 80 |
|
80 | 81 |
|
81 | 82 | locale.setlocale(locale.LC_ALL, '') |
@@ -2224,6 +2225,35 @@ def shortcuts(self, args): |
2224 | 2225 | self._logger.info("{:<10} -> {}".format(shortcut, command)) |
2225 | 2226 | self._logger.info('\nUse `deis help [command]` to learn more') |
2226 | 2227 |
|
| 2228 | + def users(self, args): |
| 2229 | + """ |
| 2230 | + Valid commands for users: |
| 2231 | +
|
| 2232 | + users:list list all registered users |
| 2233 | +
|
| 2234 | + Use `deis help [command]` to learn more. |
| 2235 | + """ |
| 2236 | + sys.argv[1] = 'users:list' |
| 2237 | + args = docopt(self.users_list.__doc__) |
| 2238 | + return self.users_list(args) |
| 2239 | + |
| 2240 | + def users_list(self, args): |
| 2241 | + """ |
| 2242 | + Lists all registered users. |
| 2243 | + Requires admin privilages. |
| 2244 | +
|
| 2245 | + Usage: deis users:list |
| 2246 | + """ |
| 2247 | + response = self._dispatch('get', '/v1/users/') |
| 2248 | + if response.status_code == requests.codes.ok: |
| 2249 | + data = response.json() |
| 2250 | + self._logger.info('=== Users') |
| 2251 | + for item in data['results']: |
| 2252 | + self._logger.info('{username}'.format(**item)) |
| 2253 | + else: |
| 2254 | + raise ResponseError(response) |
| 2255 | + |
| 2256 | + |
2227 | 2257 | SHORTCUTS = OrderedDict([ |
2228 | 2258 | ('create', 'apps:create'), |
2229 | 2259 | ('destroy', 'apps:destroy'), |
|
0 commit comments