# -*- coding: utf-8 -*-
# 确认事件
# 作者: 陈磊
# 时间: 2019-10-24
from WorkApi.ApiBase import ApiBase
from WorkUtils.UtilsRequest import UtilsRequest
from WorkUtils.UtilsLog import UtilsLog


class ProblemAcknowledge(object):
    def __init__(self, _host):
        """
        :param _host: 域名
        :return:
        """
        self.log = UtilsLog()
        self.log.info("调用确认事件")
        self.log.info(self.__class__)

        self._host = _host
        self._headers = {}
        self._path = "/problem/acknowledge"
        self._url = self._host + self._path
        self._params = {}
        self._json = {}
        self.response = ""

        self.eventids = None
        self.action = None
        self.message = None
        self.severity = None

        self.api = UtilsRequest()

    def get_response(self):
        base = ApiBase()
        base.dict_add_key(_key="eventids", value=self.eventids)
        base.dict_add_key(_key="action", value=self.action)
        base.dict_add_key(_key="message", value=self.message)
        base.dict_add_key(_key="severity", value=self.severity)
        self._json = base._json

        self.response = self.api.post(url=self._url, json=self._json)
