hiddenlayer-sdk 1.2.1__py3-none-any.whl → 2.0.1__py3-none-any.whl
Sign up to get free protection for your applications and to get access to all the features.
- hiddenlayer/__init__.py +0 -10
- hiddenlayer/sdk/exceptions.py +1 -1
- hiddenlayer/sdk/models.py +2 -3
- hiddenlayer/sdk/rest/__init__.py +16 -11
- hiddenlayer/sdk/rest/api/__init__.py +0 -1
- hiddenlayer/sdk/rest/api/model_supply_chain_api.py +1706 -571
- hiddenlayer/sdk/rest/api/sensor_api.py +214 -1320
- hiddenlayer/sdk/rest/models/__init__.py +16 -10
- hiddenlayer/sdk/rest/models/{scan_model_request.py → begin_multi_file_upload200_response.py} +9 -9
- hiddenlayer/sdk/rest/models/{get_multipart_upload_response.py → begin_multipart_file_upload200_response.py} +9 -9
- hiddenlayer/sdk/rest/models/{multipart_upload_part.py → begin_multipart_file_upload200_response_parts_inner.py} +11 -10
- hiddenlayer/sdk/rest/models/errors_inner.py +91 -0
- hiddenlayer/sdk/rest/models/file_details_v3.py +8 -2
- hiddenlayer/sdk/rest/models/{scan_results_v2.py → file_result_v3.py} +21 -32
- hiddenlayer/sdk/rest/models/{model_scan_api_v3_scan_query200_response.py → get_condensed_model_scan_reports200_response.py} +4 -4
- hiddenlayer/sdk/rest/models/inventory_v3.py +97 -0
- hiddenlayer/sdk/rest/models/model_inventory_info.py +1 -1
- hiddenlayer/sdk/rest/models/{detections.py → multi_file_upload_request_v3.py} +14 -22
- hiddenlayer/sdk/rest/models/{model_scan_api_v3_scan_model_version_id_patch200_response.py → notify_model_scan_completed200_response.py} +4 -4
- hiddenlayer/sdk/rest/models/pagination_v3.py +95 -0
- hiddenlayer/sdk/rest/models/problem_details.py +103 -0
- hiddenlayer/sdk/rest/models/scan_detection_v31.py +155 -0
- hiddenlayer/sdk/rest/models/scan_model_details_v3.py +1 -1
- hiddenlayer/sdk/rest/models/scan_results_map_v3.py +105 -0
- hiddenlayer/sdk/rest/models/scan_results_v3.py +120 -0
- hiddenlayer/sdk/rest/models/{model.py → sensor.py} +4 -4
- hiddenlayer/sdk/rest/models/{model_query_response.py → sensor_query_response.py} +7 -7
- hiddenlayer/sdk/services/aidr_predictive.py +57 -3
- hiddenlayer/sdk/services/model_scan.py +98 -135
- hiddenlayer/sdk/version.py +1 -1
- {hiddenlayer_sdk-1.2.1.dist-info → hiddenlayer_sdk-2.0.1.dist-info}/METADATA +12 -2
- {hiddenlayer_sdk-1.2.1.dist-info → hiddenlayer_sdk-2.0.1.dist-info}/RECORD +35 -31
- hiddenlayer/sdk/rest/api/model_scan_api.py +0 -591
- hiddenlayer/sdk/rest/models/scan_results.py +0 -118
- hiddenlayer/sdk/services/model.py +0 -149
- {hiddenlayer_sdk-1.2.1.dist-info → hiddenlayer_sdk-2.0.1.dist-info}/LICENSE +0 -0
- {hiddenlayer_sdk-1.2.1.dist-info → hiddenlayer_sdk-2.0.1.dist-info}/WHEEL +0 -0
- {hiddenlayer_sdk-1.2.1.dist-info → hiddenlayer_sdk-2.0.1.dist-info}/top_level.txt +0 -0
@@ -20,24 +20,29 @@ from hiddenlayer.sdk.rest.models.artifact_change import ArtifactChange
|
|
20
20
|
from hiddenlayer.sdk.rest.models.artifact_content import ArtifactContent
|
21
21
|
from hiddenlayer.sdk.rest.models.artifact_location import ArtifactLocation
|
22
22
|
from hiddenlayer.sdk.rest.models.attachment import Attachment
|
23
|
+
from hiddenlayer.sdk.rest.models.begin_multi_file_upload200_response import BeginMultiFileUpload200Response
|
24
|
+
from hiddenlayer.sdk.rest.models.begin_multipart_file_upload200_response import BeginMultipartFileUpload200Response
|
25
|
+
from hiddenlayer.sdk.rest.models.begin_multipart_file_upload200_response_parts_inner import BeginMultipartFileUpload200ResponsePartsInner
|
23
26
|
from hiddenlayer.sdk.rest.models.code_flow import CodeFlow
|
24
27
|
from hiddenlayer.sdk.rest.models.configuration_override import ConfigurationOverride
|
25
28
|
from hiddenlayer.sdk.rest.models.conversion import Conversion
|
26
29
|
from hiddenlayer.sdk.rest.models.create_sensor_request import CreateSensorRequest
|
27
|
-
from hiddenlayer.sdk.rest.models.detections import Detections
|
28
30
|
from hiddenlayer.sdk.rest.models.edge import Edge
|
29
31
|
from hiddenlayer.sdk.rest.models.edge_traversal import EdgeTraversal
|
32
|
+
from hiddenlayer.sdk.rest.models.errors_inner import ErrorsInner
|
30
33
|
from hiddenlayer.sdk.rest.models.exception import Exception
|
31
34
|
from hiddenlayer.sdk.rest.models.external_properties import ExternalProperties
|
32
35
|
from hiddenlayer.sdk.rest.models.external_property_file_reference import ExternalPropertyFileReference
|
33
36
|
from hiddenlayer.sdk.rest.models.external_property_file_references import ExternalPropertyFileReferences
|
34
37
|
from hiddenlayer.sdk.rest.models.file_details_v3 import FileDetailsV3
|
38
|
+
from hiddenlayer.sdk.rest.models.file_result_v3 import FileResultV3
|
35
39
|
from hiddenlayer.sdk.rest.models.file_scan_report_v3 import FileScanReportV3
|
36
40
|
from hiddenlayer.sdk.rest.models.file_scan_reports_v3 import FileScanReportsV3
|
37
41
|
from hiddenlayer.sdk.rest.models.fix import Fix
|
38
|
-
from hiddenlayer.sdk.rest.models.
|
42
|
+
from hiddenlayer.sdk.rest.models.get_condensed_model_scan_reports200_response import GetCondensedModelScanReports200Response
|
39
43
|
from hiddenlayer.sdk.rest.models.graph import Graph
|
40
44
|
from hiddenlayer.sdk.rest.models.graph_traversal import GraphTraversal
|
45
|
+
from hiddenlayer.sdk.rest.models.inventory_v3 import InventoryV3
|
41
46
|
from hiddenlayer.sdk.rest.models.invocation import Invocation
|
42
47
|
from hiddenlayer.sdk.rest.models.location import Location
|
43
48
|
from hiddenlayer.sdk.rest.models.location_inner import LocationInner
|
@@ -45,17 +50,16 @@ from hiddenlayer.sdk.rest.models.location_relationship import LocationRelationsh
|
|
45
50
|
from hiddenlayer.sdk.rest.models.logical_location import LogicalLocation
|
46
51
|
from hiddenlayer.sdk.rest.models.mitre_atlas_inner import MITREAtlasInner
|
47
52
|
from hiddenlayer.sdk.rest.models.message import Message
|
48
|
-
from hiddenlayer.sdk.rest.models.model import Model
|
49
53
|
from hiddenlayer.sdk.rest.models.model_inventory_info import ModelInventoryInfo
|
50
|
-
from hiddenlayer.sdk.rest.models.
|
51
|
-
from hiddenlayer.sdk.rest.models.model_scan_api_v3_scan_model_version_id_patch200_response import ModelScanApiV3ScanModelVersionIdPatch200Response
|
52
|
-
from hiddenlayer.sdk.rest.models.model_scan_api_v3_scan_query200_response import ModelScanApiV3ScanQuery200Response
|
54
|
+
from hiddenlayer.sdk.rest.models.multi_file_upload_request_v3 import MultiFileUploadRequestV3
|
53
55
|
from hiddenlayer.sdk.rest.models.multiformat_message_string import MultiformatMessageString
|
54
|
-
from hiddenlayer.sdk.rest.models.multipart_upload_part import MultipartUploadPart
|
55
56
|
from hiddenlayer.sdk.rest.models.node import Node
|
56
57
|
from hiddenlayer.sdk.rest.models.notification import Notification
|
58
|
+
from hiddenlayer.sdk.rest.models.notify_model_scan_completed200_response import NotifyModelScanCompleted200Response
|
57
59
|
from hiddenlayer.sdk.rest.models.paged_response_with_total import PagedResponseWithTotal
|
60
|
+
from hiddenlayer.sdk.rest.models.pagination_v3 import PaginationV3
|
58
61
|
from hiddenlayer.sdk.rest.models.physical_location import PhysicalLocation
|
62
|
+
from hiddenlayer.sdk.rest.models.problem_details import ProblemDetails
|
59
63
|
from hiddenlayer.sdk.rest.models.property_bag import PropertyBag
|
60
64
|
from hiddenlayer.sdk.rest.models.rectangle import Rectangle
|
61
65
|
from hiddenlayer.sdk.rest.models.region import Region
|
@@ -72,16 +76,18 @@ from hiddenlayer.sdk.rest.models.run_automation_details import RunAutomationDeta
|
|
72
76
|
from hiddenlayer.sdk.rest.models.sarif210 import Sarif210
|
73
77
|
from hiddenlayer.sdk.rest.models.scan_create_request import ScanCreateRequest
|
74
78
|
from hiddenlayer.sdk.rest.models.scan_detection_v3 import ScanDetectionV3
|
79
|
+
from hiddenlayer.sdk.rest.models.scan_detection_v31 import ScanDetectionV31
|
75
80
|
from hiddenlayer.sdk.rest.models.scan_header_v3 import ScanHeaderV3
|
76
81
|
from hiddenlayer.sdk.rest.models.scan_job import ScanJob
|
77
82
|
from hiddenlayer.sdk.rest.models.scan_job_inventory import ScanJobInventory
|
78
83
|
from hiddenlayer.sdk.rest.models.scan_model_details_v3 import ScanModelDetailsV3
|
79
84
|
from hiddenlayer.sdk.rest.models.scan_model_ids_v3 import ScanModelIdsV3
|
80
|
-
from hiddenlayer.sdk.rest.models.scan_model_request import ScanModelRequest
|
81
85
|
from hiddenlayer.sdk.rest.models.scan_report_v3 import ScanReportV3
|
82
|
-
from hiddenlayer.sdk.rest.models.
|
83
|
-
from hiddenlayer.sdk.rest.models.
|
86
|
+
from hiddenlayer.sdk.rest.models.scan_results_map_v3 import ScanResultsMapV3
|
87
|
+
from hiddenlayer.sdk.rest.models.scan_results_v3 import ScanResultsV3
|
84
88
|
from hiddenlayer.sdk.rest.models.security_posture import SecurityPosture
|
89
|
+
from hiddenlayer.sdk.rest.models.sensor import Sensor
|
90
|
+
from hiddenlayer.sdk.rest.models.sensor_query_response import SensorQueryResponse
|
85
91
|
from hiddenlayer.sdk.rest.models.sensor_sor_model_card_query_response import SensorSORModelCardQueryResponse
|
86
92
|
from hiddenlayer.sdk.rest.models.sensor_sor_model_card_response import SensorSORModelCardResponse
|
87
93
|
from hiddenlayer.sdk.rest.models.sensor_sor_query_filter import SensorSORQueryFilter
|
hiddenlayer/sdk/rest/models/{scan_model_request.py → begin_multi_file_upload200_response.py}
RENAMED
@@ -17,17 +17,17 @@ import pprint
|
|
17
17
|
import re # noqa: F401
|
18
18
|
import json
|
19
19
|
|
20
|
-
from pydantic import BaseModel, ConfigDict, StrictStr
|
21
|
-
from typing import Any, ClassVar, Dict, List
|
20
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictStr
|
21
|
+
from typing import Any, ClassVar, Dict, List, Optional
|
22
22
|
from typing import Optional, Set
|
23
23
|
from typing_extensions import Self
|
24
24
|
|
25
|
-
class
|
25
|
+
class BeginMultiFileUpload200Response(BaseModel):
|
26
26
|
"""
|
27
|
-
|
27
|
+
BeginMultiFileUpload200Response
|
28
28
|
""" # noqa: E501
|
29
|
-
|
30
|
-
__properties: ClassVar[List[str]] = ["
|
29
|
+
scan_id: Optional[StrictStr] = Field(default=None, description="Request to resource is successful")
|
30
|
+
__properties: ClassVar[List[str]] = ["scan_id"]
|
31
31
|
|
32
32
|
model_config = ConfigDict(
|
33
33
|
populate_by_name=True,
|
@@ -47,7 +47,7 @@ class ScanModelRequest(BaseModel):
|
|
47
47
|
|
48
48
|
@classmethod
|
49
49
|
def from_json(cls, json_str: str) -> Optional[Self]:
|
50
|
-
"""Create an instance of
|
50
|
+
"""Create an instance of BeginMultiFileUpload200Response from a JSON string"""
|
51
51
|
return cls.from_dict(json.loads(json_str))
|
52
52
|
|
53
53
|
def to_dict(self) -> Dict[str, Any]:
|
@@ -72,7 +72,7 @@ class ScanModelRequest(BaseModel):
|
|
72
72
|
|
73
73
|
@classmethod
|
74
74
|
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
75
|
-
"""Create an instance of
|
75
|
+
"""Create an instance of BeginMultiFileUpload200Response from a dict"""
|
76
76
|
if obj is None:
|
77
77
|
return None
|
78
78
|
|
@@ -80,7 +80,7 @@ class ScanModelRequest(BaseModel):
|
|
80
80
|
return cls.model_validate(obj)
|
81
81
|
|
82
82
|
_obj = cls.model_validate({
|
83
|
-
"
|
83
|
+
"scan_id": obj.get("scan_id")
|
84
84
|
})
|
85
85
|
return _obj
|
86
86
|
|
@@ -17,18 +17,18 @@ import pprint
|
|
17
17
|
import re # noqa: F401
|
18
18
|
import json
|
19
19
|
|
20
|
-
from pydantic import BaseModel, ConfigDict, StrictStr
|
20
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictStr
|
21
21
|
from typing import Any, ClassVar, Dict, List
|
22
|
-
from hiddenlayer.sdk.rest.models.
|
22
|
+
from hiddenlayer.sdk.rest.models.begin_multipart_file_upload200_response_parts_inner import BeginMultipartFileUpload200ResponsePartsInner
|
23
23
|
from typing import Optional, Set
|
24
24
|
from typing_extensions import Self
|
25
25
|
|
26
|
-
class
|
26
|
+
class BeginMultipartFileUpload200Response(BaseModel):
|
27
27
|
"""
|
28
|
-
|
28
|
+
BeginMultipartFileUpload200Response
|
29
29
|
""" # noqa: E501
|
30
|
-
upload_id: StrictStr
|
31
|
-
parts: List[
|
30
|
+
upload_id: StrictStr = Field(description="UploadId for the current file")
|
31
|
+
parts: List[BeginMultipartFileUpload200ResponsePartsInner]
|
32
32
|
__properties: ClassVar[List[str]] = ["upload_id", "parts"]
|
33
33
|
|
34
34
|
model_config = ConfigDict(
|
@@ -49,7 +49,7 @@ class GetMultipartUploadResponse(BaseModel):
|
|
49
49
|
|
50
50
|
@classmethod
|
51
51
|
def from_json(cls, json_str: str) -> Optional[Self]:
|
52
|
-
"""Create an instance of
|
52
|
+
"""Create an instance of BeginMultipartFileUpload200Response from a JSON string"""
|
53
53
|
return cls.from_dict(json.loads(json_str))
|
54
54
|
|
55
55
|
def to_dict(self) -> Dict[str, Any]:
|
@@ -81,7 +81,7 @@ class GetMultipartUploadResponse(BaseModel):
|
|
81
81
|
|
82
82
|
@classmethod
|
83
83
|
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
84
|
-
"""Create an instance of
|
84
|
+
"""Create an instance of BeginMultipartFileUpload200Response from a dict"""
|
85
85
|
if obj is None:
|
86
86
|
return None
|
87
87
|
|
@@ -90,7 +90,7 @@ class GetMultipartUploadResponse(BaseModel):
|
|
90
90
|
|
91
91
|
_obj = cls.model_validate({
|
92
92
|
"upload_id": obj.get("upload_id"),
|
93
|
-
"parts": [
|
93
|
+
"parts": [BeginMultipartFileUpload200ResponsePartsInner.from_dict(_item) for _item in obj["parts"]] if obj.get("parts") is not None else None
|
94
94
|
})
|
95
95
|
return _obj
|
96
96
|
|
@@ -19,18 +19,19 @@ import json
|
|
19
19
|
|
20
20
|
from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr
|
21
21
|
from typing import Any, ClassVar, Dict, List, Optional
|
22
|
+
from typing_extensions import Annotated
|
22
23
|
from typing import Optional, Set
|
23
24
|
from typing_extensions import Self
|
24
25
|
|
25
|
-
class
|
26
|
+
class BeginMultipartFileUpload200ResponsePartsInner(BaseModel):
|
26
27
|
"""
|
27
|
-
|
28
|
+
BeginMultipartFileUpload200ResponsePartsInner
|
28
29
|
""" # noqa: E501
|
29
|
-
part_number:
|
30
|
-
start_offset: StrictInt
|
31
|
-
|
32
|
-
upload_url: Optional[StrictStr] =
|
33
|
-
__properties: ClassVar[List[str]] = ["part_number", "start_offset", "
|
30
|
+
part_number: Optional[Annotated[int, Field(strict=True, ge=0)]] = None
|
31
|
+
start_offset: Optional[StrictInt] = None
|
32
|
+
stop_offset: Optional[StrictInt] = None
|
33
|
+
upload_url: Optional[StrictStr] = None
|
34
|
+
__properties: ClassVar[List[str]] = ["part_number", "start_offset", "stop_offset", "upload_url"]
|
34
35
|
|
35
36
|
model_config = ConfigDict(
|
36
37
|
populate_by_name=True,
|
@@ -50,7 +51,7 @@ class MultipartUploadPart(BaseModel):
|
|
50
51
|
|
51
52
|
@classmethod
|
52
53
|
def from_json(cls, json_str: str) -> Optional[Self]:
|
53
|
-
"""Create an instance of
|
54
|
+
"""Create an instance of BeginMultipartFileUpload200ResponsePartsInner from a JSON string"""
|
54
55
|
return cls.from_dict(json.loads(json_str))
|
55
56
|
|
56
57
|
def to_dict(self) -> Dict[str, Any]:
|
@@ -75,7 +76,7 @@ class MultipartUploadPart(BaseModel):
|
|
75
76
|
|
76
77
|
@classmethod
|
77
78
|
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
78
|
-
"""Create an instance of
|
79
|
+
"""Create an instance of BeginMultipartFileUpload200ResponsePartsInner from a dict"""
|
79
80
|
if obj is None:
|
80
81
|
return None
|
81
82
|
|
@@ -85,7 +86,7 @@ class MultipartUploadPart(BaseModel):
|
|
85
86
|
_obj = cls.model_validate({
|
86
87
|
"part_number": obj.get("part_number"),
|
87
88
|
"start_offset": obj.get("start_offset"),
|
88
|
-
"
|
89
|
+
"stop_offset": obj.get("stop_offset"),
|
89
90
|
"upload_url": obj.get("upload_url")
|
90
91
|
})
|
91
92
|
return _obj
|
@@ -0,0 +1,91 @@
|
|
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, StrictStr
|
21
|
+
from typing import Any, ClassVar, Dict, List, Optional
|
22
|
+
from typing import Optional, Set
|
23
|
+
from typing_extensions import Self
|
24
|
+
|
25
|
+
class ErrorsInner(BaseModel):
|
26
|
+
"""
|
27
|
+
ErrorsInner
|
28
|
+
""" # noqa: E501
|
29
|
+
code: Optional[StrictStr] = None
|
30
|
+
detail: Optional[StrictStr] = None
|
31
|
+
pointer: Optional[List[StrictStr]] = Field(default=None, description="array of JSON Pointers")
|
32
|
+
__properties: ClassVar[List[str]] = ["code", "detail", "pointer"]
|
33
|
+
|
34
|
+
model_config = ConfigDict(
|
35
|
+
populate_by_name=True,
|
36
|
+
validate_assignment=True,
|
37
|
+
protected_namespaces=(),
|
38
|
+
)
|
39
|
+
|
40
|
+
|
41
|
+
def to_str(self) -> str:
|
42
|
+
"""Returns the string representation of the model using alias"""
|
43
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
44
|
+
|
45
|
+
def to_json(self) -> str:
|
46
|
+
"""Returns the JSON representation of the model using alias"""
|
47
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
48
|
+
return json.dumps(self.to_dict())
|
49
|
+
|
50
|
+
@classmethod
|
51
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
52
|
+
"""Create an instance of ErrorsInner from a JSON string"""
|
53
|
+
return cls.from_dict(json.loads(json_str))
|
54
|
+
|
55
|
+
def to_dict(self) -> Dict[str, Any]:
|
56
|
+
"""Return the dictionary representation of the model using alias.
|
57
|
+
|
58
|
+
This has the following differences from calling pydantic's
|
59
|
+
`self.model_dump(by_alias=True)`:
|
60
|
+
|
61
|
+
* `None` is only added to the output dict for nullable fields that
|
62
|
+
were set at model initialization. Other fields with value `None`
|
63
|
+
are ignored.
|
64
|
+
"""
|
65
|
+
excluded_fields: Set[str] = set([
|
66
|
+
])
|
67
|
+
|
68
|
+
_dict = self.model_dump(
|
69
|
+
by_alias=True,
|
70
|
+
exclude=excluded_fields,
|
71
|
+
exclude_none=True,
|
72
|
+
)
|
73
|
+
return _dict
|
74
|
+
|
75
|
+
@classmethod
|
76
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
77
|
+
"""Create an instance of ErrorsInner from a dict"""
|
78
|
+
if obj is None:
|
79
|
+
return None
|
80
|
+
|
81
|
+
if not isinstance(obj, dict):
|
82
|
+
return cls.model_validate(obj)
|
83
|
+
|
84
|
+
_obj = cls.model_validate({
|
85
|
+
"code": obj.get("code"),
|
86
|
+
"detail": obj.get("detail"),
|
87
|
+
"pointer": obj.get("pointer")
|
88
|
+
})
|
89
|
+
return _obj
|
90
|
+
|
91
|
+
|
@@ -28,9 +28,9 @@ class FileDetailsV3(BaseModel):
|
|
28
28
|
FileDetailsV3
|
29
29
|
""" # noqa: E501
|
30
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")
|
31
|
+
md5: Optional[Annotated[str, Field(strict=True)]] = Field(default=None, description="hexadecimal md5 hash of file")
|
32
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")
|
33
|
+
tlsh: Optional[Annotated[str, Field(strict=True)]] = Field(default=None, description="TLSH hash of file")
|
34
34
|
file_size: Optional[Annotated[str, Field(strict=True)]] = Field(default=None, description="size of the file in human readable format")
|
35
35
|
file_size_bytes: Optional[StrictInt] = Field(default=None, description="size of the file in bytes")
|
36
36
|
file_type: StrictStr = Field(description="type of the file")
|
@@ -40,6 +40,9 @@ class FileDetailsV3(BaseModel):
|
|
40
40
|
@field_validator('md5')
|
41
41
|
def md5_validate_regular_expression(cls, value):
|
42
42
|
"""Validates the regular expression"""
|
43
|
+
if value is None:
|
44
|
+
return value
|
45
|
+
|
43
46
|
if not re.match(r"^[a-fA-F0-9]{32}$", value):
|
44
47
|
raise ValueError(r"must validate the regular expression /^[a-fA-F0-9]{32}$/")
|
45
48
|
return value
|
@@ -54,6 +57,9 @@ class FileDetailsV3(BaseModel):
|
|
54
57
|
@field_validator('tlsh')
|
55
58
|
def tlsh_validate_regular_expression(cls, value):
|
56
59
|
"""Validates the regular expression"""
|
60
|
+
if value is None:
|
61
|
+
return value
|
62
|
+
|
57
63
|
if not re.match(r"^[a-fA-F0-9]{70}$", value):
|
58
64
|
raise ValueError(r"must validate the regular expression /^[a-fA-F0-9]{70}$/")
|
59
65
|
return value
|
@@ -19,39 +19,28 @@ import json
|
|
19
19
|
|
20
20
|
from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr, field_validator
|
21
21
|
from typing import Any, ClassVar, Dict, List, Optional
|
22
|
-
from hiddenlayer.sdk.rest.models.
|
23
|
-
from hiddenlayer.sdk.rest.models.scan_results import ScanResults
|
22
|
+
from hiddenlayer.sdk.rest.models.scan_detection_v31 import ScanDetectionV31
|
24
23
|
from typing import Optional, Set
|
25
24
|
from typing_extensions import Self
|
26
25
|
|
27
|
-
class
|
26
|
+
class FileResultV3(BaseModel):
|
28
27
|
"""
|
29
|
-
|
28
|
+
FileResultV3
|
30
29
|
""" # noqa: E501
|
31
|
-
|
30
|
+
file_location: StrictStr
|
32
31
|
status: StrictStr
|
33
|
-
start_time: StrictInt
|
34
|
-
end_time: StrictInt
|
35
|
-
|
36
|
-
|
37
|
-
detections: List[
|
38
|
-
__properties: ClassVar[List[str]] = ["
|
32
|
+
start_time: Optional[StrictInt] = None
|
33
|
+
end_time: Optional[StrictInt] = None
|
34
|
+
details: Optional[Dict[str, Any]] = None
|
35
|
+
seen: Optional[StrictInt] = None
|
36
|
+
detections: Optional[List[ScanDetectionV31]] = None
|
37
|
+
__properties: ClassVar[List[str]] = ["file_location", "status", "start_time", "end_time", "details", "seen", "detections"]
|
39
38
|
|
40
39
|
@field_validator('status')
|
41
40
|
def status_validate_enum(cls, value):
|
42
41
|
"""Validates the enum"""
|
43
|
-
if value not in set(['done', '
|
44
|
-
raise ValueError("must be one of enum values ('done', '
|
45
|
-
return value
|
46
|
-
|
47
|
-
@field_validator('severity')
|
48
|
-
def severity_validate_enum(cls, value):
|
49
|
-
"""Validates the enum"""
|
50
|
-
if value is None:
|
51
|
-
return value
|
52
|
-
|
53
|
-
if value not in set(['UNKNOWN', 'SAFE', 'SUSPICIOUS', 'MALICIOUS']):
|
54
|
-
raise ValueError("must be one of enum values ('UNKNOWN', 'SAFE', 'SUSPICIOUS', 'MALICIOUS')")
|
42
|
+
if value not in set(['done', 'running', 'failed', 'pending', 'canceled', 'skipped']):
|
43
|
+
raise ValueError("must be one of enum values ('done', 'running', 'failed', 'pending', 'canceled', 'skipped')")
|
55
44
|
return value
|
56
45
|
|
57
46
|
model_config = ConfigDict(
|
@@ -72,7 +61,7 @@ class ScanResultsV2(BaseModel):
|
|
72
61
|
|
73
62
|
@classmethod
|
74
63
|
def from_json(cls, json_str: str) -> Optional[Self]:
|
75
|
-
"""Create an instance of
|
64
|
+
"""Create an instance of FileResultV3 from a JSON string"""
|
76
65
|
return cls.from_dict(json.loads(json_str))
|
77
66
|
|
78
67
|
def to_dict(self) -> Dict[str, Any]:
|
@@ -93,9 +82,9 @@ class ScanResultsV2(BaseModel):
|
|
93
82
|
exclude=excluded_fields,
|
94
83
|
exclude_none=True,
|
95
84
|
)
|
96
|
-
# override the default output from pydantic by calling `to_dict()` of
|
97
|
-
if self.
|
98
|
-
_dict['
|
85
|
+
# override the default output from pydantic by calling `to_dict()` of details
|
86
|
+
if self.details:
|
87
|
+
_dict['details'] = self.details.to_dict()
|
99
88
|
# override the default output from pydantic by calling `to_dict()` of each item in detections (list)
|
100
89
|
_items = []
|
101
90
|
if self.detections:
|
@@ -107,7 +96,7 @@ class ScanResultsV2(BaseModel):
|
|
107
96
|
|
108
97
|
@classmethod
|
109
98
|
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
110
|
-
"""Create an instance of
|
99
|
+
"""Create an instance of FileResultV3 from a dict"""
|
111
100
|
if obj is None:
|
112
101
|
return None
|
113
102
|
|
@@ -115,13 +104,13 @@ class ScanResultsV2(BaseModel):
|
|
115
104
|
return cls.model_validate(obj)
|
116
105
|
|
117
106
|
_obj = cls.model_validate({
|
118
|
-
"
|
107
|
+
"file_location": obj.get("file_location"),
|
119
108
|
"status": obj.get("status"),
|
120
109
|
"start_time": obj.get("start_time"),
|
121
110
|
"end_time": obj.get("end_time"),
|
122
|
-
"
|
123
|
-
"
|
124
|
-
"detections": [
|
111
|
+
"details": FileDetailsV3.from_dict(obj["details"]) if obj.get("details") is not None else None,
|
112
|
+
"seen": obj.get("seen"),
|
113
|
+
"detections": [ScanDetectionV31.from_dict(_item) for _item in obj["detections"]] if obj.get("detections") is not None else None
|
125
114
|
})
|
126
115
|
return _obj
|
127
116
|
|
@@ -24,9 +24,9 @@ from hiddenlayer.sdk.rest.models.scan_report_v3 import ScanReportV3
|
|
24
24
|
from typing import Optional, Set
|
25
25
|
from typing_extensions import Self
|
26
26
|
|
27
|
-
class
|
27
|
+
class GetCondensedModelScanReports200Response(BaseModel):
|
28
28
|
"""
|
29
|
-
|
29
|
+
GetCondensedModelScanReports200Response
|
30
30
|
""" # noqa: E501
|
31
31
|
items: Optional[List[ScanReportV3]] = None
|
32
32
|
total: Annotated[int, Field(strict=True, ge=0)] = Field(description="Total number of items available based on the query criteria.")
|
@@ -52,7 +52,7 @@ class ModelScanApiV3ScanQuery200Response(BaseModel):
|
|
52
52
|
|
53
53
|
@classmethod
|
54
54
|
def from_json(cls, json_str: str) -> Optional[Self]:
|
55
|
-
"""Create an instance of
|
55
|
+
"""Create an instance of GetCondensedModelScanReports200Response from a JSON string"""
|
56
56
|
return cls.from_dict(json.loads(json_str))
|
57
57
|
|
58
58
|
def to_dict(self) -> Dict[str, Any]:
|
@@ -84,7 +84,7 @@ class ModelScanApiV3ScanQuery200Response(BaseModel):
|
|
84
84
|
|
85
85
|
@classmethod
|
86
86
|
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
87
|
-
"""Create an instance of
|
87
|
+
"""Create an instance of GetCondensedModelScanReports200Response from a dict"""
|
88
88
|
if obj is None:
|
89
89
|
return None
|
90
90
|
|
@@ -0,0 +1,97 @@
|
|
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, StrictStr
|
21
|
+
from typing import Any, ClassVar, Dict, List, Optional
|
22
|
+
from typing import Optional, Set
|
23
|
+
from typing_extensions import Self
|
24
|
+
|
25
|
+
class InventoryV3(BaseModel):
|
26
|
+
"""
|
27
|
+
InventoryV3
|
28
|
+
""" # noqa: E501
|
29
|
+
requested_scan_location: Optional[StrictStr] = None
|
30
|
+
model_name: Optional[StrictStr] = None
|
31
|
+
model_source: Optional[StrictStr] = None
|
32
|
+
model_version: Optional[StrictStr] = None
|
33
|
+
model_version_id: Optional[StrictStr] = None
|
34
|
+
requesting_entity: Optional[StrictStr] = None
|
35
|
+
__properties: ClassVar[List[str]] = ["requested_scan_location", "model_name", "model_source", "model_version", "model_version_id", "requesting_entity"]
|
36
|
+
|
37
|
+
model_config = ConfigDict(
|
38
|
+
populate_by_name=True,
|
39
|
+
validate_assignment=True,
|
40
|
+
protected_namespaces=(),
|
41
|
+
)
|
42
|
+
|
43
|
+
|
44
|
+
def to_str(self) -> str:
|
45
|
+
"""Returns the string representation of the model using alias"""
|
46
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
47
|
+
|
48
|
+
def to_json(self) -> str:
|
49
|
+
"""Returns the JSON representation of the model using alias"""
|
50
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
51
|
+
return json.dumps(self.to_dict())
|
52
|
+
|
53
|
+
@classmethod
|
54
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
55
|
+
"""Create an instance of InventoryV3 from a JSON string"""
|
56
|
+
return cls.from_dict(json.loads(json_str))
|
57
|
+
|
58
|
+
def to_dict(self) -> Dict[str, Any]:
|
59
|
+
"""Return the dictionary representation of the model using alias.
|
60
|
+
|
61
|
+
This has the following differences from calling pydantic's
|
62
|
+
`self.model_dump(by_alias=True)`:
|
63
|
+
|
64
|
+
* `None` is only added to the output dict for nullable fields that
|
65
|
+
were set at model initialization. Other fields with value `None`
|
66
|
+
are ignored.
|
67
|
+
"""
|
68
|
+
excluded_fields: Set[str] = set([
|
69
|
+
])
|
70
|
+
|
71
|
+
_dict = self.model_dump(
|
72
|
+
by_alias=True,
|
73
|
+
exclude=excluded_fields,
|
74
|
+
exclude_none=True,
|
75
|
+
)
|
76
|
+
return _dict
|
77
|
+
|
78
|
+
@classmethod
|
79
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
80
|
+
"""Create an instance of InventoryV3 from a dict"""
|
81
|
+
if obj is None:
|
82
|
+
return None
|
83
|
+
|
84
|
+
if not isinstance(obj, dict):
|
85
|
+
return cls.model_validate(obj)
|
86
|
+
|
87
|
+
_obj = cls.model_validate({
|
88
|
+
"requested_scan_location": obj.get("requested_scan_location"),
|
89
|
+
"model_name": obj.get("model_name"),
|
90
|
+
"model_source": obj.get("model_source"),
|
91
|
+
"model_version": obj.get("model_version"),
|
92
|
+
"model_version_id": obj.get("model_version_id"),
|
93
|
+
"requesting_entity": obj.get("requesting_entity")
|
94
|
+
})
|
95
|
+
return _obj
|
96
|
+
|
97
|
+
|
@@ -28,7 +28,7 @@ class ModelInventoryInfo(BaseModel):
|
|
28
28
|
""" # noqa: E501
|
29
29
|
model_name: StrictStr = Field(description="name of the model")
|
30
30
|
model_version: StrictStr = Field(description="version of the model")
|
31
|
-
model_source: StrictStr = Field(description="source (provider) info")
|
31
|
+
model_source: Optional[StrictStr] = Field(default=None, description="source (provider) info")
|
32
32
|
requested_scan_location: StrictStr = Field(description="Location to be scanned")
|
33
33
|
requesting_entity: Optional[StrictStr] = Field(default=None, description="Entity that requested the scan")
|
34
34
|
model_id: StrictStr = Field(description="Unique identifier for the model")
|