summaryrefslogtreecommitdiff
path: root/README.rst
diff options
context:
space:
mode:
authorMonty Taylor <mordred@inaugust.com>2015-12-03 11:26:12 -0600
committerMonty Taylor <mordred@inaugust.com>2015-12-07 02:42:47 +0000
commit5beaeef2c3140f84b2e5a57a789460d4db9ff766 (patch)
treeb469da33b4e5d3e4e1674a758de8291847415e0d /README.rst
parented2f34b06a7d581fb5fdd9811e3f8a7f748a2ce4 (diff)
downloados-client-config-5beaeef2c3140f84b2e5a57a789460d4db9ff766.tar.gz
Add simple helper function for client construction
Often times you don't want to take advantage of all the flexibility, you simple want the basic works-like-it-should thing. Add a warpper around get_legacy_client to do tht one thing. Change-Id: I086dc4a8e762d4e8e56e01cabe2386577f2ceec8
Diffstat (limited to 'README.rst')
-rw-r--r--README.rst31
1 files changed, 31 insertions, 0 deletions
diff --git a/README.rst b/README.rst
index d8fde59..156c760 100644
--- a/README.rst
+++ b/README.rst
@@ -319,3 +319,34 @@ with - as well as a consumption argument.
options = parser.parse_args()
cloud = cloud_config.get_one_cloud(argparse=options)
+
+Constructing OpenStack Client objects
+-------------------------------------
+
+If all you want to do is get a Client object from a python-*client library,
+and you want it to do all the normal things related to clouds.yaml, `OS_`
+environment variables, a hepler function is provided.
+
+::
+
+ import argparse
+
+ from novaclient import client
+ import os_client_config
+
+ nova = os_client_config.make_client('compute', client.Client)
+
+If you want to do the same thing but also support command line parsing.
+
+::
+
+ import argparse
+
+ from novaclient import client
+ import os_client_config
+
+ nova = os_client_config.make_client(
+ 'compute', client.Client, options=argparse.ArgumentParser())
+
+If you want to get fancier than that in your python, then the rest of the
+API is avaiable to you. But often times, you just want to do the one thing.