2 # -------------------------------------------------------------------------
3 # Copyright (c) 2015-2017 AT&T Intellectual Property
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
9 # http://www.apache.org/licenses/LICENSE-2.0
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
17 # -------------------------------------------------------------------------
22 # from oslo_config import cfg
23 # import oslo_messaging
25 # from conductor.agent import plugin_base
26 # from conductor import sample
29 # cfg.MultiStrOpt('http_control_exchanges',
30 # default=[cfg.CONF.nova_control_exchange,
31 # cfg.CONF.glance_control_exchange,
32 # cfg.CONF.neutron_control_exchange,
33 # cfg.CONF.cinder_control_exchange],
34 # help="Exchanges name to listen for notifications."),
37 # cfg.CONF.register_opts(OPTS)
40 # class HTTPRequest(plugin_base.NotificationBase,
41 # plugin_base.NonMetricNotificationBase):
42 # event_types = ['http.request']
44 # def get_targets(self, conf):
45 # """Return a sequence of oslo_messaging.Target
46 # This sequence is defining the exchange and topics to be connected for
49 # return [oslo_messaging.Target(topic=topic, exchange=exchange)
50 # for topic in self.get_notification_topics(conf)
51 # for exchange in conf.http_control_exchanges]
53 # def process_notification(self, message):
54 # yield sample.Sample.from_notification(
55 # name=message['event_type'],
56 # type=sample.TYPE_DELTA,
58 # unit=message['event_type'].split('.')[1],
59 # user_id=message['payload']['request'].get('HTTP_X_USER_ID'),
60 # project_id=message['payload']['request'].get('HTTP_X_PROJECT_ID'),
61 # resource_id=message['payload']['request'].get(
62 # 'HTTP_X_SERVICE_NAME'),
66 # class HTTPResponse(HTTPRequest):
67 # event_types = ['http.response']