"Fossies" - the Fresh Open Source Software Archive

Member "monasca-api-3.1.0/monasca_api/api/logs_api.py" (27 Sep 2019, 1765 Bytes) of package /linux/misc/openstack/monasca-api-3.1.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 "logs_api.py" see the Fossies "Dox" file reference documentation.

    1 # Copyright 2015 kornicameister@gmail.com
    2 # Copyright 2016 FUJITSU LIMITED
    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 falcon
   17 from oslo_log import log
   18 
   19 
   20 LOG = log.getLogger(__name__)
   21 
   22 
   23 class LogsApi(object):
   24     """Logs API.
   25 
   26     Logs API acts as RESTful endpoint accepting
   27     messages contains collected log entries from the system.
   28     Works as gateway for any further processing for accepted data.
   29 
   30     """
   31     def __init__(self):
   32         super(LogsApi, self).__init__()
   33         LOG.info('Initializing LogsApi')
   34 
   35     def on_post(self, req, res):
   36         """Accepts sent logs as text or json.
   37 
   38         Accepts logs sent to resource which should
   39         be sent to kafka queue.
   40 
   41         :param req: current request
   42         :param res: current response
   43 
   44         """
   45         res.status = falcon.HTTP_501  # pragma: no cover
   46 
   47     def on_get(self, req, res):
   48         """Queries logs matching specified dimension values.
   49 
   50         Performs queries on the underlying log storage
   51         against a time range and set of dimension values.
   52 
   53         :param req: current request
   54         :param res: current response
   55 
   56         """
   57         res.status = falcon.HTTP_501  # pragma: no cover
   58 
   59     @property
   60     def version(self):
   61         return getattr(self, 'VERSION')