thousandeyes-sdk-instant-tests 1.0.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- thousandeyes_sdk/instant_tests/__init__.py +117 -0
- thousandeyes_sdk/instant_tests/api/__init__.py +17 -0
- thousandeyes_sdk/instant_tests/api/agent_to_agent_api.py +376 -0
- thousandeyes_sdk/instant_tests/api/agent_to_server_api.py +376 -0
- thousandeyes_sdk/instant_tests/api/api_api.py +376 -0
- thousandeyes_sdk/instant_tests/api/dns_security_api.py +376 -0
- thousandeyes_sdk/instant_tests/api/dns_server_api.py +376 -0
- thousandeyes_sdk/instant_tests/api/dns_trace_api.py +376 -0
- thousandeyes_sdk/instant_tests/api/ftp_server_api.py +376 -0
- thousandeyes_sdk/instant_tests/api/http_page_load_api.py +376 -0
- thousandeyes_sdk/instant_tests/api/http_server_api.py +376 -0
- thousandeyes_sdk/instant_tests/api/run_api.py +338 -0
- thousandeyes_sdk/instant_tests/api/sip_server_api.py +376 -0
- thousandeyes_sdk/instant_tests/api/voice_api.py +376 -0
- thousandeyes_sdk/instant_tests/api/web_transaction_api.py +376 -0
- thousandeyes_sdk/instant_tests/models/__init__.py +100 -0
- thousandeyes_sdk/instant_tests/models/agent.py +125 -0
- thousandeyes_sdk/instant_tests/models/agent_base.py +98 -0
- thousandeyes_sdk/instant_tests/models/agent_to_agent_instant_test.py +198 -0
- thousandeyes_sdk/instant_tests/models/agent_to_agent_instant_test_request.py +176 -0
- thousandeyes_sdk/instant_tests/models/agent_to_agent_properties.py +123 -0
- thousandeyes_sdk/instant_tests/models/agent_to_agent_test_protocol.py +37 -0
- thousandeyes_sdk/instant_tests/models/agent_to_server_instant_test.py +203 -0
- thousandeyes_sdk/instant_tests/models/agent_to_server_instant_test_request.py +181 -0
- thousandeyes_sdk/instant_tests/models/agent_to_server_properties.py +128 -0
- thousandeyes_sdk/instant_tests/models/api_instant_test.py +214 -0
- thousandeyes_sdk/instant_tests/models/api_instant_test_request.py +192 -0
- thousandeyes_sdk/instant_tests/models/api_predefined_variable.py +90 -0
- thousandeyes_sdk/instant_tests/models/api_properties.py +137 -0
- thousandeyes_sdk/instant_tests/models/api_request.py +138 -0
- thousandeyes_sdk/instant_tests/models/api_request_assertion.py +94 -0
- thousandeyes_sdk/instant_tests/models/api_request_assertion_name.py +37 -0
- thousandeyes_sdk/instant_tests/models/api_request_assertion_operator.py +39 -0
- thousandeyes_sdk/instant_tests/models/api_request_auth_type.py +38 -0
- thousandeyes_sdk/instant_tests/models/api_request_header.py +90 -0
- thousandeyes_sdk/instant_tests/models/api_request_method.py +40 -0
- thousandeyes_sdk/instant_tests/models/api_request_variable.py +90 -0
- thousandeyes_sdk/instant_tests/models/cloud_enterprise_agent_type.py +38 -0
- thousandeyes_sdk/instant_tests/models/dns_query_class.py +37 -0
- thousandeyes_sdk/instant_tests/models/dns_sec_instant_test.py +170 -0
- thousandeyes_sdk/instant_tests/models/dns_sec_instant_test_request.py +148 -0
- thousandeyes_sdk/instant_tests/models/dns_sec_properties.py +95 -0
- thousandeyes_sdk/instant_tests/models/dns_server_instant_test.py +208 -0
- thousandeyes_sdk/instant_tests/models/dns_server_instant_test_request.py +178 -0
- thousandeyes_sdk/instant_tests/models/dns_server_properties.py +133 -0
- thousandeyes_sdk/instant_tests/models/dns_servers_request.py +88 -0
- thousandeyes_sdk/instant_tests/models/dns_trace_instant_test.py +173 -0
- thousandeyes_sdk/instant_tests/models/dns_trace_instant_test_request.py +151 -0
- thousandeyes_sdk/instant_tests/models/dns_trace_properties.py +98 -0
- thousandeyes_sdk/instant_tests/models/error.py +96 -0
- thousandeyes_sdk/instant_tests/models/expand.py +38 -0
- thousandeyes_sdk/instant_tests/models/ftp_server_instant_test.py +207 -0
- thousandeyes_sdk/instant_tests/models/ftp_server_properties.py +132 -0
- thousandeyes_sdk/instant_tests/models/ftp_server_request_type.py +38 -0
- thousandeyes_sdk/instant_tests/models/http_server_instant_test.py +246 -0
- thousandeyes_sdk/instant_tests/models/http_server_instant_test_request.py +224 -0
- thousandeyes_sdk/instant_tests/models/http_server_properties.py +171 -0
- thousandeyes_sdk/instant_tests/models/instant_test.py +152 -0
- thousandeyes_sdk/instant_tests/models/instant_test_request.py +100 -0
- thousandeyes_sdk/instant_tests/models/link.py +102 -0
- thousandeyes_sdk/instant_tests/models/page_load_instant_test.py +254 -0
- thousandeyes_sdk/instant_tests/models/page_load_instant_test_request.py +232 -0
- thousandeyes_sdk/instant_tests/models/page_load_properties.py +179 -0
- thousandeyes_sdk/instant_tests/models/server_instant_test_request.py +185 -0
- thousandeyes_sdk/instant_tests/models/shared_with_account.py +90 -0
- thousandeyes_sdk/instant_tests/models/simple_agent.py +122 -0
- thousandeyes_sdk/instant_tests/models/sip_server_instant_test.py +191 -0
- thousandeyes_sdk/instant_tests/models/sip_server_instant_test_request.py +175 -0
- thousandeyes_sdk/instant_tests/models/sip_server_instant_test_request1.py +197 -0
- thousandeyes_sdk/instant_tests/models/sip_server_instant_test_response.py +204 -0
- thousandeyes_sdk/instant_tests/models/sip_server_properties.py +116 -0
- thousandeyes_sdk/instant_tests/models/sip_test_protocol.py +38 -0
- thousandeyes_sdk/instant_tests/models/test_agent.py +90 -0
- thousandeyes_sdk/instant_tests/models/test_auth_type.py +40 -0
- thousandeyes_sdk/instant_tests/models/test_custom_headers.py +92 -0
- thousandeyes_sdk/instant_tests/models/test_direction.py +38 -0
- thousandeyes_sdk/instant_tests/models/test_dns_server.py +90 -0
- thousandeyes_sdk/instant_tests/models/test_dns_transport_protocol.py +37 -0
- thousandeyes_sdk/instant_tests/models/test_dscp_id.py +57 -0
- thousandeyes_sdk/instant_tests/models/test_ipv6_policy.py +39 -0
- thousandeyes_sdk/instant_tests/models/test_label.py +92 -0
- thousandeyes_sdk/instant_tests/models/test_links.py +102 -0
- thousandeyes_sdk/instant_tests/models/test_page_loading_strategy.py +38 -0
- thousandeyes_sdk/instant_tests/models/test_path_trace_mode.py +37 -0
- thousandeyes_sdk/instant_tests/models/test_probe_mode.py +38 -0
- thousandeyes_sdk/instant_tests/models/test_protocol.py +38 -0
- thousandeyes_sdk/instant_tests/models/test_self_link.py +102 -0
- thousandeyes_sdk/instant_tests/models/test_sip_credentials.py +100 -0
- thousandeyes_sdk/instant_tests/models/test_ssl_version_id.py +40 -0
- thousandeyes_sdk/instant_tests/models/test_type.py +48 -0
- thousandeyes_sdk/instant_tests/models/unauthorized_error.py +90 -0
- thousandeyes_sdk/instant_tests/models/unexpanded_instant_test.py +128 -0
- thousandeyes_sdk/instant_tests/models/validation_error.py +111 -0
- thousandeyes_sdk/instant_tests/models/validation_error_item.py +92 -0
- thousandeyes_sdk/instant_tests/models/voice_instant_test.py +189 -0
- thousandeyes_sdk/instant_tests/models/voice_instant_test_request.py +167 -0
- thousandeyes_sdk/instant_tests/models/voice_properties.py +114 -0
- thousandeyes_sdk/instant_tests/models/web_transaction_instant_test.py +258 -0
- thousandeyes_sdk/instant_tests/models/web_transaction_instant_test_request.py +236 -0
- thousandeyes_sdk/instant_tests/models/web_transaction_properties.py +181 -0
- thousandeyes_sdk/instant_tests/py.typed +0 -0
- thousandeyes_sdk_instant_tests-1.0.0.dist-info/LICENSE +176 -0
- thousandeyes_sdk_instant_tests-1.0.0.dist-info/METADATA +423 -0
- thousandeyes_sdk_instant_tests-1.0.0.dist-info/NOTICE +7 -0
- thousandeyes_sdk_instant_tests-1.0.0.dist-info/RECORD +107 -0
- thousandeyes_sdk_instant_tests-1.0.0.dist-info/WHEEL +5 -0
- thousandeyes_sdk_instant_tests-1.0.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,197 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
"""
|
4
|
+
Instant Tests API
|
5
|
+
|
6
|
+
The Instant Tests API endpoint lets you create and run new instant tests. You will need to be a regular user or have the following permissions: * `API Access` * `View tests` The response does not include the immediate test results. Use the Test Results endpoints to get test results after creating and executing an instant test. You can find the URLs for these endpoints in the _links section of the test definition that is returned when you create the instant test.
|
7
|
+
|
8
|
+
The version of the OpenAPI document: 7.0.8
|
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, StrictStr
|
22
|
+
from typing import Any, ClassVar, Dict, List, Optional
|
23
|
+
from typing_extensions import Annotated
|
24
|
+
from thousandeyes_sdk.instant_tests.models.agent import Agent
|
25
|
+
from thousandeyes_sdk.instant_tests.models.shared_with_account import SharedWithAccount
|
26
|
+
from thousandeyes_sdk.instant_tests.models.test_ipv6_policy import TestIpv6Policy
|
27
|
+
from thousandeyes_sdk.instant_tests.models.test_label import TestLabel
|
28
|
+
from thousandeyes_sdk.instant_tests.models.test_links import TestLinks
|
29
|
+
from thousandeyes_sdk.instant_tests.models.test_path_trace_mode import TestPathTraceMode
|
30
|
+
from thousandeyes_sdk.instant_tests.models.test_probe_mode import TestProbeMode
|
31
|
+
from thousandeyes_sdk.instant_tests.models.test_sip_credentials import TestSipCredentials
|
32
|
+
from typing import Optional, Set
|
33
|
+
from typing_extensions import Self
|
34
|
+
|
35
|
+
class SipServerInstantTestRequest1(BaseModel):
|
36
|
+
"""
|
37
|
+
SipServerInstantTestRequest1
|
38
|
+
""" # noqa: E501
|
39
|
+
created_by: Optional[StrictStr] = Field(default=None, description="User that created the test.", alias="createdBy")
|
40
|
+
created_date: Optional[datetime] = Field(default=None, description="UTC created date (ISO date-time format).", alias="createdDate")
|
41
|
+
description: Optional[StrictStr] = Field(default=None, description="A description of the test.")
|
42
|
+
live_share: Optional[StrictBool] = Field(default=None, description="Indicates if the test is shared with the account group.", alias="liveShare")
|
43
|
+
modified_by: Optional[StrictStr] = Field(default=None, description="User that modified the test.", alias="modifiedBy")
|
44
|
+
modified_date: Optional[datetime] = Field(default=None, description="UTC last modification date (ISO date-time format).", alias="modifiedDate")
|
45
|
+
saved_event: Optional[StrictBool] = Field(default=None, description="Indicates if the test is a saved event.", alias="savedEvent")
|
46
|
+
test_id: Optional[StrictStr] = Field(default=None, description="Each test is assigned an unique ID; this is used to access test information and results from other endpoints.", alias="testId")
|
47
|
+
test_name: Optional[StrictStr] = Field(default=None, description="The name of the test. Test name must be unique.", alias="testName")
|
48
|
+
type: Optional[StrictStr] = None
|
49
|
+
links: Optional[TestLinks] = Field(default=None, alias="_links")
|
50
|
+
labels: Optional[List[TestLabel]] = None
|
51
|
+
shared_with_accounts: Optional[List[SharedWithAccount]] = Field(default=None, alias="sharedWithAccounts")
|
52
|
+
mtu_measurements: Optional[StrictBool] = Field(default=None, description="Set `true` to measure MTU sizes on network from agents to the target.", alias="mtuMeasurements")
|
53
|
+
network_measurements: Optional[StrictBool] = Field(default=True, description="Enable or disable network measurements. Set to true to enable or false to disable network measurements.", alias="networkMeasurements")
|
54
|
+
num_path_traces: Optional[Annotated[int, Field(le=10, strict=True, ge=1)]] = Field(default=3, description="Number of path traces executed by the agent.", alias="numPathTraces")
|
55
|
+
options_regex: Optional[StrictStr] = Field(default=None, description="Options regex, this field does not require escaping.", alias="optionsRegex")
|
56
|
+
path_trace_mode: Optional[TestPathTraceMode] = Field(default=None, alias="pathTraceMode")
|
57
|
+
probe_mode: Optional[TestProbeMode] = Field(default=None, alias="probeMode")
|
58
|
+
register_enabled: Optional[StrictBool] = Field(default=False, description="Set to true to perform SIP registration on the test target with the SIP REGISTER command.", alias="registerEnabled")
|
59
|
+
sip_target_time: Optional[Annotated[int, Field(le=5000, strict=True, ge=100)]] = Field(default=None, description="Target time for test completion in milliseconds.", alias="sipTargetTime")
|
60
|
+
sip_time_limit: Optional[Annotated[int, Field(le=10, strict=True, ge=5)]] = Field(default=5, description="Time limit in milliseconds.", alias="sipTimeLimit")
|
61
|
+
fixed_packet_rate: Optional[Annotated[int, Field(le=100, strict=True, ge=0)]] = Field(default=None, description="Sets packets rate sent to measure the network in packets per second.", alias="fixedPacketRate")
|
62
|
+
ipv6_policy: Optional[TestIpv6Policy] = Field(default=None, alias="ipv6Policy")
|
63
|
+
agents: Optional[List[Agent]] = Field(default=None, description="Contains list of agents.")
|
64
|
+
target_sip_credentials: TestSipCredentials = Field(alias="targetSipCredentials")
|
65
|
+
__properties: ClassVar[List[str]] = ["createdBy", "createdDate", "description", "liveShare", "modifiedBy", "modifiedDate", "savedEvent", "testId", "testName", "type", "_links", "labels", "sharedWithAccounts", "mtuMeasurements", "networkMeasurements", "numPathTraces", "optionsRegex", "pathTraceMode", "probeMode", "registerEnabled", "sipTargetTime", "sipTimeLimit", "fixedPacketRate", "ipv6Policy", "agents", "targetSipCredentials"]
|
66
|
+
|
67
|
+
model_config = ConfigDict(
|
68
|
+
populate_by_name=True,
|
69
|
+
validate_assignment=True,
|
70
|
+
protected_namespaces=(),
|
71
|
+
extra="allow",
|
72
|
+
)
|
73
|
+
|
74
|
+
|
75
|
+
def to_str(self) -> str:
|
76
|
+
"""Returns the string representation of the model using alias"""
|
77
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
78
|
+
|
79
|
+
def to_json(self) -> str:
|
80
|
+
"""Returns the JSON representation of the model using alias"""
|
81
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
82
|
+
return self.model_dump_json(by_alias=True, exclude_unset=True, exclude_none=True)
|
83
|
+
|
84
|
+
@classmethod
|
85
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
86
|
+
"""Create an instance of SipServerInstantTestRequest1 from a JSON string"""
|
87
|
+
return cls.from_dict(json.loads(json_str))
|
88
|
+
|
89
|
+
def to_dict(self) -> Dict[str, Any]:
|
90
|
+
"""Return the dictionary representation of the model using alias.
|
91
|
+
|
92
|
+
This has the following differences from calling pydantic's
|
93
|
+
`self.model_dump(by_alias=True)`:
|
94
|
+
|
95
|
+
* `None` is only added to the output dict for nullable fields that
|
96
|
+
were set at model initialization. Other fields with value `None`
|
97
|
+
are ignored.
|
98
|
+
* OpenAPI `readOnly` fields are excluded.
|
99
|
+
* OpenAPI `readOnly` fields are excluded.
|
100
|
+
* OpenAPI `readOnly` fields are excluded.
|
101
|
+
* OpenAPI `readOnly` fields are excluded.
|
102
|
+
* OpenAPI `readOnly` fields are excluded.
|
103
|
+
* OpenAPI `readOnly` fields are excluded.
|
104
|
+
* OpenAPI `readOnly` fields are excluded.
|
105
|
+
* OpenAPI `readOnly` fields are excluded.
|
106
|
+
* OpenAPI `readOnly` fields are excluded.
|
107
|
+
* OpenAPI `readOnly` fields are excluded.
|
108
|
+
* OpenAPI `readOnly` fields are excluded.
|
109
|
+
"""
|
110
|
+
excluded_fields: Set[str] = set([
|
111
|
+
"created_by",
|
112
|
+
"created_date",
|
113
|
+
"live_share",
|
114
|
+
"modified_by",
|
115
|
+
"modified_date",
|
116
|
+
"saved_event",
|
117
|
+
"test_id",
|
118
|
+
"type",
|
119
|
+
"labels",
|
120
|
+
"shared_with_accounts",
|
121
|
+
"agents",
|
122
|
+
])
|
123
|
+
|
124
|
+
_dict = self.model_dump(
|
125
|
+
by_alias=True,
|
126
|
+
exclude=excluded_fields,
|
127
|
+
exclude_none=True,
|
128
|
+
)
|
129
|
+
# override the default output from pydantic by calling `to_dict()` of links
|
130
|
+
if self.links:
|
131
|
+
_dict['_links'] = self.links.to_dict()
|
132
|
+
# override the default output from pydantic by calling `to_dict()` of each item in labels (list)
|
133
|
+
_items = []
|
134
|
+
if self.labels:
|
135
|
+
for _item in self.labels:
|
136
|
+
if _item:
|
137
|
+
_items.append(_item.to_dict())
|
138
|
+
_dict['labels'] = _items
|
139
|
+
# override the default output from pydantic by calling `to_dict()` of each item in shared_with_accounts (list)
|
140
|
+
_items = []
|
141
|
+
if self.shared_with_accounts:
|
142
|
+
for _item in self.shared_with_accounts:
|
143
|
+
if _item:
|
144
|
+
_items.append(_item.to_dict())
|
145
|
+
_dict['sharedWithAccounts'] = _items
|
146
|
+
# override the default output from pydantic by calling `to_dict()` of each item in agents (list)
|
147
|
+
_items = []
|
148
|
+
if self.agents:
|
149
|
+
for _item in self.agents:
|
150
|
+
if _item:
|
151
|
+
_items.append(_item.to_dict())
|
152
|
+
_dict['agents'] = _items
|
153
|
+
# override the default output from pydantic by calling `to_dict()` of target_sip_credentials
|
154
|
+
if self.target_sip_credentials:
|
155
|
+
_dict['targetSipCredentials'] = self.target_sip_credentials.to_dict()
|
156
|
+
return _dict
|
157
|
+
|
158
|
+
@classmethod
|
159
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
160
|
+
"""Create an instance of SipServerInstantTestRequest1 from a dict"""
|
161
|
+
if obj is None:
|
162
|
+
return None
|
163
|
+
|
164
|
+
if not isinstance(obj, dict):
|
165
|
+
return cls.model_validate(obj)
|
166
|
+
|
167
|
+
_obj = cls.model_validate({
|
168
|
+
"createdBy": obj.get("createdBy"),
|
169
|
+
"createdDate": obj.get("createdDate"),
|
170
|
+
"description": obj.get("description"),
|
171
|
+
"liveShare": obj.get("liveShare"),
|
172
|
+
"modifiedBy": obj.get("modifiedBy"),
|
173
|
+
"modifiedDate": obj.get("modifiedDate"),
|
174
|
+
"savedEvent": obj.get("savedEvent"),
|
175
|
+
"testId": obj.get("testId"),
|
176
|
+
"testName": obj.get("testName"),
|
177
|
+
"type": obj.get("type"),
|
178
|
+
"_links": TestLinks.from_dict(obj["_links"]) if obj.get("_links") is not None else None,
|
179
|
+
"labels": [TestLabel.from_dict(_item) for _item in obj["labels"]] if obj.get("labels") is not None else None,
|
180
|
+
"sharedWithAccounts": [SharedWithAccount.from_dict(_item) for _item in obj["sharedWithAccounts"]] if obj.get("sharedWithAccounts") is not None else None,
|
181
|
+
"mtuMeasurements": obj.get("mtuMeasurements"),
|
182
|
+
"networkMeasurements": obj.get("networkMeasurements") if obj.get("networkMeasurements") is not None else True,
|
183
|
+
"numPathTraces": obj.get("numPathTraces") if obj.get("numPathTraces") is not None else 3,
|
184
|
+
"optionsRegex": obj.get("optionsRegex"),
|
185
|
+
"pathTraceMode": obj.get("pathTraceMode"),
|
186
|
+
"probeMode": obj.get("probeMode"),
|
187
|
+
"registerEnabled": obj.get("registerEnabled") if obj.get("registerEnabled") is not None else False,
|
188
|
+
"sipTargetTime": obj.get("sipTargetTime"),
|
189
|
+
"sipTimeLimit": obj.get("sipTimeLimit") if obj.get("sipTimeLimit") is not None else 5,
|
190
|
+
"fixedPacketRate": obj.get("fixedPacketRate"),
|
191
|
+
"ipv6Policy": obj.get("ipv6Policy"),
|
192
|
+
"agents": [Agent.from_dict(_item) for _item in obj["agents"]] if obj.get("agents") is not None else None,
|
193
|
+
"targetSipCredentials": TestSipCredentials.from_dict(obj["targetSipCredentials"]) if obj.get("targetSipCredentials") is not None else None
|
194
|
+
})
|
195
|
+
return _obj
|
196
|
+
|
197
|
+
|
@@ -0,0 +1,204 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
"""
|
4
|
+
Instant Tests API
|
5
|
+
|
6
|
+
The Instant Tests API endpoint lets you create and run new instant tests. You will need to be a regular user or have the following permissions: * `API Access` * `View tests` The response does not include the immediate test results. Use the Test Results endpoints to get test results after creating and executing an instant test. You can find the URLs for these endpoints in the _links section of the test definition that is returned when you create the instant test.
|
7
|
+
|
8
|
+
The version of the OpenAPI document: 7.0.8
|
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, StrictStr
|
22
|
+
from typing import Any, ClassVar, Dict, List, Optional
|
23
|
+
from typing_extensions import Annotated
|
24
|
+
from thousandeyes_sdk.instant_tests.models.agent import Agent
|
25
|
+
from thousandeyes_sdk.instant_tests.models.shared_with_account import SharedWithAccount
|
26
|
+
from thousandeyes_sdk.instant_tests.models.sip_test_protocol import SipTestProtocol
|
27
|
+
from thousandeyes_sdk.instant_tests.models.test_ipv6_policy import TestIpv6Policy
|
28
|
+
from thousandeyes_sdk.instant_tests.models.test_label import TestLabel
|
29
|
+
from thousandeyes_sdk.instant_tests.models.test_links import TestLinks
|
30
|
+
from thousandeyes_sdk.instant_tests.models.test_path_trace_mode import TestPathTraceMode
|
31
|
+
from thousandeyes_sdk.instant_tests.models.test_probe_mode import TestProbeMode
|
32
|
+
from typing import Optional, Set
|
33
|
+
from typing_extensions import Self
|
34
|
+
|
35
|
+
class SipServerInstantTestResponse(BaseModel):
|
36
|
+
"""
|
37
|
+
SipServerInstantTestResponse
|
38
|
+
""" # noqa: E501
|
39
|
+
created_by: Optional[StrictStr] = Field(default=None, description="User that created the test.", alias="createdBy")
|
40
|
+
created_date: Optional[datetime] = Field(default=None, description="UTC created date (ISO date-time format).", alias="createdDate")
|
41
|
+
description: Optional[StrictStr] = Field(default=None, description="A description of the test.")
|
42
|
+
live_share: Optional[StrictBool] = Field(default=None, description="Indicates if the test is shared with the account group.", alias="liveShare")
|
43
|
+
modified_by: Optional[StrictStr] = Field(default=None, description="User that modified the test.", alias="modifiedBy")
|
44
|
+
modified_date: Optional[datetime] = Field(default=None, description="UTC last modification date (ISO date-time format).", alias="modifiedDate")
|
45
|
+
saved_event: Optional[StrictBool] = Field(default=None, description="Indicates if the test is a saved event.", alias="savedEvent")
|
46
|
+
test_id: Optional[StrictStr] = Field(default=None, description="Each test is assigned an unique ID; this is used to access test information and results from other endpoints.", alias="testId")
|
47
|
+
test_name: Optional[StrictStr] = Field(default=None, description="The name of the test. Test name must be unique.", alias="testName")
|
48
|
+
type: Optional[StrictStr] = None
|
49
|
+
links: Optional[TestLinks] = Field(default=None, alias="_links")
|
50
|
+
labels: Optional[List[TestLabel]] = None
|
51
|
+
shared_with_accounts: Optional[List[SharedWithAccount]] = Field(default=None, alias="sharedWithAccounts")
|
52
|
+
mtu_measurements: Optional[StrictBool] = Field(default=None, description="Set `true` to measure MTU sizes on network from agents to the target.", alias="mtuMeasurements")
|
53
|
+
network_measurements: Optional[StrictBool] = Field(default=True, description="Enable or disable network measurements. Set to true to enable or false to disable network measurements.", alias="networkMeasurements")
|
54
|
+
num_path_traces: Optional[Annotated[int, Field(le=10, strict=True, ge=1)]] = Field(default=3, description="Number of path traces executed by the agent.", alias="numPathTraces")
|
55
|
+
options_regex: Optional[StrictStr] = Field(default=None, description="Options regex, this field does not require escaping.", alias="optionsRegex")
|
56
|
+
path_trace_mode: Optional[TestPathTraceMode] = Field(default=None, alias="pathTraceMode")
|
57
|
+
probe_mode: Optional[TestProbeMode] = Field(default=None, alias="probeMode")
|
58
|
+
register_enabled: Optional[StrictBool] = Field(default=False, description="Set to true to perform SIP registration on the test target with the SIP REGISTER command.", alias="registerEnabled")
|
59
|
+
sip_target_time: Optional[Annotated[int, Field(le=5000, strict=True, ge=100)]] = Field(default=None, description="Target time for test completion in milliseconds.", alias="sipTargetTime")
|
60
|
+
sip_time_limit: Optional[Annotated[int, Field(le=10, strict=True, ge=5)]] = Field(default=5, description="Time limit in milliseconds.", alias="sipTimeLimit")
|
61
|
+
fixed_packet_rate: Optional[Annotated[int, Field(le=100, strict=True, ge=0)]] = Field(default=None, description="Sets packets rate sent to measure the network in packets per second.", alias="fixedPacketRate")
|
62
|
+
ipv6_policy: Optional[TestIpv6Policy] = Field(default=None, alias="ipv6Policy")
|
63
|
+
agents: Optional[List[Agent]] = Field(default=None, description="Contains list of agents.")
|
64
|
+
auth_user: Optional[StrictStr] = Field(default=None, description="Username for authentication with SIP server.", alias="authUser")
|
65
|
+
password: Optional[StrictStr] = Field(default=None, description="Password for Basic/NTLM authentication.")
|
66
|
+
port: Annotated[int, Field(le=65535, strict=True, ge=1)] = Field(description="Target port.")
|
67
|
+
protocol: Optional[SipTestProtocol] = None
|
68
|
+
sip_registrar: Optional[StrictStr] = Field(default=None, description="SIP server to be tested, specified by domain name or IP address.", alias="sipRegistrar")
|
69
|
+
user: Optional[StrictStr] = Field(default=None, description="Username for SIP registration, should be unique within a ThousandEyes account group.")
|
70
|
+
__properties: ClassVar[List[str]] = ["createdBy", "createdDate", "description", "liveShare", "modifiedBy", "modifiedDate", "savedEvent", "testId", "testName", "type", "_links", "labels", "sharedWithAccounts", "mtuMeasurements", "networkMeasurements", "numPathTraces", "optionsRegex", "pathTraceMode", "probeMode", "registerEnabled", "sipTargetTime", "sipTimeLimit", "fixedPacketRate", "ipv6Policy", "agents", "authUser", "password", "port", "protocol", "sipRegistrar", "user"]
|
71
|
+
|
72
|
+
model_config = ConfigDict(
|
73
|
+
populate_by_name=True,
|
74
|
+
validate_assignment=True,
|
75
|
+
protected_namespaces=(),
|
76
|
+
extra="allow",
|
77
|
+
)
|
78
|
+
|
79
|
+
|
80
|
+
def to_str(self) -> str:
|
81
|
+
"""Returns the string representation of the model using alias"""
|
82
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
83
|
+
|
84
|
+
def to_json(self) -> str:
|
85
|
+
"""Returns the JSON representation of the model using alias"""
|
86
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
87
|
+
return self.model_dump_json(by_alias=True, exclude_unset=True, exclude_none=True)
|
88
|
+
|
89
|
+
@classmethod
|
90
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
91
|
+
"""Create an instance of SipServerInstantTestResponse from a JSON string"""
|
92
|
+
return cls.from_dict(json.loads(json_str))
|
93
|
+
|
94
|
+
def to_dict(self) -> Dict[str, Any]:
|
95
|
+
"""Return the dictionary representation of the model using alias.
|
96
|
+
|
97
|
+
This has the following differences from calling pydantic's
|
98
|
+
`self.model_dump(by_alias=True)`:
|
99
|
+
|
100
|
+
* `None` is only added to the output dict for nullable fields that
|
101
|
+
were set at model initialization. Other fields with value `None`
|
102
|
+
are ignored.
|
103
|
+
* OpenAPI `readOnly` fields are excluded.
|
104
|
+
* OpenAPI `readOnly` fields are excluded.
|
105
|
+
* OpenAPI `readOnly` fields are excluded.
|
106
|
+
* OpenAPI `readOnly` fields are excluded.
|
107
|
+
* OpenAPI `readOnly` fields are excluded.
|
108
|
+
* OpenAPI `readOnly` fields are excluded.
|
109
|
+
* OpenAPI `readOnly` fields are excluded.
|
110
|
+
* OpenAPI `readOnly` fields are excluded.
|
111
|
+
* OpenAPI `readOnly` fields are excluded.
|
112
|
+
* OpenAPI `readOnly` fields are excluded.
|
113
|
+
* OpenAPI `readOnly` fields are excluded.
|
114
|
+
"""
|
115
|
+
excluded_fields: Set[str] = set([
|
116
|
+
"created_by",
|
117
|
+
"created_date",
|
118
|
+
"live_share",
|
119
|
+
"modified_by",
|
120
|
+
"modified_date",
|
121
|
+
"saved_event",
|
122
|
+
"test_id",
|
123
|
+
"type",
|
124
|
+
"labels",
|
125
|
+
"shared_with_accounts",
|
126
|
+
"agents",
|
127
|
+
])
|
128
|
+
|
129
|
+
_dict = self.model_dump(
|
130
|
+
by_alias=True,
|
131
|
+
exclude=excluded_fields,
|
132
|
+
exclude_none=True,
|
133
|
+
)
|
134
|
+
# override the default output from pydantic by calling `to_dict()` of links
|
135
|
+
if self.links:
|
136
|
+
_dict['_links'] = self.links.to_dict()
|
137
|
+
# override the default output from pydantic by calling `to_dict()` of each item in labels (list)
|
138
|
+
_items = []
|
139
|
+
if self.labels:
|
140
|
+
for _item in self.labels:
|
141
|
+
if _item:
|
142
|
+
_items.append(_item.to_dict())
|
143
|
+
_dict['labels'] = _items
|
144
|
+
# override the default output from pydantic by calling `to_dict()` of each item in shared_with_accounts (list)
|
145
|
+
_items = []
|
146
|
+
if self.shared_with_accounts:
|
147
|
+
for _item in self.shared_with_accounts:
|
148
|
+
if _item:
|
149
|
+
_items.append(_item.to_dict())
|
150
|
+
_dict['sharedWithAccounts'] = _items
|
151
|
+
# override the default output from pydantic by calling `to_dict()` of each item in agents (list)
|
152
|
+
_items = []
|
153
|
+
if self.agents:
|
154
|
+
for _item in self.agents:
|
155
|
+
if _item:
|
156
|
+
_items.append(_item.to_dict())
|
157
|
+
_dict['agents'] = _items
|
158
|
+
return _dict
|
159
|
+
|
160
|
+
@classmethod
|
161
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
162
|
+
"""Create an instance of SipServerInstantTestResponse 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
|
+
"createdBy": obj.get("createdBy"),
|
171
|
+
"createdDate": obj.get("createdDate"),
|
172
|
+
"description": obj.get("description"),
|
173
|
+
"liveShare": obj.get("liveShare"),
|
174
|
+
"modifiedBy": obj.get("modifiedBy"),
|
175
|
+
"modifiedDate": obj.get("modifiedDate"),
|
176
|
+
"savedEvent": obj.get("savedEvent"),
|
177
|
+
"testId": obj.get("testId"),
|
178
|
+
"testName": obj.get("testName"),
|
179
|
+
"type": obj.get("type"),
|
180
|
+
"_links": TestLinks.from_dict(obj["_links"]) if obj.get("_links") is not None else None,
|
181
|
+
"labels": [TestLabel.from_dict(_item) for _item in obj["labels"]] if obj.get("labels") is not None else None,
|
182
|
+
"sharedWithAccounts": [SharedWithAccount.from_dict(_item) for _item in obj["sharedWithAccounts"]] if obj.get("sharedWithAccounts") is not None else None,
|
183
|
+
"mtuMeasurements": obj.get("mtuMeasurements"),
|
184
|
+
"networkMeasurements": obj.get("networkMeasurements") if obj.get("networkMeasurements") is not None else True,
|
185
|
+
"numPathTraces": obj.get("numPathTraces") if obj.get("numPathTraces") is not None else 3,
|
186
|
+
"optionsRegex": obj.get("optionsRegex"),
|
187
|
+
"pathTraceMode": obj.get("pathTraceMode"),
|
188
|
+
"probeMode": obj.get("probeMode"),
|
189
|
+
"registerEnabled": obj.get("registerEnabled") if obj.get("registerEnabled") is not None else False,
|
190
|
+
"sipTargetTime": obj.get("sipTargetTime"),
|
191
|
+
"sipTimeLimit": obj.get("sipTimeLimit") if obj.get("sipTimeLimit") is not None else 5,
|
192
|
+
"fixedPacketRate": obj.get("fixedPacketRate"),
|
193
|
+
"ipv6Policy": obj.get("ipv6Policy"),
|
194
|
+
"agents": [Agent.from_dict(_item) for _item in obj["agents"]] if obj.get("agents") is not None else None,
|
195
|
+
"authUser": obj.get("authUser"),
|
196
|
+
"password": obj.get("password"),
|
197
|
+
"port": obj.get("port") if obj.get("port") is not None else 49153,
|
198
|
+
"protocol": obj.get("protocol"),
|
199
|
+
"sipRegistrar": obj.get("sipRegistrar"),
|
200
|
+
"user": obj.get("user")
|
201
|
+
})
|
202
|
+
return _obj
|
203
|
+
|
204
|
+
|
@@ -0,0 +1,116 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
"""
|
4
|
+
Instant Tests API
|
5
|
+
|
6
|
+
The Instant Tests API endpoint lets you create and run new instant tests. You will need to be a regular user or have the following permissions: * `API Access` * `View tests` The response does not include the immediate test results. Use the Test Results endpoints to get test results after creating and executing an instant test. You can find the URLs for these endpoints in the _links section of the test definition that is returned when you create the instant test.
|
7
|
+
|
8
|
+
The version of the OpenAPI document: 7.0.8
|
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
|
21
|
+
from typing import Any, ClassVar, Dict, List, Optional
|
22
|
+
from typing_extensions import Annotated
|
23
|
+
from thousandeyes_sdk.instant_tests.models.test_ipv6_policy import TestIpv6Policy
|
24
|
+
from thousandeyes_sdk.instant_tests.models.test_path_trace_mode import TestPathTraceMode
|
25
|
+
from thousandeyes_sdk.instant_tests.models.test_probe_mode import TestProbeMode
|
26
|
+
from typing import Optional, Set
|
27
|
+
from typing_extensions import Self
|
28
|
+
|
29
|
+
class SipServerProperties(BaseModel):
|
30
|
+
"""
|
31
|
+
SipServerProperties
|
32
|
+
""" # noqa: E501
|
33
|
+
mtu_measurements: Optional[StrictBool] = Field(default=None, description="Set `true` to measure MTU sizes on network from agents to the target.", alias="mtuMeasurements")
|
34
|
+
network_measurements: Optional[StrictBool] = Field(default=True, description="Enable or disable network measurements. Set to true to enable or false to disable network measurements.", alias="networkMeasurements")
|
35
|
+
num_path_traces: Optional[Annotated[int, Field(le=10, strict=True, ge=1)]] = Field(default=3, description="Number of path traces executed by the agent.", alias="numPathTraces")
|
36
|
+
options_regex: Optional[StrictStr] = Field(default=None, description="Options regex, this field does not require escaping.", alias="optionsRegex")
|
37
|
+
path_trace_mode: Optional[TestPathTraceMode] = Field(default=None, alias="pathTraceMode")
|
38
|
+
probe_mode: Optional[TestProbeMode] = Field(default=None, alias="probeMode")
|
39
|
+
register_enabled: Optional[StrictBool] = Field(default=False, description="Set to true to perform SIP registration on the test target with the SIP REGISTER command.", alias="registerEnabled")
|
40
|
+
sip_target_time: Optional[Annotated[int, Field(le=5000, strict=True, ge=100)]] = Field(default=None, description="Target time for test completion in milliseconds.", alias="sipTargetTime")
|
41
|
+
sip_time_limit: Optional[Annotated[int, Field(le=10, strict=True, ge=5)]] = Field(default=5, description="Time limit in milliseconds.", alias="sipTimeLimit")
|
42
|
+
fixed_packet_rate: Optional[Annotated[int, Field(le=100, strict=True, ge=0)]] = Field(default=None, description="Sets packets rate sent to measure the network in packets per second.", alias="fixedPacketRate")
|
43
|
+
ipv6_policy: Optional[TestIpv6Policy] = Field(default=None, alias="ipv6Policy")
|
44
|
+
type: Optional[StrictStr] = None
|
45
|
+
__properties: ClassVar[List[str]] = ["mtuMeasurements", "networkMeasurements", "numPathTraces", "optionsRegex", "pathTraceMode", "probeMode", "registerEnabled", "sipTargetTime", "sipTimeLimit", "fixedPacketRate", "ipv6Policy", "type"]
|
46
|
+
|
47
|
+
model_config = ConfigDict(
|
48
|
+
populate_by_name=True,
|
49
|
+
validate_assignment=True,
|
50
|
+
protected_namespaces=(),
|
51
|
+
extra="allow",
|
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 self.model_dump_json(by_alias=True, exclude_unset=True, exclude_none=True)
|
63
|
+
|
64
|
+
@classmethod
|
65
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
66
|
+
"""Create an instance of SipServerProperties 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
|
+
* OpenAPI `readOnly` fields are excluded.
|
79
|
+
"""
|
80
|
+
excluded_fields: Set[str] = set([
|
81
|
+
"type",
|
82
|
+
])
|
83
|
+
|
84
|
+
_dict = self.model_dump(
|
85
|
+
by_alias=True,
|
86
|
+
exclude=excluded_fields,
|
87
|
+
exclude_none=True,
|
88
|
+
)
|
89
|
+
return _dict
|
90
|
+
|
91
|
+
@classmethod
|
92
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
93
|
+
"""Create an instance of SipServerProperties from a dict"""
|
94
|
+
if obj is None:
|
95
|
+
return None
|
96
|
+
|
97
|
+
if not isinstance(obj, dict):
|
98
|
+
return cls.model_validate(obj)
|
99
|
+
|
100
|
+
_obj = cls.model_validate({
|
101
|
+
"mtuMeasurements": obj.get("mtuMeasurements"),
|
102
|
+
"networkMeasurements": obj.get("networkMeasurements") if obj.get("networkMeasurements") is not None else True,
|
103
|
+
"numPathTraces": obj.get("numPathTraces") if obj.get("numPathTraces") is not None else 3,
|
104
|
+
"optionsRegex": obj.get("optionsRegex"),
|
105
|
+
"pathTraceMode": obj.get("pathTraceMode"),
|
106
|
+
"probeMode": obj.get("probeMode"),
|
107
|
+
"registerEnabled": obj.get("registerEnabled") if obj.get("registerEnabled") is not None else False,
|
108
|
+
"sipTargetTime": obj.get("sipTargetTime"),
|
109
|
+
"sipTimeLimit": obj.get("sipTimeLimit") if obj.get("sipTimeLimit") is not None else 5,
|
110
|
+
"fixedPacketRate": obj.get("fixedPacketRate"),
|
111
|
+
"ipv6Policy": obj.get("ipv6Policy"),
|
112
|
+
"type": obj.get("type")
|
113
|
+
})
|
114
|
+
return _obj
|
115
|
+
|
116
|
+
|
@@ -0,0 +1,38 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
"""
|
4
|
+
Instant Tests API
|
5
|
+
|
6
|
+
The Instant Tests API endpoint lets you create and run new instant tests. You will need to be a regular user or have the following permissions: * `API Access` * `View tests` The response does not include the immediate test results. Use the Test Results endpoints to get test results after creating and executing an instant test. You can find the URLs for these endpoints in the _links section of the test definition that is returned when you create the instant test.
|
7
|
+
|
8
|
+
The version of the OpenAPI document: 7.0.8
|
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 json
|
17
|
+
from enum import Enum
|
18
|
+
from typing_extensions import Self
|
19
|
+
|
20
|
+
|
21
|
+
class SipTestProtocol(str, Enum):
|
22
|
+
"""
|
23
|
+
Transport layer for SIP communication.
|
24
|
+
"""
|
25
|
+
|
26
|
+
"""
|
27
|
+
allowed enum values
|
28
|
+
"""
|
29
|
+
TCP = 'tcp'
|
30
|
+
TLS = 'tls'
|
31
|
+
UDP = 'udp'
|
32
|
+
|
33
|
+
@classmethod
|
34
|
+
def from_json(cls, json_str: str) -> Self:
|
35
|
+
"""Create an instance of SipTestProtocol from a JSON string"""
|
36
|
+
return cls(json.loads(json_str))
|
37
|
+
|
38
|
+
|
@@ -0,0 +1,90 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
"""
|
4
|
+
Instant Tests API
|
5
|
+
|
6
|
+
The Instant Tests API endpoint lets you create and run new instant tests. You will need to be a regular user or have the following permissions: * `API Access` * `View tests` The response does not include the immediate test results. Use the Test Results endpoints to get test results after creating and executing an instant test. You can find the URLs for these endpoints in the _links section of the test definition that is returned when you create the instant test.
|
7
|
+
|
8
|
+
The version of the OpenAPI document: 7.0.8
|
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 import Optional, Set
|
23
|
+
from typing_extensions import Self
|
24
|
+
|
25
|
+
class TestAgent(BaseModel):
|
26
|
+
"""
|
27
|
+
TestAgent
|
28
|
+
""" # noqa: E501
|
29
|
+
agent_id: Optional[StrictStr] = Field(default=None, description="Identifier for the agent (get `agentId` from `/agents` endpoint).", alias="agentId")
|
30
|
+
source_ip_address: Optional[StrictStr] = Field(default=None, description="IP address from the agent's `ipAddresses` field (get `ipAddresses` from `/agents` endpoint). Used for interface selection.", alias="sourceIpAddress")
|
31
|
+
__properties: ClassVar[List[str]] = ["agentId", "sourceIpAddress"]
|
32
|
+
|
33
|
+
model_config = ConfigDict(
|
34
|
+
populate_by_name=True,
|
35
|
+
validate_assignment=True,
|
36
|
+
protected_namespaces=(),
|
37
|
+
extra="allow",
|
38
|
+
)
|
39
|
+
|
40
|
+
|
41
|
+
def to_str(self) -> str:
|
42
|
+
"""Returns the string representation of the model using alias"""
|
43
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
44
|
+
|
45
|
+
def to_json(self) -> str:
|
46
|
+
"""Returns the JSON representation of the model using alias"""
|
47
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
48
|
+
return self.model_dump_json(by_alias=True, exclude_unset=True, exclude_none=True)
|
49
|
+
|
50
|
+
@classmethod
|
51
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
52
|
+
"""Create an instance of TestAgent from a JSON string"""
|
53
|
+
return cls.from_dict(json.loads(json_str))
|
54
|
+
|
55
|
+
def to_dict(self) -> Dict[str, Any]:
|
56
|
+
"""Return the dictionary representation of the model using alias.
|
57
|
+
|
58
|
+
This has the following differences from calling pydantic's
|
59
|
+
`self.model_dump(by_alias=True)`:
|
60
|
+
|
61
|
+
* `None` is only added to the output dict for nullable fields that
|
62
|
+
were set at model initialization. Other fields with value `None`
|
63
|
+
are ignored.
|
64
|
+
"""
|
65
|
+
excluded_fields: Set[str] = set([
|
66
|
+
])
|
67
|
+
|
68
|
+
_dict = self.model_dump(
|
69
|
+
by_alias=True,
|
70
|
+
exclude=excluded_fields,
|
71
|
+
exclude_none=True,
|
72
|
+
)
|
73
|
+
return _dict
|
74
|
+
|
75
|
+
@classmethod
|
76
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
77
|
+
"""Create an instance of TestAgent from a dict"""
|
78
|
+
if obj is None:
|
79
|
+
return None
|
80
|
+
|
81
|
+
if not isinstance(obj, dict):
|
82
|
+
return cls.model_validate(obj)
|
83
|
+
|
84
|
+
_obj = cls.model_validate({
|
85
|
+
"agentId": obj.get("agentId"),
|
86
|
+
"sourceIpAddress": obj.get("sourceIpAddress")
|
87
|
+
})
|
88
|
+
return _obj
|
89
|
+
|
90
|
+
|