summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2016-06-01 14:48:20 +0000
committerGerrit Code Review <review@openstack.org>2016-06-01 14:48:20 +0000
commitafbb28817e4caef902b4987c6a1812f00c5eada3 (patch)
treefc89ca81e96a71469d779f170dcc5b2a0385a8b5
parent6ea67cd4580c5b76972d2b9273d9a65a2bc4afcf (diff)
parent6a834063a25852f7f6cd45d6f7331aa0f77ff4c5 (diff)
downloados-client-config-afbb28817e4caef902b4987c6a1812f00c5eada3.tar.gz
Merge "Rename session_client to make_rest_client"
-rw-r--r--README.rst34
-rw-r--r--os_client_config/__init__.py8
-rw-r--r--releasenotes/notes/make-rest-client-dd3d365632a26fa0.yaml4
3 files changed, 26 insertions, 20 deletions
diff --git a/README.rst b/README.rst
index 223fcfa..99ed287 100644
--- a/README.rst
+++ b/README.rst
@@ -392,6 +392,23 @@ for additional flexibility. If the helper function here does not meet your
needs, you should see the `from_config` method of
`openstack.connection.Connection <http://developer.openstack.org/sdks/python/openstacksdk/users/guides/connect_from_config.html>`_
+Constructing REST API Clients
+-----------------------------
+
+What if you want to make direct REST calls via a Session interface? You're
+in luck. The same interface for `make_sdk` is supported for
+`make_rest_client` and will return you a keystoneauth Session object that is
+mounted on the endpoint for the service you're looking for.
+
+.. code-block:: python
+
+ import os_client_config
+
+ session = os_client_config.make_rest_client('compute', cloud='vexxhost')
+
+ response = session.get('/servers')
+ server_list = response.json()['servers']
+
Constructing Legacy Client objects
----------------------------------
@@ -428,23 +445,6 @@ If you want to do the same thing but also support command line parsing.
If you want to get fancier than that in your python, then the rest of the
API is available to you. But often times, you just want to do the one thing.
-Constructing Mounted Session Objects
-------------------------------------
-
-What if you want to make direct REST calls via a Session interface? You're
-in luck. The same interface for `make_client` is supported for `session_client`
-and will return you a keystoneauth Session object that is mounted on the
-endpoint for the service you're looking for.
-
-.. code-block:: python
-
- import os_client_config
-
- session = os_client_config.session_client('compute', cloud='vexxhost')
-
- response = session.get('/servers')
- server_list = response.json()['servers']
-
Source
------
diff --git a/os_client_config/__init__.py b/os_client_config/__init__.py
index c88ccb2..6142853 100644
--- a/os_client_config/__init__.py
+++ b/os_client_config/__init__.py
@@ -34,7 +34,7 @@ def get_config(service_key=None, options=None, **kwargs):
return config.get_one_cloud(options=parsed_options, **kwargs)
-def session_client(service_key, options=None, **kwargs):
+def make_rest_client(service_key, options=None, **kwargs):
"""Simple wrapper function. It has almost no features.
This will get you a raw requests Session Adapter that is mounted
@@ -50,7 +50,9 @@ def session_client(service_key, options=None, **kwargs):
cloud = get_config(service_key=service_key, options=options, **kwargs)
return cloud.get_session_client(service_key)
# Backwards compat - simple_client was a terrible name
-simple_client = session_client
+simple_client = make_rest_client
+# Backwards compat - session_client was a terrible name
+session_client = make_rest_client
def make_client(service_key, constructor=None, options=None, **kwargs):
@@ -73,7 +75,7 @@ def make_sdk(options=None, **kwargs):
"""Simple wrapper for getting an OpenStack SDK Connection.
For completeness, provide a mechanism that matches make_client and
- session_client. The heavy lifting here is done in openstacksdk.
+ make_rest_client. The heavy lifting here is done in openstacksdk.
:rtype: :class:`~openstack.connection.Connection`
"""
diff --git a/releasenotes/notes/make-rest-client-dd3d365632a26fa0.yaml b/releasenotes/notes/make-rest-client-dd3d365632a26fa0.yaml
new file mode 100644
index 0000000..8e34e51
--- /dev/null
+++ b/releasenotes/notes/make-rest-client-dd3d365632a26fa0.yaml
@@ -0,0 +1,4 @@
+---
+deprecations:
+ - Renamed session_client to make_rest_client. session_client
+ will continue to be supported for backwards compatability.