hiddenlayer-sdk 0.1.2__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.
- hiddenlayer/sdk/models.py +45 -8
- hiddenlayer/sdk/rest/__init__.py +80 -3
- hiddenlayer/sdk/rest/api/__init__.py +3 -0
- hiddenlayer/sdk/rest/api/aidr_predictive_api.py +1 -1
- hiddenlayer/sdk/rest/api/health_api.py +272 -0
- hiddenlayer/sdk/rest/api/model_scan_api.py +1 -1
- hiddenlayer/sdk/rest/api/model_supply_chain_api.py +2927 -0
- hiddenlayer/sdk/rest/api/readiness_api.py +272 -0
- hiddenlayer/sdk/rest/api/sensor_api.py +345 -16
- hiddenlayer/sdk/rest/api_client.py +1 -1
- hiddenlayer/sdk/rest/configuration.py +4 -4
- hiddenlayer/sdk/rest/exceptions.py +1 -1
- hiddenlayer/sdk/rest/models/__init__.py +77 -3
- hiddenlayer/sdk/rest/models/address.py +110 -0
- hiddenlayer/sdk/rest/models/artifact.py +155 -0
- hiddenlayer/sdk/rest/models/artifact_change.py +108 -0
- hiddenlayer/sdk/rest/models/artifact_content.py +101 -0
- hiddenlayer/sdk/rest/models/artifact_location.py +109 -0
- hiddenlayer/sdk/rest/models/attachment.py +129 -0
- hiddenlayer/sdk/rest/models/code_flow.py +113 -0
- hiddenlayer/sdk/rest/models/configuration_override.py +108 -0
- hiddenlayer/sdk/rest/models/conversion.py +114 -0
- hiddenlayer/sdk/rest/models/create_sensor_request.py +1 -1
- hiddenlayer/sdk/rest/models/detections.py +101 -0
- hiddenlayer/sdk/rest/models/edge.py +108 -0
- hiddenlayer/sdk/rest/models/edge_traversal.py +122 -0
- hiddenlayer/sdk/rest/models/exception.py +113 -0
- hiddenlayer/sdk/rest/models/external_properties.py +273 -0
- hiddenlayer/sdk/rest/models/external_property_file_reference.py +102 -0
- hiddenlayer/sdk/rest/models/external_property_file_references.py +240 -0
- hiddenlayer/sdk/rest/models/file_details_v3.py +140 -0
- hiddenlayer/sdk/rest/models/file_results_inner.py +121 -0
- hiddenlayer/sdk/rest/models/file_scan_report_v3.py +95 -0
- hiddenlayer/sdk/rest/models/fix.py +113 -0
- hiddenlayer/sdk/rest/models/get_multipart_upload_response.py +1 -1
- hiddenlayer/sdk/rest/models/graph.py +123 -0
- hiddenlayer/sdk/rest/models/graph_traversal.py +97 -0
- hiddenlayer/sdk/rest/models/invocation.py +199 -0
- hiddenlayer/sdk/rest/models/location.py +146 -0
- hiddenlayer/sdk/rest/models/{validation_error_model_loc_inner.py → location_inner.py} +7 -7
- hiddenlayer/sdk/rest/models/location_relationship.py +107 -0
- hiddenlayer/sdk/rest/models/logical_location.py +104 -0
- hiddenlayer/sdk/rest/models/message.py +92 -0
- hiddenlayer/sdk/rest/models/mitre_atlas_inner.py +110 -0
- hiddenlayer/sdk/rest/models/model.py +1 -1
- hiddenlayer/sdk/rest/models/model_inventory_info.py +99 -0
- hiddenlayer/sdk/rest/models/model_query_response.py +1 -1
- hiddenlayer/sdk/rest/models/model_scan_api_v3_scan_model_version_id_patch200_response.py +87 -0
- hiddenlayer/sdk/rest/models/model_scan_api_v3_scan_query200_response.py +102 -0
- hiddenlayer/sdk/rest/models/multiformat_message_string.py +95 -0
- hiddenlayer/sdk/rest/models/multipart_upload_part.py +1 -1
- hiddenlayer/sdk/rest/models/node.py +122 -0
- hiddenlayer/sdk/rest/models/notification.py +157 -0
- hiddenlayer/sdk/rest/models/paged_response_with_total.py +94 -0
- hiddenlayer/sdk/rest/models/physical_location.py +94 -0
- hiddenlayer/sdk/rest/models/property_bag.py +101 -0
- hiddenlayer/sdk/rest/models/rectangle.py +110 -0
- hiddenlayer/sdk/rest/models/region.py +127 -0
- hiddenlayer/sdk/rest/models/replacement.py +103 -0
- hiddenlayer/sdk/rest/models/reporting_configuration.py +113 -0
- hiddenlayer/sdk/rest/models/reporting_descriptor.py +162 -0
- hiddenlayer/sdk/rest/models/reporting_descriptor_reference.py +103 -0
- hiddenlayer/sdk/rest/models/reporting_descriptor_relationship.py +115 -0
- hiddenlayer/sdk/rest/models/result.py +312 -0
- hiddenlayer/sdk/rest/models/result_provenance.py +133 -0
- hiddenlayer/sdk/rest/models/rule_details_inner.py +102 -0
- hiddenlayer/sdk/rest/models/run.py +318 -0
- hiddenlayer/sdk/rest/models/run_automation_details.py +129 -0
- hiddenlayer/sdk/rest/models/sarif210.py +123 -0
- hiddenlayer/sdk/rest/models/scan_create_request.py +87 -0
- hiddenlayer/sdk/rest/models/scan_detection_v3.py +156 -0
- hiddenlayer/sdk/rest/models/scan_header_v3.py +129 -0
- hiddenlayer/sdk/rest/models/scan_job.py +109 -0
- hiddenlayer/sdk/rest/models/scan_job_inventory.py +137 -0
- hiddenlayer/sdk/rest/models/scan_model_details_v3.py +95 -0
- hiddenlayer/sdk/rest/models/scan_model_ids_v3.py +89 -0
- hiddenlayer/sdk/rest/models/scan_model_request.py +1 -1
- hiddenlayer/sdk/rest/models/scan_report_v3.py +139 -0
- hiddenlayer/sdk/rest/models/{file_info.py → scan_results.py} +14 -6
- hiddenlayer/sdk/rest/models/scan_results_v2.py +30 -10
- hiddenlayer/sdk/rest/models/security_posture.py +89 -0
- hiddenlayer/sdk/rest/models/sensor_sor_model_card_query_response.py +101 -0
- hiddenlayer/sdk/rest/models/sensor_sor_model_card_response.py +127 -0
- hiddenlayer/sdk/rest/models/sensor_sor_query_filter.py +1 -1
- hiddenlayer/sdk/rest/models/sensor_sor_query_request.py +1 -1
- hiddenlayer/sdk/rest/models/special_locations.py +97 -0
- hiddenlayer/sdk/rest/models/stack.py +113 -0
- hiddenlayer/sdk/rest/models/stack_frame.py +104 -0
- hiddenlayer/sdk/rest/models/submission_response.py +1 -1
- hiddenlayer/sdk/rest/models/submission_v2.py +1 -1
- hiddenlayer/sdk/rest/models/suppression.py +133 -0
- hiddenlayer/sdk/rest/models/thread_flow.py +144 -0
- hiddenlayer/sdk/rest/models/thread_flow_location.py +166 -0
- hiddenlayer/sdk/rest/models/tool.py +107 -0
- hiddenlayer/sdk/rest/models/tool_component.py +251 -0
- hiddenlayer/sdk/rest/models/tool_component_reference.py +108 -0
- hiddenlayer/sdk/rest/models/translation_metadata.py +110 -0
- hiddenlayer/sdk/rest/models/validation_error_model.py +4 -4
- hiddenlayer/sdk/rest/models/version_control_details.py +108 -0
- hiddenlayer/sdk/rest/models/web_request.py +112 -0
- hiddenlayer/sdk/rest/models/web_response.py +112 -0
- hiddenlayer/sdk/rest/rest.py +1 -1
- hiddenlayer/sdk/services/model.py +5 -2
- hiddenlayer/sdk/services/model_scan.py +153 -105
- hiddenlayer/sdk/version.py +1 -1
- {hiddenlayer_sdk-0.1.2.dist-info → hiddenlayer_sdk-1.0.0.dist-info}/METADATA +39 -20
- hiddenlayer_sdk-1.0.0.dist-info/RECORD +118 -0
- {hiddenlayer_sdk-0.1.2.dist-info → hiddenlayer_sdk-1.0.0.dist-info}/WHEEL +1 -1
- hiddenlayer/sdk/enterprise/__init__.py +0 -0
- hiddenlayer/sdk/enterprise/enterprise_model_scan_api.py +0 -55
- hiddenlayer_sdk-0.1.2.dist-info/RECORD +0 -43
- {hiddenlayer_sdk-0.1.2.dist-info → hiddenlayer_sdk-1.0.0.dist-info}/LICENSE +0 -0
- {hiddenlayer_sdk-0.1.2.dist-info → hiddenlayer_sdk-1.0.0.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,129 @@
|
|
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.artifact_location import ArtifactLocation
|
24
|
+
from hiddenlayer.sdk.rest.models.message import Message
|
25
|
+
from hiddenlayer.sdk.rest.models.property_bag import PropertyBag
|
26
|
+
from hiddenlayer.sdk.rest.models.rectangle import Rectangle
|
27
|
+
from hiddenlayer.sdk.rest.models.region import Region
|
28
|
+
from typing import Optional, Set
|
29
|
+
from typing_extensions import Self
|
30
|
+
|
31
|
+
class Attachment(BaseModel):
|
32
|
+
"""
|
33
|
+
An artifact relevant to a result.
|
34
|
+
""" # noqa: E501
|
35
|
+
description: Optional[Message] = None
|
36
|
+
artifact_location: ArtifactLocation = Field(alias="artifactLocation")
|
37
|
+
regions: Optional[Annotated[List[Region], Field(min_length=0)]] = Field(default=None, description="An array of regions of interest within the attachment.")
|
38
|
+
rectangles: Optional[Annotated[List[Rectangle], Field(min_length=0)]] = Field(default=None, description="An array of rectangles specifying areas of interest within the image.")
|
39
|
+
properties: Optional[PropertyBag] = None
|
40
|
+
__properties: ClassVar[List[str]] = ["description", "artifactLocation", "regions", "rectangles", "properties"]
|
41
|
+
|
42
|
+
model_config = ConfigDict(
|
43
|
+
populate_by_name=True,
|
44
|
+
validate_assignment=True,
|
45
|
+
protected_namespaces=(),
|
46
|
+
)
|
47
|
+
|
48
|
+
|
49
|
+
def to_str(self) -> str:
|
50
|
+
"""Returns the string representation of the model using alias"""
|
51
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
52
|
+
|
53
|
+
def to_json(self) -> str:
|
54
|
+
"""Returns the JSON representation of the model using alias"""
|
55
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
56
|
+
return json.dumps(self.to_dict())
|
57
|
+
|
58
|
+
@classmethod
|
59
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
60
|
+
"""Create an instance of Attachment from a JSON string"""
|
61
|
+
return cls.from_dict(json.loads(json_str))
|
62
|
+
|
63
|
+
def to_dict(self) -> Dict[str, Any]:
|
64
|
+
"""Return the dictionary representation of the model using alias.
|
65
|
+
|
66
|
+
This has the following differences from calling pydantic's
|
67
|
+
`self.model_dump(by_alias=True)`:
|
68
|
+
|
69
|
+
* `None` is only added to the output dict for nullable fields that
|
70
|
+
were set at model initialization. Other fields with value `None`
|
71
|
+
are ignored.
|
72
|
+
"""
|
73
|
+
excluded_fields: Set[str] = set([
|
74
|
+
])
|
75
|
+
|
76
|
+
_dict = self.model_dump(
|
77
|
+
by_alias=True,
|
78
|
+
exclude=excluded_fields,
|
79
|
+
exclude_none=True,
|
80
|
+
)
|
81
|
+
# override the default output from pydantic by calling `to_dict()` of description
|
82
|
+
if self.description:
|
83
|
+
_dict['description'] = self.description.to_dict()
|
84
|
+
# override the default output from pydantic by calling `to_dict()` of artifact_location
|
85
|
+
if self.artifact_location:
|
86
|
+
_dict['artifactLocation'] = self.artifact_location.to_dict()
|
87
|
+
# override the default output from pydantic by calling `to_dict()` of each item in regions (list)
|
88
|
+
_items = []
|
89
|
+
if self.regions:
|
90
|
+
for _item in self.regions:
|
91
|
+
if _item:
|
92
|
+
_items.append(_item.to_dict())
|
93
|
+
_dict['regions'] = _items
|
94
|
+
# override the default output from pydantic by calling `to_dict()` of each item in rectangles (list)
|
95
|
+
_items = []
|
96
|
+
if self.rectangles:
|
97
|
+
for _item in self.rectangles:
|
98
|
+
if _item:
|
99
|
+
_items.append(_item.to_dict())
|
100
|
+
_dict['rectangles'] = _items
|
101
|
+
# override the default output from pydantic by calling `to_dict()` of properties
|
102
|
+
if self.properties:
|
103
|
+
_dict['properties'] = self.properties.to_dict()
|
104
|
+
# set to None if description (nullable) is None
|
105
|
+
# and model_fields_set contains the field
|
106
|
+
if self.description is None and "description" in self.model_fields_set:
|
107
|
+
_dict['description'] = None
|
108
|
+
|
109
|
+
return _dict
|
110
|
+
|
111
|
+
@classmethod
|
112
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
113
|
+
"""Create an instance of Attachment from a dict"""
|
114
|
+
if obj is None:
|
115
|
+
return None
|
116
|
+
|
117
|
+
if not isinstance(obj, dict):
|
118
|
+
return cls.model_validate(obj)
|
119
|
+
|
120
|
+
_obj = cls.model_validate({
|
121
|
+
"description": Message.from_dict(obj["description"]) if obj.get("description") is not None else None,
|
122
|
+
"artifactLocation": ArtifactLocation.from_dict(obj["artifactLocation"]) if obj.get("artifactLocation") is not None else None,
|
123
|
+
"regions": [Region.from_dict(_item) for _item in obj["regions"]] if obj.get("regions") is not None else None,
|
124
|
+
"rectangles": [Rectangle.from_dict(_item) for _item in obj["rectangles"]] if obj.get("rectangles") is not None else None,
|
125
|
+
"properties": PropertyBag.from_dict(obj["properties"]) if obj.get("properties") is not None else None
|
126
|
+
})
|
127
|
+
return _obj
|
128
|
+
|
129
|
+
|
@@ -0,0 +1,113 @@
|
|
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.message import Message
|
24
|
+
from hiddenlayer.sdk.rest.models.property_bag import PropertyBag
|
25
|
+
from hiddenlayer.sdk.rest.models.thread_flow import ThreadFlow
|
26
|
+
from typing import Optional, Set
|
27
|
+
from typing_extensions import Self
|
28
|
+
|
29
|
+
class CodeFlow(BaseModel):
|
30
|
+
"""
|
31
|
+
A set of threadFlows which together describe a pattern of code execution relevant to detecting a result.
|
32
|
+
""" # noqa: E501
|
33
|
+
message: Optional[Message] = None
|
34
|
+
thread_flows: Annotated[List[ThreadFlow], Field(min_length=1)] = Field(description="An array of one or more unique threadFlow objects, each of which describes the progress of a program through a thread of execution.", alias="threadFlows")
|
35
|
+
properties: Optional[PropertyBag] = None
|
36
|
+
__properties: ClassVar[List[str]] = ["message", "threadFlows", "properties"]
|
37
|
+
|
38
|
+
model_config = ConfigDict(
|
39
|
+
populate_by_name=True,
|
40
|
+
validate_assignment=True,
|
41
|
+
protected_namespaces=(),
|
42
|
+
)
|
43
|
+
|
44
|
+
|
45
|
+
def to_str(self) -> str:
|
46
|
+
"""Returns the string representation of the model using alias"""
|
47
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
48
|
+
|
49
|
+
def to_json(self) -> str:
|
50
|
+
"""Returns the JSON representation of the model using alias"""
|
51
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
52
|
+
return json.dumps(self.to_dict())
|
53
|
+
|
54
|
+
@classmethod
|
55
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
56
|
+
"""Create an instance of CodeFlow from a JSON string"""
|
57
|
+
return cls.from_dict(json.loads(json_str))
|
58
|
+
|
59
|
+
def to_dict(self) -> Dict[str, Any]:
|
60
|
+
"""Return the dictionary representation of the model using alias.
|
61
|
+
|
62
|
+
This has the following differences from calling pydantic's
|
63
|
+
`self.model_dump(by_alias=True)`:
|
64
|
+
|
65
|
+
* `None` is only added to the output dict for nullable fields that
|
66
|
+
were set at model initialization. Other fields with value `None`
|
67
|
+
are ignored.
|
68
|
+
"""
|
69
|
+
excluded_fields: Set[str] = set([
|
70
|
+
])
|
71
|
+
|
72
|
+
_dict = self.model_dump(
|
73
|
+
by_alias=True,
|
74
|
+
exclude=excluded_fields,
|
75
|
+
exclude_none=True,
|
76
|
+
)
|
77
|
+
# override the default output from pydantic by calling `to_dict()` of message
|
78
|
+
if self.message:
|
79
|
+
_dict['message'] = self.message.to_dict()
|
80
|
+
# override the default output from pydantic by calling `to_dict()` of each item in thread_flows (list)
|
81
|
+
_items = []
|
82
|
+
if self.thread_flows:
|
83
|
+
for _item in self.thread_flows:
|
84
|
+
if _item:
|
85
|
+
_items.append(_item.to_dict())
|
86
|
+
_dict['threadFlows'] = _items
|
87
|
+
# override the default output from pydantic by calling `to_dict()` of properties
|
88
|
+
if self.properties:
|
89
|
+
_dict['properties'] = self.properties.to_dict()
|
90
|
+
# set to None if message (nullable) is None
|
91
|
+
# and model_fields_set contains the field
|
92
|
+
if self.message is None and "message" in self.model_fields_set:
|
93
|
+
_dict['message'] = None
|
94
|
+
|
95
|
+
return _dict
|
96
|
+
|
97
|
+
@classmethod
|
98
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
99
|
+
"""Create an instance of CodeFlow from a dict"""
|
100
|
+
if obj is None:
|
101
|
+
return None
|
102
|
+
|
103
|
+
if not isinstance(obj, dict):
|
104
|
+
return cls.model_validate(obj)
|
105
|
+
|
106
|
+
_obj = cls.model_validate({
|
107
|
+
"message": Message.from_dict(obj["message"]) if obj.get("message") is not None else None,
|
108
|
+
"threadFlows": [ThreadFlow.from_dict(_item) for _item in obj["threadFlows"]] if obj.get("threadFlows") is not None else None,
|
109
|
+
"properties": PropertyBag.from_dict(obj["properties"]) if obj.get("properties") is not None else None
|
110
|
+
})
|
111
|
+
return _obj
|
112
|
+
|
113
|
+
|
@@ -0,0 +1,108 @@
|
|
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.property_bag import PropertyBag
|
23
|
+
from hiddenlayer.sdk.rest.models.reporting_configuration import ReportingConfiguration
|
24
|
+
from hiddenlayer.sdk.rest.models.reporting_descriptor_reference import ReportingDescriptorReference
|
25
|
+
from typing import Optional, Set
|
26
|
+
from typing_extensions import Self
|
27
|
+
|
28
|
+
class ConfigurationOverride(BaseModel):
|
29
|
+
"""
|
30
|
+
Information about how a specific rule or notification was reconfigured at runtime.
|
31
|
+
""" # noqa: E501
|
32
|
+
configuration: ReportingConfiguration
|
33
|
+
descriptor: Optional[ReportingDescriptorReference]
|
34
|
+
properties: Optional[PropertyBag] = None
|
35
|
+
__properties: ClassVar[List[str]] = ["configuration", "descriptor", "properties"]
|
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 ConfigurationOverride 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
|
+
# override the default output from pydantic by calling `to_dict()` of configuration
|
77
|
+
if self.configuration:
|
78
|
+
_dict['configuration'] = self.configuration.to_dict()
|
79
|
+
# override the default output from pydantic by calling `to_dict()` of descriptor
|
80
|
+
if self.descriptor:
|
81
|
+
_dict['descriptor'] = self.descriptor.to_dict()
|
82
|
+
# override the default output from pydantic by calling `to_dict()` of properties
|
83
|
+
if self.properties:
|
84
|
+
_dict['properties'] = self.properties.to_dict()
|
85
|
+
# set to None if descriptor (nullable) is None
|
86
|
+
# and model_fields_set contains the field
|
87
|
+
if self.descriptor is None and "descriptor" in self.model_fields_set:
|
88
|
+
_dict['descriptor'] = None
|
89
|
+
|
90
|
+
return _dict
|
91
|
+
|
92
|
+
@classmethod
|
93
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
94
|
+
"""Create an instance of ConfigurationOverride from a dict"""
|
95
|
+
if obj is None:
|
96
|
+
return None
|
97
|
+
|
98
|
+
if not isinstance(obj, dict):
|
99
|
+
return cls.model_validate(obj)
|
100
|
+
|
101
|
+
_obj = cls.model_validate({
|
102
|
+
"configuration": ReportingConfiguration.from_dict(obj["configuration"]) if obj.get("configuration") is not None else None,
|
103
|
+
"descriptor": ReportingDescriptorReference.from_dict(obj["descriptor"]) if obj.get("descriptor") is not None else None,
|
104
|
+
"properties": PropertyBag.from_dict(obj["properties"]) if obj.get("properties") is not None else None
|
105
|
+
})
|
106
|
+
return _obj
|
107
|
+
|
108
|
+
|
@@ -0,0 +1,114 @@
|
|
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.artifact_location import ArtifactLocation
|
24
|
+
from hiddenlayer.sdk.rest.models.invocation import Invocation
|
25
|
+
from hiddenlayer.sdk.rest.models.property_bag import PropertyBag
|
26
|
+
from hiddenlayer.sdk.rest.models.tool import Tool
|
27
|
+
from typing import Optional, Set
|
28
|
+
from typing_extensions import Self
|
29
|
+
|
30
|
+
class Conversion(BaseModel):
|
31
|
+
"""
|
32
|
+
Describes how a converter transformed the output of a static analysis tool from the analysis tool's native output format into the SARIF format.
|
33
|
+
""" # noqa: E501
|
34
|
+
tool: Tool
|
35
|
+
invocation: Optional[Invocation] = None
|
36
|
+
analysis_tool_log_files: Optional[Annotated[List[ArtifactLocation], Field(min_length=0)]] = Field(default=None, description="The locations of the analysis tool's per-run log files.", alias="analysisToolLogFiles")
|
37
|
+
properties: Optional[PropertyBag] = None
|
38
|
+
__properties: ClassVar[List[str]] = ["tool", "invocation", "analysisToolLogFiles", "properties"]
|
39
|
+
|
40
|
+
model_config = ConfigDict(
|
41
|
+
populate_by_name=True,
|
42
|
+
validate_assignment=True,
|
43
|
+
protected_namespaces=(),
|
44
|
+
)
|
45
|
+
|
46
|
+
|
47
|
+
def to_str(self) -> str:
|
48
|
+
"""Returns the string representation of the model using alias"""
|
49
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
50
|
+
|
51
|
+
def to_json(self) -> str:
|
52
|
+
"""Returns the JSON representation of the model using alias"""
|
53
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
54
|
+
return json.dumps(self.to_dict())
|
55
|
+
|
56
|
+
@classmethod
|
57
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
58
|
+
"""Create an instance of Conversion from a JSON string"""
|
59
|
+
return cls.from_dict(json.loads(json_str))
|
60
|
+
|
61
|
+
def to_dict(self) -> Dict[str, Any]:
|
62
|
+
"""Return the dictionary representation of the model using alias.
|
63
|
+
|
64
|
+
This has the following differences from calling pydantic's
|
65
|
+
`self.model_dump(by_alias=True)`:
|
66
|
+
|
67
|
+
* `None` is only added to the output dict for nullable fields that
|
68
|
+
were set at model initialization. Other fields with value `None`
|
69
|
+
are ignored.
|
70
|
+
"""
|
71
|
+
excluded_fields: Set[str] = set([
|
72
|
+
])
|
73
|
+
|
74
|
+
_dict = self.model_dump(
|
75
|
+
by_alias=True,
|
76
|
+
exclude=excluded_fields,
|
77
|
+
exclude_none=True,
|
78
|
+
)
|
79
|
+
# override the default output from pydantic by calling `to_dict()` of tool
|
80
|
+
if self.tool:
|
81
|
+
_dict['tool'] = self.tool.to_dict()
|
82
|
+
# override the default output from pydantic by calling `to_dict()` of invocation
|
83
|
+
if self.invocation:
|
84
|
+
_dict['invocation'] = self.invocation.to_dict()
|
85
|
+
# override the default output from pydantic by calling `to_dict()` of each item in analysis_tool_log_files (list)
|
86
|
+
_items = []
|
87
|
+
if self.analysis_tool_log_files:
|
88
|
+
for _item in self.analysis_tool_log_files:
|
89
|
+
if _item:
|
90
|
+
_items.append(_item.to_dict())
|
91
|
+
_dict['analysisToolLogFiles'] = _items
|
92
|
+
# override the default output from pydantic by calling `to_dict()` of properties
|
93
|
+
if self.properties:
|
94
|
+
_dict['properties'] = self.properties.to_dict()
|
95
|
+
return _dict
|
96
|
+
|
97
|
+
@classmethod
|
98
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
99
|
+
"""Create an instance of Conversion from a dict"""
|
100
|
+
if obj is None:
|
101
|
+
return None
|
102
|
+
|
103
|
+
if not isinstance(obj, dict):
|
104
|
+
return cls.model_validate(obj)
|
105
|
+
|
106
|
+
_obj = cls.model_validate({
|
107
|
+
"tool": Tool.from_dict(obj["tool"]) if obj.get("tool") is not None else None,
|
108
|
+
"invocation": Invocation.from_dict(obj["invocation"]) if obj.get("invocation") is not None else None,
|
109
|
+
"analysisToolLogFiles": [ArtifactLocation.from_dict(_item) for _item in obj["analysisToolLogFiles"]] if obj.get("analysisToolLogFiles") is not None else None,
|
110
|
+
"properties": PropertyBag.from_dict(obj["properties"]) if obj.get("properties") is not None else None
|
111
|
+
})
|
112
|
+
return _obj
|
113
|
+
|
114
|
+
|
@@ -0,0 +1,101 @@
|
|
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, field_validator
|
21
|
+
from typing import Any, ClassVar, Dict, List, Optional
|
22
|
+
from typing import Optional, Set
|
23
|
+
from typing_extensions import Self
|
24
|
+
|
25
|
+
class Detections(BaseModel):
|
26
|
+
"""
|
27
|
+
Detections
|
28
|
+
""" # noqa: E501
|
29
|
+
description: Optional[StrictStr] = None
|
30
|
+
message: Optional[StrictStr] = None
|
31
|
+
severity: Optional[StrictStr] = None
|
32
|
+
__properties: ClassVar[List[str]] = ["description", "message", "severity"]
|
33
|
+
|
34
|
+
@field_validator('severity')
|
35
|
+
def severity_validate_enum(cls, value):
|
36
|
+
"""Validates the enum"""
|
37
|
+
if value is None:
|
38
|
+
return value
|
39
|
+
|
40
|
+
if value not in set(['MISS', 'SAFE', 'SUSPICIOUS', 'UNSAFE', 'MALICIOUS']):
|
41
|
+
raise ValueError("must be one of enum values ('MISS', 'SAFE', 'SUSPICIOUS', 'UNSAFE', 'MALICIOUS')")
|
42
|
+
return value
|
43
|
+
|
44
|
+
model_config = ConfigDict(
|
45
|
+
populate_by_name=True,
|
46
|
+
validate_assignment=True,
|
47
|
+
protected_namespaces=(),
|
48
|
+
)
|
49
|
+
|
50
|
+
|
51
|
+
def to_str(self) -> str:
|
52
|
+
"""Returns the string representation of the model using alias"""
|
53
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
54
|
+
|
55
|
+
def to_json(self) -> str:
|
56
|
+
"""Returns the JSON representation of the model using alias"""
|
57
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
58
|
+
return json.dumps(self.to_dict())
|
59
|
+
|
60
|
+
@classmethod
|
61
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
62
|
+
"""Create an instance of Detections from a JSON string"""
|
63
|
+
return cls.from_dict(json.loads(json_str))
|
64
|
+
|
65
|
+
def to_dict(self) -> Dict[str, Any]:
|
66
|
+
"""Return the dictionary representation of the model using alias.
|
67
|
+
|
68
|
+
This has the following differences from calling pydantic's
|
69
|
+
`self.model_dump(by_alias=True)`:
|
70
|
+
|
71
|
+
* `None` is only added to the output dict for nullable fields that
|
72
|
+
were set at model initialization. Other fields with value `None`
|
73
|
+
are ignored.
|
74
|
+
"""
|
75
|
+
excluded_fields: Set[str] = set([
|
76
|
+
])
|
77
|
+
|
78
|
+
_dict = self.model_dump(
|
79
|
+
by_alias=True,
|
80
|
+
exclude=excluded_fields,
|
81
|
+
exclude_none=True,
|
82
|
+
)
|
83
|
+
return _dict
|
84
|
+
|
85
|
+
@classmethod
|
86
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
87
|
+
"""Create an instance of Detections from a dict"""
|
88
|
+
if obj is None:
|
89
|
+
return None
|
90
|
+
|
91
|
+
if not isinstance(obj, dict):
|
92
|
+
return cls.model_validate(obj)
|
93
|
+
|
94
|
+
_obj = cls.model_validate({
|
95
|
+
"description": obj.get("description"),
|
96
|
+
"message": obj.get("message"),
|
97
|
+
"severity": obj.get("severity")
|
98
|
+
})
|
99
|
+
return _obj
|
100
|
+
|
101
|
+
|
@@ -0,0 +1,108 @@
|
|
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 hiddenlayer.sdk.rest.models.message import Message
|
23
|
+
from hiddenlayer.sdk.rest.models.property_bag import PropertyBag
|
24
|
+
from typing import Optional, Set
|
25
|
+
from typing_extensions import Self
|
26
|
+
|
27
|
+
class Edge(BaseModel):
|
28
|
+
"""
|
29
|
+
Represents a directed edge in a graph.
|
30
|
+
""" # noqa: E501
|
31
|
+
id: StrictStr = Field(description="A string that uniquely identifies the edge within its graph.")
|
32
|
+
label: Optional[Message] = None
|
33
|
+
source_node_id: StrictStr = Field(description="Identifies the source node (the node at which the edge starts).", alias="sourceNodeId")
|
34
|
+
target_node_id: StrictStr = Field(description="Identifies the target node (the node at which the edge ends).", alias="targetNodeId")
|
35
|
+
properties: Optional[PropertyBag] = None
|
36
|
+
__properties: ClassVar[List[str]] = ["id", "label", "sourceNodeId", "targetNodeId", "properties"]
|
37
|
+
|
38
|
+
model_config = ConfigDict(
|
39
|
+
populate_by_name=True,
|
40
|
+
validate_assignment=True,
|
41
|
+
protected_namespaces=(),
|
42
|
+
)
|
43
|
+
|
44
|
+
|
45
|
+
def to_str(self) -> str:
|
46
|
+
"""Returns the string representation of the model using alias"""
|
47
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
48
|
+
|
49
|
+
def to_json(self) -> str:
|
50
|
+
"""Returns the JSON representation of the model using alias"""
|
51
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
52
|
+
return json.dumps(self.to_dict())
|
53
|
+
|
54
|
+
@classmethod
|
55
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
56
|
+
"""Create an instance of Edge from a JSON string"""
|
57
|
+
return cls.from_dict(json.loads(json_str))
|
58
|
+
|
59
|
+
def to_dict(self) -> Dict[str, Any]:
|
60
|
+
"""Return the dictionary representation of the model using alias.
|
61
|
+
|
62
|
+
This has the following differences from calling pydantic's
|
63
|
+
`self.model_dump(by_alias=True)`:
|
64
|
+
|
65
|
+
* `None` is only added to the output dict for nullable fields that
|
66
|
+
were set at model initialization. Other fields with value `None`
|
67
|
+
are ignored.
|
68
|
+
"""
|
69
|
+
excluded_fields: Set[str] = set([
|
70
|
+
])
|
71
|
+
|
72
|
+
_dict = self.model_dump(
|
73
|
+
by_alias=True,
|
74
|
+
exclude=excluded_fields,
|
75
|
+
exclude_none=True,
|
76
|
+
)
|
77
|
+
# override the default output from pydantic by calling `to_dict()` of label
|
78
|
+
if self.label:
|
79
|
+
_dict['label'] = self.label.to_dict()
|
80
|
+
# override the default output from pydantic by calling `to_dict()` of properties
|
81
|
+
if self.properties:
|
82
|
+
_dict['properties'] = self.properties.to_dict()
|
83
|
+
# set to None if label (nullable) is None
|
84
|
+
# and model_fields_set contains the field
|
85
|
+
if self.label is None and "label" in self.model_fields_set:
|
86
|
+
_dict['label'] = None
|
87
|
+
|
88
|
+
return _dict
|
89
|
+
|
90
|
+
@classmethod
|
91
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
92
|
+
"""Create an instance of Edge from a dict"""
|
93
|
+
if obj is None:
|
94
|
+
return None
|
95
|
+
|
96
|
+
if not isinstance(obj, dict):
|
97
|
+
return cls.model_validate(obj)
|
98
|
+
|
99
|
+
_obj = cls.model_validate({
|
100
|
+
"id": obj.get("id"),
|
101
|
+
"label": Message.from_dict(obj["label"]) if obj.get("label") is not None else None,
|
102
|
+
"sourceNodeId": obj.get("sourceNodeId"),
|
103
|
+
"targetNodeId": obj.get("targetNodeId"),
|
104
|
+
"properties": PropertyBag.from_dict(obj["properties"]) if obj.get("properties") is not None else None
|
105
|
+
})
|
106
|
+
return _obj
|
107
|
+
|
108
|
+
|