# Path: monasca_notification/plugins/abstract_notifier.py
# class AbstractNotifier(object, metaclass=abc.ABCMeta):
# 
#     def __init__(self):
#         pass
# 
#     @abc.abstractproperty
#     def statsd_name(self):
#         pass
# 
#     @abc.abstractmethod
#     def config(self, config):
#         pass
# 
#     @abc.abstractmethod
#     def send_notification(self, notification):
#         pass


from debtcollector import removals
from jinja2 import Template
from oslo_config import cfg
from monasca_notification.plugins.abstract_notifier import AbstractNotifier
import jira
import simplejson as json
import urllib
import yaml


"""
   Note:
     This plugin doesn't support multi tenancy. Multi tenancy requires support for
     multiple JIRA server url. JIRA doesn't support OAUTH2 tokens, we may need to get
     the user credentials in query params and store them in monasca DB which we don't want to do.
     That is the reason for not supporting true multitenancy.

    MultiTenancy can be achieved by creating issues in different project for different tenant on
    the same JIRA server.

   notification.address = https://<jira_url>/?project=<project_name>

   Jira Configuration
       1) jira:
            user: username
            password: password

    Sample notification:
       monasca notification-create MyIssuer JIRA https://jira.hpcloud.net/?project=MyProject
       monasca notification-create MyIssuer1 JIRA https://jira.hpcloud.net/?project=MyProject&
                           component=MyComponent

"""


CONF = cfg.CONF



# Path: monasca_notification/plugins/abstract_notifier.py
# class AbstractNotifier(object, metaclass=abc.ABCMeta):
# 
#     def __init__(self):
#         pass
# 
#     @abc.abstractproperty
#     def statsd_name(self):
#         pass
# 
#     @abc.abstractmethod
#     def config(self, config):
#         pass
# 
#     @abc.abstractmethod
#     def send_notification(self, notification):
#         pass


# Path: monasca_notification/plugins/jira_notifier.py
from debtcollector import removals
from jinja2 import Template
from oslo_config import cfg
from monasca_notification.plugins.abstract_notifier import AbstractNotifier
import jira
import simplejson as json
import urllib
import yaml



"""
   Note:
     This plugin doesn't support multi tenancy. Multi tenancy requires support for
     multiple JIRA server url. JIRA doesn't support OAUTH2 tokens, we may need to get
     the user credentials in query params and store them in monasca DB which we don't want to do.
     That is the reason for not supporting true multitenancy.

    MultiTenancy can be achieved by creating issues in different project for different tenant on
    the same JIRA server.

   notification.address = https://<jira_url>/?project=<project_name>

   Jira Configuration
       1) jira:
            user: username
            password: password

    Sample notification:
       monasca notification-create MyIssuer JIRA https://jira.hpcloud.net/?project=MyProject
       monasca notification-create MyIssuer1 JIRA https://jira.hpcloud.net/?project=MyProject&
                           component=MyComponent

"""


CONF = cfg.CONF



class JiraNotifier(AbstractNotifier):