Skip to content

Commit 594f247

Browse files
committed
Change visibility to interface
Change-Id: I984dc2e9ae362c5d9dcf6bc9ef9f9d5e3b356679 Closes-Bug: #1479421
1 parent c725e6e commit 594f247

25 files changed

+113
-113
lines changed

examples/common.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,8 @@ def set_option(cls, var, values):
139139
cls.prof.set_region(service, value)
140140
elif var == 'version':
141141
cls.prof.set_version(service, value)
142-
elif var == 'visibility':
143-
cls.prof.set_visibility(service, value)
142+
elif var == 'interface':
143+
cls.prof.set_interface(service, value)
144144

145145
def __call__(self, parser, namespace, values, option_string=None):
146146
if getattr(namespace, self.dest, None) is None:
@@ -283,12 +283,12 @@ def option_parser():
283283
help='Desired API versions defaults to env[OS_API_VERSION]',
284284
)
285285
parser.add_argument(
286-
'--os-api-visibility',
286+
'--os-api-interface',
287287
dest='preferences',
288-
metavar='<service>=<visibility>',
288+
metavar='<service>=<interface>',
289289
action=ProfileAction,
290-
default=ProfileAction.env('OS_API_VISIBILITY'),
291-
help='Desired API visibility defaults to env[OS_API_VISIBILITY]',
290+
default=ProfileAction.env('OS_INTERFACE'),
291+
help='Desired API interface defaults to env[OS_INTERFACE]',
292292
)
293293
verify_group = parser.add_mutually_exclusive_group()
294294
verify_group.add_argument(

openstack/auth/service_catalog.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ def _get_endpoints(self, filtration):
6666
6767
Returns a tuple containting the url and version for the specified
6868
service (or all) containing the specified type, name, region and
69-
visibility.
69+
interface.
7070
"""
7171
eps = []
7272
for service in self.catalog:
@@ -77,7 +77,7 @@ def _get_endpoints(self, filtration):
7777
for endpoint in service.get('endpoints', []):
7878
if not filtration.match_region(endpoint.get('region', None)):
7979
continue
80-
if not filtration.match_visibility(endpoint.get('interface')):
80+
if not filtration.match_interface(endpoint.get('interface')):
8181
continue
8282
url = endpoint.get('url', None)
8383
if not url:
@@ -91,7 +91,7 @@ def get_urls(self, filtration):
9191
9292
Returns a list of urls based on the service filter. If not endpoints
9393
are found that match the service filter, an empty list is returned.
94-
The filter may specify type, name, region, version and visibility.
94+
The filter may specify type, name, region, version and interface.
9595
"""
9696
urls = []
9797
for url, version in self._get_endpoints(filtration):
@@ -107,7 +107,7 @@ def get_versions(self, filtration):
107107
no endpoint matching the filter, None will be returned. An empty
108108
list of versions means the service is supported, but no version is
109109
specified in the service catalog. The filter may specify type, name,
110-
region, version and visibility.
110+
region, version and interface.
111111
"""
112112
vers = None
113113
for url, version in self._get_endpoints(filtration):

openstack/auth/service_filter.py

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
--------
2626
2727
The :class:`~openstack.auth.service_filter.ServiceFilter` class can be built
28-
with a service type, visibility, region, name, and version.
28+
with a service type, interface, region, name, and version.
2929
3030
Create a service filter
3131
~~~~~~~~~~~~~~~~~~~~~~~
@@ -41,13 +41,13 @@
4141
matches = (result.match_service_type('compute') and
4242
result.match_service_name('Hal9000') and
4343
result.match_region('DiscoveryOne') and
44-
result.match_visibility('public'))
44+
result.match_interface('public'))
4545
print(str(result))
4646
print("matches=" + str(matches))
4747
4848
The resulting output from the code::
4949
50-
service_type=compute,visibility=public,version=v2
50+
service_type=compute,interface=public,version=v2
5151
matches=True
5252
"""
5353

@@ -72,30 +72,30 @@ class ServiceFilter(object):
7272
PUBLIC = 'public'
7373
INTERNAL = 'internal'
7474
ADMIN = 'admin'
75-
VISIBILITY = [PUBLIC, INTERNAL, ADMIN]
75+
INTERFACE = [PUBLIC, INTERNAL, ADMIN]
7676
valid_versions = []
7777

78-
def __init__(self, service_type=ANY, visibility=PUBLIC, region=None,
78+
def __init__(self, service_type=ANY, interface=PUBLIC, region=None,
7979
service_name=None, version=None):
8080
"""Create a service identifier.
8181
8282
:param string service_type: The desired type of service.
83-
:param string visibility: The exposure of the endpoint. Should be
83+
:param string interface: The exposure of the endpoint. Should be
8484
`public` (default), `internal` or `admin`.
8585
:param string region: The desired region (optional).
8686
:param string service_name: Name of the service
8787
:param string version: Version of service to use.
8888
"""
8989
self.service_type = service_type.lower()
90-
self.set_visibility(visibility)
90+
self.set_interface(interface)
9191
self.region = region
9292
self.service_name = service_name
9393
self.version = version
9494

9595
def __repr__(self):
9696
ret = "service_type=%s" % self.service_type
97-
if self.visibility is not None:
98-
ret += ",visibility=%s" % self.visibility
97+
if self.interface is not None:
98+
ret += ",interface=%s" % self.interface
9999
if self.region is not None:
100100
ret += ",region=%s" % self.region
101101
if self.service_name:
@@ -121,9 +121,9 @@ def join(self, default):
121121
response.service_type = default.service_type
122122
response.service_name = self.service_name
123123
response.valid_versions = default.valid_versions
124-
response.visibility = default.visibility
125-
if self.visibility:
126-
response.visibility = self.visibility
124+
response.interface = default.interface
125+
if self.interface:
126+
response.interface = self.interface
127127
if self.region:
128128
response.region = self.region
129129
response.version = version
@@ -151,23 +151,23 @@ def match_region(self, region):
151151
return True
152152
return False
153153

154-
def match_visibility(self, visibility):
155-
"""Service visibilities are equavilent."""
156-
if not self.visibility:
154+
def match_interface(self, interface):
155+
"""Service interfaces are equavilent."""
156+
if not self.interface:
157157
return True
158-
return self.visibility == visibility
158+
return self.interface == interface
159159

160-
def set_visibility(self, visibility):
161-
"""Set the visibility of the service filter."""
162-
if not visibility:
163-
self.visibility = None
160+
def set_interface(self, interface):
161+
"""Set the interface of the service filter."""
162+
if not interface:
163+
self.interface = None
164164
return
165-
visibility = visibility.replace('URL', '')
166-
visibility = visibility.lower()
167-
if visibility not in self.VISIBILITY:
168-
msg = "Visibility <%s> not in %s" % (visibility, self.VISIBILITY)
165+
interface = interface.replace('URL', '')
166+
interface = interface.lower()
167+
if interface not in self.INTERFACE:
168+
msg = "Interface <%s> not in %s" % (interface, self.INTERFACE)
169169
raise exceptions.SDKException(msg)
170-
self.visibility = visibility
170+
self.interface = interface
171171

172172
def _get_valid_version(self):
173173
if self.valid_versions:

openstack/connection.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ def from_config(opts):
111111
version = "v" + version
112112
prof.set_version(service, version)
113113
prof.set_name(service, cloud_config.get_service_name(service))
114-
prof.set_visibility(
114+
prof.set_interface(
115115
service, cloud_config.get_interface(service))
116116
prof.set_region(service, cloud_config.get_region_name(service))
117117

@@ -154,7 +154,7 @@ def __init__(self, transport=None, authenticator=None, profile=None,
154154
authenticator.
155155
:type authenticator: :class:`~openstack.auth.base.BaseAuthPlugin`
156156
:param profile: If the user has any special profiles such as the
157-
service name, region, version or visibility, they may be provided
157+
service name, region, version or interface, they may be provided
158158
in the profile object. If no profiles are provided, the
159159
services that appear first in the service catalog will be used.
160160
:type profile: :class:`~openstack.profile.Profile`

openstack/identity/identity_service.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,5 +30,5 @@ def __init__(self, **kwargs):
3030
class AdminService(IdentityService):
3131

3232
def __init__(self, **kwargs):
33-
kwargs['visibility'] = service_filter.ServiceFilter.ADMIN
33+
kwargs['interface'] = service_filter.ServiceFilter.ADMIN
3434
super(AdminService, self).__init__(**kwargs)

openstack/identity/v3/endpoint.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class Endpoint(resource.Resource):
3232
#: Setting this value to ``False`` prevents the endpoint from appearing
3333
#: in the service catalog. *Type: bool*
3434
enabled = resource.prop('enabled', type=bool)
35-
#: Describes the visibility of the endpoint according to one of the
35+
#: Describes the interface of the endpoint according to one of the
3636
#: following values:
3737
#:
3838
#: - `public`: intended for consumption by end users, generally on a

openstack/module_loader.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def load_service_extensions(namespace):
2626
services = {}
2727
for service in service_extensions:
2828
service = service.obj
29-
service.set_visibility(None)
29+
service.set_interface(None)
3030
services[service.service_type] = service
3131
return services
3232

openstack/profile.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"""
1414
:class:`~openstack.profile.Profile` is the class that is used to
1515
define the various preferences for different services. The preferences that
16-
are currently supported are service name, region, version and visibility.
16+
are currently supported are service name, region, version and interface.
1717
The :class:`~openstack.profile.Profile` and the
1818
:class:`~openstack.connection.Connection` classes are the most important
1919
user facing classes.
@@ -35,7 +35,7 @@
3535
prof.set_name('compute', 'matrix')
3636
prof.set_region(prof.ALL, 'zion')
3737
prof.set_version('identity', 'v3')
38-
prof.set_visibility('object-store', 'internal')
38+
prof.set_interface('object-store', 'internal')
3939
for service in prof.get_services():
4040
print str(prof.get_preference(service.service_type))
4141
@@ -47,7 +47,7 @@
4747
service_type=image,region=zion
4848
service_type=metering,region=zion
4949
service_type=orchestration,region=zion
50-
service_type=object-store,visibility=internal,region=zion
50+
service_type=object-store,interface=internal,region=zion
5151
service_type=identity,region=zion,version=v3
5252
"""
5353

@@ -113,7 +113,7 @@ def __repr__(self):
113113
return repr(self._preferences)
114114

115115
def _add_service(self, serv):
116-
serv.set_visibility(None)
116+
serv.set_interface(None)
117117
self._services[serv.service_type] = serv
118118

119119
def _load_extension(self, namespace):
@@ -186,15 +186,15 @@ def set_version(self, service, version):
186186
"""
187187
self._get_service(service).version = version
188188

189-
def set_visibility(self, service, visibility):
190-
"""Set the desired visibility for the specified service.
189+
def set_interface(self, service, interface):
190+
"""Set the desired interface for the specified service.
191191
192192
:param str service: Service type.
193-
:param str visibility: Desired service visibility.
193+
:param str interface: Desired service interface.
194194
"""
195195
if service == self.ALL:
196196
services = self.service_names
197197
else:
198198
services = [service]
199199
for service in services:
200-
self._get_service(service).set_visibility(visibility)
200+
self._get_service(service).set_interface(interface)

openstack/session.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ def __init__(self, transport, authenticator, profile=None):
8181
get_endpoint methods for the session.
8282
:type authenticator: :class:`~openstack.auth.base.BaseAuthPlugin`
8383
:param profile: If the user has any special profiles such as the
84-
service name, region, version or visibility, they may be provided
84+
service name, region, version or interface, they may be provided
8585
in the profile object. If no profiles are provided, the
8686
services that appear first in the service catalog will be used.
8787
:type profile: :class:`~openstack.profile.Profile`

openstack/tests/unit/auth/test_service_catalog.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -69,19 +69,19 @@ def get_urls_region(self, sot):
6969
self.assertEqual(["http://compute.region1.public/v2.0"],
7070
sot.get_urls(sf))
7171

72-
def get_urls_visibility(self, sot):
72+
def get_urls_interface(self, sot):
7373
sf = service_filter.ServiceFilter(service_type='identity',
74-
visibility='admin')
74+
interface='admin')
7575
self.assertEqual(["http://identity.region1.admin/v1.1/123123"],
7676
sot.get_urls(sf))
7777
sf = service_filter.ServiceFilter(service_type='identity',
78-
visibility='internal')
78+
interface='internal')
7979
self.assertEqual(
8080
["http://identity.region1.internal/v1.1/123123"],
8181
sot.get_urls(sf)
8282
)
8383
sf = service_filter.ServiceFilter(service_type='identity',
84-
visibility='public')
84+
interface='public')
8585
self.assertEqual(["http://identity.region1.public/v1.1/123123"],
8686
sot.get_urls(sf))
8787

@@ -107,9 +107,9 @@ def test_get_urls_region(self):
107107
sot = catalog.ServiceCatalogV2(common.TEST_SERVICE_CATALOG_V2)
108108
self.get_urls_region(sot)
109109

110-
def test_get_urls_visibility(self):
110+
def test_get_urls_interface(self):
111111
sot = catalog.ServiceCatalogV2(common.TEST_SERVICE_CATALOG_V2)
112-
self.get_urls_visibility(sot)
112+
self.get_urls_interface(sot)
113113

114114

115115
class TestServiceCatalogV3(TestServiceCatalog):
@@ -133,9 +133,9 @@ def test_get_urls_region(self):
133133
sot = catalog.ServiceCatalog(common.TEST_SERVICE_CATALOG_V3)
134134
self.get_urls_region(sot)
135135

136-
def test_get_urls_visibility(self):
136+
def test_get_urls_interface(self):
137137
sot = catalog.ServiceCatalog(common.TEST_SERVICE_CATALOG_V3)
138-
self.get_urls_visibility(sot)
138+
self.get_urls_interface(sot)
139139

140140
def test_get_versions(self):
141141
sot = catalog.ServiceCatalog(common.TEST_SERVICE_CATALOG_V3)

0 commit comments

Comments
 (0)