hiddenlayer-sdk 0.1.2__py3-none-any.whl → 1.0.0__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
Files changed (113) hide show
  1. hiddenlayer/sdk/models.py +45 -8
  2. hiddenlayer/sdk/rest/__init__.py +80 -3
  3. hiddenlayer/sdk/rest/api/__init__.py +3 -0
  4. hiddenlayer/sdk/rest/api/aidr_predictive_api.py +1 -1
  5. hiddenlayer/sdk/rest/api/health_api.py +272 -0
  6. hiddenlayer/sdk/rest/api/model_scan_api.py +1 -1
  7. hiddenlayer/sdk/rest/api/model_supply_chain_api.py +2927 -0
  8. hiddenlayer/sdk/rest/api/readiness_api.py +272 -0
  9. hiddenlayer/sdk/rest/api/sensor_api.py +345 -16
  10. hiddenlayer/sdk/rest/api_client.py +1 -1
  11. hiddenlayer/sdk/rest/configuration.py +4 -4
  12. hiddenlayer/sdk/rest/exceptions.py +1 -1
  13. hiddenlayer/sdk/rest/models/__init__.py +77 -3
  14. hiddenlayer/sdk/rest/models/address.py +110 -0
  15. hiddenlayer/sdk/rest/models/artifact.py +155 -0
  16. hiddenlayer/sdk/rest/models/artifact_change.py +108 -0
  17. hiddenlayer/sdk/rest/models/artifact_content.py +101 -0
  18. hiddenlayer/sdk/rest/models/artifact_location.py +109 -0
  19. hiddenlayer/sdk/rest/models/attachment.py +129 -0
  20. hiddenlayer/sdk/rest/models/code_flow.py +113 -0
  21. hiddenlayer/sdk/rest/models/configuration_override.py +108 -0
  22. hiddenlayer/sdk/rest/models/conversion.py +114 -0
  23. hiddenlayer/sdk/rest/models/create_sensor_request.py +1 -1
  24. hiddenlayer/sdk/rest/models/detections.py +101 -0
  25. hiddenlayer/sdk/rest/models/edge.py +108 -0
  26. hiddenlayer/sdk/rest/models/edge_traversal.py +122 -0
  27. hiddenlayer/sdk/rest/models/exception.py +113 -0
  28. hiddenlayer/sdk/rest/models/external_properties.py +273 -0
  29. hiddenlayer/sdk/rest/models/external_property_file_reference.py +102 -0
  30. hiddenlayer/sdk/rest/models/external_property_file_references.py +240 -0
  31. hiddenlayer/sdk/rest/models/file_details_v3.py +140 -0
  32. hiddenlayer/sdk/rest/models/file_results_inner.py +121 -0
  33. hiddenlayer/sdk/rest/models/file_scan_report_v3.py +95 -0
  34. hiddenlayer/sdk/rest/models/fix.py +113 -0
  35. hiddenlayer/sdk/rest/models/get_multipart_upload_response.py +1 -1
  36. hiddenlayer/sdk/rest/models/graph.py +123 -0
  37. hiddenlayer/sdk/rest/models/graph_traversal.py +97 -0
  38. hiddenlayer/sdk/rest/models/invocation.py +199 -0
  39. hiddenlayer/sdk/rest/models/location.py +146 -0
  40. hiddenlayer/sdk/rest/models/{validation_error_model_loc_inner.py → location_inner.py} +7 -7
  41. hiddenlayer/sdk/rest/models/location_relationship.py +107 -0
  42. hiddenlayer/sdk/rest/models/logical_location.py +104 -0
  43. hiddenlayer/sdk/rest/models/message.py +92 -0
  44. hiddenlayer/sdk/rest/models/mitre_atlas_inner.py +110 -0
  45. hiddenlayer/sdk/rest/models/model.py +1 -1
  46. hiddenlayer/sdk/rest/models/model_inventory_info.py +99 -0
  47. hiddenlayer/sdk/rest/models/model_query_response.py +1 -1
  48. hiddenlayer/sdk/rest/models/model_scan_api_v3_scan_model_version_id_patch200_response.py +87 -0
  49. hiddenlayer/sdk/rest/models/model_scan_api_v3_scan_query200_response.py +102 -0
  50. hiddenlayer/sdk/rest/models/multiformat_message_string.py +95 -0
  51. hiddenlayer/sdk/rest/models/multipart_upload_part.py +1 -1
  52. hiddenlayer/sdk/rest/models/node.py +122 -0
  53. hiddenlayer/sdk/rest/models/notification.py +157 -0
  54. hiddenlayer/sdk/rest/models/paged_response_with_total.py +94 -0
  55. hiddenlayer/sdk/rest/models/physical_location.py +94 -0
  56. hiddenlayer/sdk/rest/models/property_bag.py +101 -0
  57. hiddenlayer/sdk/rest/models/rectangle.py +110 -0
  58. hiddenlayer/sdk/rest/models/region.py +127 -0
  59. hiddenlayer/sdk/rest/models/replacement.py +103 -0
  60. hiddenlayer/sdk/rest/models/reporting_configuration.py +113 -0
  61. hiddenlayer/sdk/rest/models/reporting_descriptor.py +162 -0
  62. hiddenlayer/sdk/rest/models/reporting_descriptor_reference.py +103 -0
  63. hiddenlayer/sdk/rest/models/reporting_descriptor_relationship.py +115 -0
  64. hiddenlayer/sdk/rest/models/result.py +312 -0
  65. hiddenlayer/sdk/rest/models/result_provenance.py +133 -0
  66. hiddenlayer/sdk/rest/models/rule_details_inner.py +102 -0
  67. hiddenlayer/sdk/rest/models/run.py +318 -0
  68. hiddenlayer/sdk/rest/models/run_automation_details.py +129 -0
  69. hiddenlayer/sdk/rest/models/sarif210.py +123 -0
  70. hiddenlayer/sdk/rest/models/scan_create_request.py +87 -0
  71. hiddenlayer/sdk/rest/models/scan_detection_v3.py +156 -0
  72. hiddenlayer/sdk/rest/models/scan_header_v3.py +129 -0
  73. hiddenlayer/sdk/rest/models/scan_job.py +109 -0
  74. hiddenlayer/sdk/rest/models/scan_job_inventory.py +137 -0
  75. hiddenlayer/sdk/rest/models/scan_model_details_v3.py +95 -0
  76. hiddenlayer/sdk/rest/models/scan_model_ids_v3.py +89 -0
  77. hiddenlayer/sdk/rest/models/scan_model_request.py +1 -1
  78. hiddenlayer/sdk/rest/models/scan_report_v3.py +139 -0
  79. hiddenlayer/sdk/rest/models/{file_info.py → scan_results.py} +14 -6
  80. hiddenlayer/sdk/rest/models/scan_results_v2.py +30 -10
  81. hiddenlayer/sdk/rest/models/security_posture.py +89 -0
  82. hiddenlayer/sdk/rest/models/sensor_sor_model_card_query_response.py +101 -0
  83. hiddenlayer/sdk/rest/models/sensor_sor_model_card_response.py +127 -0
  84. hiddenlayer/sdk/rest/models/sensor_sor_query_filter.py +1 -1
  85. hiddenlayer/sdk/rest/models/sensor_sor_query_request.py +1 -1
  86. hiddenlayer/sdk/rest/models/special_locations.py +97 -0
  87. hiddenlayer/sdk/rest/models/stack.py +113 -0
  88. hiddenlayer/sdk/rest/models/stack_frame.py +104 -0
  89. hiddenlayer/sdk/rest/models/submission_response.py +1 -1
  90. hiddenlayer/sdk/rest/models/submission_v2.py +1 -1
  91. hiddenlayer/sdk/rest/models/suppression.py +133 -0
  92. hiddenlayer/sdk/rest/models/thread_flow.py +144 -0
  93. hiddenlayer/sdk/rest/models/thread_flow_location.py +166 -0
  94. hiddenlayer/sdk/rest/models/tool.py +107 -0
  95. hiddenlayer/sdk/rest/models/tool_component.py +251 -0
  96. hiddenlayer/sdk/rest/models/tool_component_reference.py +108 -0
  97. hiddenlayer/sdk/rest/models/translation_metadata.py +110 -0
  98. hiddenlayer/sdk/rest/models/validation_error_model.py +4 -4
  99. hiddenlayer/sdk/rest/models/version_control_details.py +108 -0
  100. hiddenlayer/sdk/rest/models/web_request.py +112 -0
  101. hiddenlayer/sdk/rest/models/web_response.py +112 -0
  102. hiddenlayer/sdk/rest/rest.py +1 -1
  103. hiddenlayer/sdk/services/model.py +5 -2
  104. hiddenlayer/sdk/services/model_scan.py +153 -105
  105. hiddenlayer/sdk/version.py +1 -1
  106. {hiddenlayer_sdk-0.1.2.dist-info → hiddenlayer_sdk-1.0.0.dist-info}/METADATA +39 -20
  107. hiddenlayer_sdk-1.0.0.dist-info/RECORD +118 -0
  108. {hiddenlayer_sdk-0.1.2.dist-info → hiddenlayer_sdk-1.0.0.dist-info}/WHEEL +1 -1
  109. hiddenlayer/sdk/enterprise/__init__.py +0 -0
  110. hiddenlayer/sdk/enterprise/enterprise_model_scan_api.py +0 -55
  111. hiddenlayer_sdk-0.1.2.dist-info/RECORD +0 -43
  112. {hiddenlayer_sdk-0.1.2.dist-info → hiddenlayer_sdk-1.0.0.dist-info}/LICENSE +0 -0
  113. {hiddenlayer_sdk-0.1.2.dist-info → hiddenlayer_sdk-1.0.0.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,127 @@
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, field_validator
21
+ from typing import Any, ClassVar, Dict, List, Optional
22
+ from hiddenlayer.sdk.rest.models.security_posture import SecurityPosture
23
+ from typing import Optional, Set
24
+ from typing_extensions import Self
25
+
26
+ class SensorSORModelCardResponse(BaseModel):
27
+ """
28
+ SensorSORModelCardResponse
29
+ """ # noqa: E501
30
+ model_id: StrictStr
31
+ created_at: StrictInt = Field(description="Unix timestamp")
32
+ plaintext_name: StrictStr
33
+ active_versions: List[StrictInt]
34
+ source: StrictStr
35
+ tags: Optional[Dict[str, Any]] = None
36
+ model_scan_threat_level: Optional[StrictStr] = None
37
+ attack_monitoring_threat_level: Optional[StrictStr] = None
38
+ security_posture: Optional[SecurityPosture] = None
39
+ __properties: ClassVar[List[str]] = ["model_id", "created_at", "plaintext_name", "active_versions", "source", "tags", "model_scan_threat_level", "attack_monitoring_threat_level", "security_posture"]
40
+
41
+ @field_validator('model_scan_threat_level')
42
+ def model_scan_threat_level_validate_enum(cls, value):
43
+ """Validates the enum"""
44
+ if value is None:
45
+ return value
46
+
47
+ if value not in set(['safe', 'unsafe', 'suspicious', 'not available']):
48
+ raise ValueError("must be one of enum values ('safe', 'unsafe', 'suspicious', 'not available')")
49
+ return value
50
+
51
+ @field_validator('attack_monitoring_threat_level')
52
+ def attack_monitoring_threat_level_validate_enum(cls, value):
53
+ """Validates the enum"""
54
+ if value is None:
55
+ return value
56
+
57
+ if value not in set(['safe', 'unsafe', 'suspicious', 'not available']):
58
+ raise ValueError("must be one of enum values ('safe', 'unsafe', 'suspicious', 'not available')")
59
+ return value
60
+
61
+ model_config = ConfigDict(
62
+ populate_by_name=True,
63
+ validate_assignment=True,
64
+ protected_namespaces=(),
65
+ )
66
+
67
+
68
+ def to_str(self) -> str:
69
+ """Returns the string representation of the model using alias"""
70
+ return pprint.pformat(self.model_dump(by_alias=True))
71
+
72
+ def to_json(self) -> str:
73
+ """Returns the JSON representation of the model using alias"""
74
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
75
+ return json.dumps(self.to_dict())
76
+
77
+ @classmethod
78
+ def from_json(cls, json_str: str) -> Optional[Self]:
79
+ """Create an instance of SensorSORModelCardResponse from a JSON string"""
80
+ return cls.from_dict(json.loads(json_str))
81
+
82
+ def to_dict(self) -> Dict[str, Any]:
83
+ """Return the dictionary representation of the model using alias.
84
+
85
+ This has the following differences from calling pydantic's
86
+ `self.model_dump(by_alias=True)`:
87
+
88
+ * `None` is only added to the output dict for nullable fields that
89
+ were set at model initialization. Other fields with value `None`
90
+ are ignored.
91
+ """
92
+ excluded_fields: Set[str] = set([
93
+ ])
94
+
95
+ _dict = self.model_dump(
96
+ by_alias=True,
97
+ exclude=excluded_fields,
98
+ exclude_none=True,
99
+ )
100
+ # override the default output from pydantic by calling `to_dict()` of security_posture
101
+ if self.security_posture:
102
+ _dict['security_posture'] = self.security_posture.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 SensorSORModelCardResponse 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
+ "model_id": obj.get("model_id"),
116
+ "created_at": obj.get("created_at"),
117
+ "plaintext_name": obj.get("plaintext_name"),
118
+ "active_versions": obj.get("active_versions"),
119
+ "source": obj.get("source"),
120
+ "tags": obj.get("tags"),
121
+ "model_scan_threat_level": obj.get("model_scan_threat_level"),
122
+ "attack_monitoring_threat_level": obj.get("attack_monitoring_threat_level"),
123
+ "security_posture": SecurityPosture.from_dict(obj["security_posture"]) if obj.get("security_posture") is not None else None
124
+ })
125
+ return _obj
126
+
127
+
@@ -1,7 +1,7 @@
1
1
  # coding: utf-8
2
2
 
3
3
  """
4
- HiddenLayer ModelScan
4
+ HiddenLayer ModelScan V2
5
5
 
6
6
  HiddenLayer ModelScan API for scanning of models
7
7
 
@@ -1,7 +1,7 @@
1
1
  # coding: utf-8
2
2
 
3
3
  """
4
- HiddenLayer ModelScan
4
+ HiddenLayer ModelScan V2
5
5
 
6
6
  HiddenLayer ModelScan API for scanning of models
7
7
 
@@ -0,0 +1,97 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ HiddenLayer ModelScan V2
5
+
6
+ HiddenLayer ModelScan API for scanning of models
7
+
8
+ The version of the OpenAPI document: 1
9
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
10
+
11
+ Do not edit the class manually.
12
+ """ # noqa: E501
13
+
14
+
15
+ from __future__ import annotations
16
+ import pprint
17
+ import re # noqa: F401
18
+ import json
19
+
20
+ from pydantic import BaseModel, ConfigDict, Field
21
+ from typing import Any, ClassVar, Dict, List, Optional
22
+ from hiddenlayer.sdk.rest.models.artifact_location import ArtifactLocation
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 SpecialLocations(BaseModel):
28
+ """
29
+ Defines locations of special significance to SARIF consumers.
30
+ """ # noqa: E501
31
+ display_base: Optional[ArtifactLocation] = Field(default=None, alias="displayBase")
32
+ properties: Optional[PropertyBag] = None
33
+ __properties: ClassVar[List[str]] = ["displayBase", "properties"]
34
+
35
+ model_config = ConfigDict(
36
+ populate_by_name=True,
37
+ validate_assignment=True,
38
+ protected_namespaces=(),
39
+ )
40
+
41
+
42
+ def to_str(self) -> str:
43
+ """Returns the string representation of the model using alias"""
44
+ return pprint.pformat(self.model_dump(by_alias=True))
45
+
46
+ def to_json(self) -> str:
47
+ """Returns the JSON representation of the model using alias"""
48
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
49
+ return json.dumps(self.to_dict())
50
+
51
+ @classmethod
52
+ def from_json(cls, json_str: str) -> Optional[Self]:
53
+ """Create an instance of SpecialLocations from a JSON string"""
54
+ return cls.from_dict(json.loads(json_str))
55
+
56
+ def to_dict(self) -> Dict[str, Any]:
57
+ """Return the dictionary representation of the model using alias.
58
+
59
+ This has the following differences from calling pydantic's
60
+ `self.model_dump(by_alias=True)`:
61
+
62
+ * `None` is only added to the output dict for nullable fields that
63
+ were set at model initialization. Other fields with value `None`
64
+ are ignored.
65
+ """
66
+ excluded_fields: Set[str] = set([
67
+ ])
68
+
69
+ _dict = self.model_dump(
70
+ by_alias=True,
71
+ exclude=excluded_fields,
72
+ exclude_none=True,
73
+ )
74
+ # override the default output from pydantic by calling `to_dict()` of display_base
75
+ if self.display_base:
76
+ _dict['displayBase'] = self.display_base.to_dict()
77
+ # override the default output from pydantic by calling `to_dict()` of properties
78
+ if self.properties:
79
+ _dict['properties'] = self.properties.to_dict()
80
+ return _dict
81
+
82
+ @classmethod
83
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
84
+ """Create an instance of SpecialLocations from a dict"""
85
+ if obj is None:
86
+ return None
87
+
88
+ if not isinstance(obj, dict):
89
+ return cls.model_validate(obj)
90
+
91
+ _obj = cls.model_validate({
92
+ "displayBase": ArtifactLocation.from_dict(obj["displayBase"]) if obj.get("displayBase") is not None else None,
93
+ "properties": PropertyBag.from_dict(obj["properties"]) if obj.get("properties") is not None else None
94
+ })
95
+ return _obj
96
+
97
+
@@ -0,0 +1,113 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ HiddenLayer ModelScan V2
5
+
6
+ HiddenLayer ModelScan API for scanning of models
7
+
8
+ The version of the OpenAPI document: 1
9
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
10
+
11
+ Do not edit the class manually.
12
+ """ # noqa: E501
13
+
14
+
15
+ from __future__ import annotations
16
+ import pprint
17
+ import re # noqa: F401
18
+ import json
19
+
20
+ from pydantic import BaseModel, ConfigDict, Field
21
+ from typing import Any, ClassVar, Dict, List, Optional
22
+ from typing_extensions import Annotated
23
+ from hiddenlayer.sdk.rest.models.message import Message
24
+ from hiddenlayer.sdk.rest.models.property_bag import PropertyBag
25
+ from hiddenlayer.sdk.rest.models.stack_frame import StackFrame
26
+ from typing import Optional, Set
27
+ from typing_extensions import Self
28
+
29
+ class Stack(BaseModel):
30
+ """
31
+ A call stack that is relevant to a result.
32
+ """ # noqa: E501
33
+ message: Optional[Message] = None
34
+ frames: Annotated[List[StackFrame], Field(min_length=0)] = Field(description="An array of stack frames that represents a sequence of calls, rendered in reverse chronological order, that comprise the call stack.")
35
+ properties: Optional[PropertyBag] = None
36
+ __properties: ClassVar[List[str]] = ["message", "frames", "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 Stack from a JSON string"""
57
+ return cls.from_dict(json.loads(json_str))
58
+
59
+ def to_dict(self) -> Dict[str, Any]:
60
+ """Return the dictionary representation of the model using alias.
61
+
62
+ This has the following differences from calling pydantic's
63
+ `self.model_dump(by_alias=True)`:
64
+
65
+ * `None` is only added to the output dict for nullable fields that
66
+ were set at model initialization. Other fields with value `None`
67
+ are ignored.
68
+ """
69
+ excluded_fields: Set[str] = set([
70
+ ])
71
+
72
+ _dict = self.model_dump(
73
+ by_alias=True,
74
+ exclude=excluded_fields,
75
+ exclude_none=True,
76
+ )
77
+ # override the default output from pydantic by calling `to_dict()` of message
78
+ if self.message:
79
+ _dict['message'] = self.message.to_dict()
80
+ # override the default output from pydantic by calling `to_dict()` of each item in frames (list)
81
+ _items = []
82
+ if self.frames:
83
+ for _item in self.frames:
84
+ if _item:
85
+ _items.append(_item.to_dict())
86
+ _dict['frames'] = _items
87
+ # override the default output from pydantic by calling `to_dict()` of properties
88
+ if self.properties:
89
+ _dict['properties'] = self.properties.to_dict()
90
+ # set to None if message (nullable) is None
91
+ # and model_fields_set contains the field
92
+ if self.message is None and "message" in self.model_fields_set:
93
+ _dict['message'] = None
94
+
95
+ return _dict
96
+
97
+ @classmethod
98
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
99
+ """Create an instance of Stack from a dict"""
100
+ if obj is None:
101
+ return None
102
+
103
+ if not isinstance(obj, dict):
104
+ return cls.model_validate(obj)
105
+
106
+ _obj = cls.model_validate({
107
+ "message": Message.from_dict(obj["message"]) if obj.get("message") is not None else None,
108
+ "frames": [StackFrame.from_dict(_item) for _item in obj["frames"]] if obj.get("frames") is not None else None,
109
+ "properties": PropertyBag.from_dict(obj["properties"]) if obj.get("properties") is not None else None
110
+ })
111
+ return _obj
112
+
113
+
@@ -0,0 +1,104 @@
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.location import Location
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 StackFrame(BaseModel):
29
+ """
30
+ A function call within a stack trace.
31
+ """ # noqa: E501
32
+ location: Optional[Location] = None
33
+ module: Optional[StrictStr] = Field(default=None, description="The name of the module that contains the code of this stack frame.")
34
+ thread_id: Optional[StrictInt] = Field(default=None, description="The thread identifier of the stack frame.", alias="threadId")
35
+ parameters: Optional[Annotated[List[StrictStr], Field(min_length=0)]] = Field(default=None, description="The parameters of the call that is executing.")
36
+ properties: Optional[PropertyBag] = None
37
+ __properties: ClassVar[List[str]] = ["location", "module", "threadId", "parameters", "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 StackFrame 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 location
79
+ if self.location:
80
+ _dict['location'] = self.location.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
+ return _dict
85
+
86
+ @classmethod
87
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
88
+ """Create an instance of StackFrame from a dict"""
89
+ if obj is None:
90
+ return None
91
+
92
+ if not isinstance(obj, dict):
93
+ return cls.model_validate(obj)
94
+
95
+ _obj = cls.model_validate({
96
+ "location": Location.from_dict(obj["location"]) if obj.get("location") is not None else None,
97
+ "module": obj.get("module"),
98
+ "threadId": obj.get("threadId"),
99
+ "parameters": obj.get("parameters"),
100
+ "properties": PropertyBag.from_dict(obj["properties"]) if obj.get("properties") is not None else None
101
+ })
102
+ return _obj
103
+
104
+
@@ -1,7 +1,7 @@
1
1
  # coding: utf-8
2
2
 
3
3
  """
4
- HiddenLayer ModelScan
4
+ HiddenLayer ModelScan V2
5
5
 
6
6
  HiddenLayer ModelScan API for scanning of models
7
7
 
@@ -1,7 +1,7 @@
1
1
  # coding: utf-8
2
2
 
3
3
  """
4
- HiddenLayer ModelScan
4
+ HiddenLayer ModelScan V2
5
5
 
6
6
  HiddenLayer ModelScan API for scanning of models
7
7
 
@@ -0,0 +1,133 @@
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.location import Location
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 Suppression(BaseModel):
29
+ """
30
+ A suppression that is relevant to a result.
31
+ """ # noqa: E501
32
+ guid: Optional[Annotated[str, Field(strict=True)]] = Field(default=None, description="A stable, unique identifier for the suppression in the form of a GUID.")
33
+ kind: StrictStr = Field(description="A string that indicates where the suppression is persisted.")
34
+ status: Optional[StrictStr] = Field(default=None, description="A string that indicates the review status of the suppression.")
35
+ justification: Optional[StrictStr] = Field(default=None, description="A string representing the justification for the suppression.")
36
+ location: Optional[Location] = None
37
+ properties: Optional[PropertyBag] = None
38
+ __properties: ClassVar[List[str]] = ["guid", "kind", "status", "justification", "location", "properties"]
39
+
40
+ @field_validator('guid')
41
+ def guid_validate_regular_expression(cls, value):
42
+ """Validates the regular expression"""
43
+ if value is None:
44
+ return value
45
+
46
+ 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):
47
+ 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}$/")
48
+ return value
49
+
50
+ @field_validator('kind')
51
+ def kind_validate_enum(cls, value):
52
+ """Validates the enum"""
53
+ if value not in set(['inSource', 'external']):
54
+ raise ValueError("must be one of enum values ('inSource', 'external')")
55
+ return value
56
+
57
+ @field_validator('status')
58
+ def status_validate_enum(cls, value):
59
+ """Validates the enum"""
60
+ if value is None:
61
+ return value
62
+
63
+ if value not in set(['accepted', 'underReview', 'rejected']):
64
+ raise ValueError("must be one of enum values ('accepted', 'underReview', 'rejected')")
65
+ return value
66
+
67
+ model_config = ConfigDict(
68
+ populate_by_name=True,
69
+ validate_assignment=True,
70
+ protected_namespaces=(),
71
+ )
72
+
73
+
74
+ def to_str(self) -> str:
75
+ """Returns the string representation of the model using alias"""
76
+ return pprint.pformat(self.model_dump(by_alias=True))
77
+
78
+ def to_json(self) -> str:
79
+ """Returns the JSON representation of the model using alias"""
80
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
81
+ return json.dumps(self.to_dict())
82
+
83
+ @classmethod
84
+ def from_json(cls, json_str: str) -> Optional[Self]:
85
+ """Create an instance of Suppression from a JSON string"""
86
+ return cls.from_dict(json.loads(json_str))
87
+
88
+ def to_dict(self) -> Dict[str, Any]:
89
+ """Return the dictionary representation of the model using alias.
90
+
91
+ This has the following differences from calling pydantic's
92
+ `self.model_dump(by_alias=True)`:
93
+
94
+ * `None` is only added to the output dict for nullable fields that
95
+ were set at model initialization. Other fields with value `None`
96
+ are ignored.
97
+ """
98
+ excluded_fields: Set[str] = set([
99
+ ])
100
+
101
+ _dict = self.model_dump(
102
+ by_alias=True,
103
+ exclude=excluded_fields,
104
+ exclude_none=True,
105
+ )
106
+ # override the default output from pydantic by calling `to_dict()` of location
107
+ if self.location:
108
+ _dict['location'] = self.location.to_dict()
109
+ # override the default output from pydantic by calling `to_dict()` of properties
110
+ if self.properties:
111
+ _dict['properties'] = self.properties.to_dict()
112
+ return _dict
113
+
114
+ @classmethod
115
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
116
+ """Create an instance of Suppression from a dict"""
117
+ if obj is None:
118
+ return None
119
+
120
+ if not isinstance(obj, dict):
121
+ return cls.model_validate(obj)
122
+
123
+ _obj = cls.model_validate({
124
+ "guid": obj.get("guid"),
125
+ "kind": obj.get("kind"),
126
+ "status": obj.get("status"),
127
+ "justification": obj.get("justification"),
128
+ "location": Location.from_dict(obj["location"]) if obj.get("location") is not None else None,
129
+ "properties": PropertyBag.from_dict(obj["properties"]) if obj.get("properties") is not None else None
130
+ })
131
+ return _obj
132
+
133
+