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

Sign up to get free protection for your applications and to get access to all the features.
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.1.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.1.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.1.dist-info/RECORD +0 -43
  112. {hiddenlayer_sdk-0.1.1.dist-info → hiddenlayer_sdk-1.0.0.dist-info}/LICENSE +0 -0
  113. {hiddenlayer_sdk-0.1.1.dist-info → hiddenlayer_sdk-1.0.0.dist-info}/top_level.txt +0 -0
@@ -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, StrictBool, StrictStr, field_validator
21
+ from typing import Any, ClassVar, Dict, List, Optional, Union
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 ReportingConfiguration(BaseModel):
28
+ """
29
+ Information about a rule or notification that can be configured at runtime.
30
+ """ # noqa: E501
31
+ enabled: Optional[StrictBool] = Field(default=True, description="Specifies whether the report may be produced during the scan.")
32
+ level: Optional[StrictStr] = Field(default='warning', description="Specifies the failure level for the report.")
33
+ rank: Optional[Union[Annotated[float, Field(le=100, strict=True, ge=-1)], Annotated[int, Field(le=100, strict=True, ge=-1)]]] = Field(default=-1, description="Specifies the relative priority of the report. Used for analysis output only.")
34
+ parameters: Optional[PropertyBag] = None
35
+ properties: Optional[PropertyBag] = None
36
+ __properties: ClassVar[List[str]] = ["enabled", "level", "rank", "parameters", "properties"]
37
+
38
+ @field_validator('level')
39
+ def level_validate_enum(cls, value):
40
+ """Validates the enum"""
41
+ if value is None:
42
+ return value
43
+
44
+ if value not in set(['none', 'note', 'warning', 'error']):
45
+ raise ValueError("must be one of enum values ('none', 'note', 'warning', 'error')")
46
+ return value
47
+
48
+ model_config = ConfigDict(
49
+ populate_by_name=True,
50
+ validate_assignment=True,
51
+ protected_namespaces=(),
52
+ )
53
+
54
+
55
+ def to_str(self) -> str:
56
+ """Returns the string representation of the model using alias"""
57
+ return pprint.pformat(self.model_dump(by_alias=True))
58
+
59
+ def to_json(self) -> str:
60
+ """Returns the JSON representation of the model using alias"""
61
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
62
+ return json.dumps(self.to_dict())
63
+
64
+ @classmethod
65
+ def from_json(cls, json_str: str) -> Optional[Self]:
66
+ """Create an instance of ReportingConfiguration from a JSON string"""
67
+ return cls.from_dict(json.loads(json_str))
68
+
69
+ def to_dict(self) -> Dict[str, Any]:
70
+ """Return the dictionary representation of the model using alias.
71
+
72
+ This has the following differences from calling pydantic's
73
+ `self.model_dump(by_alias=True)`:
74
+
75
+ * `None` is only added to the output dict for nullable fields that
76
+ were set at model initialization. Other fields with value `None`
77
+ are ignored.
78
+ """
79
+ excluded_fields: Set[str] = set([
80
+ ])
81
+
82
+ _dict = self.model_dump(
83
+ by_alias=True,
84
+ exclude=excluded_fields,
85
+ exclude_none=True,
86
+ )
87
+ # override the default output from pydantic by calling `to_dict()` of parameters
88
+ if self.parameters:
89
+ _dict['parameters'] = self.parameters.to_dict()
90
+ # override the default output from pydantic by calling `to_dict()` of properties
91
+ if self.properties:
92
+ _dict['properties'] = self.properties.to_dict()
93
+ return _dict
94
+
95
+ @classmethod
96
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
97
+ """Create an instance of ReportingConfiguration 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
+ "enabled": obj.get("enabled") if obj.get("enabled") is not None else True,
106
+ "level": obj.get("level") if obj.get("level") is not None else 'warning',
107
+ "rank": obj.get("rank") if obj.get("rank") is not None else -1,
108
+ "parameters": PropertyBag.from_dict(obj["parameters"]) if obj.get("parameters") 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,162 @@
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.multiformat_message_string import MultiformatMessageString
24
+ from hiddenlayer.sdk.rest.models.property_bag import PropertyBag
25
+ from hiddenlayer.sdk.rest.models.reporting_configuration import ReportingConfiguration
26
+ from hiddenlayer.sdk.rest.models.reporting_descriptor_relationship import ReportingDescriptorRelationship
27
+ from typing import Optional, Set
28
+ from typing_extensions import Self
29
+
30
+ class ReportingDescriptor(BaseModel):
31
+ """
32
+ Metadata that describes a specific report produced by the tool, as part of the analysis it provides or its runtime reporting.
33
+ """ # noqa: E501
34
+ id: StrictStr = Field(description="A stable, opaque identifier for the report.")
35
+ deprecated_ids: Optional[Annotated[List[StrictStr], Field(min_length=0)]] = Field(default=None, description="An array of stable, opaque identifiers by which this report was known in some previous version of the analysis tool.", alias="deprecatedIds")
36
+ guid: Optional[Annotated[str, Field(strict=True)]] = Field(default=None, description="A unique identifier for the reporting descriptor in the form of a GUID.")
37
+ deprecated_guids: Optional[Annotated[List[Annotated[str, Field(strict=True)]], Field(min_length=0)]] = Field(default=None, description="An array of unique identifies in the form of a GUID by which this report was known in some previous version of the analysis tool.", alias="deprecatedGuids")
38
+ name: Optional[StrictStr] = Field(default=None, description="A report identifier that is understandable to an end user.")
39
+ deprecated_names: Optional[Annotated[List[StrictStr], Field(min_length=0)]] = Field(default=None, description="An array of readable identifiers by which this report was known in some previous version of the analysis tool.", alias="deprecatedNames")
40
+ short_description: Optional[MultiformatMessageString] = Field(default=None, alias="shortDescription")
41
+ full_description: Optional[MultiformatMessageString] = Field(default=None, alias="fullDescription")
42
+ message_strings: Optional[Dict[str, MultiformatMessageString]] = Field(default=None, description="A set of name/value pairs with arbitrary names. Each value is a multiformatMessageString object, which holds message strings in plain text and (optionally) Markdown format. The strings can include placeholders, which can be used to construct a message in combination with an arbitrary number of additional string arguments.", alias="messageStrings")
43
+ default_configuration: Optional[ReportingConfiguration] = Field(default=None, alias="defaultConfiguration")
44
+ help_uri: Optional[StrictStr] = Field(default=None, description="A URI where the primary documentation for the report can be found.", alias="helpUri")
45
+ help: Optional[MultiformatMessageString] = None
46
+ relationships: Optional[Annotated[List[ReportingDescriptorRelationship], Field(min_length=0)]] = Field(default=None, description="An array of objects that describe relationships between this reporting descriptor and others.")
47
+ properties: Optional[PropertyBag] = None
48
+ __properties: ClassVar[List[str]] = ["id", "deprecatedIds", "guid", "deprecatedGuids", "name", "deprecatedNames", "shortDescription", "fullDescription", "messageStrings", "defaultConfiguration", "helpUri", "help", "relationships", "properties"]
49
+
50
+ @field_validator('guid')
51
+ def guid_validate_regular_expression(cls, value):
52
+ """Validates the regular expression"""
53
+ if value is None:
54
+ return value
55
+
56
+ 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):
57
+ 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}$/")
58
+ return value
59
+
60
+ model_config = ConfigDict(
61
+ populate_by_name=True,
62
+ validate_assignment=True,
63
+ protected_namespaces=(),
64
+ )
65
+
66
+
67
+ def to_str(self) -> str:
68
+ """Returns the string representation of the model using alias"""
69
+ return pprint.pformat(self.model_dump(by_alias=True))
70
+
71
+ def to_json(self) -> str:
72
+ """Returns the JSON representation of the model using alias"""
73
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
74
+ return json.dumps(self.to_dict())
75
+
76
+ @classmethod
77
+ def from_json(cls, json_str: str) -> Optional[Self]:
78
+ """Create an instance of ReportingDescriptor from a JSON string"""
79
+ return cls.from_dict(json.loads(json_str))
80
+
81
+ def to_dict(self) -> Dict[str, Any]:
82
+ """Return the dictionary representation of the model using alias.
83
+
84
+ This has the following differences from calling pydantic's
85
+ `self.model_dump(by_alias=True)`:
86
+
87
+ * `None` is only added to the output dict for nullable fields that
88
+ were set at model initialization. Other fields with value `None`
89
+ are ignored.
90
+ """
91
+ excluded_fields: Set[str] = set([
92
+ ])
93
+
94
+ _dict = self.model_dump(
95
+ by_alias=True,
96
+ exclude=excluded_fields,
97
+ exclude_none=True,
98
+ )
99
+ # override the default output from pydantic by calling `to_dict()` of short_description
100
+ if self.short_description:
101
+ _dict['shortDescription'] = self.short_description.to_dict()
102
+ # override the default output from pydantic by calling `to_dict()` of full_description
103
+ if self.full_description:
104
+ _dict['fullDescription'] = self.full_description.to_dict()
105
+ # override the default output from pydantic by calling `to_dict()` of each value in message_strings (dict)
106
+ _field_dict = {}
107
+ if self.message_strings:
108
+ for _key in self.message_strings:
109
+ if self.message_strings[_key]:
110
+ _field_dict[_key] = self.message_strings[_key].to_dict()
111
+ _dict['messageStrings'] = _field_dict
112
+ # override the default output from pydantic by calling `to_dict()` of default_configuration
113
+ if self.default_configuration:
114
+ _dict['defaultConfiguration'] = self.default_configuration.to_dict()
115
+ # override the default output from pydantic by calling `to_dict()` of help
116
+ if self.help:
117
+ _dict['help'] = self.help.to_dict()
118
+ # override the default output from pydantic by calling `to_dict()` of each item in relationships (list)
119
+ _items = []
120
+ if self.relationships:
121
+ for _item in self.relationships:
122
+ if _item:
123
+ _items.append(_item.to_dict())
124
+ _dict['relationships'] = _items
125
+ # override the default output from pydantic by calling `to_dict()` of properties
126
+ if self.properties:
127
+ _dict['properties'] = self.properties.to_dict()
128
+ return _dict
129
+
130
+ @classmethod
131
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
132
+ """Create an instance of ReportingDescriptor from a dict"""
133
+ if obj is None:
134
+ return None
135
+
136
+ if not isinstance(obj, dict):
137
+ return cls.model_validate(obj)
138
+
139
+ _obj = cls.model_validate({
140
+ "id": obj.get("id"),
141
+ "deprecatedIds": obj.get("deprecatedIds"),
142
+ "guid": obj.get("guid"),
143
+ "deprecatedGuids": obj.get("deprecatedGuids"),
144
+ "name": obj.get("name"),
145
+ "deprecatedNames": obj.get("deprecatedNames"),
146
+ "shortDescription": MultiformatMessageString.from_dict(obj["shortDescription"]) if obj.get("shortDescription") is not None else None,
147
+ "fullDescription": MultiformatMessageString.from_dict(obj["fullDescription"]) if obj.get("fullDescription") is not None else None,
148
+ "messageStrings": dict(
149
+ (_k, MultiformatMessageString.from_dict(_v))
150
+ for _k, _v in obj["messageStrings"].items()
151
+ )
152
+ if obj.get("messageStrings") is not None
153
+ else None,
154
+ "defaultConfiguration": ReportingConfiguration.from_dict(obj["defaultConfiguration"]) if obj.get("defaultConfiguration") is not None else None,
155
+ "helpUri": obj.get("helpUri"),
156
+ "help": MultiformatMessageString.from_dict(obj["help"]) if obj.get("help") is not None else None,
157
+ "relationships": [ReportingDescriptorRelationship.from_dict(_item) for _item in obj["relationships"]] if obj.get("relationships") is not None else None,
158
+ "properties": PropertyBag.from_dict(obj["properties"]) if obj.get("properties") is not None else None
159
+ })
160
+ return _obj
161
+
162
+
@@ -0,0 +1,103 @@
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.property_bag import PropertyBag
24
+ from hiddenlayer.sdk.rest.models.tool_component_reference import ToolComponentReference
25
+ from typing import Optional, Set
26
+ from typing_extensions import Self
27
+
28
+ class ReportingDescriptorReference(BaseModel):
29
+ """
30
+ Information about how to locate a relevant reporting descriptor.
31
+ """ # noqa: E501
32
+ id: Optional[StrictStr] = Field(default=None, description="The id of the descriptor.")
33
+ index: Optional[Annotated[int, Field(strict=True, ge=-1)]] = Field(default=-1, description="The index into an array of descriptors in toolComponent.ruleDescriptors, toolComponent.notificationDescriptors, or toolComponent.taxonomyDescriptors, depending on context.")
34
+ guid: Optional[Annotated[str, Field(strict=True)]] = Field(default=None, description="A guid that uniquely identifies the descriptor.")
35
+ tool_component: Optional[ToolComponentReference] = Field(default=None, alias="toolComponent")
36
+ properties: Optional[PropertyBag] = None
37
+ __properties: ClassVar[List[str]] = []
38
+
39
+ @field_validator('guid')
40
+ def guid_validate_regular_expression(cls, value):
41
+ """Validates the regular expression"""
42
+ if value is None:
43
+ return value
44
+
45
+ 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):
46
+ 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}$/")
47
+ return value
48
+
49
+ model_config = ConfigDict(
50
+ populate_by_name=True,
51
+ validate_assignment=True,
52
+ protected_namespaces=(),
53
+ )
54
+
55
+
56
+ def to_str(self) -> str:
57
+ """Returns the string representation of the model using alias"""
58
+ return pprint.pformat(self.model_dump(by_alias=True))
59
+
60
+ def to_json(self) -> str:
61
+ """Returns the JSON representation of the model using alias"""
62
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
63
+ return json.dumps(self.to_dict())
64
+
65
+ @classmethod
66
+ def from_json(cls, json_str: str) -> Optional[Self]:
67
+ """Create an instance of ReportingDescriptorReference from a JSON string"""
68
+ return cls.from_dict(json.loads(json_str))
69
+
70
+ def to_dict(self) -> Dict[str, Any]:
71
+ """Return the dictionary representation of the model using alias.
72
+
73
+ This has the following differences from calling pydantic's
74
+ `self.model_dump(by_alias=True)`:
75
+
76
+ * `None` is only added to the output dict for nullable fields that
77
+ were set at model initialization. Other fields with value `None`
78
+ are ignored.
79
+ """
80
+ excluded_fields: Set[str] = set([
81
+ ])
82
+
83
+ _dict = self.model_dump(
84
+ by_alias=True,
85
+ exclude=excluded_fields,
86
+ exclude_none=True,
87
+ )
88
+ return _dict
89
+
90
+ @classmethod
91
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
92
+ """Create an instance of ReportingDescriptorReference 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
+ })
101
+ return _obj
102
+
103
+
@@ -0,0 +1,115 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ HiddenLayer ModelScan V2
5
+
6
+ HiddenLayer ModelScan API for scanning of models
7
+
8
+ The version of the OpenAPI document: 1
9
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
10
+
11
+ Do not edit the class manually.
12
+ """ # noqa: E501
13
+
14
+
15
+ from __future__ import annotations
16
+ import pprint
17
+ import re # noqa: F401
18
+ import json
19
+
20
+ from pydantic import BaseModel, ConfigDict, Field, StrictStr
21
+ from typing import Any, ClassVar, Dict, List, Optional
22
+ from hiddenlayer.sdk.rest.models.message import Message
23
+ from hiddenlayer.sdk.rest.models.property_bag import PropertyBag
24
+ from hiddenlayer.sdk.rest.models.reporting_descriptor_reference import ReportingDescriptorReference
25
+ from typing import Optional, Set
26
+ from typing_extensions import Self
27
+
28
+ class ReportingDescriptorRelationship(BaseModel):
29
+ """
30
+ Information about the relation of one reporting descriptor to another.
31
+ """ # noqa: E501
32
+ target: Optional[ReportingDescriptorReference]
33
+ kinds: Optional[List[StrictStr]] = Field(default=None, description="A set of distinct strings that categorize the relationship. Well-known kinds include 'canPrecede', 'canFollow', 'willPrecede', 'willFollow', 'superset', 'subset', 'equal', 'disjoint', 'relevant', and 'incomparable'.")
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 ReportingDescriptorRelationship 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 target
78
+ if self.target:
79
+ _dict['target'] = self.target.to_dict()
80
+ # override the default output from pydantic by calling `to_dict()` of description
81
+ if self.description:
82
+ _dict['description'] = self.description.to_dict()
83
+ # override the default output from pydantic by calling `to_dict()` of properties
84
+ if self.properties:
85
+ _dict['properties'] = self.properties.to_dict()
86
+ # set to None if target (nullable) is None
87
+ # and model_fields_set contains the field
88
+ if self.target is None and "target" in self.model_fields_set:
89
+ _dict['target'] = None
90
+
91
+ # set to None if description (nullable) is None
92
+ # and model_fields_set contains the field
93
+ if self.description is None and "description" in self.model_fields_set:
94
+ _dict['description'] = None
95
+
96
+ return _dict
97
+
98
+ @classmethod
99
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
100
+ """Create an instance of ReportingDescriptorRelationship from a dict"""
101
+ if obj is None:
102
+ return None
103
+
104
+ if not isinstance(obj, dict):
105
+ return cls.model_validate(obj)
106
+
107
+ _obj = cls.model_validate({
108
+ "target": ReportingDescriptorReference.from_dict(obj["target"]) if obj.get("target") is not None else None,
109
+ "kinds": obj.get("kinds"),
110
+ "description": Message.from_dict(obj["description"]) if obj.get("description") is not None else None,
111
+ "properties": PropertyBag.from_dict(obj["properties"]) if obj.get("properties") is not None else None
112
+ })
113
+ return _obj
114
+
115
+