hiddenlayer-sdk 0.1.2__py3-none-any.whl → 1.1.0__py3-none-any.whl
Sign up to get free protection for your applications and to get access to all the features.
- hiddenlayer/sdk/constants.py +1 -0
- 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 +354 -37
- 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_scan_report_v3.py +132 -0
- hiddenlayer/sdk/rest/models/file_scan_reports_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 +51 -3
- hiddenlayer/sdk/services/model_scan.py +153 -105
- hiddenlayer/sdk/version.py +1 -1
- {hiddenlayer_sdk-0.1.2.dist-info → hiddenlayer_sdk-1.1.0.dist-info}/METADATA +40 -21
- hiddenlayer_sdk-1.1.0.dist-info/RECORD +118 -0
- {hiddenlayer_sdk-0.1.2.dist-info → hiddenlayer_sdk-1.1.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.1.0.dist-info}/LICENSE +0 -0
- {hiddenlayer_sdk-0.1.2.dist-info → hiddenlayer_sdk-1.1.0.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,318 @@
|
|
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, field_validator
|
21
|
+
from typing import Any, ClassVar, Dict, List, Optional
|
22
|
+
from typing_extensions import Annotated
|
23
|
+
from hiddenlayer.sdk.rest.models.address import Address
|
24
|
+
from hiddenlayer.sdk.rest.models.artifact import Artifact
|
25
|
+
from hiddenlayer.sdk.rest.models.artifact_location import ArtifactLocation
|
26
|
+
from hiddenlayer.sdk.rest.models.conversion import Conversion
|
27
|
+
from hiddenlayer.sdk.rest.models.external_property_file_references import ExternalPropertyFileReferences
|
28
|
+
from hiddenlayer.sdk.rest.models.graph import Graph
|
29
|
+
from hiddenlayer.sdk.rest.models.invocation import Invocation
|
30
|
+
from hiddenlayer.sdk.rest.models.logical_location import LogicalLocation
|
31
|
+
from hiddenlayer.sdk.rest.models.property_bag import PropertyBag
|
32
|
+
from hiddenlayer.sdk.rest.models.result import Result
|
33
|
+
from hiddenlayer.sdk.rest.models.run_automation_details import RunAutomationDetails
|
34
|
+
from hiddenlayer.sdk.rest.models.special_locations import SpecialLocations
|
35
|
+
from hiddenlayer.sdk.rest.models.thread_flow_location import ThreadFlowLocation
|
36
|
+
from hiddenlayer.sdk.rest.models.tool import Tool
|
37
|
+
from hiddenlayer.sdk.rest.models.tool_component import ToolComponent
|
38
|
+
from hiddenlayer.sdk.rest.models.version_control_details import VersionControlDetails
|
39
|
+
from hiddenlayer.sdk.rest.models.web_request import WebRequest
|
40
|
+
from hiddenlayer.sdk.rest.models.web_response import WebResponse
|
41
|
+
from typing import Optional, Set
|
42
|
+
from typing_extensions import Self
|
43
|
+
|
44
|
+
class Run(BaseModel):
|
45
|
+
"""
|
46
|
+
Describes a single run of an analysis tool, and contains the reported output of that run.
|
47
|
+
""" # noqa: E501
|
48
|
+
tool: Tool
|
49
|
+
invocations: Optional[Annotated[List[Invocation], Field(min_length=0)]] = Field(default=None, description="Describes the invocation of the analysis tool.")
|
50
|
+
conversion: Optional[Conversion] = None
|
51
|
+
language: Optional[Annotated[str, Field(strict=True)]] = Field(default='en-US', description="The language of the messages emitted into the log file during this run (expressed as an ISO 639-1 two-letter lowercase culture code) and an optional region (expressed as an ISO 3166-1 two-letter uppercase subculture code associated with a country or region). The casing is recommended but not required (in order for this data to conform to RFC5646).")
|
52
|
+
version_control_provenance: Optional[Annotated[List[VersionControlDetails], Field(min_length=0)]] = Field(default=None, description="Specifies the revision in version control of the artifacts that were scanned.", alias="versionControlProvenance")
|
53
|
+
original_uri_base_ids: Optional[Dict[str, ArtifactLocation]] = Field(default=None, description="The artifact location specified by each uriBaseId symbol on the machine where the tool originally ran.", alias="originalUriBaseIds")
|
54
|
+
artifacts: Optional[Annotated[List[Artifact], Field(min_length=0)]] = Field(default=None, description="An array of artifact objects relevant to the run.")
|
55
|
+
logical_locations: Optional[Annotated[List[LogicalLocation], Field(min_length=0)]] = Field(default=None, description="An array of logical locations such as namespaces, types or functions.", alias="logicalLocations")
|
56
|
+
graphs: Optional[Annotated[List[Graph], Field(min_length=0)]] = Field(default=None, description="An array of zero or more unique graph objects associated with the run.")
|
57
|
+
results: Optional[Annotated[List[Result], Field(min_length=0)]] = Field(default=None, description="The set of results contained in an SARIF log. The results array can be omitted when a run is solely exporting rules metadata. It must be present (but may be empty) if a log file represents an actual scan.")
|
58
|
+
automation_details: Optional[RunAutomationDetails] = Field(default=None, alias="automationDetails")
|
59
|
+
run_aggregates: Optional[Annotated[List[RunAutomationDetails], Field(min_length=0)]] = Field(default=None, description="Automation details that describe the aggregate of runs to which this run belongs.", alias="runAggregates")
|
60
|
+
baseline_guid: Optional[Annotated[str, Field(strict=True)]] = Field(default=None, description="The 'guid' property of a previous SARIF 'run' that comprises the baseline that was used to compute result 'baselineState' properties for the run.", alias="baselineGuid")
|
61
|
+
redaction_tokens: Optional[Annotated[List[StrictStr], Field(min_length=0)]] = Field(default=None, description="An array of strings used to replace sensitive information in a redaction-aware property.", alias="redactionTokens")
|
62
|
+
default_encoding: Optional[StrictStr] = Field(default=None, description="Specifies the default encoding for any artifact object that refers to a text file.", alias="defaultEncoding")
|
63
|
+
default_source_language: Optional[StrictStr] = Field(default=None, description="Specifies the default source language for any artifact object that refers to a text file that contains source code.", alias="defaultSourceLanguage")
|
64
|
+
newline_sequences: Optional[Annotated[List[StrictStr], Field(min_length=1)]] = Field(default=None, description="An ordered list of character sequences that were treated as line breaks when computing region information for the run.", alias="newlineSequences")
|
65
|
+
column_kind: Optional[StrictStr] = Field(default=None, description="Specifies the unit in which the tool measures columns.", alias="columnKind")
|
66
|
+
external_property_file_references: Optional[ExternalPropertyFileReferences] = Field(default=None, alias="externalPropertyFileReferences")
|
67
|
+
thread_flow_locations: Optional[Annotated[List[ThreadFlowLocation], Field(min_length=0)]] = Field(default=None, description="An array of threadFlowLocation objects cached at run level.", alias="threadFlowLocations")
|
68
|
+
taxonomies: Optional[Annotated[List[ToolComponent], Field(min_length=0)]] = Field(default=None, description="An array of toolComponent objects relevant to a taxonomy in which results are categorized.")
|
69
|
+
addresses: Optional[Annotated[List[Address], Field(min_length=0)]] = Field(default=None, description="Addresses associated with this run instance, if any.")
|
70
|
+
translations: Optional[Annotated[List[ToolComponent], Field(min_length=0)]] = Field(default=None, description="The set of available translations of the localized data provided by the tool.")
|
71
|
+
policies: Optional[Annotated[List[ToolComponent], Field(min_length=0)]] = Field(default=None, description="Contains configurations that may potentially override both reportingDescriptor.defaultConfiguration (the tool's default severities) and invocation.configurationOverrides (severities established at run-time from the command line).")
|
72
|
+
web_requests: Optional[Annotated[List[WebRequest], Field(min_length=0)]] = Field(default=None, description="An array of request objects cached at run level.", alias="webRequests")
|
73
|
+
web_responses: Optional[Annotated[List[WebResponse], Field(min_length=0)]] = Field(default=None, description="An array of response objects cached at run level.", alias="webResponses")
|
74
|
+
special_locations: Optional[SpecialLocations] = Field(default=None, alias="specialLocations")
|
75
|
+
properties: Optional[PropertyBag] = None
|
76
|
+
__properties: ClassVar[List[str]] = ["tool", "invocations", "conversion", "language", "versionControlProvenance", "originalUriBaseIds", "artifacts", "logicalLocations", "graphs", "results", "automationDetails", "runAggregates", "baselineGuid", "redactionTokens", "defaultEncoding", "defaultSourceLanguage", "newlineSequences", "columnKind", "externalPropertyFileReferences", "threadFlowLocations", "taxonomies", "addresses", "translations", "policies", "webRequests", "webResponses", "specialLocations", "properties"]
|
77
|
+
|
78
|
+
@field_validator('language')
|
79
|
+
def language_validate_regular_expression(cls, value):
|
80
|
+
"""Validates the regular expression"""
|
81
|
+
if value is None:
|
82
|
+
return value
|
83
|
+
|
84
|
+
if not re.match(r"^[a-zA-Z]{2}|^[a-zA-Z]{2}-[a-zA-Z]{2}?$", value):
|
85
|
+
raise ValueError(r"must validate the regular expression /^[a-zA-Z]{2}|^[a-zA-Z]{2}-[a-zA-Z]{2}?$/")
|
86
|
+
return value
|
87
|
+
|
88
|
+
@field_validator('baseline_guid')
|
89
|
+
def baseline_guid_validate_regular_expression(cls, value):
|
90
|
+
"""Validates the regular expression"""
|
91
|
+
if value is None:
|
92
|
+
return value
|
93
|
+
|
94
|
+
if not re.match(r"^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-5][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$", value):
|
95
|
+
raise ValueError(r"must validate the regular expression /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-5][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$/")
|
96
|
+
return value
|
97
|
+
|
98
|
+
@field_validator('column_kind')
|
99
|
+
def column_kind_validate_enum(cls, value):
|
100
|
+
"""Validates the enum"""
|
101
|
+
if value is None:
|
102
|
+
return value
|
103
|
+
|
104
|
+
if value not in set(['utf16CodeUnits', 'unicodeCodePoints']):
|
105
|
+
raise ValueError("must be one of enum values ('utf16CodeUnits', 'unicodeCodePoints')")
|
106
|
+
return value
|
107
|
+
|
108
|
+
model_config = ConfigDict(
|
109
|
+
populate_by_name=True,
|
110
|
+
validate_assignment=True,
|
111
|
+
protected_namespaces=(),
|
112
|
+
)
|
113
|
+
|
114
|
+
|
115
|
+
def to_str(self) -> str:
|
116
|
+
"""Returns the string representation of the model using alias"""
|
117
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
118
|
+
|
119
|
+
def to_json(self) -> str:
|
120
|
+
"""Returns the JSON representation of the model using alias"""
|
121
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
122
|
+
return json.dumps(self.to_dict())
|
123
|
+
|
124
|
+
@classmethod
|
125
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
126
|
+
"""Create an instance of Run from a JSON string"""
|
127
|
+
return cls.from_dict(json.loads(json_str))
|
128
|
+
|
129
|
+
def to_dict(self) -> Dict[str, Any]:
|
130
|
+
"""Return the dictionary representation of the model using alias.
|
131
|
+
|
132
|
+
This has the following differences from calling pydantic's
|
133
|
+
`self.model_dump(by_alias=True)`:
|
134
|
+
|
135
|
+
* `None` is only added to the output dict for nullable fields that
|
136
|
+
were set at model initialization. Other fields with value `None`
|
137
|
+
are ignored.
|
138
|
+
"""
|
139
|
+
excluded_fields: Set[str] = set([
|
140
|
+
])
|
141
|
+
|
142
|
+
_dict = self.model_dump(
|
143
|
+
by_alias=True,
|
144
|
+
exclude=excluded_fields,
|
145
|
+
exclude_none=True,
|
146
|
+
)
|
147
|
+
# override the default output from pydantic by calling `to_dict()` of tool
|
148
|
+
if self.tool:
|
149
|
+
_dict['tool'] = self.tool.to_dict()
|
150
|
+
# override the default output from pydantic by calling `to_dict()` of each item in invocations (list)
|
151
|
+
_items = []
|
152
|
+
if self.invocations:
|
153
|
+
for _item in self.invocations:
|
154
|
+
if _item:
|
155
|
+
_items.append(_item.to_dict())
|
156
|
+
_dict['invocations'] = _items
|
157
|
+
# override the default output from pydantic by calling `to_dict()` of conversion
|
158
|
+
if self.conversion:
|
159
|
+
_dict['conversion'] = self.conversion.to_dict()
|
160
|
+
# override the default output from pydantic by calling `to_dict()` of each item in version_control_provenance (list)
|
161
|
+
_items = []
|
162
|
+
if self.version_control_provenance:
|
163
|
+
for _item in self.version_control_provenance:
|
164
|
+
if _item:
|
165
|
+
_items.append(_item.to_dict())
|
166
|
+
_dict['versionControlProvenance'] = _items
|
167
|
+
# override the default output from pydantic by calling `to_dict()` of each value in original_uri_base_ids (dict)
|
168
|
+
_field_dict = {}
|
169
|
+
if self.original_uri_base_ids:
|
170
|
+
for _key in self.original_uri_base_ids:
|
171
|
+
if self.original_uri_base_ids[_key]:
|
172
|
+
_field_dict[_key] = self.original_uri_base_ids[_key].to_dict()
|
173
|
+
_dict['originalUriBaseIds'] = _field_dict
|
174
|
+
# override the default output from pydantic by calling `to_dict()` of each item in artifacts (list)
|
175
|
+
_items = []
|
176
|
+
if self.artifacts:
|
177
|
+
for _item in self.artifacts:
|
178
|
+
if _item:
|
179
|
+
_items.append(_item.to_dict())
|
180
|
+
_dict['artifacts'] = _items
|
181
|
+
# override the default output from pydantic by calling `to_dict()` of each item in logical_locations (list)
|
182
|
+
_items = []
|
183
|
+
if self.logical_locations:
|
184
|
+
for _item in self.logical_locations:
|
185
|
+
if _item:
|
186
|
+
_items.append(_item.to_dict())
|
187
|
+
_dict['logicalLocations'] = _items
|
188
|
+
# override the default output from pydantic by calling `to_dict()` of each item in graphs (list)
|
189
|
+
_items = []
|
190
|
+
if self.graphs:
|
191
|
+
for _item in self.graphs:
|
192
|
+
if _item:
|
193
|
+
_items.append(_item.to_dict())
|
194
|
+
_dict['graphs'] = _items
|
195
|
+
# override the default output from pydantic by calling `to_dict()` of each item in results (list)
|
196
|
+
_items = []
|
197
|
+
if self.results:
|
198
|
+
for _item in self.results:
|
199
|
+
if _item:
|
200
|
+
_items.append(_item.to_dict())
|
201
|
+
_dict['results'] = _items
|
202
|
+
# override the default output from pydantic by calling `to_dict()` of automation_details
|
203
|
+
if self.automation_details:
|
204
|
+
_dict['automationDetails'] = self.automation_details.to_dict()
|
205
|
+
# override the default output from pydantic by calling `to_dict()` of each item in run_aggregates (list)
|
206
|
+
_items = []
|
207
|
+
if self.run_aggregates:
|
208
|
+
for _item in self.run_aggregates:
|
209
|
+
if _item:
|
210
|
+
_items.append(_item.to_dict())
|
211
|
+
_dict['runAggregates'] = _items
|
212
|
+
# override the default output from pydantic by calling `to_dict()` of external_property_file_references
|
213
|
+
if self.external_property_file_references:
|
214
|
+
_dict['externalPropertyFileReferences'] = self.external_property_file_references.to_dict()
|
215
|
+
# override the default output from pydantic by calling `to_dict()` of each item in thread_flow_locations (list)
|
216
|
+
_items = []
|
217
|
+
if self.thread_flow_locations:
|
218
|
+
for _item in self.thread_flow_locations:
|
219
|
+
if _item:
|
220
|
+
_items.append(_item.to_dict())
|
221
|
+
_dict['threadFlowLocations'] = _items
|
222
|
+
# override the default output from pydantic by calling `to_dict()` of each item in taxonomies (list)
|
223
|
+
_items = []
|
224
|
+
if self.taxonomies:
|
225
|
+
for _item in self.taxonomies:
|
226
|
+
if _item:
|
227
|
+
_items.append(_item.to_dict())
|
228
|
+
_dict['taxonomies'] = _items
|
229
|
+
# override the default output from pydantic by calling `to_dict()` of each item in addresses (list)
|
230
|
+
_items = []
|
231
|
+
if self.addresses:
|
232
|
+
for _item in self.addresses:
|
233
|
+
if _item:
|
234
|
+
_items.append(_item.to_dict())
|
235
|
+
_dict['addresses'] = _items
|
236
|
+
# override the default output from pydantic by calling `to_dict()` of each item in translations (list)
|
237
|
+
_items = []
|
238
|
+
if self.translations:
|
239
|
+
for _item in self.translations:
|
240
|
+
if _item:
|
241
|
+
_items.append(_item.to_dict())
|
242
|
+
_dict['translations'] = _items
|
243
|
+
# override the default output from pydantic by calling `to_dict()` of each item in policies (list)
|
244
|
+
_items = []
|
245
|
+
if self.policies:
|
246
|
+
for _item in self.policies:
|
247
|
+
if _item:
|
248
|
+
_items.append(_item.to_dict())
|
249
|
+
_dict['policies'] = _items
|
250
|
+
# override the default output from pydantic by calling `to_dict()` of each item in web_requests (list)
|
251
|
+
_items = []
|
252
|
+
if self.web_requests:
|
253
|
+
for _item in self.web_requests:
|
254
|
+
if _item:
|
255
|
+
_items.append(_item.to_dict())
|
256
|
+
_dict['webRequests'] = _items
|
257
|
+
# override the default output from pydantic by calling `to_dict()` of each item in web_responses (list)
|
258
|
+
_items = []
|
259
|
+
if self.web_responses:
|
260
|
+
for _item in self.web_responses:
|
261
|
+
if _item:
|
262
|
+
_items.append(_item.to_dict())
|
263
|
+
_dict['webResponses'] = _items
|
264
|
+
# override the default output from pydantic by calling `to_dict()` of special_locations
|
265
|
+
if self.special_locations:
|
266
|
+
_dict['specialLocations'] = self.special_locations.to_dict()
|
267
|
+
# override the default output from pydantic by calling `to_dict()` of properties
|
268
|
+
if self.properties:
|
269
|
+
_dict['properties'] = self.properties.to_dict()
|
270
|
+
return _dict
|
271
|
+
|
272
|
+
@classmethod
|
273
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
274
|
+
"""Create an instance of Run from a dict"""
|
275
|
+
if obj is None:
|
276
|
+
return None
|
277
|
+
|
278
|
+
if not isinstance(obj, dict):
|
279
|
+
return cls.model_validate(obj)
|
280
|
+
|
281
|
+
_obj = cls.model_validate({
|
282
|
+
"tool": Tool.from_dict(obj["tool"]) if obj.get("tool") is not None else None,
|
283
|
+
"invocations": [Invocation.from_dict(_item) for _item in obj["invocations"]] if obj.get("invocations") is not None else None,
|
284
|
+
"conversion": Conversion.from_dict(obj["conversion"]) if obj.get("conversion") is not None else None,
|
285
|
+
"language": obj.get("language") if obj.get("language") is not None else 'en-US',
|
286
|
+
"versionControlProvenance": [VersionControlDetails.from_dict(_item) for _item in obj["versionControlProvenance"]] if obj.get("versionControlProvenance") is not None else None,
|
287
|
+
"originalUriBaseIds": dict(
|
288
|
+
(_k, ArtifactLocation.from_dict(_v))
|
289
|
+
for _k, _v in obj["originalUriBaseIds"].items()
|
290
|
+
)
|
291
|
+
if obj.get("originalUriBaseIds") is not None
|
292
|
+
else None,
|
293
|
+
"artifacts": [Artifact.from_dict(_item) for _item in obj["artifacts"]] if obj.get("artifacts") is not None else None,
|
294
|
+
"logicalLocations": [LogicalLocation.from_dict(_item) for _item in obj["logicalLocations"]] if obj.get("logicalLocations") is not None else None,
|
295
|
+
"graphs": [Graph.from_dict(_item) for _item in obj["graphs"]] if obj.get("graphs") is not None else None,
|
296
|
+
"results": [Result.from_dict(_item) for _item in obj["results"]] if obj.get("results") is not None else None,
|
297
|
+
"automationDetails": RunAutomationDetails.from_dict(obj["automationDetails"]) if obj.get("automationDetails") is not None else None,
|
298
|
+
"runAggregates": [RunAutomationDetails.from_dict(_item) for _item in obj["runAggregates"]] if obj.get("runAggregates") is not None else None,
|
299
|
+
"baselineGuid": obj.get("baselineGuid"),
|
300
|
+
"redactionTokens": obj.get("redactionTokens"),
|
301
|
+
"defaultEncoding": obj.get("defaultEncoding"),
|
302
|
+
"defaultSourceLanguage": obj.get("defaultSourceLanguage"),
|
303
|
+
"newlineSequences": obj.get("newlineSequences"),
|
304
|
+
"columnKind": obj.get("columnKind"),
|
305
|
+
"externalPropertyFileReferences": ExternalPropertyFileReferences.from_dict(obj["externalPropertyFileReferences"]) if obj.get("externalPropertyFileReferences") is not None else None,
|
306
|
+
"threadFlowLocations": [ThreadFlowLocation.from_dict(_item) for _item in obj["threadFlowLocations"]] if obj.get("threadFlowLocations") is not None else None,
|
307
|
+
"taxonomies": [ToolComponent.from_dict(_item) for _item in obj["taxonomies"]] if obj.get("taxonomies") is not None else None,
|
308
|
+
"addresses": [Address.from_dict(_item) for _item in obj["addresses"]] if obj.get("addresses") is not None else None,
|
309
|
+
"translations": [ToolComponent.from_dict(_item) for _item in obj["translations"]] if obj.get("translations") is not None else None,
|
310
|
+
"policies": [ToolComponent.from_dict(_item) for _item in obj["policies"]] if obj.get("policies") is not None else None,
|
311
|
+
"webRequests": [WebRequest.from_dict(_item) for _item in obj["webRequests"]] if obj.get("webRequests") is not None else None,
|
312
|
+
"webResponses": [WebResponse.from_dict(_item) for _item in obj["webResponses"]] if obj.get("webResponses") is not None else None,
|
313
|
+
"specialLocations": SpecialLocations.from_dict(obj["specialLocations"]) if obj.get("specialLocations") is not None else None,
|
314
|
+
"properties": PropertyBag.from_dict(obj["properties"]) if obj.get("properties") is not None else None
|
315
|
+
})
|
316
|
+
return _obj
|
317
|
+
|
318
|
+
|
@@ -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, StrictStr, field_validator
|
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 typing import Optional, Set
|
26
|
+
from typing_extensions import Self
|
27
|
+
|
28
|
+
class RunAutomationDetails(BaseModel):
|
29
|
+
"""
|
30
|
+
Information that describes a run's identity and role within an engineering system process.
|
31
|
+
""" # noqa: E501
|
32
|
+
description: Optional[Message] = None
|
33
|
+
id: Optional[StrictStr] = Field(default=None, description="A hierarchical string that uniquely identifies this object's containing run object.")
|
34
|
+
guid: Optional[Annotated[str, Field(strict=True)]] = Field(default=None, description="A stable, unique identifier for this object's containing run object in the form of a GUID.")
|
35
|
+
correlation_guid: Optional[Annotated[str, Field(strict=True)]] = Field(default=None, description="A stable, unique identifier for the equivalence class of runs to which this object's containing run object belongs in the form of a GUID.", alias="correlationGuid")
|
36
|
+
properties: Optional[PropertyBag] = None
|
37
|
+
__properties: ClassVar[List[str]] = ["description", "id", "guid", "correlationGuid", "properties"]
|
38
|
+
|
39
|
+
@field_validator('guid')
|
40
|
+
def guid_validate_regular_expression(cls, value):
|
41
|
+
"""Validates the regular expression"""
|
42
|
+
if value is None:
|
43
|
+
return value
|
44
|
+
|
45
|
+
if not re.match(r"^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-5][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$", value):
|
46
|
+
raise ValueError(r"must validate the regular expression /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-5][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$/")
|
47
|
+
return value
|
48
|
+
|
49
|
+
@field_validator('correlation_guid')
|
50
|
+
def correlation_guid_validate_regular_expression(cls, value):
|
51
|
+
"""Validates the regular expression"""
|
52
|
+
if value is None:
|
53
|
+
return value
|
54
|
+
|
55
|
+
if not re.match(r"^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-5][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$", value):
|
56
|
+
raise ValueError(r"must validate the regular expression /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-5][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$/")
|
57
|
+
return value
|
58
|
+
|
59
|
+
model_config = ConfigDict(
|
60
|
+
populate_by_name=True,
|
61
|
+
validate_assignment=True,
|
62
|
+
protected_namespaces=(),
|
63
|
+
)
|
64
|
+
|
65
|
+
|
66
|
+
def to_str(self) -> str:
|
67
|
+
"""Returns the string representation of the model using alias"""
|
68
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
69
|
+
|
70
|
+
def to_json(self) -> str:
|
71
|
+
"""Returns the JSON representation of the model using alias"""
|
72
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
73
|
+
return json.dumps(self.to_dict())
|
74
|
+
|
75
|
+
@classmethod
|
76
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
77
|
+
"""Create an instance of RunAutomationDetails from a JSON string"""
|
78
|
+
return cls.from_dict(json.loads(json_str))
|
79
|
+
|
80
|
+
def to_dict(self) -> Dict[str, Any]:
|
81
|
+
"""Return the dictionary representation of the model using alias.
|
82
|
+
|
83
|
+
This has the following differences from calling pydantic's
|
84
|
+
`self.model_dump(by_alias=True)`:
|
85
|
+
|
86
|
+
* `None` is only added to the output dict for nullable fields that
|
87
|
+
were set at model initialization. Other fields with value `None`
|
88
|
+
are ignored.
|
89
|
+
"""
|
90
|
+
excluded_fields: Set[str] = set([
|
91
|
+
])
|
92
|
+
|
93
|
+
_dict = self.model_dump(
|
94
|
+
by_alias=True,
|
95
|
+
exclude=excluded_fields,
|
96
|
+
exclude_none=True,
|
97
|
+
)
|
98
|
+
# override the default output from pydantic by calling `to_dict()` of description
|
99
|
+
if self.description:
|
100
|
+
_dict['description'] = self.description.to_dict()
|
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 RunAutomationDetails 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
|
+
"id": obj.get("id"),
|
123
|
+
"guid": obj.get("guid"),
|
124
|
+
"correlationGuid": obj.get("correlationGuid"),
|
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,123 @@
|
|
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, field_validator
|
21
|
+
from typing import Any, ClassVar, Dict, List, Optional
|
22
|
+
from typing_extensions import Annotated
|
23
|
+
from hiddenlayer.sdk.rest.models.external_properties import ExternalProperties
|
24
|
+
from hiddenlayer.sdk.rest.models.property_bag import PropertyBag
|
25
|
+
from hiddenlayer.sdk.rest.models.run import Run
|
26
|
+
from typing import Optional, Set
|
27
|
+
from typing_extensions import Self
|
28
|
+
|
29
|
+
class Sarif210(BaseModel):
|
30
|
+
"""
|
31
|
+
Static Analysis Results Format (SARIF) Version 2.1.0 JSON Schema: a standard format for the output of static analysis tools.
|
32
|
+
""" # noqa: E501
|
33
|
+
var_schema: Optional[StrictStr] = Field(default=None, description="The URI of the JSON schema corresponding to the version.", alias="$schema")
|
34
|
+
version: Dict[str, Any] = Field(description="The SARIF format version of this log file.")
|
35
|
+
runs: Annotated[List[Run], Field(min_length=0)] = Field(description="The set of runs contained in this log file.")
|
36
|
+
inline_external_properties: Optional[Annotated[List[ExternalProperties], Field(min_length=0)]] = Field(default=None, description="References to external property files that share data between runs.", alias="inlineExternalProperties")
|
37
|
+
properties: Optional[PropertyBag] = None
|
38
|
+
__properties: ClassVar[List[str]] = ["$schema", "version", "runs", "inlineExternalProperties", "properties"]
|
39
|
+
|
40
|
+
@field_validator('version')
|
41
|
+
def version_validate_enum(cls, value):
|
42
|
+
"""Validates the enum"""
|
43
|
+
if value not in set(['2.1.0']):
|
44
|
+
raise ValueError("must be one of enum values ('2.1.0')")
|
45
|
+
return value
|
46
|
+
|
47
|
+
model_config = ConfigDict(
|
48
|
+
populate_by_name=True,
|
49
|
+
validate_assignment=True,
|
50
|
+
protected_namespaces=(),
|
51
|
+
)
|
52
|
+
|
53
|
+
|
54
|
+
def to_str(self) -> str:
|
55
|
+
"""Returns the string representation of the model using alias"""
|
56
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
57
|
+
|
58
|
+
def to_json(self) -> str:
|
59
|
+
"""Returns the JSON representation of the model using alias"""
|
60
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
61
|
+
return json.dumps(self.to_dict())
|
62
|
+
|
63
|
+
@classmethod
|
64
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
65
|
+
"""Create an instance of Sarif210 from a JSON string"""
|
66
|
+
return cls.from_dict(json.loads(json_str))
|
67
|
+
|
68
|
+
def to_dict(self) -> Dict[str, Any]:
|
69
|
+
"""Return the dictionary representation of the model using alias.
|
70
|
+
|
71
|
+
This has the following differences from calling pydantic's
|
72
|
+
`self.model_dump(by_alias=True)`:
|
73
|
+
|
74
|
+
* `None` is only added to the output dict for nullable fields that
|
75
|
+
were set at model initialization. Other fields with value `None`
|
76
|
+
are ignored.
|
77
|
+
"""
|
78
|
+
excluded_fields: Set[str] = set([
|
79
|
+
])
|
80
|
+
|
81
|
+
_dict = self.model_dump(
|
82
|
+
by_alias=True,
|
83
|
+
exclude=excluded_fields,
|
84
|
+
exclude_none=True,
|
85
|
+
)
|
86
|
+
# override the default output from pydantic by calling `to_dict()` of each item in runs (list)
|
87
|
+
_items = []
|
88
|
+
if self.runs:
|
89
|
+
for _item in self.runs:
|
90
|
+
if _item:
|
91
|
+
_items.append(_item.to_dict())
|
92
|
+
_dict['runs'] = _items
|
93
|
+
# override the default output from pydantic by calling `to_dict()` of each item in inline_external_properties (list)
|
94
|
+
_items = []
|
95
|
+
if self.inline_external_properties:
|
96
|
+
for _item in self.inline_external_properties:
|
97
|
+
if _item:
|
98
|
+
_items.append(_item.to_dict())
|
99
|
+
_dict['inlineExternalProperties'] = _items
|
100
|
+
# override the default output from pydantic by calling `to_dict()` of properties
|
101
|
+
if self.properties:
|
102
|
+
_dict['properties'] = self.properties.to_dict()
|
103
|
+
return _dict
|
104
|
+
|
105
|
+
@classmethod
|
106
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
107
|
+
"""Create an instance of Sarif210 from a dict"""
|
108
|
+
if obj is None:
|
109
|
+
return None
|
110
|
+
|
111
|
+
if not isinstance(obj, dict):
|
112
|
+
return cls.model_validate(obj)
|
113
|
+
|
114
|
+
_obj = cls.model_validate({
|
115
|
+
"$schema": obj.get("$schema"),
|
116
|
+
"version": obj.get("version"),
|
117
|
+
"runs": [Run.from_dict(_item) for _item in obj["runs"]] if obj.get("runs") is not None else None,
|
118
|
+
"inlineExternalProperties": [ExternalProperties.from_dict(_item) for _item in obj["inlineExternalProperties"]] if obj.get("inlineExternalProperties") is not None else None,
|
119
|
+
"properties": PropertyBag.from_dict(obj["properties"]) if obj.get("properties") is not None else None
|
120
|
+
})
|
121
|
+
return _obj
|
122
|
+
|
123
|
+
|
@@ -0,0 +1,87 @@
|
|
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
|
22
|
+
from typing import Optional, Set
|
23
|
+
from typing_extensions import Self
|
24
|
+
|
25
|
+
class ScanCreateRequest(BaseModel):
|
26
|
+
"""
|
27
|
+
ScanCreateRequest
|
28
|
+
""" # noqa: E501
|
29
|
+
location: StrictStr
|
30
|
+
__properties: ClassVar[List[str]] = ["location"]
|
31
|
+
|
32
|
+
model_config = ConfigDict(
|
33
|
+
populate_by_name=True,
|
34
|
+
validate_assignment=True,
|
35
|
+
protected_namespaces=(),
|
36
|
+
)
|
37
|
+
|
38
|
+
|
39
|
+
def to_str(self) -> str:
|
40
|
+
"""Returns the string representation of the model using alias"""
|
41
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
42
|
+
|
43
|
+
def to_json(self) -> str:
|
44
|
+
"""Returns the JSON representation of the model using alias"""
|
45
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
46
|
+
return json.dumps(self.to_dict())
|
47
|
+
|
48
|
+
@classmethod
|
49
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
50
|
+
"""Create an instance of ScanCreateRequest from a JSON string"""
|
51
|
+
return cls.from_dict(json.loads(json_str))
|
52
|
+
|
53
|
+
def to_dict(self) -> Dict[str, Any]:
|
54
|
+
"""Return the dictionary representation of the model using alias.
|
55
|
+
|
56
|
+
This has the following differences from calling pydantic's
|
57
|
+
`self.model_dump(by_alias=True)`:
|
58
|
+
|
59
|
+
* `None` is only added to the output dict for nullable fields that
|
60
|
+
were set at model initialization. Other fields with value `None`
|
61
|
+
are ignored.
|
62
|
+
"""
|
63
|
+
excluded_fields: Set[str] = set([
|
64
|
+
])
|
65
|
+
|
66
|
+
_dict = self.model_dump(
|
67
|
+
by_alias=True,
|
68
|
+
exclude=excluded_fields,
|
69
|
+
exclude_none=True,
|
70
|
+
)
|
71
|
+
return _dict
|
72
|
+
|
73
|
+
@classmethod
|
74
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
75
|
+
"""Create an instance of ScanCreateRequest from a dict"""
|
76
|
+
if obj is None:
|
77
|
+
return None
|
78
|
+
|
79
|
+
if not isinstance(obj, dict):
|
80
|
+
return cls.model_validate(obj)
|
81
|
+
|
82
|
+
_obj = cls.model_validate({
|
83
|
+
"location": obj.get("location")
|
84
|
+
})
|
85
|
+
return _obj
|
86
|
+
|
87
|
+
|