Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.11/site-packages/rekor_types/_internal/alpine.py: 97%

Shortcuts on this page

r m x   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

32 statements  

1# generated by datamodel-codegen: 

2# filename: alpine_schema.json 

3# version: 0.26.3 

4 

5from __future__ import annotations 

6 

7from enum import Enum 

8from typing import Dict, Optional, Union 

9 

10from pydantic import BaseModel, ConfigDict, Field, RootModel, StrictStr 

11 

12 

13class PublicKey(BaseModel): 

14 """The public key that can verify the package signature""" 

15 

16 model_config = ConfigDict( 

17 populate_by_name=True, 

18 ) 

19 content: str = Field( 

20 ..., 

21 description="Specifies the content of the public key inline within the document", 

22 ) 

23 

24 

25class Algorithm(str, Enum): 

26 """The hashing function used to compute the hash value""" 

27 

28 SHA256 = "sha256" 

29 

30 

31class Hash(BaseModel): 

32 """Specifies the hash algorithm and value for the package""" 

33 

34 model_config = ConfigDict( 

35 populate_by_name=True, 

36 ) 

37 algorithm: Algorithm = Field( 

38 ..., 

39 description="The hashing function used to compute the hash value", 

40 ) 

41 value: StrictStr = Field(..., description="The hash value for the package") 

42 

43 

44class Package(BaseModel): 

45 """Information about the package associated with the entry""" 

46 

47 model_config = ConfigDict( 

48 populate_by_name=True, 

49 ) 

50 pkginfo: Optional[Dict[str, StrictStr]] = Field( 

51 default=None, 

52 description="Values of the .PKGINFO key / value pairs", 

53 ) 

54 hash: Hash = Field(..., description="Specifies the hash algorithm and value for the package") 

55 content: Optional[str] = Field( 

56 default=None, 

57 description="Specifies the package inline within the document", 

58 ) 

59 

60 

61class Hash1(Hash): 

62 """Specifies the hash algorithm and value for the package""" 

63 

64 

65class Package1(BaseModel): 

66 """Information about the package associated with the entry""" 

67 

68 model_config = ConfigDict( 

69 populate_by_name=True, 

70 ) 

71 pkginfo: Optional[Dict[str, StrictStr]] = Field( 

72 default=None, 

73 description="Values of the .PKGINFO key / value pairs", 

74 ) 

75 hash: Optional[Hash1] = Field( 

76 default=None, 

77 description="Specifies the hash algorithm and value for the package", 

78 ) 

79 content: str = Field(..., description="Specifies the package inline within the document") 

80 

81 

82class AlpineV001Schema(BaseModel): 

83 """Schema for Alpine Package entries""" 

84 

85 model_config = ConfigDict( 

86 populate_by_name=True, 

87 ) 

88 public_key: PublicKey = Field( 

89 ..., 

90 alias="publicKey", 

91 description="The public key that can verify the package signature", 

92 ) 

93 package: Union[Package, Package1] = Field( 

94 ..., 

95 description="Information about the package associated with the entry", 

96 ) 

97 

98 

99class AlpinePackageSchema(RootModel[AlpineV001Schema]): 

100 model_config = ConfigDict( 

101 populate_by_name=True, 

102 ) 

103 root: AlpineV001Schema = Field( 

104 ..., 

105 description="Schema for Alpine package objects", 

106 title="Alpine Package Schema", 

107 )