Coverage for harbor_cli/commands/api/vulnerabilities.py: 88%

8 statements  

« prev     ^ index     » next       coverage.py v6.5.0, created at 2023-02-09 12:09 +0100

1from __future__ import annotations 

2 

3from typing import Optional 

4 

5import typer 

6from harborapi.models.scanner import Severity 

7 

8from ...app import app 

9 

10 

11@app.command("vulnerabilities", no_args_is_help=True) 

12def vulnerabilities( 

13 ctx: typer.Context, 

14 project: Optional[str] = typer.Option( 

15 None, 

16 "--project", 

17 "-p", 

18 help="Project name to list vulnerabilities for.", 

19 ), 

20 repo: Optional[str] = typer.Option( 

21 None, 

22 "-r", 

23 "--repo", 

24 help="Repository name to list vulnerabilities for.", 

25 ), 

26 tag: Optional[str] = typer.Option( 

27 None, 

28 "-t", 

29 "--tag", 

30 help="Tag name to list vulnerabilities for.", 

31 ), 

32 artifact: Optional[str] = typer.Option( 

33 None, 

34 "-a", 

35 "--artifact", 

36 help="Complete name of artifact in the form of <project>/<repo>:<tag_or_digest>", 

37 ), 

38 min_severity: Optional[Severity] = typer.Option( 

39 None, 

40 "--min-severity", 

41 "-s", 

42 help="Minimum severity of vulnerabilities to list.", 

43 ), 

44) -> None: 

45 """List vulnerabilities for an artifact.""" 

46 # TODO: move to own function 

47 raise NotImplementedError("Disabled for now.")