"Fossies" - the Fresh Open Source Software Archive

Member "keystone-17.0.0/keystone/resource/config_backends/base.py" (13 May 2020, 5312 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 # 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 DomainConfigDriverBase(object, metaclass=abc.ABCMeta):
   21     """Interface description for a Domain Config driver."""
   22 
   23     @abc.abstractmethod
   24     def create_config_options(self, domain_id, option_list):
   25         """Create config options for a domain.
   26 
   27         Any existing config options will first be deleted.
   28 
   29         :param domain_id: the domain for this option
   30         :param option_list: a list of dicts, each one specifying an option
   31 
   32         Option schema::
   33 
   34             type: dict
   35             properties:
   36                 group:
   37                     type: string
   38                 option:
   39                     type: string
   40                 value:
   41                     type: depends on the option
   42                 sensitive:
   43                     type: boolean
   44             required: [group, option, value, sensitive]
   45             additionalProperties: false
   46 
   47         """
   48         raise exception.NotImplemented()  # pragma: no cover
   49 
   50     @abc.abstractmethod
   51     def get_config_option(self, domain_id, group, option, sensitive=False):
   52         """Get the config option for a domain.
   53 
   54         :param domain_id: the domain for this option
   55         :param group: the group name
   56         :param option: the option name
   57         :param sensitive: whether the option is sensitive
   58 
   59         :returns: dict containing group, option and value
   60         :raises keystone.exception.DomainConfigNotFound: the option doesn't
   61                                                          exist.
   62 
   63         """
   64         raise exception.NotImplemented()  # pragma: no cover
   65 
   66     @abc.abstractmethod
   67     def list_config_options(self, domain_id, group=None, option=False,
   68                             sensitive=False):
   69         """Get a config options for a domain.
   70 
   71         :param domain_id: the domain for this option
   72         :param group: optional group option name
   73         :param option: optional option name. If group is None, then this
   74                        parameter is ignored
   75         :param sensitive: whether the option is sensitive
   76 
   77         :returns: list of dicts containing group, option and value
   78 
   79         """
   80         raise exception.NotImplemented()  # pragma: no cover
   81 
   82     @abc.abstractmethod
   83     def update_config_options(self, domain_id, option_list):
   84         """Update config options for a domain.
   85 
   86         :param domain_id: the domain for this option
   87         :param option_list: a list of dicts, each one specifying an option
   88 
   89         """
   90         raise exception.NotImplemented()  # pragma: no cover
   91 
   92     @abc.abstractmethod
   93     def delete_config_options(self, domain_id, group=None, option=None):
   94         """Delete config options for a domain.
   95 
   96         Allows deletion of all options for a domain, all options in a group
   97         or a specific option. The driver is silent if there are no options
   98         to delete.
   99 
  100         :param domain_id: the domain for this option
  101         :param group: optional group option name
  102         :param option: optional option name. If group is None, then this
  103                        parameter is ignored
  104 
  105         The option is uniquely defined by domain_id, group and option,
  106         irrespective of whether it is sensitive ot not.
  107 
  108         """
  109         raise exception.NotImplemented()  # pragma: no cover
  110 
  111     @abc.abstractmethod
  112     def obtain_registration(self, domain_id, type):
  113         """Try and register this domain to use the type specified.
  114 
  115         :param domain_id: the domain required
  116         :param type: type of registration
  117         :returns: True if the domain was registered, False otherwise. Failing
  118                   to register means that someone already has it (which could
  119                   even be the domain being requested).
  120 
  121         """
  122         raise exception.NotImplemented()  # pragma: no cover
  123 
  124     @abc.abstractmethod
  125     def read_registration(self, type):
  126         """Get the domain ID of who is registered to use this type.
  127 
  128         :param type: type of registration
  129         :returns: domain_id of who is registered.
  130         :raises keystone.exception.ConfigRegistrationNotFound: If nobody is
  131             registered.
  132 
  133         """
  134         raise exception.NotImplemented()  # pragma: no cover
  135 
  136     @abc.abstractmethod
  137     def release_registration(self, domain_id, type=None):
  138         """Release registration if it is held by the domain specified.
  139 
  140         If the specified domain is registered for this domain then free it,
  141         if it is not then do nothing - no exception is raised.
  142 
  143         :param domain_id: the domain in question
  144         :param type: type of registration, if None then all registrations
  145                      for this domain will be freed
  146 
  147         """
  148         raise exception.NotImplemented()  # pragma: no cover