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,146 @@
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.location_relationship import LocationRelationship
24
+ from hiddenlayer.sdk.rest.models.logical_location import LogicalLocation
25
+ from hiddenlayer.sdk.rest.models.message import Message
26
+ from hiddenlayer.sdk.rest.models.physical_location import PhysicalLocation
27
+ from hiddenlayer.sdk.rest.models.property_bag import PropertyBag
28
+ from hiddenlayer.sdk.rest.models.region import Region
29
+ from typing import Optional, Set
30
+ from typing_extensions import Self
31
+
32
+ class Location(BaseModel):
33
+ """
34
+ A location within a programming artifact.
35
+ """ # noqa: E501
36
+ id: Optional[Annotated[int, Field(strict=True, ge=-1)]] = Field(default=-1, description="Value that distinguishes this location from all other locations within a single result object.")
37
+ physical_location: Optional[PhysicalLocation] = Field(default=None, alias="physicalLocation")
38
+ logical_locations: Optional[Annotated[List[LogicalLocation], Field(min_length=0)]] = Field(default=None, description="The logical locations associated with the result.", alias="logicalLocations")
39
+ message: Optional[Message] = None
40
+ annotations: Optional[Annotated[List[Region], Field(min_length=0)]] = Field(default=None, description="A set of regions relevant to the location.")
41
+ relationships: Optional[Annotated[List[LocationRelationship], Field(min_length=0)]] = Field(default=None, description="An array of objects that describe relationships between this location and others.")
42
+ properties: Optional[PropertyBag] = None
43
+ __properties: ClassVar[List[str]] = ["id", "physicalLocation", "logicalLocations", "message", "annotations", "relationships", "properties"]
44
+
45
+ model_config = ConfigDict(
46
+ populate_by_name=True,
47
+ validate_assignment=True,
48
+ protected_namespaces=(),
49
+ )
50
+
51
+
52
+ def to_str(self) -> str:
53
+ """Returns the string representation of the model using alias"""
54
+ return pprint.pformat(self.model_dump(by_alias=True))
55
+
56
+ def to_json(self) -> str:
57
+ """Returns the JSON representation of the model using alias"""
58
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
59
+ return json.dumps(self.to_dict())
60
+
61
+ @classmethod
62
+ def from_json(cls, json_str: str) -> Optional[Self]:
63
+ """Create an instance of Location from a JSON string"""
64
+ return cls.from_dict(json.loads(json_str))
65
+
66
+ def to_dict(self) -> Dict[str, Any]:
67
+ """Return the dictionary representation of the model using alias.
68
+
69
+ This has the following differences from calling pydantic's
70
+ `self.model_dump(by_alias=True)`:
71
+
72
+ * `None` is only added to the output dict for nullable fields that
73
+ were set at model initialization. Other fields with value `None`
74
+ are ignored.
75
+ """
76
+ excluded_fields: Set[str] = set([
77
+ ])
78
+
79
+ _dict = self.model_dump(
80
+ by_alias=True,
81
+ exclude=excluded_fields,
82
+ exclude_none=True,
83
+ )
84
+ # override the default output from pydantic by calling `to_dict()` of physical_location
85
+ if self.physical_location:
86
+ _dict['physicalLocation'] = self.physical_location.to_dict()
87
+ # override the default output from pydantic by calling `to_dict()` of each item in logical_locations (list)
88
+ _items = []
89
+ if self.logical_locations:
90
+ for _item in self.logical_locations:
91
+ if _item:
92
+ _items.append(_item.to_dict())
93
+ _dict['logicalLocations'] = _items
94
+ # override the default output from pydantic by calling `to_dict()` of message
95
+ if self.message:
96
+ _dict['message'] = self.message.to_dict()
97
+ # override the default output from pydantic by calling `to_dict()` of each item in annotations (list)
98
+ _items = []
99
+ if self.annotations:
100
+ for _item in self.annotations:
101
+ if _item:
102
+ _items.append(_item.to_dict())
103
+ _dict['annotations'] = _items
104
+ # override the default output from pydantic by calling `to_dict()` of each item in relationships (list)
105
+ _items = []
106
+ if self.relationships:
107
+ for _item in self.relationships:
108
+ if _item:
109
+ _items.append(_item.to_dict())
110
+ _dict['relationships'] = _items
111
+ # override the default output from pydantic by calling `to_dict()` of properties
112
+ if self.properties:
113
+ _dict['properties'] = self.properties.to_dict()
114
+ # set to None if physical_location (nullable) is None
115
+ # and model_fields_set contains the field
116
+ if self.physical_location is None and "physical_location" in self.model_fields_set:
117
+ _dict['physicalLocation'] = None
118
+
119
+ # set to None if message (nullable) is None
120
+ # and model_fields_set contains the field
121
+ if self.message is None and "message" in self.model_fields_set:
122
+ _dict['message'] = None
123
+
124
+ return _dict
125
+
126
+ @classmethod
127
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
128
+ """Create an instance of Location from a dict"""
129
+ if obj is None:
130
+ return None
131
+
132
+ if not isinstance(obj, dict):
133
+ return cls.model_validate(obj)
134
+
135
+ _obj = cls.model_validate({
136
+ "id": obj.get("id") if obj.get("id") is not None else -1,
137
+ "physicalLocation": PhysicalLocation.from_dict(obj["physicalLocation"]) if obj.get("physicalLocation") is not None else None,
138
+ "logicalLocations": [LogicalLocation.from_dict(_item) for _item in obj["logicalLocations"]] if obj.get("logicalLocations") is not None else None,
139
+ "message": Message.from_dict(obj["message"]) if obj.get("message") is not None else None,
140
+ "annotations": [Region.from_dict(_item) for _item in obj["annotations"]] if obj.get("annotations") is not None else None,
141
+ "relationships": [LocationRelationship.from_dict(_item) for _item in obj["relationships"]] if obj.get("relationships") is not None else None,
142
+ "properties": PropertyBag.from_dict(obj["properties"]) if obj.get("properties") is not None else None
143
+ })
144
+ return _obj
145
+
146
+
@@ -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
 
@@ -23,11 +23,11 @@ from typing import Union, Any, List, Set, TYPE_CHECKING, Optional, Dict
23
23
  from typing_extensions import Literal, Self
24
24
  from pydantic import Field
25
25
 
26
- VALIDATIONERRORMODELLOCINNER_ANY_OF_SCHEMAS = ["int", "str"]
26
+ LOCATIONINNER_ANY_OF_SCHEMAS = ["int", "str"]
27
27
 
28
- class ValidationErrorModelLocInner(BaseModel):
28
+ class LocationInner(BaseModel):
29
29
  """
30
- ValidationErrorModelLocInner
30
+ LocationInner
31
31
  """
32
32
 
33
33
  # data type: str
@@ -57,7 +57,7 @@ class ValidationErrorModelLocInner(BaseModel):
57
57
 
58
58
  @field_validator('actual_instance')
59
59
  def actual_instance_must_validate_anyof(cls, v):
60
- instance = ValidationErrorModelLocInner.model_construct()
60
+ instance = LocationInner.model_construct()
61
61
  error_messages = []
62
62
  # validate data type: str
63
63
  try:
@@ -73,7 +73,7 @@ class ValidationErrorModelLocInner(BaseModel):
73
73
  error_messages.append(str(e))
74
74
  if error_messages:
75
75
  # no match
76
- raise ValueError("No match found when setting the actual_instance in ValidationErrorModelLocInner with anyOf schemas: int, str. Details: " + ", ".join(error_messages))
76
+ raise ValueError("No match found when setting the actual_instance in LocationInner with anyOf schemas: int, str. Details: " + ", ".join(error_messages))
77
77
  else:
78
78
  return v
79
79
 
@@ -107,7 +107,7 @@ class ValidationErrorModelLocInner(BaseModel):
107
107
 
108
108
  if error_messages:
109
109
  # no match
110
- raise ValueError("No match found when deserializing the JSON string into ValidationErrorModelLocInner with anyOf schemas: int, str. Details: " + ", ".join(error_messages))
110
+ raise ValueError("No match found when deserializing the JSON string into LocationInner with anyOf schemas: int, str. Details: " + ", ".join(error_messages))
111
111
  else:
112
112
  return instance
113
113
 
@@ -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, 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 LocationRelationship(BaseModel):
29
+ """
30
+ Information about the relation of one location to another.
31
+ """ # noqa: E501
32
+ target: Annotated[int, Field(strict=True, ge=0)] = Field(description="A reference to the related location.")
33
+ kinds: Optional[List[StrictStr]] = Field(default=None, description="A set of distinct strings that categorize the relationship. Well-known kinds include 'includes', 'isIncludedBy' and 'relevant'.")
34
+ description: Optional[Message] = None
35
+ properties: Optional[PropertyBag] = None
36
+ __properties: ClassVar[List[str]] = ["target", "kinds", "description", "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 LocationRelationship 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 description
78
+ if self.description:
79
+ _dict['description'] = self.description.to_dict()
80
+ # override the default output from pydantic by calling `to_dict()` of properties
81
+ if self.properties:
82
+ _dict['properties'] = self.properties.to_dict()
83
+ # set to None if description (nullable) is None
84
+ # and model_fields_set contains the field
85
+ if self.description is None and "description" in self.model_fields_set:
86
+ _dict['description'] = None
87
+
88
+ return _dict
89
+
90
+ @classmethod
91
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
92
+ """Create an instance of LocationRelationship from a dict"""
93
+ if obj is None:
94
+ return None
95
+
96
+ if not isinstance(obj, dict):
97
+ return cls.model_validate(obj)
98
+
99
+ _obj = cls.model_validate({
100
+ "target": obj.get("target"),
101
+ "kinds": obj.get("kinds"),
102
+ "description": Message.from_dict(obj["description"]) if obj.get("description") 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
+
@@ -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, 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 LogicalLocation(BaseModel):
28
+ """
29
+ A logical location of a construct that produced a result.
30
+ """ # noqa: E501
31
+ name: Optional[StrictStr] = Field(default=None, description="Identifies the construct in which the result occurred. For example, this property might contain the name of a class or a method.")
32
+ index: Optional[Annotated[int, Field(strict=True, ge=-1)]] = Field(default=-1, description="The index within the logical locations array.")
33
+ fully_qualified_name: Optional[StrictStr] = Field(default=None, description="The human-readable fully qualified name of the logical location.", alias="fullyQualifiedName")
34
+ decorated_name: Optional[StrictStr] = Field(default=None, description="The machine-readable name for the logical location, such as a mangled function name provided by a C++ compiler that encodes calling convention, return type and other details along with the function name.", alias="decoratedName")
35
+ parent_index: Optional[Annotated[int, Field(strict=True, ge=-1)]] = Field(default=-1, description="Identifies the index of the immediate parent of the construct in which the result was detected. For example, this property might point to a logical location that represents the namespace that holds a type.", alias="parentIndex")
36
+ kind: Optional[StrictStr] = Field(default=None, description="The type of construct this logical location component refers to. Should be one of 'function', 'member', 'module', 'namespace', 'parameter', 'resource', 'returnType', 'type', 'variable', 'object', 'array', 'property', 'value', 'element', 'text', 'attribute', 'comment', 'declaration', 'dtd' or 'processingInstruction', if any of those accurately describe the construct.")
37
+ properties: Optional[PropertyBag] = None
38
+ __properties: ClassVar[List[str]] = ["name", "index", "fullyQualifiedName", "decoratedName", "parentIndex", "kind", "properties"]
39
+
40
+ model_config = ConfigDict(
41
+ populate_by_name=True,
42
+ validate_assignment=True,
43
+ protected_namespaces=(),
44
+ )
45
+
46
+
47
+ def to_str(self) -> str:
48
+ """Returns the string representation of the model using alias"""
49
+ return pprint.pformat(self.model_dump(by_alias=True))
50
+
51
+ def to_json(self) -> str:
52
+ """Returns the JSON representation of the model using alias"""
53
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
54
+ return json.dumps(self.to_dict())
55
+
56
+ @classmethod
57
+ def from_json(cls, json_str: str) -> Optional[Self]:
58
+ """Create an instance of LogicalLocation from a JSON string"""
59
+ return cls.from_dict(json.loads(json_str))
60
+
61
+ def to_dict(self) -> Dict[str, Any]:
62
+ """Return the dictionary representation of the model using alias.
63
+
64
+ This has the following differences from calling pydantic's
65
+ `self.model_dump(by_alias=True)`:
66
+
67
+ * `None` is only added to the output dict for nullable fields that
68
+ were set at model initialization. Other fields with value `None`
69
+ are ignored.
70
+ """
71
+ excluded_fields: Set[str] = set([
72
+ ])
73
+
74
+ _dict = self.model_dump(
75
+ by_alias=True,
76
+ exclude=excluded_fields,
77
+ exclude_none=True,
78
+ )
79
+ # override the default output from pydantic by calling `to_dict()` of 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 LogicalLocation 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
+ "name": obj.get("name"),
95
+ "index": obj.get("index") if obj.get("index") is not None else -1,
96
+ "fullyQualifiedName": obj.get("fullyQualifiedName"),
97
+ "decoratedName": obj.get("decoratedName"),
98
+ "parentIndex": obj.get("parentIndex") if obj.get("parentIndex") is not None else -1,
99
+ "kind": obj.get("kind"),
100
+ "properties": PropertyBag.from_dict(obj["properties"]) if obj.get("properties") is not None else None
101
+ })
102
+ return _obj
103
+
104
+
@@ -0,0 +1,92 @@
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.property_bag import PropertyBag
24
+ from typing import Optional, Set
25
+ from typing_extensions import Self
26
+
27
+ class Message(BaseModel):
28
+ """
29
+ Encapsulates a message intended to be read by the end user.
30
+ """ # noqa: E501
31
+ text: Optional[StrictStr] = Field(default=None, description="A plain text message string.")
32
+ markdown: Optional[StrictStr] = Field(default=None, description="A Markdown message string.")
33
+ id: Optional[StrictStr] = Field(default=None, description="The identifier for this message.")
34
+ arguments: Optional[Annotated[List[StrictStr], Field(min_length=0)]] = Field(default=None, description="An array of strings to substitute into the message string.")
35
+ properties: Optional[PropertyBag] = None
36
+ __properties: ClassVar[List[str]] = []
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 Message 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
+ return _dict
78
+
79
+ @classmethod
80
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
81
+ """Create an instance of Message from a dict"""
82
+ if obj is None:
83
+ return None
84
+
85
+ if not isinstance(obj, dict):
86
+ return cls.model_validate(obj)
87
+
88
+ _obj = cls.model_validate({
89
+ })
90
+ return _obj
91
+
92
+
@@ -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, field_validator
21
+ from typing import Any, ClassVar, Dict, List, Optional
22
+ from typing_extensions import Annotated
23
+ from typing import Optional, Set
24
+ from typing_extensions import Self
25
+
26
+ class MITREAtlasInner(BaseModel):
27
+ """
28
+ MITREAtlasInner
29
+ """ # noqa: E501
30
+ technique: Optional[Annotated[str, Field(strict=True)]] = Field(default=None, description="MITRE Atlas Technique")
31
+ tactic: Optional[Annotated[str, Field(strict=True)]] = Field(default=None, description="MITRE Atlas Tactic")
32
+ __properties: ClassVar[List[str]] = ["technique", "tactic"]
33
+
34
+ @field_validator('technique')
35
+ def technique_validate_regular_expression(cls, value):
36
+ """Validates the regular expression"""
37
+ if value is None:
38
+ return value
39
+
40
+ if not re.match(r"^AML\.T\d{4}(\.\d{3})?.*$", value):
41
+ raise ValueError(r"must validate the regular expression /^AML\.T\d{4}(\.\d{3})?.*$/")
42
+ return value
43
+
44
+ @field_validator('tactic')
45
+ def tactic_validate_regular_expression(cls, value):
46
+ """Validates the regular expression"""
47
+ if value is None:
48
+ return value
49
+
50
+ if not re.match(r"^AML\.T(A)?\d{4}(\.\d{3})?$", value):
51
+ raise ValueError(r"must validate the regular expression /^AML\.T(A)?\d{4}(\.\d{3})?$/")
52
+ return value
53
+
54
+ model_config = ConfigDict(
55
+ populate_by_name=True,
56
+ validate_assignment=True,
57
+ protected_namespaces=(),
58
+ )
59
+
60
+
61
+ def to_str(self) -> str:
62
+ """Returns the string representation of the model using alias"""
63
+ return pprint.pformat(self.model_dump(by_alias=True))
64
+
65
+ def to_json(self) -> str:
66
+ """Returns the JSON representation of the model using alias"""
67
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
68
+ return json.dumps(self.to_dict())
69
+
70
+ @classmethod
71
+ def from_json(cls, json_str: str) -> Optional[Self]:
72
+ """Create an instance of MITREAtlasInner from a JSON string"""
73
+ return cls.from_dict(json.loads(json_str))
74
+
75
+ def to_dict(self) -> Dict[str, Any]:
76
+ """Return the dictionary representation of the model using alias.
77
+
78
+ This has the following differences from calling pydantic's
79
+ `self.model_dump(by_alias=True)`:
80
+
81
+ * `None` is only added to the output dict for nullable fields that
82
+ were set at model initialization. Other fields with value `None`
83
+ are ignored.
84
+ """
85
+ excluded_fields: Set[str] = set([
86
+ ])
87
+
88
+ _dict = self.model_dump(
89
+ by_alias=True,
90
+ exclude=excluded_fields,
91
+ exclude_none=True,
92
+ )
93
+ return _dict
94
+
95
+ @classmethod
96
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
97
+ """Create an instance of MITREAtlasInner from a dict"""
98
+ if obj is None:
99
+ return None
100
+
101
+ if not isinstance(obj, dict):
102
+ return cls.model_validate(obj)
103
+
104
+ _obj = cls.model_validate({
105
+ "technique": obj.get("technique"),
106
+ "tactic": obj.get("tactic")
107
+ })
108
+ return _obj
109
+
110
+
@@ -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