Source code for honeycomb.integrationmanager.models
# -*- coding: utf-8 -*-
"""Honeycomb integration models."""
from __future__ import unicode_literals, absolute_import
from datetime import datetime, timedelta
from attr import attrs, attrib, Factory
from honeycomb.decoymanager.models import Alert
[docs]@attrs
class Integration(object):
"""Integration model."""
parameters = attrib(type=str)
display_name = attrib(type=str)
required_fields = attrib(type=list)
polling_enabled = attrib(type=bool)
integration_type = attrib(type=str)
max_send_retries = attrib(type=int)
supported_event_types = attrib(type=list)
test_connection_enabled = attrib(type=bool)
module = attrib(default=None)
description = attrib(type=str, default=None)
polling_duration = attrib(type=timedelta, default=0)
# TODO: Fix schema differences between custom service and integration config.json
name = attrib(type=str, init=False, default=Factory(lambda self: self.display_name.lower().replace(" ", "_"),
takes_self=True))
label = attrib(type=str, init=False, default=Factory(lambda self: self.description, takes_self=True))
# status = attrib(type=str, init=False)
# configuring = attrib(type=bool, default=False)
[docs]@attrs
class IntegrationAlert(object):
"""Integration alert model."""
alert = attrib(type=Alert)
status = attrib(type=str)
retries = attrib(type=int)
configured_integration = attrib(type=ConfiguredIntegration)
send_time = attrib(type=datetime, init=False)
output_data = attrib(type=str, init=False)