google.cloud.forseti.scanner.scanner module

GCP Resource scanner.

_error_message(failed)[source]

Construct error message for failed scanners.

Parameters:failed (list) – names of scanners that failed
Returns:error message detailing the scanners that failed
Return type:str
init_scanner_index(session, inventory_index_id)[source]

Initialize the ‘scanner_index’ table.

Make sure we have a ‘scanner_index’ row for the current scanner run.

Parameters:
  • session (Session) – SQLAlchemy session object.
  • inventory_index_id (str) – Id of the inventory index.
Returns:

the id of the ‘scanner_index’ db row

Return type:

str

mark_scanner_index_complete(session, scanner_index_id, succeeded, failed)[source]

Mark the current ‘scanner_index’ row as complete.

Parameters:
  • session (Session) – SQLAlchemy session object.
  • scanner_index_id (str) – id of the ScannerIndex row to mark
  • succeeded (list) – names of scanners that ran successfully
  • failed (list) – names of scanners that failed
run(model_name=None, progress_queue=None, service_config=None, scanner_name=None)[source]

Run the scanners.

Entry point when the scanner is run as a library.

Parameters:
  • model_name (str) – The name of the data model.
  • progress_queue (Queue) – The progress queue.
  • service_config (ServiceConfig) – Forseti 2.0 service configs.
  • scanner_name (str) – Name of the scanner that runs separately.
Returns:

Status code.

Return type:

int