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,95 @@
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
21
+ from typing import Any, ClassVar, Dict, List, Optional
22
+ from hiddenlayer.sdk.rest.models.file_scan_report_v3 import FileScanReportV3
23
+ from typing import Optional, Set
24
+ from typing_extensions import Self
25
+
26
+ class FileScanReportsV3(BaseModel):
27
+ """
28
+ FileScanReportsV3
29
+ """ # noqa: E501
30
+ file_results: Optional[List[FileScanReportV3]] = None
31
+ __properties: ClassVar[List[str]] = ["file_results"]
32
+
33
+ model_config = ConfigDict(
34
+ populate_by_name=True,
35
+ validate_assignment=True,
36
+ protected_namespaces=(),
37
+ )
38
+
39
+
40
+ def to_str(self) -> str:
41
+ """Returns the string representation of the model using alias"""
42
+ return pprint.pformat(self.model_dump(by_alias=True))
43
+
44
+ def to_json(self) -> str:
45
+ """Returns the JSON representation of the model using alias"""
46
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
47
+ return json.dumps(self.to_dict())
48
+
49
+ @classmethod
50
+ def from_json(cls, json_str: str) -> Optional[Self]:
51
+ """Create an instance of FileScanReportsV3 from a JSON string"""
52
+ return cls.from_dict(json.loads(json_str))
53
+
54
+ def to_dict(self) -> Dict[str, Any]:
55
+ """Return the dictionary representation of the model using alias.
56
+
57
+ This has the following differences from calling pydantic's
58
+ `self.model_dump(by_alias=True)`:
59
+
60
+ * `None` is only added to the output dict for nullable fields that
61
+ were set at model initialization. Other fields with value `None`
62
+ are ignored.
63
+ """
64
+ excluded_fields: Set[str] = set([
65
+ ])
66
+
67
+ _dict = self.model_dump(
68
+ by_alias=True,
69
+ exclude=excluded_fields,
70
+ exclude_none=True,
71
+ )
72
+ # override the default output from pydantic by calling `to_dict()` of each item in file_results (list)
73
+ _items = []
74
+ if self.file_results:
75
+ for _item in self.file_results:
76
+ if _item:
77
+ _items.append(_item.to_dict())
78
+ _dict['file_results'] = _items
79
+ return _dict
80
+
81
+ @classmethod
82
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
83
+ """Create an instance of FileScanReportsV3 from a dict"""
84
+ if obj is None:
85
+ return None
86
+
87
+ if not isinstance(obj, dict):
88
+ return cls.model_validate(obj)
89
+
90
+ _obj = cls.model_validate({
91
+ "file_results": [FileScanReportV3.from_dict(_item) for _item in obj["file_results"]] if obj.get("file_results") is not None else None
92
+ })
93
+ return _obj
94
+
95
+
@@ -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.artifact_change import ArtifactChange
24
+ from hiddenlayer.sdk.rest.models.message import Message
25
+ from hiddenlayer.sdk.rest.models.property_bag import PropertyBag
26
+ from typing import Optional, Set
27
+ from typing_extensions import Self
28
+
29
+ class Fix(BaseModel):
30
+ """
31
+ A proposed fix for the problem represented by a result object. A fix specifies a set of artifacts to modify. For each artifact, it specifies a set of bytes to remove, and provides a set of new bytes to replace them.
32
+ """ # noqa: E501
33
+ description: Optional[Message] = None
34
+ artifact_changes: Annotated[List[ArtifactChange], Field(min_length=1)] = Field(description="One or more artifact changes that comprise a fix for a result.", alias="artifactChanges")
35
+ properties: Optional[PropertyBag] = None
36
+ __properties: ClassVar[List[str]] = ["description", "artifactChanges", "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 Fix 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 each item in artifact_changes (list)
81
+ _items = []
82
+ if self.artifact_changes:
83
+ for _item in self.artifact_changes:
84
+ if _item:
85
+ _items.append(_item.to_dict())
86
+ _dict['artifactChanges'] = _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 description (nullable) is None
91
+ # and model_fields_set contains the field
92
+ if self.description is None and "description" in self.model_fields_set:
93
+ _dict['description'] = 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 Fix 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
+ "description": Message.from_dict(obj["description"]) if obj.get("description") is not None else None,
108
+ "artifactChanges": [ArtifactChange.from_dict(_item) for _item in obj["artifactChanges"]] if obj.get("artifactChanges") 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
+
@@ -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,123 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ HiddenLayer ModelScan V2
5
+
6
+ HiddenLayer ModelScan API for scanning of models
7
+
8
+ The version of the OpenAPI document: 1
9
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
10
+
11
+ Do not edit the class manually.
12
+ """ # noqa: E501
13
+
14
+
15
+ from __future__ import annotations
16
+ import pprint
17
+ import re # noqa: F401
18
+ import json
19
+
20
+ from pydantic import BaseModel, ConfigDict, Field
21
+ from typing import Any, ClassVar, Dict, List, Optional
22
+ from typing_extensions import Annotated
23
+ from hiddenlayer.sdk.rest.models.edge import Edge
24
+ from hiddenlayer.sdk.rest.models.message import Message
25
+ from hiddenlayer.sdk.rest.models.node import Node
26
+ from hiddenlayer.sdk.rest.models.property_bag import PropertyBag
27
+ from typing import Optional, Set
28
+ from typing_extensions import Self
29
+
30
+ class Graph(BaseModel):
31
+ """
32
+ A network of nodes and directed edges that describes some aspect of the structure of the code (for example, a call graph).
33
+ """ # noqa: E501
34
+ description: Optional[Message] = None
35
+ nodes: Optional[Annotated[List[Node], Field(min_length=0)]] = Field(default=None, description="An array of node objects representing the nodes of the graph.")
36
+ edges: Optional[Annotated[List[Edge], Field(min_length=0)]] = Field(default=None, description="An array of edge objects representing the edges of the graph.")
37
+ properties: Optional[PropertyBag] = None
38
+ __properties: ClassVar[List[str]] = ["description", "nodes", "edges", "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 Graph 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 description
80
+ if self.description:
81
+ _dict['description'] = self.description.to_dict()
82
+ # override the default output from pydantic by calling `to_dict()` of each item in nodes (list)
83
+ _items = []
84
+ if self.nodes:
85
+ for _item in self.nodes:
86
+ if _item:
87
+ _items.append(_item.to_dict())
88
+ _dict['nodes'] = _items
89
+ # override the default output from pydantic by calling `to_dict()` of each item in edges (list)
90
+ _items = []
91
+ if self.edges:
92
+ for _item in self.edges:
93
+ if _item:
94
+ _items.append(_item.to_dict())
95
+ _dict['edges'] = _items
96
+ # override the default output from pydantic by calling `to_dict()` of properties
97
+ if self.properties:
98
+ _dict['properties'] = self.properties.to_dict()
99
+ # set to None if description (nullable) is None
100
+ # and model_fields_set contains the field
101
+ if self.description is None and "description" in self.model_fields_set:
102
+ _dict['description'] = None
103
+
104
+ return _dict
105
+
106
+ @classmethod
107
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
108
+ """Create an instance of Graph from a dict"""
109
+ if obj is None:
110
+ return None
111
+
112
+ if not isinstance(obj, dict):
113
+ return cls.model_validate(obj)
114
+
115
+ _obj = cls.model_validate({
116
+ "description": Message.from_dict(obj["description"]) if obj.get("description") is not None else None,
117
+ "nodes": [Node.from_dict(_item) for _item in obj["nodes"]] if obj.get("nodes") is not None else None,
118
+ "edges": [Edge.from_dict(_item) for _item in obj["edges"]] if obj.get("edges") is not None else None,
119
+ "properties": PropertyBag.from_dict(obj["properties"]) if obj.get("properties") is not None else None
120
+ })
121
+ return _obj
122
+
123
+
@@ -0,0 +1,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 typing_extensions import Annotated
23
+ from hiddenlayer.sdk.rest.models.edge_traversal import EdgeTraversal
24
+ from hiddenlayer.sdk.rest.models.message import Message
25
+ from hiddenlayer.sdk.rest.models.multiformat_message_string import MultiformatMessageString
26
+ from hiddenlayer.sdk.rest.models.property_bag import PropertyBag
27
+ from typing import Optional, Set
28
+ from typing_extensions import Self
29
+
30
+ class GraphTraversal(BaseModel):
31
+ """
32
+ Represents a path through a graph.
33
+ """ # noqa: E501
34
+ run_graph_index: Optional[Annotated[int, Field(strict=True, ge=-1)]] = Field(default=-1, description="The index within the run.graphs to be associated with the result.", alias="runGraphIndex")
35
+ result_graph_index: Optional[Annotated[int, Field(strict=True, ge=-1)]] = Field(default=-1, description="The index within the result.graphs to be associated with the result.", alias="resultGraphIndex")
36
+ description: Optional[Message] = None
37
+ initial_state: Optional[Dict[str, MultiformatMessageString]] = Field(default=None, description="Values of relevant expressions at the start of the graph traversal that may change during graph traversal.", alias="initialState")
38
+ immutable_state: Optional[Dict[str, MultiformatMessageString]] = Field(default=None, description="Values of relevant expressions at the start of the graph traversal that remain constant for the graph traversal.", alias="immutableState")
39
+ edge_traversals: Optional[Annotated[List[EdgeTraversal], Field(min_length=0)]] = Field(default=None, description="The sequences of edges traversed by this graph traversal.", alias="edgeTraversals")
40
+ properties: Optional[PropertyBag] = None
41
+ __properties: ClassVar[List[str]] = []
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 GraphTraversal 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
+ return _dict
83
+
84
+ @classmethod
85
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
86
+ """Create an instance of GraphTraversal 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
+ })
95
+ return _obj
96
+
97
+
@@ -0,0 +1,199 @@
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, StrictBool, StrictInt, StrictStr
22
+ from typing import Any, ClassVar, Dict, List, Optional
23
+ from typing_extensions import Annotated
24
+ from hiddenlayer.sdk.rest.models.artifact_location import ArtifactLocation
25
+ from hiddenlayer.sdk.rest.models.configuration_override import ConfigurationOverride
26
+ from hiddenlayer.sdk.rest.models.notification import Notification
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 Invocation(BaseModel):
32
+ """
33
+ The runtime environment of the analysis tool run.
34
+ """ # noqa: E501
35
+ command_line: Optional[StrictStr] = Field(default=None, description="The command line used to invoke the tool.", alias="commandLine")
36
+ arguments: Optional[Annotated[List[StrictStr], Field(min_length=0)]] = Field(default=None, description="An array of strings, containing in order the command line arguments passed to the tool from the operating system.")
37
+ response_files: Optional[Annotated[List[ArtifactLocation], Field(min_length=0)]] = Field(default=None, description="The locations of any response files specified on the tool's command line.", alias="responseFiles")
38
+ start_time_utc: Optional[datetime] = Field(default=None, description="The Coordinated Universal Time (UTC) date and time at which the invocation started. See \"Date/time properties\" in the SARIF spec for the required format.", alias="startTimeUtc")
39
+ end_time_utc: Optional[datetime] = Field(default=None, description="The Coordinated Universal Time (UTC) date and time at which the invocation ended. See \"Date/time properties\" in the SARIF spec for the required format.", alias="endTimeUtc")
40
+ exit_code: Optional[StrictInt] = Field(default=None, description="The process exit code.", alias="exitCode")
41
+ rule_configuration_overrides: Optional[Annotated[List[ConfigurationOverride], Field(min_length=0)]] = Field(default=None, description="An array of configurationOverride objects that describe rules related runtime overrides.", alias="ruleConfigurationOverrides")
42
+ notification_configuration_overrides: Optional[Annotated[List[ConfigurationOverride], Field(min_length=0)]] = Field(default=None, description="An array of configurationOverride objects that describe notifications related runtime overrides.", alias="notificationConfigurationOverrides")
43
+ tool_execution_notifications: Optional[Annotated[List[Notification], Field(min_length=0)]] = Field(default=None, description="A list of runtime conditions detected by the tool during the analysis.", alias="toolExecutionNotifications")
44
+ tool_configuration_notifications: Optional[Annotated[List[Notification], Field(min_length=0)]] = Field(default=None, description="A list of conditions detected by the tool that are relevant to the tool's configuration.", alias="toolConfigurationNotifications")
45
+ exit_code_description: Optional[StrictStr] = Field(default=None, description="The reason for the process exit.", alias="exitCodeDescription")
46
+ exit_signal_name: Optional[StrictStr] = Field(default=None, description="The name of the signal that caused the process to exit.", alias="exitSignalName")
47
+ exit_signal_number: Optional[StrictInt] = Field(default=None, description="The numeric value of the signal that caused the process to exit.", alias="exitSignalNumber")
48
+ process_start_failure_message: Optional[StrictStr] = Field(default=None, description="The reason given by the operating system that the process failed to start.", alias="processStartFailureMessage")
49
+ execution_successful: StrictBool = Field(description="Specifies whether the tool's execution completed successfully.", alias="executionSuccessful")
50
+ machine: Optional[StrictStr] = Field(default=None, description="The machine on which the invocation occurred.")
51
+ account: Optional[StrictStr] = Field(default=None, description="The account under which the invocation occurred.")
52
+ process_id: Optional[StrictInt] = Field(default=None, description="The id of the process in which the invocation occurred.", alias="processId")
53
+ executable_location: Optional[ArtifactLocation] = Field(default=None, alias="executableLocation")
54
+ working_directory: Optional[ArtifactLocation] = Field(default=None, alias="workingDirectory")
55
+ environment_variables: Optional[Dict[str, StrictStr]] = Field(default=None, description="The environment variables associated with the analysis tool process, expressed as key/value pairs.", alias="environmentVariables")
56
+ stdin: Optional[ArtifactLocation] = None
57
+ stdout: Optional[ArtifactLocation] = None
58
+ stderr: Optional[ArtifactLocation] = None
59
+ stdout_stderr: Optional[ArtifactLocation] = Field(default=None, alias="stdoutStderr")
60
+ properties: Optional[PropertyBag] = None
61
+ __properties: ClassVar[List[str]] = ["commandLine", "arguments", "responseFiles", "startTimeUtc", "endTimeUtc", "exitCode", "ruleConfigurationOverrides", "notificationConfigurationOverrides", "toolExecutionNotifications", "toolConfigurationNotifications", "exitCodeDescription", "exitSignalName", "exitSignalNumber", "processStartFailureMessage", "executionSuccessful", "machine", "account", "processId", "executableLocation", "workingDirectory", "environmentVariables", "stdin", "stdout", "stderr", "stdoutStderr", "properties"]
62
+
63
+ model_config = ConfigDict(
64
+ populate_by_name=True,
65
+ validate_assignment=True,
66
+ protected_namespaces=(),
67
+ )
68
+
69
+
70
+ def to_str(self) -> str:
71
+ """Returns the string representation of the model using alias"""
72
+ return pprint.pformat(self.model_dump(by_alias=True))
73
+
74
+ def to_json(self) -> str:
75
+ """Returns the JSON representation of the model using alias"""
76
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
77
+ return json.dumps(self.to_dict())
78
+
79
+ @classmethod
80
+ def from_json(cls, json_str: str) -> Optional[Self]:
81
+ """Create an instance of Invocation from a JSON string"""
82
+ return cls.from_dict(json.loads(json_str))
83
+
84
+ def to_dict(self) -> Dict[str, Any]:
85
+ """Return the dictionary representation of the model using alias.
86
+
87
+ This has the following differences from calling pydantic's
88
+ `self.model_dump(by_alias=True)`:
89
+
90
+ * `None` is only added to the output dict for nullable fields that
91
+ were set at model initialization. Other fields with value `None`
92
+ are ignored.
93
+ """
94
+ excluded_fields: Set[str] = set([
95
+ ])
96
+
97
+ _dict = self.model_dump(
98
+ by_alias=True,
99
+ exclude=excluded_fields,
100
+ exclude_none=True,
101
+ )
102
+ # override the default output from pydantic by calling `to_dict()` of each item in response_files (list)
103
+ _items = []
104
+ if self.response_files:
105
+ for _item in self.response_files:
106
+ if _item:
107
+ _items.append(_item.to_dict())
108
+ _dict['responseFiles'] = _items
109
+ # override the default output from pydantic by calling `to_dict()` of each item in rule_configuration_overrides (list)
110
+ _items = []
111
+ if self.rule_configuration_overrides:
112
+ for _item in self.rule_configuration_overrides:
113
+ if _item:
114
+ _items.append(_item.to_dict())
115
+ _dict['ruleConfigurationOverrides'] = _items
116
+ # override the default output from pydantic by calling `to_dict()` of each item in notification_configuration_overrides (list)
117
+ _items = []
118
+ if self.notification_configuration_overrides:
119
+ for _item in self.notification_configuration_overrides:
120
+ if _item:
121
+ _items.append(_item.to_dict())
122
+ _dict['notificationConfigurationOverrides'] = _items
123
+ # override the default output from pydantic by calling `to_dict()` of each item in tool_execution_notifications (list)
124
+ _items = []
125
+ if self.tool_execution_notifications:
126
+ for _item in self.tool_execution_notifications:
127
+ if _item:
128
+ _items.append(_item.to_dict())
129
+ _dict['toolExecutionNotifications'] = _items
130
+ # override the default output from pydantic by calling `to_dict()` of each item in tool_configuration_notifications (list)
131
+ _items = []
132
+ if self.tool_configuration_notifications:
133
+ for _item in self.tool_configuration_notifications:
134
+ if _item:
135
+ _items.append(_item.to_dict())
136
+ _dict['toolConfigurationNotifications'] = _items
137
+ # override the default output from pydantic by calling `to_dict()` of executable_location
138
+ if self.executable_location:
139
+ _dict['executableLocation'] = self.executable_location.to_dict()
140
+ # override the default output from pydantic by calling `to_dict()` of working_directory
141
+ if self.working_directory:
142
+ _dict['workingDirectory'] = self.working_directory.to_dict()
143
+ # override the default output from pydantic by calling `to_dict()` of stdin
144
+ if self.stdin:
145
+ _dict['stdin'] = self.stdin.to_dict()
146
+ # override the default output from pydantic by calling `to_dict()` of stdout
147
+ if self.stdout:
148
+ _dict['stdout'] = self.stdout.to_dict()
149
+ # override the default output from pydantic by calling `to_dict()` of stderr
150
+ if self.stderr:
151
+ _dict['stderr'] = self.stderr.to_dict()
152
+ # override the default output from pydantic by calling `to_dict()` of stdout_stderr
153
+ if self.stdout_stderr:
154
+ _dict['stdoutStderr'] = self.stdout_stderr.to_dict()
155
+ # override the default output from pydantic by calling `to_dict()` of properties
156
+ if self.properties:
157
+ _dict['properties'] = self.properties.to_dict()
158
+ return _dict
159
+
160
+ @classmethod
161
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
162
+ """Create an instance of Invocation from a dict"""
163
+ if obj is None:
164
+ return None
165
+
166
+ if not isinstance(obj, dict):
167
+ return cls.model_validate(obj)
168
+
169
+ _obj = cls.model_validate({
170
+ "commandLine": obj.get("commandLine"),
171
+ "arguments": obj.get("arguments"),
172
+ "responseFiles": [ArtifactLocation.from_dict(_item) for _item in obj["responseFiles"]] if obj.get("responseFiles") is not None else None,
173
+ "startTimeUtc": obj.get("startTimeUtc"),
174
+ "endTimeUtc": obj.get("endTimeUtc"),
175
+ "exitCode": obj.get("exitCode"),
176
+ "ruleConfigurationOverrides": [ConfigurationOverride.from_dict(_item) for _item in obj["ruleConfigurationOverrides"]] if obj.get("ruleConfigurationOverrides") is not None else None,
177
+ "notificationConfigurationOverrides": [ConfigurationOverride.from_dict(_item) for _item in obj["notificationConfigurationOverrides"]] if obj.get("notificationConfigurationOverrides") is not None else None,
178
+ "toolExecutionNotifications": [Notification.from_dict(_item) for _item in obj["toolExecutionNotifications"]] if obj.get("toolExecutionNotifications") is not None else None,
179
+ "toolConfigurationNotifications": [Notification.from_dict(_item) for _item in obj["toolConfigurationNotifications"]] if obj.get("toolConfigurationNotifications") is not None else None,
180
+ "exitCodeDescription": obj.get("exitCodeDescription"),
181
+ "exitSignalName": obj.get("exitSignalName"),
182
+ "exitSignalNumber": obj.get("exitSignalNumber"),
183
+ "processStartFailureMessage": obj.get("processStartFailureMessage"),
184
+ "executionSuccessful": obj.get("executionSuccessful"),
185
+ "machine": obj.get("machine"),
186
+ "account": obj.get("account"),
187
+ "processId": obj.get("processId"),
188
+ "executableLocation": ArtifactLocation.from_dict(obj["executableLocation"]) if obj.get("executableLocation") is not None else None,
189
+ "workingDirectory": ArtifactLocation.from_dict(obj["workingDirectory"]) if obj.get("workingDirectory") is not None else None,
190
+ "environmentVariables": obj.get("environmentVariables"),
191
+ "stdin": ArtifactLocation.from_dict(obj["stdin"]) if obj.get("stdin") is not None else None,
192
+ "stdout": ArtifactLocation.from_dict(obj["stdout"]) if obj.get("stdout") is not None else None,
193
+ "stderr": ArtifactLocation.from_dict(obj["stderr"]) if obj.get("stderr") is not None else None,
194
+ "stdoutStderr": ArtifactLocation.from_dict(obj["stdoutStderr"]) if obj.get("stdoutStderr") is not None else None,
195
+ "properties": PropertyBag.from_dict(obj["properties"]) if obj.get("properties") is not None else None
196
+ })
197
+ return _obj
198
+
199
+