Notification Engine for Monasca
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

base_repo.py 1.5KB

12345678910111213141516171819202122232425262728293031
  1. # Copyright 2015 FUJITSU LIMITED
  2. # (C) Copyright 2016 Hewlett Packard Enterprise Development LP
  3. #
  4. # Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
  5. # in compliance with the License. You may obtain 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 distributed under the License
  10. # is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
  11. # or implied. See the License for the specific language governing permissions and limitations under
  12. # the License.
  13. class BaseRepo(object):
  14. def __init__(self, config):
  15. self._find_alarm_action_sql = \
  16. """SELECT id, type, name, address, period
  17. FROM alarm_action as aa
  18. JOIN notification_method as nm ON aa.action_id = nm.id
  19. WHERE aa.alarm_definition_id = %s and aa.alarm_state = %s"""
  20. self._find_alarm_state_sql = \
  21. """SELECT state
  22. FROM alarm
  23. WHERE alarm.id = %s"""
  24. self._insert_notification_types_sql = \
  25. """INSERT INTO notification_method_type (name) VALUES ( %s)"""
  26. self._find_all_notification_types_sql = """SELECT name from notification_method_type """
  27. self._get_notification_sql = """SELECT name, type, address, period
  28. FROM notification_method
  29. WHERE id = %s"""