diff options
author | David Stanek <dstanek@dstanek.com> | 2016-06-15 12:51:04 +0000 |
---|---|---|
committer | dineshbhor <dinesh.bhor@nttdata.com> | 2018-03-26 01:51:30 -0700 |
commit | b2e9caee38ca66147552a8f677468becf812e16e (patch) | |
tree | ee6d38ec886efb8da04664ab822d501cf57ff559 /doc | |
parent | 70f33b5e226e9b945cea66bfa774934537f04841 (diff) | |
download | python-keystoneclient-b2e9caee38ca66147552a8f677468becf812e16e.tar.gz |
Add Response class to return request-id to caller
This change is required to return 'request_id' from client
to log request_id mappings of cross-project requests.
Instantiating class 'keystoneclient.v3.client.Client' using
'include_metadata=True' will cause manager response to return
a new 'Response' class instead of just the data. This 'Response'
class is going to have additional metadata properties available
like 'request_ids' and the original data will be available as
property 'data' to it.
This change is backward compatible since user has to set a new
parameter 'include_metadata=True' to client in order to get the
request_id returned.
Co-author: Dinesh Bhor <dinesh.bhor@nttdata.com>
Partially Implements: blueprint return-request-id-to-caller
Change-Id: Ibefaa484158ff08bfcacc1e2802d87fc26fd76a5
Diffstat (limited to 'doc')
-rw-r--r-- | doc/source/using-api-v3.rst | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/doc/source/using-api-v3.rst b/doc/source/using-api-v3.rst index f0c82c5..4f305e8 100644 --- a/doc/source/using-api-v3.rst +++ b/doc/source/using-api-v3.rst @@ -102,6 +102,31 @@ For more information on Sessions refer to: `Using Sessions`_. .. _`Using Sessions`: using-sessions.html +Getting Metadata Responses +========================== + +Instantiating :py:class:`keystoneclient.v3.client.Client` using +`include_metadata=True` will cause manager response to return +:py:class:`keystoneclient.base.Response` instead of just the data. +The metadata property will be available directly to the +:py:class:`keystoneclient.base.Response` and the response data will +be available as property `data` to it. + + >>> from keystoneauth1.identity import v3 + >>> from keystoneauth1 import session + >>> from keystoneclient.v3 import client + >>> auth = v3.Password(auth_url='https://my.keystone.com:5000/v3', + ... user_id='myuserid', + ... password='mypassword', + ... project_id='myprojectid') + >>> sess = session.Session(auth=auth) + >>> keystone = client.Client(session=sess, include_metadata=True) + >>> resp = keystone.projects.list() + >>> resp.request_ids[0] + req-1234-5678-... + >>> resp.data + [<Project ...>, <Project ...>, ...] + Non-Session Authentication (deprecated) ======================================= |