Use abstract base class for trust driver

Use the abc module for managing abstract base classes in the driver
layer.

bp abstract-base-class-drivers

Change-Id: I84fa24bf636e13d39544c2a811f92f62c538b100
This commit is contained in:
Doug Hellmann 2013-10-06 12:36:53 -04:00
parent b00df6785c
commit d346f50c10
1 changed files with 12 additions and 0 deletions

View File

@ -16,6 +16,10 @@
"""Main entry point into the Identity service."""
import abc
import six
from keystone.common import dependency
from keystone.common import manager
from keystone import config
@ -41,7 +45,10 @@ class Manager(manager.Manager):
super(Manager, self).__init__(CONF.trust.driver)
@six.add_metaclass(abc.ABCMeta)
class Driver(object):
@abc.abstractmethod
def create_trust(self, trust_id, trust, roles):
"""Create a new trust.
@ -49,17 +56,22 @@ class Driver(object):
"""
raise exception.NotImplemented()
@abc.abstractmethod
def get_trust(self, trust_id):
raise exception.NotImplemented()
@abc.abstractmethod
def list_trusts(self):
raise exception.NotImplemented()
@abc.abstractmethod
def list_trusts_for_trustee(self, trustee):
raise exception.NotImplemented()
@abc.abstractmethod
def list_trusts_for_trustor(self, trustor):
raise exception.NotImplemented()
@abc.abstractmethod
def delete_trust(self, trust_id):
raise exception.NotImplemented()