"Fossies" - the Fresh Open Source Software Archive

Member "keystone-17.0.0/keystone/trust/backends/base.py" (13 May 2020, 3319 Bytes) of package /linux/misc/openstack/keystone-17.0.0.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Python source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. For more information about "base.py" see the Fossies "Dox" file reference documentation and the latest Fossies "Diffs" side-by-side code changes report: 16.0.1_vs_17.0.0.

    1 # Copyright 2012 OpenStack Foundation
    2 #
    3 # Licensed under the Apache License, Version 2.0 (the "License"); you may
    4 # not use this file except in compliance with the License. You may obtain
    5 # a copy of the License at
    6 #
    7 #      http://www.apache.org/licenses/LICENSE-2.0
    8 #
    9 # Unless required by applicable law or agreed to in writing, software
   10 # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
   11 # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
   12 # License for the specific language governing permissions and limitations
   13 # under the License.
   14 
   15 import abc
   16 
   17 from keystone import exception
   18 
   19 
   20 class TrustDriverBase(object, metaclass=abc.ABCMeta):
   21 
   22     @abc.abstractmethod
   23     def create_trust(self, trust_id, trust, roles):
   24         """Create a new trust.
   25 
   26         :returns: a new trust
   27         """
   28         raise exception.NotImplemented()  # pragma: no cover
   29 
   30     @abc.abstractmethod
   31     def get_trust(self, trust_id, deleted=False):
   32         """Get a trust by the trust id.
   33 
   34         :param trust_id: the trust identifier
   35         :type trust_id: string
   36         :param deleted: return the trust even if it is deleted, expired, or
   37                         has no consumptions left
   38         :type deleted: bool
   39         """
   40         raise exception.NotImplemented()  # pragma: no cover
   41 
   42     @abc.abstractmethod
   43     def list_trusts(self):
   44         raise exception.NotImplemented()  # pragma: no cover
   45 
   46     @abc.abstractmethod
   47     def list_trusts_for_trustee(self, trustee):
   48         raise exception.NotImplemented()  # pragma: no cover
   49 
   50     @abc.abstractmethod
   51     def list_trusts_for_trustor(self, trustor):
   52         raise exception.NotImplemented()  # pragma: no cover
   53 
   54     @abc.abstractmethod
   55     def delete_trust(self, trust_id):
   56         raise exception.NotImplemented()  # pragma: no cover
   57 
   58     @abc.abstractmethod
   59     def consume_use(self, trust_id):
   60         """Consume one use of a trust.
   61 
   62         One use of a trust is consumed when the trust was created with a
   63         limitation on its uses, provided there are still uses available.
   64 
   65         :raises keystone.exception.TrustUseLimitReached: If no remaining uses
   66             for trust.
   67         :raises keystone.exception.TrustNotFound: If the trust doesn't exist.
   68         """
   69         raise exception.NotImplemented()  # pragma: no cover
   70 
   71     @abc.abstractmethod
   72     def delete_trusts_for_project(self, project_id):
   73         """Delete all trusts for a project.
   74 
   75         :param project_id: ID of a project to filter trusts by.
   76 
   77         """
   78         raise exception.NotImplemented()  # pragma: no cover
   79 
   80     @abc.abstractmethod
   81     def flush_expired_and_soft_deleted_trusts(self, project_id=None,
   82                                               trustor_user_id=None,
   83                                               trustee_user_id=None,
   84                                               date=None):
   85         """Flush expired and non-expired soft deleted trusts from the backend.
   86 
   87         :param project_id: ID of a project to filter trusts by.
   88         :param trustor_user_id: ID of a trustor_user_id to filter trusts by.
   89         :param trustee_user_id: ID of a trustee_user_id to filter trusts by.
   90         :param date: date to filter trusts by.
   91         :type date: datetime
   92 
   93         """
   94         raise exception.NotImplemented()  # pragma: no cover