hiddenlayer-sdk 2.0.9__py3-none-any.whl → 3.0.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (204) hide show
  1. hiddenlayer/__init__.py +109 -105
  2. hiddenlayer/_base_client.py +1995 -0
  3. hiddenlayer/_client.py +761 -0
  4. hiddenlayer/_compat.py +219 -0
  5. hiddenlayer/_constants.py +14 -0
  6. hiddenlayer/_exceptions.py +108 -0
  7. hiddenlayer/_files.py +123 -0
  8. hiddenlayer/_models.py +835 -0
  9. hiddenlayer/_oauth2.py +118 -0
  10. hiddenlayer/_qs.py +150 -0
  11. hiddenlayer/_resource.py +43 -0
  12. hiddenlayer/_response.py +832 -0
  13. hiddenlayer/_streaming.py +333 -0
  14. hiddenlayer/_types.py +260 -0
  15. hiddenlayer/_utils/__init__.py +64 -0
  16. hiddenlayer/_utils/_compat.py +45 -0
  17. hiddenlayer/_utils/_datetime_parse.py +136 -0
  18. hiddenlayer/_utils/_logs.py +25 -0
  19. hiddenlayer/_utils/_proxy.py +65 -0
  20. hiddenlayer/_utils/_reflection.py +42 -0
  21. hiddenlayer/_utils/_resources_proxy.py +24 -0
  22. hiddenlayer/_utils/_streams.py +12 -0
  23. hiddenlayer/_utils/_sync.py +86 -0
  24. hiddenlayer/_utils/_transform.py +457 -0
  25. hiddenlayer/_utils/_typing.py +156 -0
  26. hiddenlayer/_utils/_utils.py +421 -0
  27. hiddenlayer/_version.py +4 -0
  28. hiddenlayer/lib/.keep +4 -0
  29. hiddenlayer/lib/__init__.py +6 -0
  30. hiddenlayer/lib/community_scan.py +174 -0
  31. hiddenlayer/lib/model_scan.py +752 -0
  32. hiddenlayer/lib/scan_utils.py +142 -0
  33. hiddenlayer/pagination.py +127 -0
  34. hiddenlayer/resources/__init__.py +75 -0
  35. hiddenlayer/resources/interactions.py +205 -0
  36. hiddenlayer/resources/models/__init__.py +33 -0
  37. hiddenlayer/resources/models/cards.py +259 -0
  38. hiddenlayer/resources/models/models.py +284 -0
  39. hiddenlayer/resources/prompt_analyzer.py +207 -0
  40. hiddenlayer/resources/scans/__init__.py +61 -0
  41. hiddenlayer/resources/scans/jobs.py +499 -0
  42. hiddenlayer/resources/scans/results.py +169 -0
  43. hiddenlayer/resources/scans/scans.py +166 -0
  44. hiddenlayer/resources/scans/upload/__init__.py +33 -0
  45. hiddenlayer/resources/scans/upload/file.py +279 -0
  46. hiddenlayer/resources/scans/upload/upload.py +340 -0
  47. hiddenlayer/resources/sensors.py +575 -0
  48. hiddenlayer/types/__init__.py +16 -0
  49. hiddenlayer/types/interaction_analyze_params.py +62 -0
  50. hiddenlayer/types/interaction_analyze_response.py +199 -0
  51. hiddenlayer/types/model_retrieve_response.py +50 -0
  52. hiddenlayer/types/models/__init__.py +6 -0
  53. hiddenlayer/types/models/card_list_params.py +65 -0
  54. hiddenlayer/types/models/card_list_response.py +50 -0
  55. hiddenlayer/types/prompt_analyzer_create_params.py +23 -0
  56. hiddenlayer/types/prompt_analyzer_create_response.py +381 -0
  57. hiddenlayer/types/scans/__init__.py +14 -0
  58. hiddenlayer/types/scans/job_list_params.py +75 -0
  59. hiddenlayer/types/scans/job_list_response.py +22 -0
  60. hiddenlayer/types/scans/job_request_params.py +49 -0
  61. hiddenlayer/types/scans/job_retrieve_params.py +16 -0
  62. hiddenlayer/types/scans/result_sarif_response.py +7 -0
  63. hiddenlayer/types/scans/scan_job.py +46 -0
  64. hiddenlayer/types/scans/scan_report.py +367 -0
  65. hiddenlayer/types/scans/upload/__init__.py +6 -0
  66. hiddenlayer/types/scans/upload/file_add_response.py +24 -0
  67. hiddenlayer/types/scans/upload/file_complete_response.py +12 -0
  68. hiddenlayer/types/scans/upload_complete_all_response.py +12 -0
  69. hiddenlayer/types/scans/upload_start_params.py +34 -0
  70. hiddenlayer/types/scans/upload_start_response.py +12 -0
  71. hiddenlayer/types/sensor_create_params.py +24 -0
  72. hiddenlayer/types/sensor_create_response.py +33 -0
  73. hiddenlayer/types/sensor_query_params.py +39 -0
  74. hiddenlayer/types/sensor_query_response.py +43 -0
  75. hiddenlayer/types/sensor_retrieve_response.py +33 -0
  76. hiddenlayer/types/sensor_update_params.py +20 -0
  77. hiddenlayer/types/sensor_update_response.py +9 -0
  78. hiddenlayer_sdk-3.0.0.dist-info/METADATA +431 -0
  79. hiddenlayer_sdk-3.0.0.dist-info/RECORD +82 -0
  80. {hiddenlayer_sdk-2.0.9.dist-info → hiddenlayer_sdk-3.0.0.dist-info}/WHEEL +1 -2
  81. {hiddenlayer_sdk-2.0.9.dist-info → hiddenlayer_sdk-3.0.0.dist-info}/licenses/LICENSE +1 -1
  82. hiddenlayer/sdk/constants.py +0 -26
  83. hiddenlayer/sdk/exceptions.py +0 -12
  84. hiddenlayer/sdk/models.py +0 -58
  85. hiddenlayer/sdk/rest/__init__.py +0 -135
  86. hiddenlayer/sdk/rest/api/__init__.py +0 -10
  87. hiddenlayer/sdk/rest/api/aidr_predictive_api.py +0 -308
  88. hiddenlayer/sdk/rest/api/health_api.py +0 -272
  89. hiddenlayer/sdk/rest/api/model_api.py +0 -559
  90. hiddenlayer/sdk/rest/api/model_supply_chain_api.py +0 -4063
  91. hiddenlayer/sdk/rest/api/readiness_api.py +0 -272
  92. hiddenlayer/sdk/rest/api/sensor_api.py +0 -1432
  93. hiddenlayer/sdk/rest/api_client.py +0 -770
  94. hiddenlayer/sdk/rest/api_response.py +0 -21
  95. hiddenlayer/sdk/rest/configuration.py +0 -445
  96. hiddenlayer/sdk/rest/exceptions.py +0 -199
  97. hiddenlayer/sdk/rest/models/__init__.py +0 -113
  98. hiddenlayer/sdk/rest/models/address.py +0 -110
  99. hiddenlayer/sdk/rest/models/artifact.py +0 -155
  100. hiddenlayer/sdk/rest/models/artifact_change.py +0 -108
  101. hiddenlayer/sdk/rest/models/artifact_content.py +0 -101
  102. hiddenlayer/sdk/rest/models/artifact_location.py +0 -109
  103. hiddenlayer/sdk/rest/models/attachment.py +0 -129
  104. hiddenlayer/sdk/rest/models/begin_multi_file_upload200_response.py +0 -87
  105. hiddenlayer/sdk/rest/models/begin_multipart_file_upload200_response.py +0 -97
  106. hiddenlayer/sdk/rest/models/begin_multipart_file_upload200_response_parts_inner.py +0 -94
  107. hiddenlayer/sdk/rest/models/code_flow.py +0 -113
  108. hiddenlayer/sdk/rest/models/configuration_override.py +0 -108
  109. hiddenlayer/sdk/rest/models/conversion.py +0 -114
  110. hiddenlayer/sdk/rest/models/create_sensor_request.py +0 -95
  111. hiddenlayer/sdk/rest/models/edge.py +0 -108
  112. hiddenlayer/sdk/rest/models/edge_traversal.py +0 -122
  113. hiddenlayer/sdk/rest/models/errors_inner.py +0 -91
  114. hiddenlayer/sdk/rest/models/exception.py +0 -113
  115. hiddenlayer/sdk/rest/models/external_properties.py +0 -273
  116. hiddenlayer/sdk/rest/models/external_property_file_reference.py +0 -102
  117. hiddenlayer/sdk/rest/models/external_property_file_references.py +0 -240
  118. hiddenlayer/sdk/rest/models/file_details_v3.py +0 -139
  119. hiddenlayer/sdk/rest/models/file_result_v3.py +0 -117
  120. hiddenlayer/sdk/rest/models/file_scan_report_v3.py +0 -132
  121. hiddenlayer/sdk/rest/models/file_scan_reports_v3.py +0 -95
  122. hiddenlayer/sdk/rest/models/fix.py +0 -113
  123. hiddenlayer/sdk/rest/models/get_condensed_model_scan_reports200_response.py +0 -102
  124. hiddenlayer/sdk/rest/models/graph.py +0 -123
  125. hiddenlayer/sdk/rest/models/graph_traversal.py +0 -97
  126. hiddenlayer/sdk/rest/models/inventory_v3.py +0 -101
  127. hiddenlayer/sdk/rest/models/invocation.py +0 -199
  128. hiddenlayer/sdk/rest/models/location.py +0 -146
  129. hiddenlayer/sdk/rest/models/location_inner.py +0 -138
  130. hiddenlayer/sdk/rest/models/location_relationship.py +0 -107
  131. hiddenlayer/sdk/rest/models/logical_location.py +0 -104
  132. hiddenlayer/sdk/rest/models/message.py +0 -92
  133. hiddenlayer/sdk/rest/models/mitre_atlas_inner.py +0 -110
  134. hiddenlayer/sdk/rest/models/model.py +0 -103
  135. hiddenlayer/sdk/rest/models/model_inventory_info.py +0 -103
  136. hiddenlayer/sdk/rest/models/model_version.py +0 -97
  137. hiddenlayer/sdk/rest/models/multi_file_upload_request_v3.py +0 -97
  138. hiddenlayer/sdk/rest/models/multiformat_message_string.py +0 -95
  139. hiddenlayer/sdk/rest/models/node.py +0 -122
  140. hiddenlayer/sdk/rest/models/notification.py +0 -157
  141. hiddenlayer/sdk/rest/models/notify_model_scan_completed200_response.py +0 -87
  142. hiddenlayer/sdk/rest/models/paged_response_with_total.py +0 -94
  143. hiddenlayer/sdk/rest/models/pagination_v3.py +0 -95
  144. hiddenlayer/sdk/rest/models/physical_location.py +0 -94
  145. hiddenlayer/sdk/rest/models/problem_details.py +0 -103
  146. hiddenlayer/sdk/rest/models/property_bag.py +0 -101
  147. hiddenlayer/sdk/rest/models/rectangle.py +0 -110
  148. hiddenlayer/sdk/rest/models/region.py +0 -127
  149. hiddenlayer/sdk/rest/models/replacement.py +0 -103
  150. hiddenlayer/sdk/rest/models/reporting_configuration.py +0 -113
  151. hiddenlayer/sdk/rest/models/reporting_descriptor.py +0 -162
  152. hiddenlayer/sdk/rest/models/reporting_descriptor_reference.py +0 -103
  153. hiddenlayer/sdk/rest/models/reporting_descriptor_relationship.py +0 -115
  154. hiddenlayer/sdk/rest/models/result.py +0 -312
  155. hiddenlayer/sdk/rest/models/result_provenance.py +0 -133
  156. hiddenlayer/sdk/rest/models/rule_details_inner.py +0 -102
  157. hiddenlayer/sdk/rest/models/run.py +0 -318
  158. hiddenlayer/sdk/rest/models/run_automation_details.py +0 -129
  159. hiddenlayer/sdk/rest/models/sarif210.py +0 -123
  160. hiddenlayer/sdk/rest/models/scan_create_request.py +0 -87
  161. hiddenlayer/sdk/rest/models/scan_detection_v3.py +0 -159
  162. hiddenlayer/sdk/rest/models/scan_detection_v31.py +0 -158
  163. hiddenlayer/sdk/rest/models/scan_header_v3.py +0 -129
  164. hiddenlayer/sdk/rest/models/scan_job.py +0 -115
  165. hiddenlayer/sdk/rest/models/scan_job_access.py +0 -97
  166. hiddenlayer/sdk/rest/models/scan_model_details_v3.py +0 -99
  167. hiddenlayer/sdk/rest/models/scan_model_details_v31.py +0 -97
  168. hiddenlayer/sdk/rest/models/scan_model_ids_v3.py +0 -89
  169. hiddenlayer/sdk/rest/models/scan_report_v3.py +0 -139
  170. hiddenlayer/sdk/rest/models/scan_results_map_v3.py +0 -105
  171. hiddenlayer/sdk/rest/models/scan_results_v3.py +0 -120
  172. hiddenlayer/sdk/rest/models/security_posture.py +0 -89
  173. hiddenlayer/sdk/rest/models/sensor.py +0 -100
  174. hiddenlayer/sdk/rest/models/sensor_query_response.py +0 -101
  175. hiddenlayer/sdk/rest/models/sensor_sor_model_card_query_response.py +0 -101
  176. hiddenlayer/sdk/rest/models/sensor_sor_model_card_response.py +0 -127
  177. hiddenlayer/sdk/rest/models/sensor_sor_query_filter.py +0 -108
  178. hiddenlayer/sdk/rest/models/sensor_sor_query_request.py +0 -109
  179. hiddenlayer/sdk/rest/models/special_locations.py +0 -97
  180. hiddenlayer/sdk/rest/models/stack.py +0 -113
  181. hiddenlayer/sdk/rest/models/stack_frame.py +0 -104
  182. hiddenlayer/sdk/rest/models/submission_response.py +0 -95
  183. hiddenlayer/sdk/rest/models/submission_v2.py +0 -109
  184. hiddenlayer/sdk/rest/models/suppression.py +0 -133
  185. hiddenlayer/sdk/rest/models/thread_flow.py +0 -144
  186. hiddenlayer/sdk/rest/models/thread_flow_location.py +0 -166
  187. hiddenlayer/sdk/rest/models/tool.py +0 -107
  188. hiddenlayer/sdk/rest/models/tool_component.py +0 -251
  189. hiddenlayer/sdk/rest/models/tool_component_reference.py +0 -108
  190. hiddenlayer/sdk/rest/models/translation_metadata.py +0 -110
  191. hiddenlayer/sdk/rest/models/validation_error_model.py +0 -99
  192. hiddenlayer/sdk/rest/models/version_control_details.py +0 -108
  193. hiddenlayer/sdk/rest/models/web_request.py +0 -112
  194. hiddenlayer/sdk/rest/models/web_response.py +0 -112
  195. hiddenlayer/sdk/rest/rest.py +0 -257
  196. hiddenlayer/sdk/services/__init__.py +0 -0
  197. hiddenlayer/sdk/services/aidr_predictive.py +0 -130
  198. hiddenlayer/sdk/services/model_scan.py +0 -505
  199. hiddenlayer/sdk/utils.py +0 -92
  200. hiddenlayer/sdk/version.py +0 -1
  201. hiddenlayer_sdk-2.0.9.dist-info/METADATA +0 -368
  202. hiddenlayer_sdk-2.0.9.dist-info/RECORD +0 -126
  203. hiddenlayer_sdk-2.0.9.dist-info/top_level.txt +0 -1
  204. /hiddenlayer/{sdk/__init__.py → py.typed} +0 -0
@@ -1,159 +0,0 @@
1
- # coding: utf-8
2
-
3
- """
4
- HiddenLayer-API
5
-
6
- HiddenLayer-API
7
-
8
- The version of the OpenAPI document: 1
9
- Generated by OpenAPI Generator (https://openapi-generator.tech)
10
-
11
- Do not edit the class manually.
12
- """ # noqa: E501
13
-
14
-
15
- from __future__ import annotations
16
- import pprint
17
- import re # noqa: F401
18
- import json
19
-
20
- from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator
21
- from typing import Any, ClassVar, Dict, List, Optional
22
- from typing_extensions import Annotated
23
- from hiddenlayer.sdk.rest.models.mitre_atlas_inner import MITREAtlasInner
24
- from hiddenlayer.sdk.rest.models.rule_details_inner import RuleDetailsInner
25
- from typing import Optional, Set
26
- from typing_extensions import Self
27
-
28
- class ScanDetectionV3(BaseModel):
29
- """
30
- ScanDetectionV3
31
- """ # noqa: E501
32
- description: StrictStr = Field(description="detection description")
33
- risk: Optional[StrictStr] = Field(default=None, description="detection risk")
34
- severity: StrictStr = Field(description="detection severity")
35
- detection_id: StrictStr = Field(description="unique identifier for the detection")
36
- impact: Optional[StrictStr] = Field(default=None, description="detection impact")
37
- likelihood: Optional[StrictStr] = Field(default=None, description="detection likelihood")
38
- rule_details: Optional[List[RuleDetailsInner]] = None
39
- rule_id: StrictStr = Field(description="unique identifier for the rule that sourced the detection")
40
- category: StrictStr = Field(description="Vulnerability category for the detection")
41
- mitre_atlas: List[MITREAtlasInner]
42
- owasp: List[Annotated[str, Field(strict=True)]]
43
- cve: Optional[List[Annotated[str, Field(strict=True)]]] = None
44
- cwe: Optional[Annotated[str, Field(strict=True)]] = None
45
- cwe_href: Optional[StrictStr] = Field(default=None, description="CWE URL for the detection")
46
- technical_blog_href: Optional[StrictStr] = Field(default=None, description="Hiddenlayer Technical Blog URL for the detection")
47
- __properties: ClassVar[List[str]] = ["description", "risk", "severity", "detection_id", "impact", "likelihood", "rule_details", "rule_id", "category", "mitre_atlas", "owasp", "cve", "cwe", "cwe_href", "technical_blog_href"]
48
-
49
- @field_validator('risk')
50
- def risk_validate_enum(cls, value):
51
- """Validates the enum"""
52
- if value is None:
53
- return value
54
-
55
- if value not in set(['MALICIOUS', 'SUSPICIOUS', 'BENIGN']):
56
- raise ValueError("must be one of enum values ('MALICIOUS', 'SUSPICIOUS', 'BENIGN')")
57
- return value
58
-
59
- @field_validator('severity')
60
- def severity_validate_enum(cls, value):
61
- """Validates the enum"""
62
- if value not in set(['low', 'medium', 'high', 'critical']):
63
- raise ValueError("must be one of enum values ('low', 'medium', 'high', 'critical')")
64
- return value
65
-
66
- @field_validator('cwe')
67
- def cwe_validate_regular_expression(cls, value):
68
- """Validates the regular expression"""
69
- if value is None:
70
- return value
71
-
72
- if not re.match(r"^CWE-\d{1,4}.*$|^$", value):
73
- raise ValueError(r"must validate the regular expression /^CWE-\d{1,4}.*$|^$/")
74
- return value
75
-
76
- model_config = ConfigDict(
77
- populate_by_name=True,
78
- validate_assignment=True,
79
- protected_namespaces=(),
80
- )
81
-
82
-
83
- def to_str(self) -> str:
84
- """Returns the string representation of the model using alias"""
85
- return pprint.pformat(self.model_dump(by_alias=True))
86
-
87
- def to_json(self) -> str:
88
- """Returns the JSON representation of the model using alias"""
89
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
90
- return json.dumps(self.to_dict())
91
-
92
- @classmethod
93
- def from_json(cls, json_str: str) -> Optional[Self]:
94
- """Create an instance of ScanDetectionV3 from a JSON string"""
95
- return cls.from_dict(json.loads(json_str))
96
-
97
- def to_dict(self) -> Dict[str, Any]:
98
- """Return the dictionary representation of the model using alias.
99
-
100
- This has the following differences from calling pydantic's
101
- `self.model_dump(by_alias=True)`:
102
-
103
- * `None` is only added to the output dict for nullable fields that
104
- were set at model initialization. Other fields with value `None`
105
- are ignored.
106
- """
107
- excluded_fields: Set[str] = set([
108
- ])
109
-
110
- _dict = self.model_dump(
111
- by_alias=True,
112
- exclude=excluded_fields,
113
- exclude_none=True,
114
- )
115
- # override the default output from pydantic by calling `to_dict()` of each item in rule_details (list)
116
- _items = []
117
- if self.rule_details:
118
- for _item in self.rule_details:
119
- if _item:
120
- _items.append(_item.to_dict())
121
- _dict['rule_details'] = _items
122
- # override the default output from pydantic by calling `to_dict()` of each item in mitre_atlas (list)
123
- _items = []
124
- if self.mitre_atlas:
125
- for _item in self.mitre_atlas:
126
- if _item:
127
- _items.append(_item.to_dict())
128
- _dict['mitre_atlas'] = _items
129
- return _dict
130
-
131
- @classmethod
132
- def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
133
- """Create an instance of ScanDetectionV3 from a dict"""
134
- if obj is None:
135
- return None
136
-
137
- if not isinstance(obj, dict):
138
- return cls.model_validate(obj)
139
-
140
- _obj = cls.model_validate({
141
- "description": obj.get("description"),
142
- "risk": obj.get("risk"),
143
- "severity": obj.get("severity"),
144
- "detection_id": obj.get("detection_id"),
145
- "impact": obj.get("impact"),
146
- "likelihood": obj.get("likelihood"),
147
- "rule_details": [RuleDetailsInner.from_dict(_item) for _item in obj["rule_details"]] if obj.get("rule_details") is not None else None,
148
- "rule_id": obj.get("rule_id"),
149
- "category": obj.get("category"),
150
- "mitre_atlas": [MITREAtlasInner.from_dict(_item) for _item in obj["mitre_atlas"]] if obj.get("mitre_atlas") is not None else None,
151
- "owasp": obj.get("owasp"),
152
- "cve": obj.get("cve"),
153
- "cwe": obj.get("cwe"),
154
- "cwe_href": obj.get("cwe_href"),
155
- "technical_blog_href": obj.get("technical_blog_href")
156
- })
157
- return _obj
158
-
159
-
@@ -1,158 +0,0 @@
1
- # coding: utf-8
2
-
3
- """
4
- HiddenLayer-API
5
-
6
- HiddenLayer-API
7
-
8
- The version of the OpenAPI document: 1
9
- Generated by OpenAPI Generator (https://openapi-generator.tech)
10
-
11
- Do not edit the class manually.
12
- """ # noqa: E501
13
-
14
-
15
- from __future__ import annotations
16
- import pprint
17
- import re # noqa: F401
18
- import json
19
-
20
- from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator
21
- from typing import Any, ClassVar, Dict, List, Optional
22
- from typing_extensions import Annotated
23
- from hiddenlayer.sdk.rest.models.mitre_atlas_inner import MITREAtlasInner
24
- from hiddenlayer.sdk.rest.models.rule_details_inner import RuleDetailsInner
25
- from typing import Optional, Set
26
- from typing_extensions import Self
27
-
28
- class ScanDetectionV31(BaseModel):
29
- """
30
- ScanDetectionV31
31
- """ # noqa: E501
32
- detection_id: StrictStr = Field(description="unique identifier for the detection")
33
- rule_id: StrictStr = Field(description="unique identifier for the rule that sourced the detection")
34
- risk: Optional[StrictStr] = Field(default=None, description="detection risk")
35
- category: StrictStr = Field(description="Vulnerability category for the detection")
36
- description: StrictStr = Field(description="detection description")
37
- likelihood: StrictStr = Field(description="detection likelihood")
38
- impact: StrictStr = Field(description="detection impact")
39
- severity: StrictStr = Field(description="detection severity")
40
- rule_details: Optional[List[RuleDetailsInner]] = None
41
- mitre_atlas: List[MITREAtlasInner]
42
- owasp: List[Annotated[str, Field(strict=True)]]
43
- cve: List[Annotated[str, Field(strict=True)]]
44
- cwe: Annotated[str, Field(strict=True)]
45
- cwe_href: StrictStr = Field(description="CWE URL for the detection")
46
- technical_blog_hrefs: Optional[List[StrictStr]] = Field(default=None, description="Hiddenlayer Technical Blog URLs for the detection")
47
- technical_blog_href: Optional[StrictStr] = Field(default=None, description="Hiddenlayer Technical Blog URL for the detection")
48
- __properties: ClassVar[List[str]] = ["detection_id", "rule_id", "risk", "category", "description", "likelihood", "impact", "severity", "rule_details", "mitre_atlas", "owasp", "cve", "cwe", "cwe_href", "technical_blog_hrefs", "technical_blog_href"]
49
-
50
- @field_validator('risk')
51
- def risk_validate_enum(cls, value):
52
- """Validates the enum"""
53
- if value is None:
54
- return value
55
-
56
- if value not in set(['MALICIOUS', 'SUSPICIOUS']):
57
- raise ValueError("must be one of enum values ('MALICIOUS', 'SUSPICIOUS')")
58
- return value
59
-
60
- @field_validator('severity')
61
- def severity_validate_enum(cls, value):
62
- """Validates the enum"""
63
- if value not in set(['low', 'medium', 'high', 'critical']):
64
- raise ValueError("must be one of enum values ('low', 'medium', 'high', 'critical')")
65
- return value
66
-
67
- @field_validator('cwe')
68
- def cwe_validate_regular_expression(cls, value):
69
- """Validates the regular expression"""
70
- if not re.match(r"^CWE-\d{1,4}.*$|^$", value):
71
- raise ValueError(r"must validate the regular expression /^CWE-\d{1,4}.*$|^$/")
72
- return value
73
-
74
- model_config = ConfigDict(
75
- populate_by_name=True,
76
- validate_assignment=True,
77
- protected_namespaces=(),
78
- )
79
-
80
-
81
- def to_str(self) -> str:
82
- """Returns the string representation of the model using alias"""
83
- return pprint.pformat(self.model_dump(by_alias=True))
84
-
85
- def to_json(self) -> str:
86
- """Returns the JSON representation of the model using alias"""
87
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
88
- return json.dumps(self.to_dict())
89
-
90
- @classmethod
91
- def from_json(cls, json_str: str) -> Optional[Self]:
92
- """Create an instance of ScanDetectionV31 from a JSON string"""
93
- return cls.from_dict(json.loads(json_str))
94
-
95
- def to_dict(self) -> Dict[str, Any]:
96
- """Return the dictionary representation of the model using alias.
97
-
98
- This has the following differences from calling pydantic's
99
- `self.model_dump(by_alias=True)`:
100
-
101
- * `None` is only added to the output dict for nullable fields that
102
- were set at model initialization. Other fields with value `None`
103
- are ignored.
104
- """
105
- excluded_fields: Set[str] = set([
106
- ])
107
-
108
- _dict = self.model_dump(
109
- by_alias=True,
110
- exclude=excluded_fields,
111
- exclude_none=True,
112
- )
113
- # override the default output from pydantic by calling `to_dict()` of each item in rule_details (list)
114
- _items = []
115
- if self.rule_details:
116
- for _item in self.rule_details:
117
- if _item:
118
- _items.append(_item.to_dict())
119
- _dict['rule_details'] = _items
120
- # override the default output from pydantic by calling `to_dict()` of each item in mitre_atlas (list)
121
- _items = []
122
- if self.mitre_atlas:
123
- for _item in self.mitre_atlas:
124
- if _item:
125
- _items.append(_item.to_dict())
126
- _dict['mitre_atlas'] = _items
127
- return _dict
128
-
129
- @classmethod
130
- def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
131
- """Create an instance of ScanDetectionV31 from a dict"""
132
- if obj is None:
133
- return None
134
-
135
- if not isinstance(obj, dict):
136
- return cls.model_validate(obj)
137
-
138
- _obj = cls.model_validate({
139
- "detection_id": obj.get("detection_id"),
140
- "rule_id": obj.get("rule_id"),
141
- "risk": obj.get("risk"),
142
- "category": obj.get("category"),
143
- "description": obj.get("description"),
144
- "likelihood": obj.get("likelihood"),
145
- "impact": obj.get("impact"),
146
- "severity": obj.get("severity"),
147
- "rule_details": [RuleDetailsInner.from_dict(_item) for _item in obj["rule_details"]] if obj.get("rule_details") is not None else None,
148
- "mitre_atlas": [MITREAtlasInner.from_dict(_item) for _item in obj["mitre_atlas"]] if obj.get("mitre_atlas") is not None else None,
149
- "owasp": obj.get("owasp"),
150
- "cve": obj.get("cve"),
151
- "cwe": obj.get("cwe"),
152
- "cwe_href": obj.get("cwe_href"),
153
- "technical_blog_hrefs": obj.get("technical_blog_hrefs"),
154
- "technical_blog_href": obj.get("technical_blog_href")
155
- })
156
- return _obj
157
-
158
-
@@ -1,129 +0,0 @@
1
- # coding: utf-8
2
-
3
- """
4
- HiddenLayer-API
5
-
6
- HiddenLayer-API
7
-
8
- The version of the OpenAPI document: 1
9
- Generated by OpenAPI Generator (https://openapi-generator.tech)
10
-
11
- Do not edit the class manually.
12
- """ # noqa: E501
13
-
14
-
15
- from __future__ import annotations
16
- import pprint
17
- import re # noqa: F401
18
- import json
19
-
20
- from datetime import datetime
21
- from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr, field_validator
22
- from typing import Any, ClassVar, Dict, List, Optional
23
- from hiddenlayer.sdk.rest.models.model_inventory_info import ModelInventoryInfo
24
- from typing import Optional, Set
25
- from typing_extensions import Self
26
-
27
- class ScanHeaderV3(BaseModel):
28
- """
29
- ScanHeaderV3
30
- """ # noqa: E501
31
- file_count: StrictInt = Field(description="number of files scanned")
32
- files_with_detections_count: StrictInt = Field(description="number of files with detections found")
33
- detection_count: StrictInt = Field(description="number of detections found")
34
- detection_categories: Optional[List[StrictStr]] = Field(default=None, description="list of detection categories found")
35
- inventory: ModelInventoryInfo
36
- version: StrictStr = Field(description="scanner version")
37
- scan_id: StrictStr = Field(description="unique identifier for the scan")
38
- start_time: datetime = Field(description="time the scan started")
39
- end_time: Optional[datetime] = Field(default=None, description="time the scan ended")
40
- status: StrictStr = Field(description="status of the scan")
41
- severity: Optional[StrictStr] = Field(default=None, description="detection severity")
42
- __properties: ClassVar[List[str]] = ["file_count", "files_with_detections_count", "detection_count", "detection_categories", "inventory", "version", "scan_id", "start_time", "end_time", "status", "severity"]
43
-
44
- @field_validator('status')
45
- def status_validate_enum(cls, value):
46
- """Validates the enum"""
47
- if value not in set(['pending', 'running', 'done', 'failed', 'canceled']):
48
- raise ValueError("must be one of enum values ('pending', 'running', 'done', 'failed', 'canceled')")
49
- return value
50
-
51
- @field_validator('severity')
52
- def severity_validate_enum(cls, value):
53
- """Validates the enum"""
54
- if value is None:
55
- return value
56
-
57
- if value not in set(['low', 'medium', 'high', 'critical', 'safe', 'unknown']):
58
- raise ValueError("must be one of enum values ('low', 'medium', 'high', 'critical', 'safe', 'unknown')")
59
- return value
60
-
61
- model_config = ConfigDict(
62
- populate_by_name=True,
63
- validate_assignment=True,
64
- protected_namespaces=(),
65
- )
66
-
67
-
68
- def to_str(self) -> str:
69
- """Returns the string representation of the model using alias"""
70
- return pprint.pformat(self.model_dump(by_alias=True))
71
-
72
- def to_json(self) -> str:
73
- """Returns the JSON representation of the model using alias"""
74
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
75
- return json.dumps(self.to_dict())
76
-
77
- @classmethod
78
- def from_json(cls, json_str: str) -> Optional[Self]:
79
- """Create an instance of ScanHeaderV3 from a JSON string"""
80
- return cls.from_dict(json.loads(json_str))
81
-
82
- def to_dict(self) -> Dict[str, Any]:
83
- """Return the dictionary representation of the model using alias.
84
-
85
- This has the following differences from calling pydantic's
86
- `self.model_dump(by_alias=True)`:
87
-
88
- * `None` is only added to the output dict for nullable fields that
89
- were set at model initialization. Other fields with value `None`
90
- are ignored.
91
- """
92
- excluded_fields: Set[str] = set([
93
- ])
94
-
95
- _dict = self.model_dump(
96
- by_alias=True,
97
- exclude=excluded_fields,
98
- exclude_none=True,
99
- )
100
- # override the default output from pydantic by calling `to_dict()` of inventory
101
- if self.inventory:
102
- _dict['inventory'] = self.inventory.to_dict()
103
- return _dict
104
-
105
- @classmethod
106
- def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
107
- """Create an instance of ScanHeaderV3 from a dict"""
108
- if obj is None:
109
- return None
110
-
111
- if not isinstance(obj, dict):
112
- return cls.model_validate(obj)
113
-
114
- _obj = cls.model_validate({
115
- "file_count": obj.get("file_count"),
116
- "files_with_detections_count": obj.get("files_with_detections_count"),
117
- "detection_count": obj.get("detection_count"),
118
- "detection_categories": obj.get("detection_categories"),
119
- "inventory": ModelInventoryInfo.from_dict(obj["inventory"]) if obj.get("inventory") is not None else None,
120
- "version": obj.get("version"),
121
- "scan_id": obj.get("scan_id"),
122
- "start_time": obj.get("start_time"),
123
- "end_time": obj.get("end_time"),
124
- "status": obj.get("status"),
125
- "severity": obj.get("severity")
126
- })
127
- return _obj
128
-
129
-
@@ -1,115 +0,0 @@
1
- # coding: utf-8
2
-
3
- """
4
- HiddenLayer-API
5
-
6
- HiddenLayer-API
7
-
8
- The version of the OpenAPI document: 1
9
- Generated by OpenAPI Generator (https://openapi-generator.tech)
10
-
11
- Do not edit the class manually.
12
- """ # noqa: E501
13
-
14
-
15
- from __future__ import annotations
16
- import pprint
17
- import re # noqa: F401
18
- import json
19
-
20
- from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator
21
- from typing import Any, ClassVar, Dict, List, Optional
22
- from hiddenlayer.sdk.rest.models.scan_job_access import ScanJobAccess
23
- from hiddenlayer.sdk.rest.models.scan_model_details_v31 import ScanModelDetailsV31
24
- from typing import Optional, Set
25
- from typing_extensions import Self
26
-
27
- class ScanJob(BaseModel):
28
- """
29
- ScanJob
30
- """ # noqa: E501
31
- access: Optional[ScanJobAccess] = None
32
- inventory: Optional[ScanModelDetailsV31] = None
33
- scan_id: Optional[StrictStr] = Field(default=None, description="unique identifier for the scan")
34
- status: Optional[StrictStr] = Field(default=None, description="Status of the scan")
35
- __properties: ClassVar[List[str]] = ["access", "inventory", "scan_id", "status"]
36
-
37
- @field_validator('status')
38
- def status_validate_enum(cls, value):
39
- """Validates the enum"""
40
- if value is None:
41
- return value
42
-
43
- if value not in set(['pending', 'running', 'done', 'failed', 'canceled']):
44
- raise ValueError("must be one of enum values ('pending', 'running', 'done', 'failed', 'canceled')")
45
- return value
46
-
47
- model_config = ConfigDict(
48
- populate_by_name=True,
49
- validate_assignment=True,
50
- protected_namespaces=(),
51
- )
52
-
53
-
54
- def to_str(self) -> str:
55
- """Returns the string representation of the model using alias"""
56
- return pprint.pformat(self.model_dump(by_alias=True))
57
-
58
- def to_json(self) -> str:
59
- """Returns the JSON representation of the model using alias"""
60
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
61
- return json.dumps(self.to_dict())
62
-
63
- @classmethod
64
- def from_json(cls, json_str: str) -> Optional[Self]:
65
- """Create an instance of ScanJob from a JSON string"""
66
- return cls.from_dict(json.loads(json_str))
67
-
68
- def to_dict(self) -> Dict[str, Any]:
69
- """Return the dictionary representation of the model using alias.
70
-
71
- This has the following differences from calling pydantic's
72
- `self.model_dump(by_alias=True)`:
73
-
74
- * `None` is only added to the output dict for nullable fields that
75
- were set at model initialization. Other fields with value `None`
76
- are ignored.
77
- * OpenAPI `readOnly` fields are excluded.
78
- * OpenAPI `readOnly` fields are excluded.
79
- """
80
- excluded_fields: Set[str] = set([
81
- "scan_id",
82
- "status",
83
- ])
84
-
85
- _dict = self.model_dump(
86
- by_alias=True,
87
- exclude=excluded_fields,
88
- exclude_none=True,
89
- )
90
- # override the default output from pydantic by calling `to_dict()` of access
91
- if self.access:
92
- _dict['access'] = self.access.to_dict()
93
- # override the default output from pydantic by calling `to_dict()` of inventory
94
- if self.inventory:
95
- _dict['inventory'] = self.inventory.to_dict()
96
- return _dict
97
-
98
- @classmethod
99
- def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
100
- """Create an instance of ScanJob from a dict"""
101
- if obj is None:
102
- return None
103
-
104
- if not isinstance(obj, dict):
105
- return cls.model_validate(obj)
106
-
107
- _obj = cls.model_validate({
108
- "access": ScanJobAccess.from_dict(obj["access"]) if obj.get("access") is not None else None,
109
- "inventory": ScanModelDetailsV31.from_dict(obj["inventory"]) if obj.get("inventory") is not None else None,
110
- "scan_id": obj.get("scan_id"),
111
- "status": obj.get("status")
112
- })
113
- return _obj
114
-
115
-
@@ -1,97 +0,0 @@
1
- # coding: utf-8
2
-
3
- """
4
- HiddenLayer-API
5
-
6
- HiddenLayer-API
7
-
8
- The version of the OpenAPI document: 1
9
- Generated by OpenAPI Generator (https://openapi-generator.tech)
10
-
11
- Do not edit the class manually.
12
- """ # noqa: E501
13
-
14
-
15
- from __future__ import annotations
16
- import pprint
17
- import re # noqa: F401
18
- import json
19
-
20
- from pydantic import BaseModel, ConfigDict, StrictStr, field_validator
21
- from typing import Any, ClassVar, Dict, List, Optional
22
- from typing import Optional, Set
23
- from typing_extensions import Self
24
-
25
- class ScanJobAccess(BaseModel):
26
- """
27
- ScanJobAccess
28
- """ # noqa: E501
29
- source: Optional[StrictStr] = None
30
- __properties: ClassVar[List[str]] = ["source"]
31
-
32
- @field_validator('source')
33
- def source_validate_enum(cls, value):
34
- """Validates the enum"""
35
- if value is None:
36
- return value
37
-
38
- if value not in set(['LOCAL', 'AWS_PRESIGNED', 'AWS_IAM_ROLE', 'AZURE_BLOB_SAS', 'AZURE_BLOB_AD', 'GOOGLE_SIGNED', 'GOOGLE_OAUTH', 'HUGGING_FACE']):
39
- raise ValueError("must be one of enum values ('LOCAL', 'AWS_PRESIGNED', 'AWS_IAM_ROLE', 'AZURE_BLOB_SAS', 'AZURE_BLOB_AD', 'GOOGLE_SIGNED', 'GOOGLE_OAUTH', 'HUGGING_FACE')")
40
- return value
41
-
42
- model_config = ConfigDict(
43
- populate_by_name=True,
44
- validate_assignment=True,
45
- protected_namespaces=(),
46
- )
47
-
48
-
49
- def to_str(self) -> str:
50
- """Returns the string representation of the model using alias"""
51
- return pprint.pformat(self.model_dump(by_alias=True))
52
-
53
- def to_json(self) -> str:
54
- """Returns the JSON representation of the model using alias"""
55
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
56
- return json.dumps(self.to_dict())
57
-
58
- @classmethod
59
- def from_json(cls, json_str: str) -> Optional[Self]:
60
- """Create an instance of ScanJobAccess from a JSON string"""
61
- return cls.from_dict(json.loads(json_str))
62
-
63
- def to_dict(self) -> Dict[str, Any]:
64
- """Return the dictionary representation of the model using alias.
65
-
66
- This has the following differences from calling pydantic's
67
- `self.model_dump(by_alias=True)`:
68
-
69
- * `None` is only added to the output dict for nullable fields that
70
- were set at model initialization. Other fields with value `None`
71
- are ignored.
72
- """
73
- excluded_fields: Set[str] = set([
74
- ])
75
-
76
- _dict = self.model_dump(
77
- by_alias=True,
78
- exclude=excluded_fields,
79
- exclude_none=True,
80
- )
81
- return _dict
82
-
83
- @classmethod
84
- def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
85
- """Create an instance of ScanJobAccess from a dict"""
86
- if obj is None:
87
- return None
88
-
89
- if not isinstance(obj, dict):
90
- return cls.model_validate(obj)
91
-
92
- _obj = cls.model_validate({
93
- "source": obj.get("source")
94
- })
95
- return _obj
96
-
97
-