google.cloud.forseti.scanner.scanners.resource_scanner module

Scanner for the resource Resource rules engine.

class ResourceScanner(global_configs, scanner_configs, service_config, model_name, snapshot_timestamp, rules)[source]

Bases: google.cloud.forseti.scanner.scanners.base_scanner.BaseScanner

Scanner for Resources.

_abc_cache = <_weakrefset.WeakSet object>
_abc_negative_cache = <_weakrefset.WeakSet object>
_abc_negative_cache_version = 203
_abc_registry = <_weakrefset.WeakSet object>
_find_violations(resources)[source]

Find Resource violations in the given resources.

Parameters:resources (List[resource]) – resources to check for violations in.
Returns:A list of all violations.
Return type:List[RuleViolation]
static _flatten_violations(violations)[source]

Flatten violations into a dict.

Parameters:violations (List[RuleViolation]) – The violations to flatten.
Yields:Iterator[dict] – flattened violations for each violation.
_output_results(all_violations)[source]

Output results.

Parameters:all_violations (List[RuleViolation]) – A list of resource Resource violations.
_retrieve()[source]

Retrieves the data for scanner.

Returns:resources to check for violations.
Return type:List[Resource]
Raises:ValueError – if resources have an unexpected type.
run()[source]

Runs the data collection.