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 = 203
_abc_registry = <_weakrefset.WeakSet object>
_compose(violation)[source]

Composes the slack webhook content

Parameters:violation (object) – Violation to transform to ascii output.
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(payload)[source]

Sends a post to a Slack webhook url

Parameters:payload (str) – Payload data to send to slack.
run()[source]

Run the slack webhook notifier