hiddenlayer-sdk 0.1.1__py3-none-any.whl → 1.0.0__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
Files changed (113) hide show
  1. hiddenlayer/sdk/models.py +45 -8
  2. hiddenlayer/sdk/rest/__init__.py +80 -3
  3. hiddenlayer/sdk/rest/api/__init__.py +3 -0
  4. hiddenlayer/sdk/rest/api/aidr_predictive_api.py +1 -1
  5. hiddenlayer/sdk/rest/api/health_api.py +272 -0
  6. hiddenlayer/sdk/rest/api/model_scan_api.py +1 -1
  7. hiddenlayer/sdk/rest/api/model_supply_chain_api.py +2927 -0
  8. hiddenlayer/sdk/rest/api/readiness_api.py +272 -0
  9. hiddenlayer/sdk/rest/api/sensor_api.py +345 -16
  10. hiddenlayer/sdk/rest/api_client.py +1 -1
  11. hiddenlayer/sdk/rest/configuration.py +4 -4
  12. hiddenlayer/sdk/rest/exceptions.py +1 -1
  13. hiddenlayer/sdk/rest/models/__init__.py +77 -3
  14. hiddenlayer/sdk/rest/models/address.py +110 -0
  15. hiddenlayer/sdk/rest/models/artifact.py +155 -0
  16. hiddenlayer/sdk/rest/models/artifact_change.py +108 -0
  17. hiddenlayer/sdk/rest/models/artifact_content.py +101 -0
  18. hiddenlayer/sdk/rest/models/artifact_location.py +109 -0
  19. hiddenlayer/sdk/rest/models/attachment.py +129 -0
  20. hiddenlayer/sdk/rest/models/code_flow.py +113 -0
  21. hiddenlayer/sdk/rest/models/configuration_override.py +108 -0
  22. hiddenlayer/sdk/rest/models/conversion.py +114 -0
  23. hiddenlayer/sdk/rest/models/create_sensor_request.py +1 -1
  24. hiddenlayer/sdk/rest/models/detections.py +101 -0
  25. hiddenlayer/sdk/rest/models/edge.py +108 -0
  26. hiddenlayer/sdk/rest/models/edge_traversal.py +122 -0
  27. hiddenlayer/sdk/rest/models/exception.py +113 -0
  28. hiddenlayer/sdk/rest/models/external_properties.py +273 -0
  29. hiddenlayer/sdk/rest/models/external_property_file_reference.py +102 -0
  30. hiddenlayer/sdk/rest/models/external_property_file_references.py +240 -0
  31. hiddenlayer/sdk/rest/models/file_details_v3.py +140 -0
  32. hiddenlayer/sdk/rest/models/file_results_inner.py +121 -0
  33. hiddenlayer/sdk/rest/models/file_scan_report_v3.py +95 -0
  34. hiddenlayer/sdk/rest/models/fix.py +113 -0
  35. hiddenlayer/sdk/rest/models/get_multipart_upload_response.py +1 -1
  36. hiddenlayer/sdk/rest/models/graph.py +123 -0
  37. hiddenlayer/sdk/rest/models/graph_traversal.py +97 -0
  38. hiddenlayer/sdk/rest/models/invocation.py +199 -0
  39. hiddenlayer/sdk/rest/models/location.py +146 -0
  40. hiddenlayer/sdk/rest/models/{validation_error_model_loc_inner.py → location_inner.py} +7 -7
  41. hiddenlayer/sdk/rest/models/location_relationship.py +107 -0
  42. hiddenlayer/sdk/rest/models/logical_location.py +104 -0
  43. hiddenlayer/sdk/rest/models/message.py +92 -0
  44. hiddenlayer/sdk/rest/models/mitre_atlas_inner.py +110 -0
  45. hiddenlayer/sdk/rest/models/model.py +1 -1
  46. hiddenlayer/sdk/rest/models/model_inventory_info.py +99 -0
  47. hiddenlayer/sdk/rest/models/model_query_response.py +1 -1
  48. hiddenlayer/sdk/rest/models/model_scan_api_v3_scan_model_version_id_patch200_response.py +87 -0
  49. hiddenlayer/sdk/rest/models/model_scan_api_v3_scan_query200_response.py +102 -0
  50. hiddenlayer/sdk/rest/models/multiformat_message_string.py +95 -0
  51. hiddenlayer/sdk/rest/models/multipart_upload_part.py +1 -1
  52. hiddenlayer/sdk/rest/models/node.py +122 -0
  53. hiddenlayer/sdk/rest/models/notification.py +157 -0
  54. hiddenlayer/sdk/rest/models/paged_response_with_total.py +94 -0
  55. hiddenlayer/sdk/rest/models/physical_location.py +94 -0
  56. hiddenlayer/sdk/rest/models/property_bag.py +101 -0
  57. hiddenlayer/sdk/rest/models/rectangle.py +110 -0
  58. hiddenlayer/sdk/rest/models/region.py +127 -0
  59. hiddenlayer/sdk/rest/models/replacement.py +103 -0
  60. hiddenlayer/sdk/rest/models/reporting_configuration.py +113 -0
  61. hiddenlayer/sdk/rest/models/reporting_descriptor.py +162 -0
  62. hiddenlayer/sdk/rest/models/reporting_descriptor_reference.py +103 -0
  63. hiddenlayer/sdk/rest/models/reporting_descriptor_relationship.py +115 -0
  64. hiddenlayer/sdk/rest/models/result.py +312 -0
  65. hiddenlayer/sdk/rest/models/result_provenance.py +133 -0
  66. hiddenlayer/sdk/rest/models/rule_details_inner.py +102 -0
  67. hiddenlayer/sdk/rest/models/run.py +318 -0
  68. hiddenlayer/sdk/rest/models/run_automation_details.py +129 -0
  69. hiddenlayer/sdk/rest/models/sarif210.py +123 -0
  70. hiddenlayer/sdk/rest/models/scan_create_request.py +87 -0
  71. hiddenlayer/sdk/rest/models/scan_detection_v3.py +156 -0
  72. hiddenlayer/sdk/rest/models/scan_header_v3.py +129 -0
  73. hiddenlayer/sdk/rest/models/scan_job.py +109 -0
  74. hiddenlayer/sdk/rest/models/scan_job_inventory.py +137 -0
  75. hiddenlayer/sdk/rest/models/scan_model_details_v3.py +95 -0
  76. hiddenlayer/sdk/rest/models/scan_model_ids_v3.py +89 -0
  77. hiddenlayer/sdk/rest/models/scan_model_request.py +1 -1
  78. hiddenlayer/sdk/rest/models/scan_report_v3.py +139 -0
  79. hiddenlayer/sdk/rest/models/{file_info.py → scan_results.py} +14 -6
  80. hiddenlayer/sdk/rest/models/scan_results_v2.py +30 -10
  81. hiddenlayer/sdk/rest/models/security_posture.py +89 -0
  82. hiddenlayer/sdk/rest/models/sensor_sor_model_card_query_response.py +101 -0
  83. hiddenlayer/sdk/rest/models/sensor_sor_model_card_response.py +127 -0
  84. hiddenlayer/sdk/rest/models/sensor_sor_query_filter.py +1 -1
  85. hiddenlayer/sdk/rest/models/sensor_sor_query_request.py +1 -1
  86. hiddenlayer/sdk/rest/models/special_locations.py +97 -0
  87. hiddenlayer/sdk/rest/models/stack.py +113 -0
  88. hiddenlayer/sdk/rest/models/stack_frame.py +104 -0
  89. hiddenlayer/sdk/rest/models/submission_response.py +1 -1
  90. hiddenlayer/sdk/rest/models/submission_v2.py +1 -1
  91. hiddenlayer/sdk/rest/models/suppression.py +133 -0
  92. hiddenlayer/sdk/rest/models/thread_flow.py +144 -0
  93. hiddenlayer/sdk/rest/models/thread_flow_location.py +166 -0
  94. hiddenlayer/sdk/rest/models/tool.py +107 -0
  95. hiddenlayer/sdk/rest/models/tool_component.py +251 -0
  96. hiddenlayer/sdk/rest/models/tool_component_reference.py +108 -0
  97. hiddenlayer/sdk/rest/models/translation_metadata.py +110 -0
  98. hiddenlayer/sdk/rest/models/validation_error_model.py +4 -4
  99. hiddenlayer/sdk/rest/models/version_control_details.py +108 -0
  100. hiddenlayer/sdk/rest/models/web_request.py +112 -0
  101. hiddenlayer/sdk/rest/models/web_response.py +112 -0
  102. hiddenlayer/sdk/rest/rest.py +1 -1
  103. hiddenlayer/sdk/services/model.py +5 -2
  104. hiddenlayer/sdk/services/model_scan.py +153 -105
  105. hiddenlayer/sdk/version.py +1 -1
  106. {hiddenlayer_sdk-0.1.1.dist-info → hiddenlayer_sdk-1.0.0.dist-info}/METADATA +39 -20
  107. hiddenlayer_sdk-1.0.0.dist-info/RECORD +118 -0
  108. {hiddenlayer_sdk-0.1.1.dist-info → hiddenlayer_sdk-1.0.0.dist-info}/WHEEL +1 -1
  109. hiddenlayer/sdk/enterprise/__init__.py +0 -0
  110. hiddenlayer/sdk/enterprise/enterprise_model_scan_api.py +0 -55
  111. hiddenlayer_sdk-0.1.1.dist-info/RECORD +0 -43
  112. {hiddenlayer_sdk-0.1.1.dist-info → hiddenlayer_sdk-1.0.0.dist-info}/LICENSE +0 -0
  113. {hiddenlayer_sdk-0.1.1.dist-info → hiddenlayer_sdk-1.0.0.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,240 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ HiddenLayer ModelScan V2
5
+
6
+ HiddenLayer ModelScan API for scanning of models
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
21
+ from typing import Any, ClassVar, Dict, List, Optional
22
+ from typing_extensions import Annotated
23
+ from hiddenlayer.sdk.rest.models.external_property_file_reference import ExternalPropertyFileReference
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 ExternalPropertyFileReferences(BaseModel):
29
+ """
30
+ References to external property files that should be inlined with the content of a root log file.
31
+ """ # noqa: E501
32
+ conversion: Optional[ExternalPropertyFileReference] = None
33
+ graphs: Optional[Annotated[List[Optional[ExternalPropertyFileReference]], Field(min_length=0)]] = Field(default=None, description="An array of external property files containing a run.graphs object to be merged with the root log file.")
34
+ externalized_properties: Optional[ExternalPropertyFileReference] = Field(default=None, alias="externalizedProperties")
35
+ artifacts: Optional[Annotated[List[Optional[ExternalPropertyFileReference]], Field(min_length=0)]] = Field(default=None, description="An array of external property files containing run.artifacts arrays to be merged with the root log file.")
36
+ invocations: Optional[Annotated[List[Optional[ExternalPropertyFileReference]], Field(min_length=0)]] = Field(default=None, description="An array of external property files containing run.invocations arrays to be merged with the root log file.")
37
+ logical_locations: Optional[Annotated[List[Optional[ExternalPropertyFileReference]], Field(min_length=0)]] = Field(default=None, description="An array of external property files containing run.logicalLocations arrays to be merged with the root log file.", alias="logicalLocations")
38
+ thread_flow_locations: Optional[Annotated[List[Optional[ExternalPropertyFileReference]], Field(min_length=0)]] = Field(default=None, description="An array of external property files containing run.threadFlowLocations arrays to be merged with the root log file.", alias="threadFlowLocations")
39
+ results: Optional[Annotated[List[Optional[ExternalPropertyFileReference]], Field(min_length=0)]] = Field(default=None, description="An array of external property files containing run.results arrays to be merged with the root log file.")
40
+ taxonomies: Optional[Annotated[List[Optional[ExternalPropertyFileReference]], Field(min_length=0)]] = Field(default=None, description="An array of external property files containing run.taxonomies arrays to be merged with the root log file.")
41
+ addresses: Optional[Annotated[List[Optional[ExternalPropertyFileReference]], Field(min_length=0)]] = Field(default=None, description="An array of external property files containing run.addresses arrays to be merged with the root log file.")
42
+ driver: Optional[ExternalPropertyFileReference] = None
43
+ extensions: Optional[Annotated[List[Optional[ExternalPropertyFileReference]], Field(min_length=0)]] = Field(default=None, description="An array of external property files containing run.extensions arrays to be merged with the root log file.")
44
+ policies: Optional[Annotated[List[Optional[ExternalPropertyFileReference]], Field(min_length=0)]] = Field(default=None, description="An array of external property files containing run.policies arrays to be merged with the root log file.")
45
+ translations: Optional[Annotated[List[Optional[ExternalPropertyFileReference]], Field(min_length=0)]] = Field(default=None, description="An array of external property files containing run.translations arrays to be merged with the root log file.")
46
+ web_requests: Optional[Annotated[List[Optional[ExternalPropertyFileReference]], Field(min_length=0)]] = Field(default=None, description="An array of external property files containing run.requests arrays to be merged with the root log file.", alias="webRequests")
47
+ web_responses: Optional[Annotated[List[Optional[ExternalPropertyFileReference]], Field(min_length=0)]] = Field(default=None, description="An array of external property files containing run.responses arrays to be merged with the root log file.", alias="webResponses")
48
+ properties: Optional[PropertyBag] = None
49
+ __properties: ClassVar[List[str]] = ["conversion", "graphs", "externalizedProperties", "artifacts", "invocations", "logicalLocations", "threadFlowLocations", "results", "taxonomies", "addresses", "driver", "extensions", "policies", "translations", "webRequests", "webResponses", "properties"]
50
+
51
+ model_config = ConfigDict(
52
+ populate_by_name=True,
53
+ validate_assignment=True,
54
+ protected_namespaces=(),
55
+ )
56
+
57
+
58
+ def to_str(self) -> str:
59
+ """Returns the string representation of the model using alias"""
60
+ return pprint.pformat(self.model_dump(by_alias=True))
61
+
62
+ def to_json(self) -> str:
63
+ """Returns the JSON representation of the model using alias"""
64
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
65
+ return json.dumps(self.to_dict())
66
+
67
+ @classmethod
68
+ def from_json(cls, json_str: str) -> Optional[Self]:
69
+ """Create an instance of ExternalPropertyFileReferences from a JSON string"""
70
+ return cls.from_dict(json.loads(json_str))
71
+
72
+ def to_dict(self) -> Dict[str, Any]:
73
+ """Return the dictionary representation of the model using alias.
74
+
75
+ This has the following differences from calling pydantic's
76
+ `self.model_dump(by_alias=True)`:
77
+
78
+ * `None` is only added to the output dict for nullable fields that
79
+ were set at model initialization. Other fields with value `None`
80
+ are ignored.
81
+ """
82
+ excluded_fields: Set[str] = set([
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 conversion
91
+ if self.conversion:
92
+ _dict['conversion'] = self.conversion.to_dict()
93
+ # override the default output from pydantic by calling `to_dict()` of each item in graphs (list)
94
+ _items = []
95
+ if self.graphs:
96
+ for _item in self.graphs:
97
+ if _item:
98
+ _items.append(_item.to_dict())
99
+ _dict['graphs'] = _items
100
+ # override the default output from pydantic by calling `to_dict()` of externalized_properties
101
+ if self.externalized_properties:
102
+ _dict['externalizedProperties'] = self.externalized_properties.to_dict()
103
+ # override the default output from pydantic by calling `to_dict()` of each item in artifacts (list)
104
+ _items = []
105
+ if self.artifacts:
106
+ for _item in self.artifacts:
107
+ if _item:
108
+ _items.append(_item.to_dict())
109
+ _dict['artifacts'] = _items
110
+ # override the default output from pydantic by calling `to_dict()` of each item in invocations (list)
111
+ _items = []
112
+ if self.invocations:
113
+ for _item in self.invocations:
114
+ if _item:
115
+ _items.append(_item.to_dict())
116
+ _dict['invocations'] = _items
117
+ # override the default output from pydantic by calling `to_dict()` of each item in logical_locations (list)
118
+ _items = []
119
+ if self.logical_locations:
120
+ for _item in self.logical_locations:
121
+ if _item:
122
+ _items.append(_item.to_dict())
123
+ _dict['logicalLocations'] = _items
124
+ # override the default output from pydantic by calling `to_dict()` of each item in thread_flow_locations (list)
125
+ _items = []
126
+ if self.thread_flow_locations:
127
+ for _item in self.thread_flow_locations:
128
+ if _item:
129
+ _items.append(_item.to_dict())
130
+ _dict['threadFlowLocations'] = _items
131
+ # override the default output from pydantic by calling `to_dict()` of each item in results (list)
132
+ _items = []
133
+ if self.results:
134
+ for _item in self.results:
135
+ if _item:
136
+ _items.append(_item.to_dict())
137
+ _dict['results'] = _items
138
+ # override the default output from pydantic by calling `to_dict()` of each item in taxonomies (list)
139
+ _items = []
140
+ if self.taxonomies:
141
+ for _item in self.taxonomies:
142
+ if _item:
143
+ _items.append(_item.to_dict())
144
+ _dict['taxonomies'] = _items
145
+ # override the default output from pydantic by calling `to_dict()` of each item in addresses (list)
146
+ _items = []
147
+ if self.addresses:
148
+ for _item in self.addresses:
149
+ if _item:
150
+ _items.append(_item.to_dict())
151
+ _dict['addresses'] = _items
152
+ # override the default output from pydantic by calling `to_dict()` of driver
153
+ if self.driver:
154
+ _dict['driver'] = self.driver.to_dict()
155
+ # override the default output from pydantic by calling `to_dict()` of each item in extensions (list)
156
+ _items = []
157
+ if self.extensions:
158
+ for _item in self.extensions:
159
+ if _item:
160
+ _items.append(_item.to_dict())
161
+ _dict['extensions'] = _items
162
+ # override the default output from pydantic by calling `to_dict()` of each item in policies (list)
163
+ _items = []
164
+ if self.policies:
165
+ for _item in self.policies:
166
+ if _item:
167
+ _items.append(_item.to_dict())
168
+ _dict['policies'] = _items
169
+ # override the default output from pydantic by calling `to_dict()` of each item in translations (list)
170
+ _items = []
171
+ if self.translations:
172
+ for _item in self.translations:
173
+ if _item:
174
+ _items.append(_item.to_dict())
175
+ _dict['translations'] = _items
176
+ # override the default output from pydantic by calling `to_dict()` of each item in web_requests (list)
177
+ _items = []
178
+ if self.web_requests:
179
+ for _item in self.web_requests:
180
+ if _item:
181
+ _items.append(_item.to_dict())
182
+ _dict['webRequests'] = _items
183
+ # override the default output from pydantic by calling `to_dict()` of each item in web_responses (list)
184
+ _items = []
185
+ if self.web_responses:
186
+ for _item in self.web_responses:
187
+ if _item:
188
+ _items.append(_item.to_dict())
189
+ _dict['webResponses'] = _items
190
+ # override the default output from pydantic by calling `to_dict()` of properties
191
+ if self.properties:
192
+ _dict['properties'] = self.properties.to_dict()
193
+ # set to None if conversion (nullable) is None
194
+ # and model_fields_set contains the field
195
+ if self.conversion is None and "conversion" in self.model_fields_set:
196
+ _dict['conversion'] = None
197
+
198
+ # set to None if externalized_properties (nullable) is None
199
+ # and model_fields_set contains the field
200
+ if self.externalized_properties is None and "externalized_properties" in self.model_fields_set:
201
+ _dict['externalizedProperties'] = None
202
+
203
+ # set to None if driver (nullable) is None
204
+ # and model_fields_set contains the field
205
+ if self.driver is None and "driver" in self.model_fields_set:
206
+ _dict['driver'] = None
207
+
208
+ return _dict
209
+
210
+ @classmethod
211
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
212
+ """Create an instance of ExternalPropertyFileReferences from a dict"""
213
+ if obj is None:
214
+ return None
215
+
216
+ if not isinstance(obj, dict):
217
+ return cls.model_validate(obj)
218
+
219
+ _obj = cls.model_validate({
220
+ "conversion": ExternalPropertyFileReference.from_dict(obj["conversion"]) if obj.get("conversion") is not None else None,
221
+ "graphs": [ExternalPropertyFileReference.from_dict(_item) for _item in obj["graphs"]] if obj.get("graphs") is not None else None,
222
+ "externalizedProperties": ExternalPropertyFileReference.from_dict(obj["externalizedProperties"]) if obj.get("externalizedProperties") is not None else None,
223
+ "artifacts": [ExternalPropertyFileReference.from_dict(_item) for _item in obj["artifacts"]] if obj.get("artifacts") is not None else None,
224
+ "invocations": [ExternalPropertyFileReference.from_dict(_item) for _item in obj["invocations"]] if obj.get("invocations") is not None else None,
225
+ "logicalLocations": [ExternalPropertyFileReference.from_dict(_item) for _item in obj["logicalLocations"]] if obj.get("logicalLocations") is not None else None,
226
+ "threadFlowLocations": [ExternalPropertyFileReference.from_dict(_item) for _item in obj["threadFlowLocations"]] if obj.get("threadFlowLocations") is not None else None,
227
+ "results": [ExternalPropertyFileReference.from_dict(_item) for _item in obj["results"]] if obj.get("results") is not None else None,
228
+ "taxonomies": [ExternalPropertyFileReference.from_dict(_item) for _item in obj["taxonomies"]] if obj.get("taxonomies") is not None else None,
229
+ "addresses": [ExternalPropertyFileReference.from_dict(_item) for _item in obj["addresses"]] if obj.get("addresses") is not None else None,
230
+ "driver": ExternalPropertyFileReference.from_dict(obj["driver"]) if obj.get("driver") is not None else None,
231
+ "extensions": [ExternalPropertyFileReference.from_dict(_item) for _item in obj["extensions"]] if obj.get("extensions") is not None else None,
232
+ "policies": [ExternalPropertyFileReference.from_dict(_item) for _item in obj["policies"]] if obj.get("policies") is not None else None,
233
+ "translations": [ExternalPropertyFileReference.from_dict(_item) for _item in obj["translations"]] if obj.get("translations") is not None else None,
234
+ "webRequests": [ExternalPropertyFileReference.from_dict(_item) for _item in obj["webRequests"]] if obj.get("webRequests") is not None else None,
235
+ "webResponses": [ExternalPropertyFileReference.from_dict(_item) for _item in obj["webResponses"]] if obj.get("webResponses") is not None else None,
236
+ "properties": PropertyBag.from_dict(obj["properties"]) if obj.get("properties") is not None else None
237
+ })
238
+ return _obj
239
+
240
+
@@ -0,0 +1,140 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ HiddenLayer ModelScan V2
5
+
6
+ HiddenLayer ModelScan API for scanning of models
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, StrictInt, StrictStr, field_validator
21
+ from typing import Any, ClassVar, Dict, List, Optional
22
+ from typing_extensions import Annotated
23
+ from typing import Optional, Set
24
+ from typing_extensions import Self
25
+
26
+ class FileDetailsV3(BaseModel):
27
+ """
28
+ FileDetailsV3
29
+ """ # noqa: E501
30
+ estimated_time: StrictStr = Field(description="estimated time to scan the file")
31
+ md5: Annotated[str, Field(strict=True)] = Field(description="hexadecimal md5 hash of file")
32
+ sha256: Annotated[str, Field(strict=True)] = Field(description="hexadecimal sha256 hash of file")
33
+ tlsh: Annotated[str, Field(strict=True)] = Field(description="TLSH hash of file")
34
+ file_size: Optional[Annotated[str, Field(strict=True)]] = Field(default=None, description="size of the file in human readable format")
35
+ file_size_bytes: Optional[StrictInt] = Field(default=None, description="size of the file in bytes")
36
+ file_type: StrictStr = Field(description="type of the file")
37
+ file_type_details: Optional[Dict[str, Any]] = None
38
+ __properties: ClassVar[List[str]] = ["estimated_time", "md5", "sha256", "tlsh", "file_size", "file_size_bytes", "file_type", "file_type_details"]
39
+
40
+ @field_validator('md5')
41
+ def md5_validate_regular_expression(cls, value):
42
+ """Validates the regular expression"""
43
+ if not re.match(r"^[a-fA-F0-9]{32}$", value):
44
+ raise ValueError(r"must validate the regular expression /^[a-fA-F0-9]{32}$/")
45
+ return value
46
+
47
+ @field_validator('sha256')
48
+ def sha256_validate_regular_expression(cls, value):
49
+ """Validates the regular expression"""
50
+ if not re.match(r"^[a-fA-F0-9]{64}$", value):
51
+ raise ValueError(r"must validate the regular expression /^[a-fA-F0-9]{64}$/")
52
+ return value
53
+
54
+ @field_validator('tlsh')
55
+ def tlsh_validate_regular_expression(cls, value):
56
+ """Validates the regular expression"""
57
+ if not re.match(r"^[a-fA-F0-9]{70}$", value):
58
+ raise ValueError(r"must validate the regular expression /^[a-fA-F0-9]{70}$/")
59
+ return value
60
+
61
+ @field_validator('file_size')
62
+ def file_size_validate_regular_expression(cls, value):
63
+ """Validates the regular expression"""
64
+ if value is None:
65
+ return value
66
+
67
+ if not re.match(r"^\d+(\.\d+)?\s?(B|KB|MB|GB|TB)$", value):
68
+ raise ValueError(r"must validate the regular expression /^\d+(\.\d+)?\s?(B|KB|MB|GB|TB)$/")
69
+ return value
70
+
71
+ @field_validator('file_type')
72
+ def file_type_validate_enum(cls, value):
73
+ """Validates the enum"""
74
+ if value not in set(['safetensors', 'RDS', 'onnx', 'tensorflow', 'keras', 'pytorch', 'pickle', 'NEMO', 'numpy', 'unknown', 'ZIP', 'TAR', 'gguf']):
75
+ raise ValueError("must be one of enum values ('safetensors', 'RDS', 'onnx', 'tensorflow', 'keras', 'pytorch', 'pickle', 'NEMO', 'numpy', 'unknown', 'ZIP', 'TAR', 'gguf')")
76
+ return value
77
+
78
+ model_config = ConfigDict(
79
+ populate_by_name=True,
80
+ validate_assignment=True,
81
+ protected_namespaces=(),
82
+ )
83
+
84
+
85
+ def to_str(self) -> str:
86
+ """Returns the string representation of the model using alias"""
87
+ return pprint.pformat(self.model_dump(by_alias=True))
88
+
89
+ def to_json(self) -> str:
90
+ """Returns the JSON representation of the model using alias"""
91
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
92
+ return json.dumps(self.to_dict())
93
+
94
+ @classmethod
95
+ def from_json(cls, json_str: str) -> Optional[Self]:
96
+ """Create an instance of FileDetailsV3 from a JSON string"""
97
+ return cls.from_dict(json.loads(json_str))
98
+
99
+ def to_dict(self) -> Dict[str, Any]:
100
+ """Return the dictionary representation of the model using alias.
101
+
102
+ This has the following differences from calling pydantic's
103
+ `self.model_dump(by_alias=True)`:
104
+
105
+ * `None` is only added to the output dict for nullable fields that
106
+ were set at model initialization. Other fields with value `None`
107
+ are ignored.
108
+ """
109
+ excluded_fields: Set[str] = set([
110
+ ])
111
+
112
+ _dict = self.model_dump(
113
+ by_alias=True,
114
+ exclude=excluded_fields,
115
+ exclude_none=True,
116
+ )
117
+ return _dict
118
+
119
+ @classmethod
120
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
121
+ """Create an instance of FileDetailsV3 from a dict"""
122
+ if obj is None:
123
+ return None
124
+
125
+ if not isinstance(obj, dict):
126
+ return cls.model_validate(obj)
127
+
128
+ _obj = cls.model_validate({
129
+ "estimated_time": obj.get("estimated_time"),
130
+ "md5": obj.get("md5"),
131
+ "sha256": obj.get("sha256"),
132
+ "tlsh": obj.get("tlsh"),
133
+ "file_size": obj.get("file_size"),
134
+ "file_size_bytes": obj.get("file_size_bytes"),
135
+ "file_type": obj.get("file_type"),
136
+ "file_type_details": obj.get("file_type_details")
137
+ })
138
+ return _obj
139
+
140
+
@@ -0,0 +1,121 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ HiddenLayer ModelScan V2
5
+
6
+ HiddenLayer ModelScan API for scanning of models
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, StrictStr, field_validator
22
+ from typing import Any, ClassVar, Dict, List, Optional
23
+ from hiddenlayer.sdk.rest.models.file_details_v3 import FileDetailsV3
24
+ from hiddenlayer.sdk.rest.models.scan_detection_v3 import ScanDetectionV3
25
+ from typing import Optional, Set
26
+ from typing_extensions import Self
27
+
28
+ class FileResultsInner(BaseModel):
29
+ """
30
+ FileResultsInner
31
+ """ # noqa: E501
32
+ file_instance_id: StrictStr = Field(description="unique ID of the file")
33
+ file_location: StrictStr = Field(description="full file path")
34
+ start_time: datetime = Field(description="time the scan started")
35
+ end_time: datetime = Field(description="time the scan ended")
36
+ details: FileDetailsV3
37
+ status: StrictStr = Field(description="status of the scan")
38
+ seen: datetime = Field(description="time the scan was seen at")
39
+ detections: Optional[List[ScanDetectionV3]] = None
40
+ __properties: ClassVar[List[str]] = ["file_instance_id", "file_location", "start_time", "end_time", "details", "status", "seen", "detections"]
41
+
42
+ @field_validator('status')
43
+ def status_validate_enum(cls, value):
44
+ """Validates the enum"""
45
+ if value not in set(['skipped', 'pending', 'running', 'done', 'failed', 'canceled']):
46
+ raise ValueError("must be one of enum values ('skipped', 'pending', 'running', 'done', 'failed', 'canceled')")
47
+ return value
48
+
49
+ model_config = ConfigDict(
50
+ populate_by_name=True,
51
+ validate_assignment=True,
52
+ protected_namespaces=(),
53
+ )
54
+
55
+
56
+ def to_str(self) -> str:
57
+ """Returns the string representation of the model using alias"""
58
+ return pprint.pformat(self.model_dump(by_alias=True))
59
+
60
+ def to_json(self) -> str:
61
+ """Returns the JSON representation of the model using alias"""
62
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
63
+ return json.dumps(self.to_dict())
64
+
65
+ @classmethod
66
+ def from_json(cls, json_str: str) -> Optional[Self]:
67
+ """Create an instance of FileResultsInner from a JSON string"""
68
+ return cls.from_dict(json.loads(json_str))
69
+
70
+ def to_dict(self) -> Dict[str, Any]:
71
+ """Return the dictionary representation of the model using alias.
72
+
73
+ This has the following differences from calling pydantic's
74
+ `self.model_dump(by_alias=True)`:
75
+
76
+ * `None` is only added to the output dict for nullable fields that
77
+ were set at model initialization. Other fields with value `None`
78
+ are ignored.
79
+ """
80
+ excluded_fields: Set[str] = set([
81
+ ])
82
+
83
+ _dict = self.model_dump(
84
+ by_alias=True,
85
+ exclude=excluded_fields,
86
+ exclude_none=True,
87
+ )
88
+ # override the default output from pydantic by calling `to_dict()` of details
89
+ if self.details:
90
+ _dict['details'] = self.details.to_dict()
91
+ # override the default output from pydantic by calling `to_dict()` of each item in detections (list)
92
+ _items = []
93
+ if self.detections:
94
+ for _item in self.detections:
95
+ if _item:
96
+ _items.append(_item.to_dict())
97
+ _dict['detections'] = _items
98
+ return _dict
99
+
100
+ @classmethod
101
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
102
+ """Create an instance of FileResultsInner from a dict"""
103
+ if obj is None:
104
+ return None
105
+
106
+ if not isinstance(obj, dict):
107
+ return cls.model_validate(obj)
108
+
109
+ _obj = cls.model_validate({
110
+ "file_instance_id": obj.get("file_instance_id"),
111
+ "file_location": obj.get("file_location"),
112
+ "start_time": obj.get("start_time"),
113
+ "end_time": obj.get("end_time"),
114
+ "details": FileDetailsV3.from_dict(obj["details"]) if obj.get("details") is not None else None,
115
+ "status": obj.get("status"),
116
+ "seen": obj.get("seen"),
117
+ "detections": [ScanDetectionV3.from_dict(_item) for _item in obj["detections"]] if obj.get("detections") is not None else None
118
+ })
119
+ return _obj
120
+
121
+
@@ -0,0 +1,95 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ HiddenLayer ModelScan V2
5
+
6
+ HiddenLayer ModelScan API for scanning of models
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
21
+ from typing import Any, ClassVar, Dict, List, Optional
22
+ from hiddenlayer.sdk.rest.models.file_results_inner import FileResultsInner
23
+ from typing import Optional, Set
24
+ from typing_extensions import Self
25
+
26
+ class FileScanReportV3(BaseModel):
27
+ """
28
+ FileScanReportV3
29
+ """ # noqa: E501
30
+ file_results: Optional[List[FileResultsInner]] = None
31
+ __properties: ClassVar[List[str]] = ["file_results"]
32
+
33
+ model_config = ConfigDict(
34
+ populate_by_name=True,
35
+ validate_assignment=True,
36
+ protected_namespaces=(),
37
+ )
38
+
39
+
40
+ def to_str(self) -> str:
41
+ """Returns the string representation of the model using alias"""
42
+ return pprint.pformat(self.model_dump(by_alias=True))
43
+
44
+ def to_json(self) -> str:
45
+ """Returns the JSON representation of the model using alias"""
46
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
47
+ return json.dumps(self.to_dict())
48
+
49
+ @classmethod
50
+ def from_json(cls, json_str: str) -> Optional[Self]:
51
+ """Create an instance of FileScanReportV3 from a JSON string"""
52
+ return cls.from_dict(json.loads(json_str))
53
+
54
+ def to_dict(self) -> Dict[str, Any]:
55
+ """Return the dictionary representation of the model using alias.
56
+
57
+ This has the following differences from calling pydantic's
58
+ `self.model_dump(by_alias=True)`:
59
+
60
+ * `None` is only added to the output dict for nullable fields that
61
+ were set at model initialization. Other fields with value `None`
62
+ are ignored.
63
+ """
64
+ excluded_fields: Set[str] = set([
65
+ ])
66
+
67
+ _dict = self.model_dump(
68
+ by_alias=True,
69
+ exclude=excluded_fields,
70
+ exclude_none=True,
71
+ )
72
+ # override the default output from pydantic by calling `to_dict()` of each item in file_results (list)
73
+ _items = []
74
+ if self.file_results:
75
+ for _item in self.file_results:
76
+ if _item:
77
+ _items.append(_item.to_dict())
78
+ _dict['file_results'] = _items
79
+ return _dict
80
+
81
+ @classmethod
82
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
83
+ """Create an instance of FileScanReportV3 from a dict"""
84
+ if obj is None:
85
+ return None
86
+
87
+ if not isinstance(obj, dict):
88
+ return cls.model_validate(obj)
89
+
90
+ _obj = cls.model_validate({
91
+ "file_results": [FileResultsInner.from_dict(_item) for _item in obj["file_results"]] if obj.get("file_results") is not None else None
92
+ })
93
+ return _obj
94
+
95
+