diff options
author | Clenimar Filemon <clenimar.filemon@gmail.com> | 2016-03-07 00:52:45 -0300 |
---|---|---|
committer | Clenimar Filemon <clenimar.filemon@gmail.com> | 2016-03-07 01:10:30 -0300 |
commit | bd9008ed5bda3e3ac9bfda536241ae02713c5b86 (patch) | |
tree | 707e81670cb1093dc7004364d72ac3f8abc2af7c /doc | |
parent | b80d64703c1310d2002fdf87cedaa72d6cdffc06 (diff) | |
download | python-heatclient-bd9008ed5bda3e3ac9bfda536241ae02713c5b86.tar.gz |
Add an example on keystoneauth Sessions to the doc
keystoneauth Session object brings an unified interface of
authentication to a variety of OpenStack services. Some components (e.g.
Nova, Glance) already have an example on their Python API docs. This
patch adds an example on how to create a heat Client instance using
keystoneauth Session API.
Change-Id: Iaa51052ccb4c66aafa11e9bfd6befbd831715110
Diffstat (limited to 'doc')
-rw-r--r-- | doc/source/index.rst | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/doc/source/index.rst b/doc/source/index.rst index ec0bdc5..cd3fcff 100644 --- a/doc/source/index.rst +++ b/doc/source/index.rst @@ -20,6 +20,24 @@ Once you have done so, you can use the API like so:: >>> from heatclient.client import Client >>> heat = Client('1', endpoint=heat_url, token=auth_token) +Alternatively, you can create a client instance using the keystoneauth session API:: + + >>> 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) + >>> sess = session.Session(auth=auth) + >>> heat = client.Client('1', endpoint=heat_url, session=sess) + >>> heat.stacks.list() + +For more information on keystoneauth API, see `Using Sessions`_. + +.. _Using Sessions: http://docs.openstack.org/developer/keystoneauth/using-sessions.html + Reference --------- |