diff options
author | Monty Taylor <mordred@inaugust.com> | 2015-12-10 13:49:14 -0500 |
---|---|---|
committer | Morgan Fainberg <morgan.fainberg@gmail.com> | 2015-12-12 20:39:57 -0800 |
commit | 1f11840dd84f3570330d1fcd53d1e8eea5ff7922 (patch) | |
tree | dab223bc1dcd0e87aaa2b5356d9ef70737157ae1 /doc | |
parent | c6dd7c7ba9e9fc3dfa45fa568c26529a63b03431 (diff) | |
download | python-novaclient-1f11840dd84f3570330d1fcd53d1e8eea5ff7922.tar.gz |
Migrate to keystoneauth from keystoneclient
As a stepping stone to the os-client-config patch, first switch to
using keystoneauth, its Session and its argparse registration and
plugin loading to sort out any issues with that level of plumbing.
The next patch will layer on the ability to use os-client-config
for argument processing and client construction.
Change-Id: Id681e5eb56b47d06000620f7c92c9b0c5f8d4408
Diffstat (limited to 'doc')
-rw-r--r-- | doc/source/api.rst | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/doc/source/api.rst b/doc/source/api.rst index ded67ed6..3b179e49 100644 --- a/doc/source/api.rst +++ b/doc/source/api.rst @@ -19,22 +19,28 @@ If you prefer string value, you can use ``1.1`` (deprecated now), ``2`` or ``2.X`` (where X is a microversion). -Alternatively, you can create a client instance using the keystoneclient +Alternatively, you can create a client instance using the keystoneauth session API:: - >>> from keystoneclient.auth.identity import v2 - >>> from keystoneclient import session + >>> from keystoneauth1 import loading + >>> from keystoneauth1 import session >>> from novaclient import client - >>> auth = v2.Password(auth_url=AUTH_URL, - ... username=USERNAME, - ... password=PASSWORD, - ... tenant_name=PROJECT_ID) + >>> loader = loading.get_plugin_loader('password') + >>> auth = loader.Password(auth_url=AUTH_URL, + ... username=USERNAME, + ... password=PASSWORD, + ... project_id=PROJECT_ID) >>> sess = session.Session(auth=auth) >>> nova = client.Client(VERSION, session=sess) -For more information on this keystoneclient API, see `Using Sessions`_. +If you have PROJECT_NAME instead of a PROJECT_ID, use the project_name +parameter. Similarly, if your cloud uses keystone v3 and you have a DOMAIN_NAME +or DOMAIN_ID, provide it as `user_domain_(name|id)` and if you are using a +PROJECT_NAME also provide the domain information as `project_domain_(name|id)`. -.. _Using Sessions: http://docs.openstack.org/developer/python-keystoneclient/using-sessions.html +For more information on this keystoneauth API, see `Using Sessions`_. + +.. _Using Sessions: http://docs.openstack.org/developer/keystoneauth/using-sessions.html It is also possible to use an instance as a context manager in which case there will be a session kept alive for the duration of the with statement:: |