google.cloud.forseti.notifier.notifiers.slack_webhook module

Slack webhook notifier to perform notifications.

class SlackWebhook(resource, inventory_index_id, violations, global_configs, notifier_config, notification_config)[source]

Bases: google.cloud.forseti.notifier.notifiers.base_notification.BaseNotification

Slack webhook notifier to perform notifications

_abc_cache = <_weakrefset.WeakSet object>
_abc_negative_cache = <_weakrefset.WeakSet object>
_abc_negative_cache_version = 186
_abc_registry = <_weakrefset.WeakSet object>
_compose(**kwargs)[source]

Composes the slack webhook content

Parameters:**kwargs – Arbitrary keyword arguments.
Returns:a string formatted violation
Return type:webhook_payload
_dump_slack_output(data, indent=0)[source]

Iterate over a dictionary and output a custom formatted string

Parameters:
  • data (dict) – a dictionary of violation data
  • indent (int) – number of spaces for indentation
Returns:

a string formatted violation

Return type:

output

_send(**kwargs)[source]

Sends a post to a Slack webhook url

Parameters:**kwargs – Arbitrary keyword arguments. payload: violation data for body of POST request
run()[source]

Run the slack webhook notifier