summaryrefslogtreecommitdiff
path: root/openstackclient/identity
diff options
context:
space:
mode:
authorQiu Yu <qiuyu@ebaysf.com>2014-01-29 15:57:18 +0800
committerQiu Yu <qiuyu@ebaysf.com>2014-01-29 15:59:12 +0800
commita8d828f330119502fc18107c264f2944548a7fb9 (patch)
tree99d50a51a05f0b52bbd0b5af7e1233ae4c8cbe9f /openstackclient/identity
parent0076f694acd7bc02ce1fb26ec0f1974ba68e0cf3 (diff)
downloadpython-openstackclient-a8d828f330119502fc18107c264f2944548a7fb9.tar.gz
Add token create subcommand for identity v3 api
Implements token create subcommand which is an equivalent of keystone token-get command. Original "wrap" parameter for keystone token-get is not implemented yet due to cliff Bug #1269299 This is a part of: blueprint add-identity-token-support Change-Id: I2255021c9d1f10f757686583b1ebe40b5f3a9ecb
Diffstat (limited to 'openstackclient/identity')
-rw-r--r--openstackclient/identity/v3/token.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/openstackclient/identity/v3/token.py b/openstackclient/identity/v3/token.py
index ba667be3..68f9ffef 100644
--- a/openstackclient/identity/v3/token.py
+++ b/openstackclient/identity/v3/token.py
@@ -185,6 +185,24 @@ class CreateRequestToken(show.ShowOne):
return zip(*sorted(six.iteritems(request_token)))
+class CreateToken(show.ShowOne):
+ """Create token command"""
+
+ log = logging.getLogger(__name__ + '.CreateToken')
+
+ def get_parser(self, prog_name):
+ parser = super(CreateToken, self).get_parser(prog_name)
+ return parser
+
+ def take_action(self, parsed_args):
+ self.log.debug('take_action(%s)' % parsed_args)
+ identity_client = self.app.client_manager.identity
+ token = identity_client.service_catalog.get_token()
+ if 'tenant_id' in token:
+ token['project_id'] = token.pop('tenant_id')
+ return zip(*sorted(six.iteritems(token)))
+
+
class DeleteAccessToken(command.Command):
"""Delete access token command"""