From 3d60183120ca709e4298fa516bc1c7b639db770b Mon Sep 17 00:00:00 2001 From: rabi Date: Thu, 8 Dec 2016 12:48:58 +0530 Subject: [PATCH] Fix doc on keystoneauth session api usage This fixes documentation on client creation with keystoneauth session api. Change-Id: I0f6bb6f4f9bbaa84b5185c0a9e9db6a4184702d4 Partial-Bug: #1646539 --- doc/source/index.rst | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/doc/source/index.rst b/doc/source/index.rst index cd3fcff4..0080645e 100644 --- a/doc/source/index.rst +++ b/doc/source/index.rst @@ -22,18 +22,23 @@ Once you have done so, you can use the API like so:: Alternatively, you can create a client instance using the keystoneauth session API:: + >>> from keystoneauth1 import loading >>> from keystoneauth1 import session - >>> from keystoneauth1.identity import v3 >>> from heatclient import client - >>> password = v3.PasswordMethod(username=USERNAME, - ... password=PASSWORD, - ... user_domain_name=DEFAULT) - >>> auth = v3.Auth(auth_url=AUTH_URL, auth_methods=[password], - ... project_id=PROJECT_ID) + >>> loader = loading.get_plugin_loader('password') + >>> auth = loader.load_from_options(auth_url=AUTH_URL, + ... username=USERNAME, + ... password=PASSWORD, + ... project_id=PROJECT_ID) >>> sess = session.Session(auth=auth) - >>> heat = client.Client('1', endpoint=heat_url, session=sess) + >>> heat = client.Client('1', session=sess) >>> heat.stacks.list() +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)`. + For more information on keystoneauth API, see `Using Sessions`_. .. _Using Sessions: http://docs.openstack.org/developer/keystoneauth/using-sessions.html