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.
Files changed (114) hide show
  1. hiddenlayer/sdk/constants.py +1 -0
  2. hiddenlayer/sdk/models.py +45 -8
  3. hiddenlayer/sdk/rest/__init__.py +80 -3
  4. hiddenlayer/sdk/rest/api/__init__.py +3 -0
  5. hiddenlayer/sdk/rest/api/aidr_predictive_api.py +1 -1
  6. hiddenlayer/sdk/rest/api/health_api.py +272 -0
  7. hiddenlayer/sdk/rest/api/model_scan_api.py +1 -1
  8. hiddenlayer/sdk/rest/api/model_supply_chain_api.py +2927 -0
  9. hiddenlayer/sdk/rest/api/readiness_api.py +272 -0
  10. hiddenlayer/sdk/rest/api/sensor_api.py +354 -37
  11. hiddenlayer/sdk/rest/api_client.py +1 -1
  12. hiddenlayer/sdk/rest/configuration.py +4 -4
  13. hiddenlayer/sdk/rest/exceptions.py +1 -1
  14. hiddenlayer/sdk/rest/models/__init__.py +77 -3
  15. hiddenlayer/sdk/rest/models/address.py +110 -0
  16. hiddenlayer/sdk/rest/models/artifact.py +155 -0
  17. hiddenlayer/sdk/rest/models/artifact_change.py +108 -0
  18. hiddenlayer/sdk/rest/models/artifact_content.py +101 -0
  19. hiddenlayer/sdk/rest/models/artifact_location.py +109 -0
  20. hiddenlayer/sdk/rest/models/attachment.py +129 -0
  21. hiddenlayer/sdk/rest/models/code_flow.py +113 -0
  22. hiddenlayer/sdk/rest/models/configuration_override.py +108 -0
  23. hiddenlayer/sdk/rest/models/conversion.py +114 -0
  24. hiddenlayer/sdk/rest/models/create_sensor_request.py +1 -1
  25. hiddenlayer/sdk/rest/models/detections.py +101 -0
  26. hiddenlayer/sdk/rest/models/edge.py +108 -0
  27. hiddenlayer/sdk/rest/models/edge_traversal.py +122 -0
  28. hiddenlayer/sdk/rest/models/exception.py +113 -0
  29. hiddenlayer/sdk/rest/models/external_properties.py +273 -0
  30. hiddenlayer/sdk/rest/models/external_property_file_reference.py +102 -0
  31. hiddenlayer/sdk/rest/models/external_property_file_references.py +240 -0
  32. hiddenlayer/sdk/rest/models/file_details_v3.py +140 -0
  33. hiddenlayer/sdk/rest/models/file_scan_report_v3.py +132 -0
  34. hiddenlayer/sdk/rest/models/file_scan_reports_v3.py +95 -0
  35. hiddenlayer/sdk/rest/models/fix.py +113 -0
  36. hiddenlayer/sdk/rest/models/get_multipart_upload_response.py +1 -1
  37. hiddenlayer/sdk/rest/models/graph.py +123 -0
  38. hiddenlayer/sdk/rest/models/graph_traversal.py +97 -0
  39. hiddenlayer/sdk/rest/models/invocation.py +199 -0
  40. hiddenlayer/sdk/rest/models/location.py +146 -0
  41. hiddenlayer/sdk/rest/models/{validation_error_model_loc_inner.py → location_inner.py} +7 -7
  42. hiddenlayer/sdk/rest/models/location_relationship.py +107 -0
  43. hiddenlayer/sdk/rest/models/logical_location.py +104 -0
  44. hiddenlayer/sdk/rest/models/message.py +92 -0
  45. hiddenlayer/sdk/rest/models/mitre_atlas_inner.py +110 -0
  46. hiddenlayer/sdk/rest/models/model.py +1 -1
  47. hiddenlayer/sdk/rest/models/model_inventory_info.py +99 -0
  48. hiddenlayer/sdk/rest/models/model_query_response.py +1 -1
  49. hiddenlayer/sdk/rest/models/model_scan_api_v3_scan_model_version_id_patch200_response.py +87 -0
  50. hiddenlayer/sdk/rest/models/model_scan_api_v3_scan_query200_response.py +102 -0
  51. hiddenlayer/sdk/rest/models/multiformat_message_string.py +95 -0
  52. hiddenlayer/sdk/rest/models/multipart_upload_part.py +1 -1
  53. hiddenlayer/sdk/rest/models/node.py +122 -0
  54. hiddenlayer/sdk/rest/models/notification.py +157 -0
  55. hiddenlayer/sdk/rest/models/paged_response_with_total.py +94 -0
  56. hiddenlayer/sdk/rest/models/physical_location.py +94 -0
  57. hiddenlayer/sdk/rest/models/property_bag.py +101 -0
  58. hiddenlayer/sdk/rest/models/rectangle.py +110 -0
  59. hiddenlayer/sdk/rest/models/region.py +127 -0
  60. hiddenlayer/sdk/rest/models/replacement.py +103 -0
  61. hiddenlayer/sdk/rest/models/reporting_configuration.py +113 -0
  62. hiddenlayer/sdk/rest/models/reporting_descriptor.py +162 -0
  63. hiddenlayer/sdk/rest/models/reporting_descriptor_reference.py +103 -0
  64. hiddenlayer/sdk/rest/models/reporting_descriptor_relationship.py +115 -0
  65. hiddenlayer/sdk/rest/models/result.py +312 -0
  66. hiddenlayer/sdk/rest/models/result_provenance.py +133 -0
  67. hiddenlayer/sdk/rest/models/rule_details_inner.py +102 -0
  68. hiddenlayer/sdk/rest/models/run.py +318 -0
  69. hiddenlayer/sdk/rest/models/run_automation_details.py +129 -0
  70. hiddenlayer/sdk/rest/models/sarif210.py +123 -0
  71. hiddenlayer/sdk/rest/models/scan_create_request.py +87 -0
  72. hiddenlayer/sdk/rest/models/scan_detection_v3.py +156 -0
  73. hiddenlayer/sdk/rest/models/scan_header_v3.py +129 -0
  74. hiddenlayer/sdk/rest/models/scan_job.py +109 -0
  75. hiddenlayer/sdk/rest/models/scan_job_inventory.py +137 -0
  76. hiddenlayer/sdk/rest/models/scan_model_details_v3.py +95 -0
  77. hiddenlayer/sdk/rest/models/scan_model_ids_v3.py +89 -0
  78. hiddenlayer/sdk/rest/models/scan_model_request.py +1 -1
  79. hiddenlayer/sdk/rest/models/scan_report_v3.py +139 -0
  80. hiddenlayer/sdk/rest/models/{file_info.py → scan_results.py} +14 -6
  81. hiddenlayer/sdk/rest/models/scan_results_v2.py +30 -10
  82. hiddenlayer/sdk/rest/models/security_posture.py +89 -0
  83. hiddenlayer/sdk/rest/models/sensor_sor_model_card_query_response.py +101 -0
  84. hiddenlayer/sdk/rest/models/sensor_sor_model_card_response.py +127 -0
  85. hiddenlayer/sdk/rest/models/sensor_sor_query_filter.py +1 -1
  86. hiddenlayer/sdk/rest/models/sensor_sor_query_request.py +1 -1
  87. hiddenlayer/sdk/rest/models/special_locations.py +97 -0
  88. hiddenlayer/sdk/rest/models/stack.py +113 -0
  89. hiddenlayer/sdk/rest/models/stack_frame.py +104 -0
  90. hiddenlayer/sdk/rest/models/submission_response.py +1 -1
  91. hiddenlayer/sdk/rest/models/submission_v2.py +1 -1
  92. hiddenlayer/sdk/rest/models/suppression.py +133 -0
  93. hiddenlayer/sdk/rest/models/thread_flow.py +144 -0
  94. hiddenlayer/sdk/rest/models/thread_flow_location.py +166 -0
  95. hiddenlayer/sdk/rest/models/tool.py +107 -0
  96. hiddenlayer/sdk/rest/models/tool_component.py +251 -0
  97. hiddenlayer/sdk/rest/models/tool_component_reference.py +108 -0
  98. hiddenlayer/sdk/rest/models/translation_metadata.py +110 -0
  99. hiddenlayer/sdk/rest/models/validation_error_model.py +4 -4
  100. hiddenlayer/sdk/rest/models/version_control_details.py +108 -0
  101. hiddenlayer/sdk/rest/models/web_request.py +112 -0
  102. hiddenlayer/sdk/rest/models/web_response.py +112 -0
  103. hiddenlayer/sdk/rest/rest.py +1 -1
  104. hiddenlayer/sdk/services/model.py +51 -3
  105. hiddenlayer/sdk/services/model_scan.py +153 -105
  106. hiddenlayer/sdk/version.py +1 -1
  107. {hiddenlayer_sdk-0.1.2.dist-info → hiddenlayer_sdk-1.1.0.dist-info}/METADATA +40 -21
  108. hiddenlayer_sdk-1.1.0.dist-info/RECORD +118 -0
  109. {hiddenlayer_sdk-0.1.2.dist-info → hiddenlayer_sdk-1.1.0.dist-info}/WHEEL +1 -1
  110. hiddenlayer/sdk/enterprise/__init__.py +0 -0
  111. hiddenlayer/sdk/enterprise/enterprise_model_scan_api.py +0 -55
  112. hiddenlayer_sdk-0.1.2.dist-info/RECORD +0 -43
  113. {hiddenlayer_sdk-0.1.2.dist-info → hiddenlayer_sdk-1.1.0.dist-info}/LICENSE +0 -0
  114. {hiddenlayer_sdk-0.1.2.dist-info → hiddenlayer_sdk-1.1.0.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,144 @@
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.multiformat_message_string import MultiformatMessageString
25
+ from hiddenlayer.sdk.rest.models.property_bag import PropertyBag
26
+ from hiddenlayer.sdk.rest.models.thread_flow_location import ThreadFlowLocation
27
+ from typing import Optional, Set
28
+ from typing_extensions import Self
29
+
30
+ class ThreadFlow(BaseModel):
31
+ """
32
+ Describes a sequence of code locations that specify a path through a single thread of execution such as an operating system or fiber.
33
+ """ # noqa: E501
34
+ id: Optional[StrictStr] = Field(default=None, description="An string that uniquely identifies the threadFlow within the codeFlow in which it occurs.")
35
+ message: Optional[Message] = None
36
+ initial_state: Optional[Dict[str, MultiformatMessageString]] = Field(default=None, description="Values of relevant expressions at the start of the thread flow that may change during thread flow execution.", alias="initialState")
37
+ immutable_state: Optional[Dict[str, MultiformatMessageString]] = Field(default=None, description="Values of relevant expressions at the start of the thread flow that remain constant.", alias="immutableState")
38
+ locations: Annotated[List[ThreadFlowLocation], Field(min_length=1)] = Field(description="A temporally ordered array of 'threadFlowLocation' objects, each of which describes a location visited by the tool while producing the result.")
39
+ properties: Optional[PropertyBag] = None
40
+ __properties: ClassVar[List[str]] = ["id", "message", "initialState", "immutableState", "locations", "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 ThreadFlow 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 message
82
+ if self.message:
83
+ _dict['message'] = self.message.to_dict()
84
+ # override the default output from pydantic by calling `to_dict()` of each value in initial_state (dict)
85
+ _field_dict = {}
86
+ if self.initial_state:
87
+ for _key in self.initial_state:
88
+ if self.initial_state[_key]:
89
+ _field_dict[_key] = self.initial_state[_key].to_dict()
90
+ _dict['initialState'] = _field_dict
91
+ # override the default output from pydantic by calling `to_dict()` of each value in immutable_state (dict)
92
+ _field_dict = {}
93
+ if self.immutable_state:
94
+ for _key in self.immutable_state:
95
+ if self.immutable_state[_key]:
96
+ _field_dict[_key] = self.immutable_state[_key].to_dict()
97
+ _dict['immutableState'] = _field_dict
98
+ # override the default output from pydantic by calling `to_dict()` of each item in locations (list)
99
+ _items = []
100
+ if self.locations:
101
+ for _item in self.locations:
102
+ if _item:
103
+ _items.append(_item.to_dict())
104
+ _dict['locations'] = _items
105
+ # override the default output from pydantic by calling `to_dict()` of properties
106
+ if self.properties:
107
+ _dict['properties'] = self.properties.to_dict()
108
+ # set to None if message (nullable) is None
109
+ # and model_fields_set contains the field
110
+ if self.message is None and "message" in self.model_fields_set:
111
+ _dict['message'] = None
112
+
113
+ return _dict
114
+
115
+ @classmethod
116
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
117
+ """Create an instance of ThreadFlow from a dict"""
118
+ if obj is None:
119
+ return None
120
+
121
+ if not isinstance(obj, dict):
122
+ return cls.model_validate(obj)
123
+
124
+ _obj = cls.model_validate({
125
+ "id": obj.get("id"),
126
+ "message": Message.from_dict(obj["message"]) if obj.get("message") is not None else None,
127
+ "initialState": dict(
128
+ (_k, MultiformatMessageString.from_dict(_v))
129
+ for _k, _v in obj["initialState"].items()
130
+ )
131
+ if obj.get("initialState") is not None
132
+ else None,
133
+ "immutableState": dict(
134
+ (_k, MultiformatMessageString.from_dict(_v))
135
+ for _k, _v in obj["immutableState"].items()
136
+ )
137
+ if obj.get("immutableState") is not None
138
+ else None,
139
+ "locations": [ThreadFlowLocation.from_dict(_item) for _item in obj["locations"]] if obj.get("locations") is not None else None,
140
+ "properties": PropertyBag.from_dict(obj["properties"]) if obj.get("properties") is not None else None
141
+ })
142
+ return _obj
143
+
144
+
@@ -0,0 +1,166 @@
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.location import Location
25
+ from hiddenlayer.sdk.rest.models.multiformat_message_string import MultiformatMessageString
26
+ from hiddenlayer.sdk.rest.models.property_bag import PropertyBag
27
+ from hiddenlayer.sdk.rest.models.reporting_descriptor_reference import ReportingDescriptorReference
28
+ from hiddenlayer.sdk.rest.models.stack import Stack
29
+ from hiddenlayer.sdk.rest.models.web_request import WebRequest
30
+ from hiddenlayer.sdk.rest.models.web_response import WebResponse
31
+ from typing import Optional, Set
32
+ from typing_extensions import Self
33
+
34
+ class ThreadFlowLocation(BaseModel):
35
+ """
36
+ A location visited by an analysis tool while simulating or monitoring the execution of a program.
37
+ """ # noqa: E501
38
+ index: Optional[Annotated[int, Field(strict=True, ge=-1)]] = Field(default=-1, description="The index within the run threadFlowLocations array.")
39
+ location: Optional[Location] = None
40
+ stack: Optional[Stack] = None
41
+ kinds: Optional[Annotated[List[StrictStr], Field(min_length=0)]] = Field(default=None, description="A set of distinct strings that categorize the thread flow location. Well-known kinds include 'acquire', 'release', 'enter', 'exit', 'call', 'return', 'branch', 'implicit', 'false', 'true', 'caution', 'danger', 'unknown', 'unreachable', 'taint', 'function', 'handler', 'lock', 'memory', 'resource', 'scope' and 'value'.")
42
+ taxa: Optional[Annotated[List[Optional[ReportingDescriptorReference]], Field(min_length=0)]] = Field(default=None, description="An array of references to rule or taxonomy reporting descriptors that are applicable to the thread flow location.")
43
+ module: Optional[StrictStr] = Field(default=None, description="The name of the module that contains the code that is executing.")
44
+ state: Optional[Dict[str, MultiformatMessageString]] = Field(default=None, description="A dictionary, each of whose keys specifies a variable or expression, the associated value of which represents the variable or expression value. For an annotation of kind 'continuation', for example, this dictionary might hold the current assumed values of a set of global variables.")
45
+ nesting_level: Optional[Annotated[int, Field(strict=True, ge=0)]] = Field(default=None, description="An integer representing a containment hierarchy within the thread flow.", alias="nestingLevel")
46
+ execution_order: Optional[Annotated[int, Field(strict=True, ge=-1)]] = Field(default=-1, description="An integer representing the temporal order in which execution reached this location.", alias="executionOrder")
47
+ execution_time_utc: Optional[datetime] = Field(default=None, description="The Coordinated Universal Time (UTC) date and time at which this location was executed.", alias="executionTimeUtc")
48
+ importance: Optional[StrictStr] = Field(default='important', description="Specifies the importance of this location in understanding the code flow in which it occurs. The order from most to least important is \"essential\", \"important\", \"unimportant\". Default: \"important\".")
49
+ web_request: Optional[WebRequest] = Field(default=None, alias="webRequest")
50
+ web_response: Optional[WebResponse] = Field(default=None, alias="webResponse")
51
+ properties: Optional[PropertyBag] = None
52
+ __properties: ClassVar[List[str]] = ["index", "location", "stack", "kinds", "taxa", "module", "state", "nestingLevel", "executionOrder", "executionTimeUtc", "importance", "webRequest", "webResponse", "properties"]
53
+
54
+ @field_validator('importance')
55
+ def importance_validate_enum(cls, value):
56
+ """Validates the enum"""
57
+ if value is None:
58
+ return value
59
+
60
+ if value not in set(['important', 'essential', 'unimportant']):
61
+ raise ValueError("must be one of enum values ('important', 'essential', 'unimportant')")
62
+ return value
63
+
64
+ model_config = ConfigDict(
65
+ populate_by_name=True,
66
+ validate_assignment=True,
67
+ protected_namespaces=(),
68
+ )
69
+
70
+
71
+ def to_str(self) -> str:
72
+ """Returns the string representation of the model using alias"""
73
+ return pprint.pformat(self.model_dump(by_alias=True))
74
+
75
+ def to_json(self) -> str:
76
+ """Returns the JSON representation of the model using alias"""
77
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
78
+ return json.dumps(self.to_dict())
79
+
80
+ @classmethod
81
+ def from_json(cls, json_str: str) -> Optional[Self]:
82
+ """Create an instance of ThreadFlowLocation from a JSON string"""
83
+ return cls.from_dict(json.loads(json_str))
84
+
85
+ def to_dict(self) -> Dict[str, Any]:
86
+ """Return the dictionary representation of the model using alias.
87
+
88
+ This has the following differences from calling pydantic's
89
+ `self.model_dump(by_alias=True)`:
90
+
91
+ * `None` is only added to the output dict for nullable fields that
92
+ were set at model initialization. Other fields with value `None`
93
+ are ignored.
94
+ """
95
+ excluded_fields: Set[str] = set([
96
+ ])
97
+
98
+ _dict = self.model_dump(
99
+ by_alias=True,
100
+ exclude=excluded_fields,
101
+ exclude_none=True,
102
+ )
103
+ # override the default output from pydantic by calling `to_dict()` of location
104
+ if self.location:
105
+ _dict['location'] = self.location.to_dict()
106
+ # override the default output from pydantic by calling `to_dict()` of stack
107
+ if self.stack:
108
+ _dict['stack'] = self.stack.to_dict()
109
+ # override the default output from pydantic by calling `to_dict()` of each item in taxa (list)
110
+ _items = []
111
+ if self.taxa:
112
+ for _item in self.taxa:
113
+ if _item:
114
+ _items.append(_item.to_dict())
115
+ _dict['taxa'] = _items
116
+ # override the default output from pydantic by calling `to_dict()` of each value in state (dict)
117
+ _field_dict = {}
118
+ if self.state:
119
+ for _key in self.state:
120
+ if self.state[_key]:
121
+ _field_dict[_key] = self.state[_key].to_dict()
122
+ _dict['state'] = _field_dict
123
+ # override the default output from pydantic by calling `to_dict()` of web_request
124
+ if self.web_request:
125
+ _dict['webRequest'] = self.web_request.to_dict()
126
+ # override the default output from pydantic by calling `to_dict()` of web_response
127
+ if self.web_response:
128
+ _dict['webResponse'] = self.web_response.to_dict()
129
+ # override the default output from pydantic by calling `to_dict()` of properties
130
+ if self.properties:
131
+ _dict['properties'] = self.properties.to_dict()
132
+ return _dict
133
+
134
+ @classmethod
135
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
136
+ """Create an instance of ThreadFlowLocation from a dict"""
137
+ if obj is None:
138
+ return None
139
+
140
+ if not isinstance(obj, dict):
141
+ return cls.model_validate(obj)
142
+
143
+ _obj = cls.model_validate({
144
+ "index": obj.get("index") if obj.get("index") is not None else -1,
145
+ "location": Location.from_dict(obj["location"]) if obj.get("location") is not None else None,
146
+ "stack": Stack.from_dict(obj["stack"]) if obj.get("stack") is not None else None,
147
+ "kinds": obj.get("kinds"),
148
+ "taxa": [ReportingDescriptorReference.from_dict(_item) for _item in obj["taxa"]] if obj.get("taxa") is not None else None,
149
+ "module": obj.get("module"),
150
+ "state": dict(
151
+ (_k, MultiformatMessageString.from_dict(_v))
152
+ for _k, _v in obj["state"].items()
153
+ )
154
+ if obj.get("state") is not None
155
+ else None,
156
+ "nestingLevel": obj.get("nestingLevel"),
157
+ "executionOrder": obj.get("executionOrder") if obj.get("executionOrder") is not None else -1,
158
+ "executionTimeUtc": obj.get("executionTimeUtc"),
159
+ "importance": obj.get("importance") if obj.get("importance") is not None else 'important',
160
+ "webRequest": WebRequest.from_dict(obj["webRequest"]) if obj.get("webRequest") is not None else None,
161
+ "webResponse": WebResponse.from_dict(obj["webResponse"]) if obj.get("webResponse") is not None else None,
162
+ "properties": PropertyBag.from_dict(obj["properties"]) if obj.get("properties") is not None else None
163
+ })
164
+ return _obj
165
+
166
+
@@ -0,0 +1,107 @@
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.property_bag import PropertyBag
24
+ from hiddenlayer.sdk.rest.models.tool_component import ToolComponent
25
+ from typing import Optional, Set
26
+ from typing_extensions import Self
27
+
28
+ class Tool(BaseModel):
29
+ """
30
+ The analysis tool that was run.
31
+ """ # noqa: E501
32
+ driver: ToolComponent
33
+ extensions: Optional[Annotated[List[ToolComponent], Field(min_length=0)]] = Field(default=None, description="Tool extensions that contributed to or reconfigured the analysis tool that was run.")
34
+ properties: Optional[PropertyBag] = None
35
+ __properties: ClassVar[List[str]] = ["driver", "extensions", "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 Tool 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 driver
77
+ if self.driver:
78
+ _dict['driver'] = self.driver.to_dict()
79
+ # override the default output from pydantic by calling `to_dict()` of each item in extensions (list)
80
+ _items = []
81
+ if self.extensions:
82
+ for _item in self.extensions:
83
+ if _item:
84
+ _items.append(_item.to_dict())
85
+ _dict['extensions'] = _items
86
+ # override the default output from pydantic by calling `to_dict()` of properties
87
+ if self.properties:
88
+ _dict['properties'] = self.properties.to_dict()
89
+ return _dict
90
+
91
+ @classmethod
92
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
93
+ """Create an instance of Tool 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
+ "driver": ToolComponent.from_dict(obj["driver"]) if obj.get("driver") is not None else None,
102
+ "extensions": [ToolComponent.from_dict(_item) for _item in obj["extensions"]] if obj.get("extensions") is not None else None,
103
+ "properties": PropertyBag.from_dict(obj["properties"]) if obj.get("properties") is not None else None
104
+ })
105
+ return _obj
106
+
107
+