"Fossies" - the Fresh Open Source Software Archive

Member "neutron-14.0.3/neutron/extensions/logging.py" (22 Oct 2019, 2836 Bytes) of package /linux/misc/openstack/neutron-14.0.3.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 "logging.py" see the Fossies "Dox" file reference documentation.

    1 # Copyright (c) 2017 Fujitsu Limited
    2 # All rights reserved.
    3 #
    4 #    Licensed under the Apache License, Version 2.0 (the "License"); you may
    5 #    not use this file except in compliance with the License. You may obtain
    6 #    a copy of the License at
    7 #
    8 #         http://www.apache.org/licenses/LICENSE-2.0
    9 #
   10 #    Unless required by applicable law or agreed to in writing, software
   11 #    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
   12 #    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
   13 #    License for the specific language governing permissions and limitations
   14 #    under the License.
   15 
   16 import abc
   17 import itertools
   18 
   19 from neutron_lib.api.definitions import logging as apidef
   20 from neutron_lib.api import extensions as api_extensions
   21 from neutron_lib.plugins import constants as plugin_const
   22 from neutron_lib.services import base as service_base
   23 import six
   24 
   25 from neutron.api.v2 import resource_helper
   26 
   27 
   28 class Logging(api_extensions.APIExtensionDescriptor):
   29     """Neutron logging api extension."""
   30 
   31     api_definition = apidef
   32 
   33     @classmethod
   34     def get_plugin_interface(cls):
   35         return LoggingPluginBase
   36 
   37     @classmethod
   38     def get_resources(cls):
   39         """Returns Ext Resources."""
   40         plural_mappings = resource_helper.build_plural_mappings(
   41             {}, itertools.chain(apidef.RESOURCE_ATTRIBUTE_MAP))
   42 
   43         resources = resource_helper.build_resource_info(
   44                                                 plural_mappings,
   45                                                 apidef.RESOURCE_ATTRIBUTE_MAP,
   46                                                 plugin_const.LOG_API,
   47                                                 translate_name=True,
   48                                                 allow_bulk=True)
   49 
   50         return resources
   51 
   52 
   53 @six.add_metaclass(abc.ABCMeta)
   54 class LoggingPluginBase(service_base.ServicePluginBase):
   55 
   56     path_prefix = apidef.API_PREFIX
   57 
   58     def get_plugin_description(self):
   59         return "Logging API Service Plugin"
   60 
   61     @classmethod
   62     def get_plugin_type(cls):
   63         return plugin_const.LOG_API
   64 
   65     @abc.abstractmethod
   66     def get_logs(self, context, filters=None, fields=None, sorts=None,
   67                  limit=None, marker=None, page_reverse=False):
   68         pass
   69 
   70     @abc.abstractmethod
   71     def get_log(self, context, log_id, fields=None):
   72         pass
   73 
   74     @abc.abstractmethod
   75     def create_log(self, context, log):
   76         pass
   77 
   78     @abc.abstractmethod
   79     def update_log(self, context, log_id, log):
   80         pass
   81 
   82     @abc.abstractmethod
   83     def delete_log(self, context, log_id):
   84         pass
   85 
   86     @abc.abstractmethod
   87     def get_loggable_resources(self, context, filters=None, fields=None,
   88                                sorts=None, limit=None,
   89                                marker=None, page_reverse=False):
   90         pass