def review(self, assets): """Review existing data in Config Validator (Audit in parallel per policy). Args: assets (list): A list of assets to review. Returns: list: List of violations. Raises: ConfigValidatorAuditError: Config Validator Audit Error. ConfigValidatorServerUnavailableError: Config Validator Server Unavailable Error. """ try: review_request = validator_pb2.ReviewRequest() # pylint: disable=no-member review_request.assets.extend(assets) # pylint: enable=no-member LOGGER.info(f'Config Validator - reviewing {len(assets)} assets') return self.stub.Review(review_request).violations except grpc.RpcError as e: # pylint: disable=no-member if e.code() == grpc.StatusCode.UNAVAILABLE: raise errors.ConfigValidatorServerUnavailableError(e) else: LOGGER.exception('ConfigValidatorAuditError: %s', e) raise errors.ConfigValidatorAuditError(e)
def audit(self): """Audit existing data in Config Validator. Returns: list: List of violations. Raises: ConfigValidatorAuditError: Config Validator Audit Error. ConfigValidatorServerUnavailableError: Config Validator Server Unavailable Error. """ try: return self.stub.Audit(validator_pb2.AuditRequest()).violations except grpc.RpcError as e: # pylint: disable=no-member if e.code() == grpc.StatusCode.UNAVAILABLE: raise errors.ConfigValidatorServerUnavailableError(e.message) else: LOGGER.exception('ConfigValidatorAuditError: %s', e.message) raise errors.ConfigValidatorAuditError(e.message)