Fix doc on keystoneauth session api usage
This fixes documentation on client creation with keystoneauth session api. Change-Id: I0f6bb6f4f9bbaa84b5185c0a9e9db6a4184702d4 Partial-Bug: #1646539
This commit is contained in:
parent
1eb72804d6
commit
3d60183120
@ -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::
|
Alternatively, you can create a client instance using the keystoneauth session API::
|
||||||
|
|
||||||
|
>>> from keystoneauth1 import loading
|
||||||
>>> from keystoneauth1 import session
|
>>> from keystoneauth1 import session
|
||||||
>>> from keystoneauth1.identity import v3
|
|
||||||
>>> from heatclient import client
|
>>> from heatclient import client
|
||||||
>>> password = v3.PasswordMethod(username=USERNAME,
|
>>> loader = loading.get_plugin_loader('password')
|
||||||
... password=PASSWORD,
|
>>> auth = loader.load_from_options(auth_url=AUTH_URL,
|
||||||
... user_domain_name=DEFAULT)
|
... username=USERNAME,
|
||||||
>>> auth = v3.Auth(auth_url=AUTH_URL, auth_methods=[password],
|
... password=PASSWORD,
|
||||||
... project_id=PROJECT_ID)
|
... project_id=PROJECT_ID)
|
||||||
>>> sess = session.Session(auth=auth)
|
>>> sess = session.Session(auth=auth)
|
||||||
>>> heat = client.Client('1', endpoint=heat_url, session=sess)
|
>>> heat = client.Client('1', session=sess)
|
||||||
>>> heat.stacks.list()
|
>>> 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`_.
|
For more information on keystoneauth API, see `Using Sessions`_.
|
||||||
|
|
||||||
.. _Using Sessions: http://docs.openstack.org/developer/keystoneauth/using-sessions.html
|
.. _Using Sessions: http://docs.openstack.org/developer/keystoneauth/using-sessions.html
|
||||||
|
Loading…
Reference in New Issue
Block a user