From 2873f48a4f49f9867107ec914dd2ac6265f47ce3 Mon Sep 17 00:00:00 2001 From: Aaron Rosen Date: Tue, 24 Mar 2015 12:28:38 -0700 Subject: [PATCH] Add get_app_service_bindings method Change-Id: Ifffcf1c90be6291f8d0d1be796fa2fe7ade829e0 --- cloudfoundryclient/v2/client.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/cloudfoundryclient/v2/client.py b/cloudfoundryclient/v2/client.py index d7e6581..33ce287 100644 --- a/cloudfoundryclient/v2/client.py +++ b/cloudfoundryclient/v2/client.py @@ -42,6 +42,7 @@ class Client(object): '/v2/organizations/%s/space_quota_definitions') apps_space_url = '/v2/spaces/%s/apps' spaces_summary_url = '/v2/spaces/%s/summary' + app_service_bindings = '/v2/apps/%s/service_bindings' def __init__(self, username="", password="", base_url="https://api.run.pivotal.io/"): @@ -168,3 +169,13 @@ class Client(object): url = self._base_url + (self.spaces_summary_url % guid) r = requests.get(url, headers=headers) return r.json() + + def get_app_service_bindings(self, guid): + """Return list service bindings to each app + + param - guid: the guid of the app. + """ + headers = self._generic_request_headers() + url = self._base_url + (self.app_service_bindings % guid) + r = requests.get(url, headers=headers) + return r.json()