Exemplo n.º 1
0
def serialize_event_to_context(event):
    event_context = get_event_context(event)
    url = add_notification_referrer_param(event_context.object_context.url,
                                          provider='polyaxon',
                                          is_absolute=False)

    payload = {
        'pretext':
        event_context.subject_action,
        'title':
        event_context.subject_action,
        'text':
        get_readable_event(event_context),
        'color':
        EventColor.get_for_event(event_content_object=event.instance,
                                 event_type=event.event_type),
        'fields': [],
        'author_name':
        'Polyaxon',
        'author_link':
        url,
        'author_icon':
        None,
    }

    return payload
Exemplo n.º 2
0
def serialize_event_to_context(event):
    event_context = get_event_context(event)
    logo_url = ''  # TODO: add logo url
    fields = []  # Use build_field
    url = add_notification_referrer_param(event_context.object_context.url,
                                          provider='slack',
                                          is_absolute=False)

    payload = {
        'fallback':
        event_context.subject_action,
        'title':
        event_context.subject_action,
        'title_link':
        url,
        'text':
        get_readable_event(event_context),
        'fields':
        fields,
        'mrkdwn_in': ['text'],
        'footer_icon':
        logo_url,
        'footer':
        'Polyaxon',
        'color':
        EventColor.get_for_event(event_content_object=event.instance,
                                 event_type=event.event_type),
        'ts':
        to_timestamp(event.datetime)
    }

    return payload
Exemplo n.º 3
0
    def serialize_event_to_context(cls, event: Event) -> Dict:
        event_context = get_event_context(event)

        context = {
            'subject': event_context.subject_action,
            'body': get_readable_event(event_context),
            'datetime': to_timestamp(event_context.datetime)
        }
        return context
Exemplo n.º 4
0
    def serialize_event_to_context(cls, event):
        event_context = get_event_context(event)

        context = {
            'subject': event_context.subject_action,
            'body': get_readable_event(event_context),
            'datetime': event_context.datetime
        }
        return context
Exemplo n.º 5
0
def serialize_event_to_context(event):
    event_context = get_event_context(event)
    logo_url = ''

    payload = {
        'content': get_readable_event(event_context),
        'avatar_url': logo_url
    }

    return payload
Exemplo n.º 6
0
    def serialize_event_to_context(cls, event):
        event_context = get_event_context(event)

        context = {
            'subject': event_context.subject_action,
            'notification': get_readable_event(event_context),
        }
        return {
            'subject_template': 'notifier/subject.txt',
            'body_template': 'notifier/body.txt',
            'context': context
        }
Exemplo n.º 7
0
def serialize_event_to_context(event):
    event_context = get_event_context(event)

    payload = {
        'message':
        get_readable_event(event_context),
        'message_format':
        'text',
        'color':
        EventColor.get_for_event(event_content_object=event.instance,
                                 event_type=event.event_type),
        'from':
        'Polyaxon',
    }

    return payload
Exemplo n.º 8
0
def serialize_event_to_context(event):
    event_context = get_event_context(event)
    contexts = []  # Use build_field
    url = add_notification_referrer_param(event_context.object_context.url,
                                          provider='pagerduty',
                                          is_absolute=False)

    payload = {
        'event_type': event_context.subject_action,
        'description': get_readable_event(event_context),
        'details': event.data,
        'incident_key': 'trigger',
        'client': 'polyaxon',
        'client_url': url,
        'contexts': contexts,
    }

    return payload