google.cloud.forseti.notifier.notifiers.cscc_notifier module

Upload violations to GCS bucket as Findings.

class CsccNotifier(inv_index_id)[source]

Bases: object

Send violations to CSCC via API or via GCS bucket.

static _get_output_filename()[source]

Create the output filename. :returns: The output filename for the violations json. :rtype: str

_send_findings_to_cscc(violations, organization_id)[source]

Send violations to CSCC directly via the CSCC API.

Parameters:
  • violations (dict) – Violations to be uploaded as findings.
  • organization_id (str) – The id prefixed with ‘organizations/’.
_send_findings_to_gcs(violations, gcs_path)[source]

Send violations to CSCC via upload to GCS (legacy mode). :param violations: Violations to be uploaded as findings. :type violations: dict :param gcs_path: The GCS bucket to upload the findings. :type gcs_path: str

_transform_for_api(violations)[source]

Transform forseti violations to findings for CSCC API.

Parameters:violations (dict) – Violations to be sent to CSCC as findings.
Returns:violations in findings format; each violation is a dict.
Return type:list
_transform_for_gcs(violations)[source]

Transform forseti violations to GCS findings format.

Parameters:violations (dict) – Violations to be uploaded as findings.
Returns:violations in findings format; each violation is a dict.
Return type:list
run(violations, gcs_path, mode, organization_id)[source]

Generate the temporary json file and upload to GCS.

Parameters:
  • violations (dict) – Violations to be uploaded as findings.
  • gcs_path (str) – The GCS bucket to upload the findings.
  • mode (str) – The mode in which to send the CSCC notification.
  • organization_id (str) – The id of the organization.