hiddenlayer-sdk 2.0.10__py3-none-any.whl → 3.0.1__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 -114
  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.1.dist-info/METADATA +521 -0
  79. hiddenlayer_sdk-3.0.1.dist-info/RECORD +82 -0
  80. {hiddenlayer_sdk-2.0.10.dist-info → hiddenlayer_sdk-3.0.1.dist-info}/WHEEL +1 -2
  81. {hiddenlayer_sdk-2.0.10.dist-info → hiddenlayer_sdk-3.0.1.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.10.dist-info/METADATA +0 -368
  202. hiddenlayer_sdk-2.0.10.dist-info/RECORD +0 -126
  203. hiddenlayer_sdk-2.0.10.dist-info/top_level.txt +0 -1
  204. /hiddenlayer/{sdk/__init__.py → py.typed} +0 -0
@@ -1,113 +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
21
- from typing import Any, ClassVar, Dict, List, Optional
22
- from typing_extensions import Annotated
23
- from hiddenlayer.sdk.rest.models.property_bag import PropertyBag
24
- from hiddenlayer.sdk.rest.models.stack import Stack
25
- from typing import Optional, Set
26
- from typing_extensions import Self
27
-
28
- class Exception(BaseModel):
29
- """
30
- Describes a runtime exception encountered during the execution of an analysis tool.
31
- """ # noqa: E501
32
- kind: Optional[StrictStr] = Field(default=None, description="A string that identifies the kind of exception, for example, the fully qualified type name of an object that was thrown, or the symbolic name of a signal.")
33
- message: Optional[StrictStr] = Field(default=None, description="A message that describes the exception.")
34
- stack: Optional[Stack] = None
35
- inner_exceptions: Optional[Annotated[List[Exception], Field(min_length=0)]] = Field(default=None, description="An array of exception objects each of which is considered a cause of this exception.", alias="innerExceptions")
36
- properties: Optional[PropertyBag] = None
37
- __properties: ClassVar[List[str]] = ["kind", "message", "stack", "innerExceptions", "properties"]
38
-
39
- model_config = ConfigDict(
40
- populate_by_name=True,
41
- validate_assignment=True,
42
- protected_namespaces=(),
43
- )
44
-
45
-
46
- def to_str(self) -> str:
47
- """Returns the string representation of the model using alias"""
48
- return pprint.pformat(self.model_dump(by_alias=True))
49
-
50
- def to_json(self) -> str:
51
- """Returns the JSON representation of the model using alias"""
52
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
53
- return json.dumps(self.to_dict())
54
-
55
- @classmethod
56
- def from_json(cls, json_str: str) -> Optional[Self]:
57
- """Create an instance of Exception from a JSON string"""
58
- return cls.from_dict(json.loads(json_str))
59
-
60
- def to_dict(self) -> Dict[str, Any]:
61
- """Return the dictionary representation of the model using alias.
62
-
63
- This has the following differences from calling pydantic's
64
- `self.model_dump(by_alias=True)`:
65
-
66
- * `None` is only added to the output dict for nullable fields that
67
- were set at model initialization. Other fields with value `None`
68
- are ignored.
69
- """
70
- excluded_fields: Set[str] = set([
71
- ])
72
-
73
- _dict = self.model_dump(
74
- by_alias=True,
75
- exclude=excluded_fields,
76
- exclude_none=True,
77
- )
78
- # override the default output from pydantic by calling `to_dict()` of stack
79
- if self.stack:
80
- _dict['stack'] = self.stack.to_dict()
81
- # override the default output from pydantic by calling `to_dict()` of each item in inner_exceptions (list)
82
- _items = []
83
- if self.inner_exceptions:
84
- for _item in self.inner_exceptions:
85
- if _item:
86
- _items.append(_item.to_dict())
87
- _dict['innerExceptions'] = _items
88
- # override the default output from pydantic by calling `to_dict()` of properties
89
- if self.properties:
90
- _dict['properties'] = self.properties.to_dict()
91
- return _dict
92
-
93
- @classmethod
94
- def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
95
- """Create an instance of Exception from a dict"""
96
- if obj is None:
97
- return None
98
-
99
- if not isinstance(obj, dict):
100
- return cls.model_validate(obj)
101
-
102
- _obj = cls.model_validate({
103
- "kind": obj.get("kind"),
104
- "message": obj.get("message"),
105
- "stack": Stack.from_dict(obj["stack"]) if obj.get("stack") is not None else None,
106
- "innerExceptions": [Exception.from_dict(_item) for _item in obj["innerExceptions"]] if obj.get("innerExceptions") is not None else None,
107
- "properties": PropertyBag.from_dict(obj["properties"]) if obj.get("properties") is not None else None
108
- })
109
- return _obj
110
-
111
- # TODO: Rewrite to not use raise_errors
112
- Exception.model_rebuild(raise_errors=False)
113
-
@@ -1,273 +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.address import Address
24
- from hiddenlayer.sdk.rest.models.artifact import Artifact
25
- from hiddenlayer.sdk.rest.models.conversion import Conversion
26
- from hiddenlayer.sdk.rest.models.graph import Graph
27
- from hiddenlayer.sdk.rest.models.invocation import Invocation
28
- from hiddenlayer.sdk.rest.models.logical_location import LogicalLocation
29
- from hiddenlayer.sdk.rest.models.property_bag import PropertyBag
30
- from hiddenlayer.sdk.rest.models.result import Result
31
- from hiddenlayer.sdk.rest.models.thread_flow_location import ThreadFlowLocation
32
- from hiddenlayer.sdk.rest.models.tool_component import ToolComponent
33
- from hiddenlayer.sdk.rest.models.web_request import WebRequest
34
- from hiddenlayer.sdk.rest.models.web_response import WebResponse
35
- from typing import Optional, Set
36
- from typing_extensions import Self
37
-
38
- class ExternalProperties(BaseModel):
39
- """
40
- The top-level element of an external property file.
41
- """ # noqa: E501
42
- var_schema: Optional[StrictStr] = Field(default=None, description="The URI of the JSON schema corresponding to the version of the external property file format.", alias="schema")
43
- version: Optional[StrictStr] = Field(default=None, description="The SARIF format version of this external properties object.")
44
- guid: Optional[Annotated[str, Field(strict=True)]] = Field(default=None, description="A stable, unique identifier for this external properties object, in the form of a GUID.")
45
- run_guid: Optional[Annotated[str, Field(strict=True)]] = Field(default=None, description="A stable, unique identifier for the run associated with this external properties object, in the form of a GUID.", alias="runGuid")
46
- conversion: Optional[Conversion] = None
47
- graphs: Optional[Annotated[List[Graph], Field(min_length=0)]] = Field(default=None, description="An array of graph objects that will be merged with a separate run.")
48
- externalized_properties: Optional[PropertyBag] = Field(default=None, alias="externalizedProperties")
49
- artifacts: Optional[Annotated[List[Artifact], Field(min_length=0)]] = Field(default=None, description="An array of artifact objects that will be merged with a separate run.")
50
- invocations: Optional[Annotated[List[Invocation], Field(min_length=0)]] = Field(default=None, description="Describes the invocation of the analysis tool that will be merged with a separate run.")
51
- logical_locations: Optional[Annotated[List[LogicalLocation], Field(min_length=0)]] = Field(default=None, description="An array of logical locations such as namespaces, types or functions that will be merged with a separate run.", alias="logicalLocations")
52
- thread_flow_locations: Optional[Annotated[List[ThreadFlowLocation], Field(min_length=0)]] = Field(default=None, description="An array of threadFlowLocation objects that will be merged with a separate run.", alias="threadFlowLocations")
53
- results: Optional[Annotated[List[Result], Field(min_length=0)]] = Field(default=None, description="An array of result objects that will be merged with a separate run.")
54
- taxonomies: Optional[Annotated[List[ToolComponent], Field(min_length=0)]] = Field(default=None, description="Tool taxonomies that will be merged with a separate run.")
55
- driver: Optional[ToolComponent] = None
56
- extensions: Optional[Annotated[List[ToolComponent], Field(min_length=0)]] = Field(default=None, description="Tool extensions that will be merged with a separate run.")
57
- policies: Optional[Annotated[List[ToolComponent], Field(min_length=0)]] = Field(default=None, description="Tool policies that will be merged with a separate run.")
58
- translations: Optional[Annotated[List[ToolComponent], Field(min_length=0)]] = Field(default=None, description="Tool translations that will be merged with a separate run.")
59
- addresses: Optional[Annotated[List[Address], Field(min_length=0)]] = Field(default=None, description="Addresses that will be merged with a separate run.")
60
- web_requests: Optional[Annotated[List[WebRequest], Field(min_length=0)]] = Field(default=None, description="Requests that will be merged with a separate run.", alias="webRequests")
61
- web_responses: Optional[Annotated[List[WebResponse], Field(min_length=0)]] = Field(default=None, description="Responses that will be merged with a separate run.", alias="webResponses")
62
- properties: Optional[PropertyBag] = None
63
- __properties: ClassVar[List[str]] = ["schema", "version", "guid", "runGuid", "conversion", "graphs", "externalizedProperties", "artifacts", "invocations", "logicalLocations", "threadFlowLocations", "results", "taxonomies", "driver", "extensions", "policies", "translations", "addresses", "webRequests", "webResponses", "properties"]
64
-
65
- @field_validator('version')
66
- def version_validate_enum(cls, value):
67
- """Validates the enum"""
68
- if value is None:
69
- return value
70
-
71
- if value not in set(['2.1.0']):
72
- raise ValueError("must be one of enum values ('2.1.0')")
73
- return value
74
-
75
- @field_validator('guid')
76
- def guid_validate_regular_expression(cls, value):
77
- """Validates the regular expression"""
78
- if value is None:
79
- return value
80
-
81
- if not re.match(r"^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-5][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$", value):
82
- raise ValueError(r"must validate the regular expression /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-5][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$/")
83
- return value
84
-
85
- @field_validator('run_guid')
86
- def run_guid_validate_regular_expression(cls, value):
87
- """Validates the regular expression"""
88
- if value is None:
89
- return value
90
-
91
- if not re.match(r"^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-5][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$", value):
92
- raise ValueError(r"must validate the regular expression /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-5][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$/")
93
- return value
94
-
95
- model_config = ConfigDict(
96
- populate_by_name=True,
97
- validate_assignment=True,
98
- protected_namespaces=(),
99
- )
100
-
101
-
102
- def to_str(self) -> str:
103
- """Returns the string representation of the model using alias"""
104
- return pprint.pformat(self.model_dump(by_alias=True))
105
-
106
- def to_json(self) -> str:
107
- """Returns the JSON representation of the model using alias"""
108
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
109
- return json.dumps(self.to_dict())
110
-
111
- @classmethod
112
- def from_json(cls, json_str: str) -> Optional[Self]:
113
- """Create an instance of ExternalProperties from a JSON string"""
114
- return cls.from_dict(json.loads(json_str))
115
-
116
- def to_dict(self) -> Dict[str, Any]:
117
- """Return the dictionary representation of the model using alias.
118
-
119
- This has the following differences from calling pydantic's
120
- `self.model_dump(by_alias=True)`:
121
-
122
- * `None` is only added to the output dict for nullable fields that
123
- were set at model initialization. Other fields with value `None`
124
- are ignored.
125
- """
126
- excluded_fields: Set[str] = set([
127
- ])
128
-
129
- _dict = self.model_dump(
130
- by_alias=True,
131
- exclude=excluded_fields,
132
- exclude_none=True,
133
- )
134
- # override the default output from pydantic by calling `to_dict()` of conversion
135
- if self.conversion:
136
- _dict['conversion'] = self.conversion.to_dict()
137
- # override the default output from pydantic by calling `to_dict()` of each item in graphs (list)
138
- _items = []
139
- if self.graphs:
140
- for _item in self.graphs:
141
- if _item:
142
- _items.append(_item.to_dict())
143
- _dict['graphs'] = _items
144
- # override the default output from pydantic by calling `to_dict()` of externalized_properties
145
- if self.externalized_properties:
146
- _dict['externalizedProperties'] = self.externalized_properties.to_dict()
147
- # override the default output from pydantic by calling `to_dict()` of each item in artifacts (list)
148
- _items = []
149
- if self.artifacts:
150
- for _item in self.artifacts:
151
- if _item:
152
- _items.append(_item.to_dict())
153
- _dict['artifacts'] = _items
154
- # override the default output from pydantic by calling `to_dict()` of each item in invocations (list)
155
- _items = []
156
- if self.invocations:
157
- for _item in self.invocations:
158
- if _item:
159
- _items.append(_item.to_dict())
160
- _dict['invocations'] = _items
161
- # override the default output from pydantic by calling `to_dict()` of each item in logical_locations (list)
162
- _items = []
163
- if self.logical_locations:
164
- for _item in self.logical_locations:
165
- if _item:
166
- _items.append(_item.to_dict())
167
- _dict['logicalLocations'] = _items
168
- # override the default output from pydantic by calling `to_dict()` of each item in thread_flow_locations (list)
169
- _items = []
170
- if self.thread_flow_locations:
171
- for _item in self.thread_flow_locations:
172
- if _item:
173
- _items.append(_item.to_dict())
174
- _dict['threadFlowLocations'] = _items
175
- # override the default output from pydantic by calling `to_dict()` of each item in results (list)
176
- _items = []
177
- if self.results:
178
- for _item in self.results:
179
- if _item:
180
- _items.append(_item.to_dict())
181
- _dict['results'] = _items
182
- # override the default output from pydantic by calling `to_dict()` of each item in taxonomies (list)
183
- _items = []
184
- if self.taxonomies:
185
- for _item in self.taxonomies:
186
- if _item:
187
- _items.append(_item.to_dict())
188
- _dict['taxonomies'] = _items
189
- # override the default output from pydantic by calling `to_dict()` of driver
190
- if self.driver:
191
- _dict['driver'] = self.driver.to_dict()
192
- # override the default output from pydantic by calling `to_dict()` of each item in extensions (list)
193
- _items = []
194
- if self.extensions:
195
- for _item in self.extensions:
196
- if _item:
197
- _items.append(_item.to_dict())
198
- _dict['extensions'] = _items
199
- # override the default output from pydantic by calling `to_dict()` of each item in policies (list)
200
- _items = []
201
- if self.policies:
202
- for _item in self.policies:
203
- if _item:
204
- _items.append(_item.to_dict())
205
- _dict['policies'] = _items
206
- # override the default output from pydantic by calling `to_dict()` of each item in translations (list)
207
- _items = []
208
- if self.translations:
209
- for _item in self.translations:
210
- if _item:
211
- _items.append(_item.to_dict())
212
- _dict['translations'] = _items
213
- # override the default output from pydantic by calling `to_dict()` of each item in addresses (list)
214
- _items = []
215
- if self.addresses:
216
- for _item in self.addresses:
217
- if _item:
218
- _items.append(_item.to_dict())
219
- _dict['addresses'] = _items
220
- # override the default output from pydantic by calling `to_dict()` of each item in web_requests (list)
221
- _items = []
222
- if self.web_requests:
223
- for _item in self.web_requests:
224
- if _item:
225
- _items.append(_item.to_dict())
226
- _dict['webRequests'] = _items
227
- # override the default output from pydantic by calling `to_dict()` of each item in web_responses (list)
228
- _items = []
229
- if self.web_responses:
230
- for _item in self.web_responses:
231
- if _item:
232
- _items.append(_item.to_dict())
233
- _dict['webResponses'] = _items
234
- # override the default output from pydantic by calling `to_dict()` of properties
235
- if self.properties:
236
- _dict['properties'] = self.properties.to_dict()
237
- return _dict
238
-
239
- @classmethod
240
- def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
241
- """Create an instance of ExternalProperties from a dict"""
242
- if obj is None:
243
- return None
244
-
245
- if not isinstance(obj, dict):
246
- return cls.model_validate(obj)
247
-
248
- _obj = cls.model_validate({
249
- "schema": obj.get("schema"),
250
- "version": obj.get("version"),
251
- "guid": obj.get("guid"),
252
- "runGuid": obj.get("runGuid"),
253
- "conversion": Conversion.from_dict(obj["conversion"]) if obj.get("conversion") is not None else None,
254
- "graphs": [Graph.from_dict(_item) for _item in obj["graphs"]] if obj.get("graphs") is not None else None,
255
- "externalizedProperties": PropertyBag.from_dict(obj["externalizedProperties"]) if obj.get("externalizedProperties") is not None else None,
256
- "artifacts": [Artifact.from_dict(_item) for _item in obj["artifacts"]] if obj.get("artifacts") is not None else None,
257
- "invocations": [Invocation.from_dict(_item) for _item in obj["invocations"]] if obj.get("invocations") is not None else None,
258
- "logicalLocations": [LogicalLocation.from_dict(_item) for _item in obj["logicalLocations"]] if obj.get("logicalLocations") is not None else None,
259
- "threadFlowLocations": [ThreadFlowLocation.from_dict(_item) for _item in obj["threadFlowLocations"]] if obj.get("threadFlowLocations") is not None else None,
260
- "results": [Result.from_dict(_item) for _item in obj["results"]] if obj.get("results") is not None else None,
261
- "taxonomies": [ToolComponent.from_dict(_item) for _item in obj["taxonomies"]] if obj.get("taxonomies") is not None else None,
262
- "driver": ToolComponent.from_dict(obj["driver"]) if obj.get("driver") is not None else None,
263
- "extensions": [ToolComponent.from_dict(_item) for _item in obj["extensions"]] if obj.get("extensions") is not None else None,
264
- "policies": [ToolComponent.from_dict(_item) for _item in obj["policies"]] if obj.get("policies") is not None else None,
265
- "translations": [ToolComponent.from_dict(_item) for _item in obj["translations"]] if obj.get("translations") is not None else None,
266
- "addresses": [Address.from_dict(_item) for _item in obj["addresses"]] if obj.get("addresses") is not None else None,
267
- "webRequests": [WebRequest.from_dict(_item) for _item in obj["webRequests"]] if obj.get("webRequests") is not None else None,
268
- "webResponses": [WebResponse.from_dict(_item) for _item in obj["webResponses"]] if obj.get("webResponses") is not None else None,
269
- "properties": PropertyBag.from_dict(obj["properties"]) if obj.get("properties") is not None else None
270
- })
271
- return _obj
272
-
273
-
@@ -1,102 +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, field_validator
21
- from typing import Any, ClassVar, Dict, List, Optional
22
- from typing_extensions import Annotated
23
- from hiddenlayer.sdk.rest.models.artifact_location import ArtifactLocation
24
- from hiddenlayer.sdk.rest.models.property_bag import PropertyBag
25
- from typing import Optional, Set
26
- from typing_extensions import Self
27
-
28
- class ExternalPropertyFileReference(BaseModel):
29
- """
30
- Contains information that enables a SARIF consumer to locate the external property file that contains the value of an externalized property associated with the run.
31
- """ # noqa: E501
32
- location: Optional[ArtifactLocation] = None
33
- guid: Optional[Annotated[str, Field(strict=True)]] = Field(default=None, description="A stable, unique identifier for the external property file in the form of a GUID.")
34
- item_count: Optional[Annotated[int, Field(strict=True, ge=-1)]] = Field(default=-1, description="A non-negative integer specifying the number of items contained in the external property file.", alias="itemCount")
35
- properties: Optional[PropertyBag] = None
36
- __properties: ClassVar[List[str]] = []
37
-
38
- @field_validator('guid')
39
- def guid_validate_regular_expression(cls, value):
40
- """Validates the regular expression"""
41
- if value is None:
42
- return value
43
-
44
- if not re.match(r"^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-5][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$", value):
45
- raise ValueError(r"must validate the regular expression /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-5][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$/")
46
- return value
47
-
48
- model_config = ConfigDict(
49
- populate_by_name=True,
50
- validate_assignment=True,
51
- protected_namespaces=(),
52
- )
53
-
54
-
55
- def to_str(self) -> str:
56
- """Returns the string representation of the model using alias"""
57
- return pprint.pformat(self.model_dump(by_alias=True))
58
-
59
- def to_json(self) -> str:
60
- """Returns the JSON representation of the model using alias"""
61
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
62
- return json.dumps(self.to_dict())
63
-
64
- @classmethod
65
- def from_json(cls, json_str: str) -> Optional[Self]:
66
- """Create an instance of ExternalPropertyFileReference from a JSON string"""
67
- return cls.from_dict(json.loads(json_str))
68
-
69
- def to_dict(self) -> Dict[str, Any]:
70
- """Return the dictionary representation of the model using alias.
71
-
72
- This has the following differences from calling pydantic's
73
- `self.model_dump(by_alias=True)`:
74
-
75
- * `None` is only added to the output dict for nullable fields that
76
- were set at model initialization. Other fields with value `None`
77
- are ignored.
78
- """
79
- excluded_fields: Set[str] = set([
80
- ])
81
-
82
- _dict = self.model_dump(
83
- by_alias=True,
84
- exclude=excluded_fields,
85
- exclude_none=True,
86
- )
87
- return _dict
88
-
89
- @classmethod
90
- def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
91
- """Create an instance of ExternalPropertyFileReference from a dict"""
92
- if obj is None:
93
- return None
94
-
95
- if not isinstance(obj, dict):
96
- return cls.model_validate(obj)
97
-
98
- _obj = cls.model_validate({
99
- })
100
- return _obj
101
-
102
-