forked from cycodehq/cycode-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclient_creator.py
More file actions
29 lines (22 loc) · 1.36 KB
/
client_creator.py
File metadata and controls
29 lines (22 loc) · 1.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
from cycode.cyclient.config import dev_mode
from cycode.cyclient.config_dev import DEV_CYCODE_API_URL
from cycode.cyclient.cycode_dev_based_client import CycodeDevBasedClient
from cycode.cyclient.cycode_token_based_client import CycodeTokenBasedClient
from cycode.cyclient.import_sbom_client import ImportSbomClient
from cycode.cyclient.report_client import ReportClient
from cycode.cyclient.scan_client import ScanClient
from cycode.cyclient.scan_config_base import DefaultScanConfig, DevScanConfig
def create_scan_client(client_id: str, client_secret: str, hide_response_log: bool) -> ScanClient:
if dev_mode:
client = CycodeDevBasedClient(DEV_CYCODE_API_URL)
scan_config = DevScanConfig()
else:
client = CycodeTokenBasedClient(client_id, client_secret)
scan_config = DefaultScanConfig()
return ScanClient(client, scan_config, hide_response_log)
def create_report_client(client_id: str, client_secret: str, _: bool) -> ReportClient:
client = CycodeDevBasedClient(DEV_CYCODE_API_URL) if dev_mode else CycodeTokenBasedClient(client_id, client_secret)
return ReportClient(client)
def create_import_sbom_client(client_id: str, client_secret: str, _: bool) -> ImportSbomClient:
client = CycodeDevBasedClient(DEV_CYCODE_API_URL) if dev_mode else CycodeTokenBasedClient(client_id, client_secret)
return ImportSbomClient(client)