def _schedule_account_scan(self, executor: ThreadPoolExecutor, account_scan_plan: AccountScanPlan) -> Future: """Schedule a local account scan. Note that we serialize the AccountScanPlan because boto3 sessions are not thread safe. Args: executor: ThreadPoolExecutor to submit scan to account_scan_plan: AccountScanPlans defining this scan """ scan_lambda = lambda: local_account_scan( scan_id=self.scan_id, account_scan_plan_dict=account_scan_plan.to_dict(), config=self.config, ) return executor.submit(scan_lambda)
def _schedule_account_scan( self, executor: ThreadPoolExecutor, account_scan_plan: AccountScanPlan ) -> Future: """Schedule an account scan by calling the AccountScan lambda with the proper arguments.""" lambda_event = { "account_scan_plan": account_scan_plan.to_dict(), "regions": account_scan_plan.regions, "json_bucket": self.json_bucket, "key_prefix": self.key_prefix, "scan_sub_accounts": self.scan_sub_accounts, } return executor.submit( invoke_lambda, self.account_scan_lambda_name, self.account_scan_lambda_timeout, lambda_event, )
def _schedule_account_scan( self, executor: ThreadPoolExecutor, account_scan_plan: AccountScanPlan ) -> Future: """Schedule an account scan by calling the AccountScan lambda with the proper arguments.""" lambda_event = { "account_scan_plan": account_scan_plan.to_dict(), "scan_id": self.scan_id, "artifact_path": self.config.artifact_path, "max_svc_scan_threads": self.config.concurrency.max_svc_scan_threads, "preferred_account_scan_regions": self.config.scan.preferred_account_scan_regions, "scan_sub_accounts": self.config.scan.scan_sub_accounts, } return executor.submit( invoke_lambda, self.account_scan_lambda_name, self.account_scan_lambda_timeout, lambda_event, )