|
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, '') |
@@ -2196,6 +2197,35 @@ def shortcuts(self, args): |
2196 | 2197 | self._logger.info("{:<10} -> {}".format(shortcut, command)) |
2197 | 2198 | self._logger.info('\nUse `deis help [command]` to learn more') |
2198 | 2199 |
|
| 2200 | + def users(self, args): |
| 2201 | + """ |
| 2202 | + Valid commands for users: |
| 2203 | +
|
| 2204 | + users:list list all registered users |
| 2205 | +
|
| 2206 | + Use `deis help [command]` to learn more. |
| 2207 | + """ |
| 2208 | + sys.argv[1] = 'users:list' |
| 2209 | + args = docopt(self.users_list.__doc__) |
| 2210 | + return self.users_list(args) |
| 2211 | + |
| 2212 | + def users_list(self, args): |
| 2213 | + """ |
| 2214 | + Lists all registered users. |
| 2215 | + Requires admin privilages. |
| 2216 | +
|
| 2217 | + Usage: deis users:list |
| 2218 | + """ |
| 2219 | + response = self._dispatch('get', '/v1/users/') |
| 2220 | + if response.status_code == requests.codes.ok: |
| 2221 | + data = response.json() |
| 2222 | + self._logger.info('=== Users') |
| 2223 | + for item in data['results']: |
| 2224 | + self._logger.info('{username}'.format(**item)) |
| 2225 | + else: |
| 2226 | + raise ResponseError(response) |
| 2227 | + |
| 2228 | + |
2199 | 2229 | SHORTCUTS = OrderedDict([ |
2200 | 2230 | ('create', 'apps:create'), |
2201 | 2231 | ('destroy', 'apps:destroy'), |
|
0 commit comments