diff options
author | Monty Taylor <mordred@inaugust.com> | 2015-12-03 11:26:12 -0600 |
---|---|---|
committer | Monty Taylor <mordred@inaugust.com> | 2015-12-07 02:42:47 +0000 |
commit | 5beaeef2c3140f84b2e5a57a789460d4db9ff766 (patch) | |
tree | b469da33b4e5d3e4e1674a758de8291847415e0d /README.rst | |
parent | ed2f34b06a7d581fb5fdd9811e3f8a7f748a2ce4 (diff) | |
download | os-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.rst | 31 |
1 files changed, 31 insertions, 0 deletions
@@ -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. |