Skip to content

Commit c5dbe78

Browse files
doc: add docstring to both iac scan methods
1 parent f782056 commit c5dbe78

File tree

1 file changed

+25
-2
lines changed

1 file changed

+25
-2
lines changed

pygitguardian/client.py

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -468,14 +468,23 @@ def create_honeytoken(
468468
result.status_code = resp.status_code
469469
return result
470470

471-
# For IaC Scans
472471
def iac_directory_scan(
473472
self,
474473
directory: Path,
475474
filenames: List[str],
476475
scan_parameters: IaCScanParameters,
477476
extra_headers: Optional[Dict[str, str]] = None,
478477
) -> Union[Detail, IaCScanResult]:
478+
"""
479+
iac_directory_scan handles the /iac_scan endpoint of the API.
480+
481+
:param directory: path to the directory to scan
482+
:param filenames: filenames of the directory to include in the scan
483+
:param scan_parameters: minimum severities wanted and policies to ignore
484+
example: {"ignored_policies":["GG_IAC_0003"],"minimum_severity":"HIGH"}
485+
:param extra_headers: optional extra headers to add to the request
486+
:return: ScanResult response and status code
487+
"""
479488
tar = _create_tar(directory, filenames)
480489
result: Union[Detail, IaCScanResult]
481490
try:
@@ -504,14 +513,28 @@ def iac_directory_scan(
504513

505514
return result
506515

507-
# For IaC diff Scans
508516
def iac_diff_scan(
509517
self,
510518
reference: bytes,
511519
current: bytes,
512520
scan_parameters: IaCScanParameters,
513521
extra_headers: Optional[Dict[str, str]] = None,
514522
) -> Union[Detail, IaCDiffScanResult]:
523+
"""
524+
iac_diff_scan handles the /iac_diff_scan endpoint of the API.
525+
526+
Scan two directories and compare their vulnerabilities.
527+
Vulnerabilities in reference but not in current are considered "new".
528+
Vulnerabilities in both reference and current are considered "unchanged".
529+
Vulnerabilities in current but not in reference are considered "deleted".
530+
531+
:param reference: tar file containing the reference directory. Usually an incoming commit
532+
:param current: tar file of the current directory. Usually HEAD
533+
:param scan_parameters: minimum severities wanted and policies to ignore
534+
example: {"ignored_policies":["GG_IAC_0003"],"minimum_severity":"HIGH"}
535+
:param extra_headers: optional extra headers to add to the request
536+
:return: ScanResult response and status code
537+
"""
515538
result: Union[Detail, IaCDiffScanResult]
516539
try:
517540
# bypass self.post because data argument is needed in self.request and self.post use it as json

0 commit comments

Comments
 (0)