summaryrefslogtreecommitdiff
path: root/doc/source
diff options
context:
space:
mode:
authorLucas H. Xu <xuh@bu.edu>2016-11-23 12:14:31 -0500
committerLucas H. Xu <xuh@bu.edu>2016-11-23 12:26:52 -0500
commitfafed7a4aa1ae90d18f4d4c40d9a45fbe9130df8 (patch)
tree9322c4c065aec2e4c3663718636039a0e8a76ad1 /doc/source
parente8046b72ed9793d0e79f4316ed4b62ecf4e52216 (diff)
downloadpython-cinderclient-fafed7a4aa1ae90d18f4d4c40d9a45fbe9130df8.tar.gz
add an alternative way of authenticating client
Change-Id: I8e0745e17f25e53539405cdafc45dc3646dbb1ae
Diffstat (limited to 'doc/source')
-rw-r--r--doc/source/index.rst15
1 files changed, 15 insertions, 0 deletions
diff --git a/doc/source/index.rst b/doc/source/index.rst
index a23a370..a87f414 100644
--- a/doc/source/index.rst
+++ b/doc/source/index.rst
@@ -13,6 +13,21 @@ In order to use the python api directly, you must first obtain an auth token and
[<Volume: ce06d0a8-5c1b-4e2c-81d2-39eca6bbfb70>]
>>>myvol.delete
+Alternatively, you can create a client instance using the keystoneauth session API::
+
+ >>> from keystoneauth1 import loading
+ >>> from keystoneauth1 import session
+ >>> from cinderclient import client
+ >>> 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)
+ >>> cinder = client.Client(VERSION, session=sess)
+ >>> cinder.volumes.list()
+ []
+
Command-line Tool
=================
In order to use the CLI, you must provide your OpenStack username, password, tenant, and auth endpoint. Use the corresponding configuration options (``--os-username``, ``--os-password``, ``--os-tenant-id``, and ``--os-auth-url``) or set them in environment variables::