Merge "Use abstract base class for endpoint_filter driver"
This commit is contained in:
commit
d057683349
@ -14,6 +14,9 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
|
import abc
|
||||||
|
|
||||||
|
import six
|
||||||
|
|
||||||
from keystone.common import dependency
|
from keystone.common import dependency
|
||||||
from keystone.common import extension
|
from keystone.common import extension
|
||||||
@ -59,9 +62,11 @@ class Manager(manager.Manager):
|
|||||||
super(Manager, self).__init__(CONF.endpoint_filter.driver)
|
super(Manager, self).__init__(CONF.endpoint_filter.driver)
|
||||||
|
|
||||||
|
|
||||||
|
@six.add_metaclass(abc.ABCMeta)
|
||||||
class Driver(object):
|
class Driver(object):
|
||||||
"""Interface description for an Endpoint Filter driver."""
|
"""Interface description for an Endpoint Filter driver."""
|
||||||
|
|
||||||
|
@abc.abstractmethod
|
||||||
def add_endpoint_to_project(self, endpoint_id, project_id):
|
def add_endpoint_to_project(self, endpoint_id, project_id):
|
||||||
"""Creates an endpoint to project association.
|
"""Creates an endpoint to project association.
|
||||||
|
|
||||||
@ -75,6 +80,7 @@ class Driver(object):
|
|||||||
"""
|
"""
|
||||||
raise exception.NotImplemented()
|
raise exception.NotImplemented()
|
||||||
|
|
||||||
|
@abc.abstractmethod
|
||||||
def remove_endpoint_from_project(self, endpoint_id, project_id):
|
def remove_endpoint_from_project(self, endpoint_id, project_id):
|
||||||
"""Removes an endpoint to project association.
|
"""Removes an endpoint to project association.
|
||||||
|
|
||||||
@ -88,6 +94,7 @@ class Driver(object):
|
|||||||
"""
|
"""
|
||||||
raise exception.NotImplemented()
|
raise exception.NotImplemented()
|
||||||
|
|
||||||
|
@abc.abstractmethod
|
||||||
def check_endpoint_in_project(self, endpoint_id, project_id):
|
def check_endpoint_in_project(self, endpoint_id, project_id):
|
||||||
"""Checks if an endpoint is associated with a project.
|
"""Checks if an endpoint is associated with a project.
|
||||||
|
|
||||||
@ -101,6 +108,7 @@ class Driver(object):
|
|||||||
"""
|
"""
|
||||||
raise exception.NotImplemented()
|
raise exception.NotImplemented()
|
||||||
|
|
||||||
|
@abc.abstractmethod
|
||||||
def list_endpoints_for_project(self, project_id):
|
def list_endpoints_for_project(self, project_id):
|
||||||
"""List all endpoints associated with a project.
|
"""List all endpoints associated with a project.
|
||||||
|
|
||||||
@ -111,6 +119,7 @@ class Driver(object):
|
|||||||
"""
|
"""
|
||||||
raise exception.NotImplemented()
|
raise exception.NotImplemented()
|
||||||
|
|
||||||
|
@abc.abstractmethod
|
||||||
def list_projects_for_endpoint(self, endpoint_id):
|
def list_projects_for_endpoint(self, endpoint_id):
|
||||||
"""List all projects associated with an endpoint.
|
"""List all projects associated with an endpoint.
|
||||||
|
|
||||||
|
@ -17,7 +17,6 @@
|
|||||||
import inspect
|
import inspect
|
||||||
import testtools
|
import testtools
|
||||||
|
|
||||||
from keystone.contrib import endpoint_filter
|
|
||||||
from keystone import exception
|
from keystone import exception
|
||||||
|
|
||||||
|
|
||||||
@ -46,7 +45,3 @@ class TestDrivers(testtools.TestCase):
|
|||||||
method = getattr(interface, name)
|
method = getattr(interface, name)
|
||||||
if name[0] != '_' and callable(method):
|
if name[0] != '_' and callable(method):
|
||||||
self.assertMethodNotImplemented(method)
|
self.assertMethodNotImplemented(method)
|
||||||
|
|
||||||
def test_endpoint_filter_driver_unimplemented(self):
|
|
||||||
interface = endpoint_filter.Driver()
|
|
||||||
self.assertInterfaceNotImplemented(interface)
|
|
||||||
|
Loading…
Reference in New Issue
Block a user