google.cloud.forseti.scanner.scanners.config_validator_util.validator_client module

Config Validator Validator Client.

class BufferedCVDataSender(validator_client, max_size=1024, max_packet_size=4000000)[source]

Bases: object

Buffered Config Validator data sender.

MAX_ALLOWED_PACKET = 4000000
add(asset)[source]

Add an Asset to the buffer to send to Config Validator.

Parameters:asset (Asset) – Asset to send to Config Validator.
flush()[source]

Flush all pending objects to the database.

class ValidatorClient(endpoint='localhost:50052')[source]

Bases: object

Validator client.

DEFAULT_ENDPOINT = 'localhost:50052'
add_data(assets)[source]

Add asset data.

Parameters:

assets (list) – A list of asset data.

Raises:
  • ConfigValidatorAddDataError – Config Validator Add Data Error.
  • ConfigValidatorServerUnavailableError – Config Validator Server Unavailable Error.
add_data_in_bulk(assets)[source]

Add asset data to buffer, intended to manage sending data in bulk.

Parameters:assets (list) – A list of asset data.
audit()[source]

Audit existing data in Config Validator.

Returns:

List of violations.

Return type:

list

Raises:
  • ConfigValidatorAuditError – Config Validator Audit Error.
  • ConfigValidatorServerUnavailableError – Config Validator Server Unavailable Error.
paged_review(assets)[source]

Review in a paged manner to avoid memory problem.

Parameters:assets (Generator) – A list of asset data.
Yields:list – A list of violations of the paged assets.
reset()[source]

Clears previously added data from Config Validator.

Raises:
  • ConfigValidatorResetError – Config Validator Reset Error.
  • ConfigValidatorServerUnavailableError – Config Validator Server Unavailable Error.
review(assets)[source]

Review existing data in Config Validator (Audit in parallel per policy).

Parameters:

assets (list) – A list of assets to review.

Returns:

List of violations.

Return type:

list

Raises:
  • ConfigValidatorAuditError – Config Validator Audit Error.
  • ConfigValidatorServerUnavailableError – Config Validator Server Unavailable Error.