"Fossies" - the Fresh Open Source Software Archive

Member "keystone-17.0.0/keystone/endpoint_policy/backends/base.py" (13 May 2020, 5832 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. See also the latest Fossies "Diffs" side-by-side code changes report for "base.py": 16.0.1_vs_17.0.0.

    1 # Licensed under the Apache License, Version 2.0 (the "License"); you may
    2 # not use this file except in compliance with the License. You may obtain
    3 # a copy of the License at
    4 #
    5 #      http://www.apache.org/licenses/LICENSE-2.0
    6 #
    7 # Unless required by applicable law or agreed to in writing, software
    8 # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
    9 # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
   10 # License for the specific language governing permissions and limitations
   11 # under the License.
   12 
   13 import abc
   14 
   15 from keystone import exception
   16 
   17 
   18 class EndpointPolicyDriverBase(object, metaclass=abc.ABCMeta):
   19     """Interface description for an Endpoint Policy driver."""
   20 
   21     @abc.abstractmethod
   22     def create_policy_association(self, policy_id, endpoint_id=None,
   23                                   service_id=None, region_id=None):
   24         """Create a policy association.
   25 
   26         :param policy_id: identity of policy that is being associated
   27         :type policy_id: string
   28         :param endpoint_id: identity of endpoint to associate
   29         :type endpoint_id: string
   30         :param service_id: identity of the service to associate
   31         :type service_id: string
   32         :param region_id: identity of the region to associate
   33         :type region_id: string
   34         :returns: None
   35 
   36         There are three types of association permitted:
   37 
   38         - Endpoint (in which case service and region must be None)
   39         - Service and region (in which endpoint must be None)
   40         - Service (in which case endpoint and region must be None)
   41 
   42         """
   43         raise exception.NotImplemented()  # pragma: no cover
   44 
   45     @abc.abstractmethod
   46     def check_policy_association(self, policy_id, endpoint_id=None,
   47                                  service_id=None, region_id=None):
   48         """Check existence of a policy association.
   49 
   50         :param policy_id: identity of policy that is being associated
   51         :type policy_id: string
   52         :param endpoint_id: identity of endpoint to associate
   53         :type endpoint_id: string
   54         :param service_id: identity of the service to associate
   55         :type service_id: string
   56         :param region_id: identity of the region to associate
   57         :type region_id: string
   58         :raises keystone.exception.PolicyAssociationNotFound: If there is no
   59             match for the specified association.
   60         :returns: None
   61 
   62         """
   63         raise exception.NotImplemented()  # pragma: no cover
   64 
   65     @abc.abstractmethod
   66     def delete_policy_association(self, policy_id, endpoint_id=None,
   67                                   service_id=None, region_id=None):
   68         """Delete a policy association.
   69 
   70         :param policy_id: identity of policy that is being associated
   71         :type policy_id: string
   72         :param endpoint_id: identity of endpoint to associate
   73         :type endpoint_id: string
   74         :param service_id: identity of the service to associate
   75         :type service_id: string
   76         :param region_id: identity of the region to associate
   77         :type region_id: string
   78         :returns: None
   79 
   80         """
   81         raise exception.NotImplemented()  # pragma: no cover
   82 
   83     @abc.abstractmethod
   84     def get_policy_association(self, endpoint_id=None,
   85                                service_id=None, region_id=None):
   86         """Get the policy for an explicit association.
   87 
   88         This method is not exposed as a public API, but is used by
   89         get_policy_for_endpoint().
   90 
   91         :param endpoint_id: identity of endpoint
   92         :type endpoint_id: string
   93         :param service_id: identity of the service
   94         :type service_id: string
   95         :param region_id: identity of the region
   96         :type region_id: string
   97         :raises keystone.exception.PolicyAssociationNotFound: If there is no
   98             match for the specified association.
   99         :returns: dict containing policy_id (value is a tuple containing only
  100                   the policy_id)
  101 
  102         """
  103         raise exception.NotImplemented()  # pragma: no cover
  104 
  105     @abc.abstractmethod
  106     def list_associations_for_policy(self, policy_id):
  107         """List the associations for a policy.
  108 
  109         This method is not exposed as a public API, but is used by
  110         list_endpoints_for_policy().
  111 
  112         :param policy_id: identity of policy
  113         :type policy_id: string
  114         :returns: List of association dicts
  115 
  116         """
  117         raise exception.NotImplemented()  # pragma: no cover
  118 
  119     @abc.abstractmethod
  120     def delete_association_by_endpoint(self, endpoint_id):
  121         """Remove all the policy associations with the specific endpoint.
  122 
  123         :param endpoint_id: identity of endpoint to check
  124         :type endpoint_id: string
  125         :returns: None
  126 
  127         """
  128         raise exception.NotImplemented()  # pragma: no cover
  129 
  130     @abc.abstractmethod
  131     def delete_association_by_service(self, service_id):
  132         """Remove all the policy associations with the specific service.
  133 
  134         :param service_id: identity of endpoint to check
  135         :type service_id: string
  136         :returns: None
  137 
  138         """
  139         raise exception.NotImplemented()  # pragma: no cover
  140 
  141     @abc.abstractmethod
  142     def delete_association_by_region(self, region_id):
  143         """Remove all the policy associations with the specific region.
  144 
  145         :param region_id: identity of endpoint to check
  146         :type region_id: string
  147         :returns: None
  148 
  149         """
  150         raise exception.NotImplemented()  # pragma: no cover
  151 
  152     @abc.abstractmethod
  153     def delete_association_by_policy(self, policy_id):
  154         """Remove all the policy associations with the specific policy.
  155 
  156         :param policy_id: identity of endpoint to check
  157         :type policy_id: string
  158         :returns: None
  159 
  160         """
  161         raise exception.NotImplemented()  # pragma: no cover