hiddenlayer-sdk 0.1.1__py3-none-any.whl → 1.0.0__py3-none-any.whl
Sign up to get free protection for your applications and to get access to all the features.
- 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.1.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.1.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.1.dist-info/RECORD +0 -43
- {hiddenlayer_sdk-0.1.1.dist-info → hiddenlayer_sdk-1.0.0.dist-info}/LICENSE +0 -0
- {hiddenlayer_sdk-0.1.1.dist-info → hiddenlayer_sdk-1.0.0.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,110 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
"""
|
4
|
+
HiddenLayer ModelScan V2
|
5
|
+
|
6
|
+
HiddenLayer ModelScan API for scanning of models
|
7
|
+
|
8
|
+
The version of the OpenAPI document: 1
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
10
|
+
|
11
|
+
Do not edit the class manually.
|
12
|
+
""" # noqa: E501
|
13
|
+
|
14
|
+
|
15
|
+
from __future__ import annotations
|
16
|
+
import pprint
|
17
|
+
import re # noqa: F401
|
18
|
+
import json
|
19
|
+
|
20
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr
|
21
|
+
from typing import Any, ClassVar, Dict, List, Optional
|
22
|
+
from typing_extensions import Annotated
|
23
|
+
from hiddenlayer.sdk.rest.models.property_bag import PropertyBag
|
24
|
+
from typing import Optional, Set
|
25
|
+
from typing_extensions import Self
|
26
|
+
|
27
|
+
class Address(BaseModel):
|
28
|
+
"""
|
29
|
+
A physical or virtual address, or a range of addresses, in an 'addressable region' (memory or a binary file).
|
30
|
+
""" # noqa: E501
|
31
|
+
absolute_address: Optional[Annotated[int, Field(strict=True, ge=-1)]] = Field(default=-1, description="The address expressed as a byte offset from the start of the addressable region.", alias="absoluteAddress")
|
32
|
+
relative_address: Optional[StrictInt] = Field(default=None, description="The address expressed as a byte offset from the absolute address of the top-most parent object.", alias="relativeAddress")
|
33
|
+
length: Optional[StrictInt] = Field(default=None, description="The number of bytes in this range of addresses.")
|
34
|
+
kind: Optional[StrictStr] = Field(default=None, description="An open-ended string that identifies the address kind. 'data', 'function', 'header','instruction', 'module', 'page', 'section', 'segment', 'stack', 'stackFrame', 'table' are well-known values.")
|
35
|
+
name: Optional[StrictStr] = Field(default=None, description="A name that is associated with the address, e.g., '.text'.")
|
36
|
+
fully_qualified_name: Optional[StrictStr] = Field(default=None, description="A human-readable fully qualified name that is associated with the address.", alias="fullyQualifiedName")
|
37
|
+
offset_from_parent: Optional[StrictInt] = Field(default=None, description="The byte offset of this address from the absolute or relative address of the parent object.", alias="offsetFromParent")
|
38
|
+
index: Optional[Annotated[int, Field(strict=True, ge=-1)]] = Field(default=-1, description="The index within run.addresses of the cached object for this address.")
|
39
|
+
parent_index: Optional[Annotated[int, Field(strict=True, ge=-1)]] = Field(default=-1, description="The index within run.addresses of the parent object.", alias="parentIndex")
|
40
|
+
properties: Optional[PropertyBag] = None
|
41
|
+
__properties: ClassVar[List[str]] = ["absoluteAddress", "relativeAddress", "length", "kind", "name", "fullyQualifiedName", "offsetFromParent", "index", "parentIndex", "properties"]
|
42
|
+
|
43
|
+
model_config = ConfigDict(
|
44
|
+
populate_by_name=True,
|
45
|
+
validate_assignment=True,
|
46
|
+
protected_namespaces=(),
|
47
|
+
)
|
48
|
+
|
49
|
+
|
50
|
+
def to_str(self) -> str:
|
51
|
+
"""Returns the string representation of the model using alias"""
|
52
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
53
|
+
|
54
|
+
def to_json(self) -> str:
|
55
|
+
"""Returns the JSON representation of the model using alias"""
|
56
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
57
|
+
return json.dumps(self.to_dict())
|
58
|
+
|
59
|
+
@classmethod
|
60
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
61
|
+
"""Create an instance of Address from a JSON string"""
|
62
|
+
return cls.from_dict(json.loads(json_str))
|
63
|
+
|
64
|
+
def to_dict(self) -> Dict[str, Any]:
|
65
|
+
"""Return the dictionary representation of the model using alias.
|
66
|
+
|
67
|
+
This has the following differences from calling pydantic's
|
68
|
+
`self.model_dump(by_alias=True)`:
|
69
|
+
|
70
|
+
* `None` is only added to the output dict for nullable fields that
|
71
|
+
were set at model initialization. Other fields with value `None`
|
72
|
+
are ignored.
|
73
|
+
"""
|
74
|
+
excluded_fields: Set[str] = set([
|
75
|
+
])
|
76
|
+
|
77
|
+
_dict = self.model_dump(
|
78
|
+
by_alias=True,
|
79
|
+
exclude=excluded_fields,
|
80
|
+
exclude_none=True,
|
81
|
+
)
|
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
|
+
return _dict
|
86
|
+
|
87
|
+
@classmethod
|
88
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
89
|
+
"""Create an instance of Address from a dict"""
|
90
|
+
if obj is None:
|
91
|
+
return None
|
92
|
+
|
93
|
+
if not isinstance(obj, dict):
|
94
|
+
return cls.model_validate(obj)
|
95
|
+
|
96
|
+
_obj = cls.model_validate({
|
97
|
+
"absoluteAddress": obj.get("absoluteAddress") if obj.get("absoluteAddress") is not None else -1,
|
98
|
+
"relativeAddress": obj.get("relativeAddress"),
|
99
|
+
"length": obj.get("length"),
|
100
|
+
"kind": obj.get("kind"),
|
101
|
+
"name": obj.get("name"),
|
102
|
+
"fullyQualifiedName": obj.get("fullyQualifiedName"),
|
103
|
+
"offsetFromParent": obj.get("offsetFromParent"),
|
104
|
+
"index": obj.get("index") if obj.get("index") is not None else -1,
|
105
|
+
"parentIndex": obj.get("parentIndex") if obj.get("parentIndex") is not None else -1,
|
106
|
+
"properties": PropertyBag.from_dict(obj["properties"]) if obj.get("properties") is not None else None
|
107
|
+
})
|
108
|
+
return _obj
|
109
|
+
|
110
|
+
|
@@ -0,0 +1,155 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
"""
|
4
|
+
HiddenLayer ModelScan V2
|
5
|
+
|
6
|
+
HiddenLayer ModelScan API for scanning of models
|
7
|
+
|
8
|
+
The version of the OpenAPI document: 1
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
10
|
+
|
11
|
+
Do not edit the class manually.
|
12
|
+
""" # noqa: E501
|
13
|
+
|
14
|
+
|
15
|
+
from __future__ import annotations
|
16
|
+
import pprint
|
17
|
+
import re # noqa: F401
|
18
|
+
import json
|
19
|
+
|
20
|
+
from datetime import datetime
|
21
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator
|
22
|
+
from typing import Any, ClassVar, Dict, List, Optional
|
23
|
+
from typing_extensions import Annotated
|
24
|
+
from hiddenlayer.sdk.rest.models.artifact_content import ArtifactContent
|
25
|
+
from hiddenlayer.sdk.rest.models.artifact_location import ArtifactLocation
|
26
|
+
from hiddenlayer.sdk.rest.models.message import Message
|
27
|
+
from hiddenlayer.sdk.rest.models.property_bag import PropertyBag
|
28
|
+
from typing import Optional, Set
|
29
|
+
from typing_extensions import Self
|
30
|
+
|
31
|
+
class Artifact(BaseModel):
|
32
|
+
"""
|
33
|
+
A single artifact. In some cases, this artifact might be nested within another artifact.
|
34
|
+
""" # noqa: E501
|
35
|
+
description: Optional[Message] = None
|
36
|
+
location: Optional[ArtifactLocation] = None
|
37
|
+
parent_index: Optional[Annotated[int, Field(strict=True, ge=-1)]] = Field(default=-1, description="Identifies the index of the immediate parent of the artifact, if this artifact is nested.", alias="parentIndex")
|
38
|
+
offset: Optional[Annotated[int, Field(strict=True, ge=0)]] = Field(default=None, description="The offset in bytes of the artifact within its containing artifact.")
|
39
|
+
length: Optional[Annotated[int, Field(strict=True, ge=-1)]] = Field(default=-1, description="The length of the artifact in bytes.")
|
40
|
+
roles: Optional[Annotated[List[StrictStr], Field(min_length=0)]] = Field(default=None, description="The role or roles played by the artifact in the analysis.")
|
41
|
+
mime_type: Optional[Annotated[str, Field(strict=True)]] = Field(default=None, description="The MIME type (RFC 2045) of the artifact.", alias="mimeType")
|
42
|
+
contents: Optional[ArtifactContent] = None
|
43
|
+
encoding: Optional[StrictStr] = Field(default=None, description="Specifies the encoding for an artifact object that refers to a text file.")
|
44
|
+
source_language: Optional[StrictStr] = Field(default=None, description="Specifies the source language for any artifact object that refers to a text file that contains source code.", alias="sourceLanguage")
|
45
|
+
hashes: Optional[Dict[str, StrictStr]] = Field(default=None, description="A dictionary, each of whose keys is the name of a hash function and each of whose values is the hashed value of the artifact produced by the specified hash function.")
|
46
|
+
last_modified_time_utc: Optional[datetime] = Field(default=None, description="The Coordinated Universal Time (UTC) date and time at which the artifact was most recently modified. See \"Date/time properties\" in the SARIF spec for the required format.", alias="lastModifiedTimeUtc")
|
47
|
+
properties: Optional[PropertyBag] = None
|
48
|
+
__properties: ClassVar[List[str]] = ["description", "location", "parentIndex", "offset", "length", "roles", "mimeType", "contents", "encoding", "sourceLanguage", "hashes", "lastModifiedTimeUtc", "properties"]
|
49
|
+
|
50
|
+
@field_validator('roles')
|
51
|
+
def roles_validate_enum(cls, value):
|
52
|
+
"""Validates the enum"""
|
53
|
+
if value is None:
|
54
|
+
return value
|
55
|
+
|
56
|
+
for i in value:
|
57
|
+
if i not in set(['analysisTarget', 'attachment', 'responseFile', 'resultFile', 'standardStream', 'tracedFile', 'unmodified', 'modified', 'added', 'deleted', 'renamed', 'uncontrolled', 'driver', 'extension', 'translation', 'taxonomy', 'policy', 'referencedOnCommandLine', 'memoryContents', 'directory', 'userSpecifiedConfiguration', 'toolSpecifiedConfiguration', 'debugOutputFile']):
|
58
|
+
raise ValueError("each list item must be one of ('analysisTarget', 'attachment', 'responseFile', 'resultFile', 'standardStream', 'tracedFile', 'unmodified', 'modified', 'added', 'deleted', 'renamed', 'uncontrolled', 'driver', 'extension', 'translation', 'taxonomy', 'policy', 'referencedOnCommandLine', 'memoryContents', 'directory', 'userSpecifiedConfiguration', 'toolSpecifiedConfiguration', 'debugOutputFile')")
|
59
|
+
return value
|
60
|
+
|
61
|
+
@field_validator('mime_type')
|
62
|
+
def mime_type_validate_regular_expression(cls, value):
|
63
|
+
"""Validates the regular expression"""
|
64
|
+
if value is None:
|
65
|
+
return value
|
66
|
+
|
67
|
+
if not re.match(r"[^\/]+\/.+", value):
|
68
|
+
raise ValueError(r"must validate the regular expression /[^\/]+\/.+/")
|
69
|
+
return value
|
70
|
+
|
71
|
+
model_config = ConfigDict(
|
72
|
+
populate_by_name=True,
|
73
|
+
validate_assignment=True,
|
74
|
+
protected_namespaces=(),
|
75
|
+
)
|
76
|
+
|
77
|
+
|
78
|
+
def to_str(self) -> str:
|
79
|
+
"""Returns the string representation of the model using alias"""
|
80
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
81
|
+
|
82
|
+
def to_json(self) -> str:
|
83
|
+
"""Returns the JSON representation of the model using alias"""
|
84
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
85
|
+
return json.dumps(self.to_dict())
|
86
|
+
|
87
|
+
@classmethod
|
88
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
89
|
+
"""Create an instance of Artifact from a JSON string"""
|
90
|
+
return cls.from_dict(json.loads(json_str))
|
91
|
+
|
92
|
+
def to_dict(self) -> Dict[str, Any]:
|
93
|
+
"""Return the dictionary representation of the model using alias.
|
94
|
+
|
95
|
+
This has the following differences from calling pydantic's
|
96
|
+
`self.model_dump(by_alias=True)`:
|
97
|
+
|
98
|
+
* `None` is only added to the output dict for nullable fields that
|
99
|
+
were set at model initialization. Other fields with value `None`
|
100
|
+
are ignored.
|
101
|
+
"""
|
102
|
+
excluded_fields: Set[str] = set([
|
103
|
+
])
|
104
|
+
|
105
|
+
_dict = self.model_dump(
|
106
|
+
by_alias=True,
|
107
|
+
exclude=excluded_fields,
|
108
|
+
exclude_none=True,
|
109
|
+
)
|
110
|
+
# override the default output from pydantic by calling `to_dict()` of description
|
111
|
+
if self.description:
|
112
|
+
_dict['description'] = self.description.to_dict()
|
113
|
+
# override the default output from pydantic by calling `to_dict()` of location
|
114
|
+
if self.location:
|
115
|
+
_dict['location'] = self.location.to_dict()
|
116
|
+
# override the default output from pydantic by calling `to_dict()` of contents
|
117
|
+
if self.contents:
|
118
|
+
_dict['contents'] = self.contents.to_dict()
|
119
|
+
# override the default output from pydantic by calling `to_dict()` of properties
|
120
|
+
if self.properties:
|
121
|
+
_dict['properties'] = self.properties.to_dict()
|
122
|
+
# set to None if description (nullable) is None
|
123
|
+
# and model_fields_set contains the field
|
124
|
+
if self.description is None and "description" in self.model_fields_set:
|
125
|
+
_dict['description'] = None
|
126
|
+
|
127
|
+
return _dict
|
128
|
+
|
129
|
+
@classmethod
|
130
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
131
|
+
"""Create an instance of Artifact from a dict"""
|
132
|
+
if obj is None:
|
133
|
+
return None
|
134
|
+
|
135
|
+
if not isinstance(obj, dict):
|
136
|
+
return cls.model_validate(obj)
|
137
|
+
|
138
|
+
_obj = cls.model_validate({
|
139
|
+
"description": Message.from_dict(obj["description"]) if obj.get("description") is not None else None,
|
140
|
+
"location": ArtifactLocation.from_dict(obj["location"]) if obj.get("location") is not None else None,
|
141
|
+
"parentIndex": obj.get("parentIndex") if obj.get("parentIndex") is not None else -1,
|
142
|
+
"offset": obj.get("offset"),
|
143
|
+
"length": obj.get("length") if obj.get("length") is not None else -1,
|
144
|
+
"roles": obj.get("roles"),
|
145
|
+
"mimeType": obj.get("mimeType"),
|
146
|
+
"contents": ArtifactContent.from_dict(obj["contents"]) if obj.get("contents") is not None else None,
|
147
|
+
"encoding": obj.get("encoding"),
|
148
|
+
"sourceLanguage": obj.get("sourceLanguage"),
|
149
|
+
"hashes": obj.get("hashes"),
|
150
|
+
"lastModifiedTimeUtc": obj.get("lastModifiedTimeUtc"),
|
151
|
+
"properties": PropertyBag.from_dict(obj["properties"]) if obj.get("properties") is not None else None
|
152
|
+
})
|
153
|
+
return _obj
|
154
|
+
|
155
|
+
|
@@ -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
|
21
|
+
from typing import Any, ClassVar, Dict, List, Optional
|
22
|
+
from typing_extensions import Annotated
|
23
|
+
from hiddenlayer.sdk.rest.models.artifact_location import ArtifactLocation
|
24
|
+
from hiddenlayer.sdk.rest.models.property_bag import PropertyBag
|
25
|
+
from hiddenlayer.sdk.rest.models.replacement import Replacement
|
26
|
+
from typing import Optional, Set
|
27
|
+
from typing_extensions import Self
|
28
|
+
|
29
|
+
class ArtifactChange(BaseModel):
|
30
|
+
"""
|
31
|
+
A change to a single artifact.
|
32
|
+
""" # noqa: E501
|
33
|
+
artifact_location: ArtifactLocation = Field(alias="artifactLocation")
|
34
|
+
replacements: Annotated[List[Replacement], Field(min_length=1)] = Field(description="An array of replacement objects, each of which represents the replacement of a single region in a single artifact specified by 'artifactLocation'.")
|
35
|
+
properties: Optional[PropertyBag] = None
|
36
|
+
__properties: ClassVar[List[str]] = ["artifactLocation", "replacements", "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 ArtifactChange 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 artifact_location
|
78
|
+
if self.artifact_location:
|
79
|
+
_dict['artifactLocation'] = self.artifact_location.to_dict()
|
80
|
+
# override the default output from pydantic by calling `to_dict()` of each item in replacements (list)
|
81
|
+
_items = []
|
82
|
+
if self.replacements:
|
83
|
+
for _item in self.replacements:
|
84
|
+
if _item:
|
85
|
+
_items.append(_item.to_dict())
|
86
|
+
_dict['replacements'] = _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
|
+
return _dict
|
91
|
+
|
92
|
+
@classmethod
|
93
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
94
|
+
"""Create an instance of ArtifactChange 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
|
+
"artifactLocation": ArtifactLocation.from_dict(obj["artifactLocation"]) if obj.get("artifactLocation") is not None else None,
|
103
|
+
"replacements": [Replacement.from_dict(_item) for _item in obj["replacements"]] if obj.get("replacements") 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,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, Field, StrictStr
|
21
|
+
from typing import Any, ClassVar, Dict, List, Optional
|
22
|
+
from hiddenlayer.sdk.rest.models.multiformat_message_string import MultiformatMessageString
|
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 ArtifactContent(BaseModel):
|
28
|
+
"""
|
29
|
+
Represents the contents of an artifact.
|
30
|
+
""" # noqa: E501
|
31
|
+
text: Optional[StrictStr] = Field(default=None, description="UTF-8-encoded content from a text artifact.")
|
32
|
+
binary: Optional[StrictStr] = Field(default=None, description="MIME Base64-encoded content from a binary artifact, or from a text artifact in its original encoding.")
|
33
|
+
rendered: Optional[MultiformatMessageString] = None
|
34
|
+
properties: Optional[PropertyBag] = None
|
35
|
+
__properties: ClassVar[List[str]] = ["text", "binary", "rendered", "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 ArtifactContent 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 rendered
|
77
|
+
if self.rendered:
|
78
|
+
_dict['rendered'] = self.rendered.to_dict()
|
79
|
+
# override the default output from pydantic by calling `to_dict()` of properties
|
80
|
+
if self.properties:
|
81
|
+
_dict['properties'] = self.properties.to_dict()
|
82
|
+
return _dict
|
83
|
+
|
84
|
+
@classmethod
|
85
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
86
|
+
"""Create an instance of ArtifactContent from a dict"""
|
87
|
+
if obj is None:
|
88
|
+
return None
|
89
|
+
|
90
|
+
if not isinstance(obj, dict):
|
91
|
+
return cls.model_validate(obj)
|
92
|
+
|
93
|
+
_obj = cls.model_validate({
|
94
|
+
"text": obj.get("text"),
|
95
|
+
"binary": obj.get("binary"),
|
96
|
+
"rendered": MultiformatMessageString.from_dict(obj["rendered"]) if obj.get("rendered") is not None else None,
|
97
|
+
"properties": PropertyBag.from_dict(obj["properties"]) if obj.get("properties") is not None else None
|
98
|
+
})
|
99
|
+
return _obj
|
100
|
+
|
101
|
+
|
@@ -0,0 +1,109 @@
|
|
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_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 ArtifactLocation(BaseModel):
|
29
|
+
"""
|
30
|
+
Specifies the location of an artifact.
|
31
|
+
""" # noqa: E501
|
32
|
+
uri: Optional[StrictStr] = Field(default=None, description="A string containing a valid relative or absolute URI.")
|
33
|
+
uri_base_id: Optional[StrictStr] = Field(default=None, description="A string which indirectly specifies the absolute URI with respect to which a relative URI in the \"uri\" property is interpreted.", alias="uriBaseId")
|
34
|
+
index: Optional[Annotated[int, Field(strict=True, ge=-1)]] = Field(default=-1, description="The index within the run artifacts array of the artifact object associated with the artifact location.")
|
35
|
+
description: Optional[Message] = None
|
36
|
+
properties: Optional[PropertyBag] = None
|
37
|
+
__properties: ClassVar[List[str]] = ["uri", "uriBaseId", "index", "description", "properties"]
|
38
|
+
|
39
|
+
model_config = ConfigDict(
|
40
|
+
populate_by_name=True,
|
41
|
+
validate_assignment=True,
|
42
|
+
protected_namespaces=(),
|
43
|
+
)
|
44
|
+
|
45
|
+
|
46
|
+
def to_str(self) -> str:
|
47
|
+
"""Returns the string representation of the model using alias"""
|
48
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
49
|
+
|
50
|
+
def to_json(self) -> str:
|
51
|
+
"""Returns the JSON representation of the model using alias"""
|
52
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
53
|
+
return json.dumps(self.to_dict())
|
54
|
+
|
55
|
+
@classmethod
|
56
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
57
|
+
"""Create an instance of ArtifactLocation from a JSON string"""
|
58
|
+
return cls.from_dict(json.loads(json_str))
|
59
|
+
|
60
|
+
def to_dict(self) -> Dict[str, Any]:
|
61
|
+
"""Return the dictionary representation of the model using alias.
|
62
|
+
|
63
|
+
This has the following differences from calling pydantic's
|
64
|
+
`self.model_dump(by_alias=True)`:
|
65
|
+
|
66
|
+
* `None` is only added to the output dict for nullable fields that
|
67
|
+
were set at model initialization. Other fields with value `None`
|
68
|
+
are ignored.
|
69
|
+
"""
|
70
|
+
excluded_fields: Set[str] = set([
|
71
|
+
])
|
72
|
+
|
73
|
+
_dict = self.model_dump(
|
74
|
+
by_alias=True,
|
75
|
+
exclude=excluded_fields,
|
76
|
+
exclude_none=True,
|
77
|
+
)
|
78
|
+
# override the default output from pydantic by calling `to_dict()` of description
|
79
|
+
if self.description:
|
80
|
+
_dict['description'] = self.description.to_dict()
|
81
|
+
# override the default output from pydantic by calling `to_dict()` of properties
|
82
|
+
if self.properties:
|
83
|
+
_dict['properties'] = self.properties.to_dict()
|
84
|
+
# set to None if description (nullable) is None
|
85
|
+
# and model_fields_set contains the field
|
86
|
+
if self.description is None and "description" in self.model_fields_set:
|
87
|
+
_dict['description'] = None
|
88
|
+
|
89
|
+
return _dict
|
90
|
+
|
91
|
+
@classmethod
|
92
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
93
|
+
"""Create an instance of ArtifactLocation from a dict"""
|
94
|
+
if obj is None:
|
95
|
+
return None
|
96
|
+
|
97
|
+
if not isinstance(obj, dict):
|
98
|
+
return cls.model_validate(obj)
|
99
|
+
|
100
|
+
_obj = cls.model_validate({
|
101
|
+
"uri": obj.get("uri"),
|
102
|
+
"uriBaseId": obj.get("uriBaseId"),
|
103
|
+
"index": obj.get("index") if obj.get("index") is not None else -1,
|
104
|
+
"description": Message.from_dict(obj["description"]) if obj.get("description") is not None else None,
|
105
|
+
"properties": PropertyBag.from_dict(obj["properties"]) if obj.get("properties") is not None else None
|
106
|
+
})
|
107
|
+
return _obj
|
108
|
+
|
109
|
+
|