summaryrefslogtreecommitdiff
path: root/swiftclient/authv1.py
diff options
context:
space:
mode:
authorTim Burke <tim.burke@gmail.com>2019-10-09 16:59:23 -0700
committerTim Burke <tim.burke@gmail.com>2019-11-06 08:47:24 +0000
commitc4bef14fc1975f2e115a6ec8560e674e8aa5b1bf (patch)
tree222191341ec8c908f9a0989dc8e9d79bbfac16c8 /swiftclient/authv1.py
parent1eda8f9f3eac55953b3d54e32754e2ec312ab348 (diff)
downloadpython-swiftclient-c4bef14fc1975f2e115a6ec8560e674e8aa5b1bf.tar.gz
v1auth: support endpoint_data_for() api
...so we can be used with openstacksdk. Also, add a few functests that use openstacksdk. Change-Id: Ie6987f5de48914ec8932254cde79a973a0264877
Diffstat (limited to 'swiftclient/authv1.py')
-rw-r--r--swiftclient/authv1.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/swiftclient/authv1.py b/swiftclient/authv1.py
index 55469ac..d70acac 100644
--- a/swiftclient/authv1.py
+++ b/swiftclient/authv1.py
@@ -45,6 +45,7 @@ from six.moves.urllib.parse import urljoin
# Note that while we import keystoneauth1 here, we *don't* need to add it to
# requirements.txt -- this entire module only makes sense (and should only be
# loaded) if keystoneauth is already installed.
+from keystoneauth1 import discover
from keystoneauth1 import plugin
from keystoneauth1 import exceptions
from keystoneauth1 import loading
@@ -110,11 +111,20 @@ class ServiceCatalogV1(object):
]
def url_for(self, **kwargs):
+ return self.endpoint_data_for(**kwargs).url
+
+ def endpoint_data_for(self, **kwargs):
kwargs.setdefault('interface', 'public')
kwargs.setdefault('service_type', None)
if kwargs['service_type'] == 'object-store':
- return self.storage_url
+ return discover.EndpointData(
+ service_type='object-store',
+ service_name='swift',
+ interface=kwargs['interface'],
+ region_name='default',
+ catalog_url=self.storage_url,
+ )
# Although our "catalog" includes an identity entry, nothing that uses
# url_for() (including `openstack endpoint list`) will know what to do