mirror of
https://github.com/thousandeyes/thousandeyes-sdk-python.git
synced 2025-12-06 06:26:51 +00:00
Some checks failed
Python CI / build (push) Has been cancelled
Co-authored-by: API Team <api-team@thousandeyes.com>
111 lines
4.7 KiB
Python
111 lines
4.7 KiB
Python
# coding: utf-8
|
||
|
||
"""
|
||
Agents API
|
||
|
||
## Overview Manage Cloud and Enterprise Agents available to your account in ThousandEyes.
|
||
|
||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||
|
||
Do not edit the class manually.
|
||
""" # noqa: E501
|
||
|
||
|
||
from __future__ import annotations
|
||
import pprint
|
||
import re # noqa: F401
|
||
import json
|
||
|
||
from datetime import datetime
|
||
from pydantic import BaseModel, ConfigDict, Field, SecretStr, StrictBool, StrictStr
|
||
from typing import Any, ClassVar, Dict, List, Optional
|
||
from thousandeyes_sdk.agents.models.proxy_auth_type import ProxyAuthType
|
||
from thousandeyes_sdk.agents.models.proxy_type import ProxyType
|
||
from typing import Optional, Set
|
||
from typing_extensions import Self
|
||
|
||
class AgentProxy(BaseModel):
|
||
"""
|
||
AgentProxy
|
||
""" # noqa: E501
|
||
aid: Optional[StrictStr] = Field(default=None, description="Account id that this proxy configuration belongs to")
|
||
auth_type: Optional[ProxyAuthType] = Field(default=None, alias="authType")
|
||
bypass_list: Optional[List[StrictStr]] = Field(default=None, description="A list of hostnames, network prefixes, or wildcards used to determine which test targets should not be proxied. If all tests should be proxied, leave empty.", alias="bypassList")
|
||
last_modified: Optional[datetime] = Field(default=None, description="Last modification timestamp of the proxy. Expressed in UTC (ISO date-time format).", alias="lastModified")
|
||
location: Optional[StrictStr] = Field(default=None, description="The location of the proxy. If proxyType is `static` use the format `hostname:port`. If location is `pac`, then specify the URL where the PAC file can be obtained.")
|
||
is_local_configured: Optional[StrictBool] = Field(default=None, description="Set to `true` if this proxy configuration comes from the agent’s config file. Specify `false` if the proxy configuration was created in the ThousandEyes application.", alias="isLocalConfigured")
|
||
name: Optional[StrictStr] = Field(default=None, description="Expression of agent notification rule.")
|
||
password: Optional[SecretStr] = Field(default=None, description="Password for proxy authentication")
|
||
proxy_id: Optional[StrictStr] = Field(default=None, description="Agent proxy's unique ID.", alias="proxyId")
|
||
type: Optional[ProxyType] = None
|
||
user: Optional[StrictStr] = Field(default=None, description="Username for proxy authentication.")
|
||
__properties: ClassVar[List[str]] = ["aid", "authType", "bypassList", "lastModified", "location", "isLocalConfigured", "name", "password", "proxyId", "type", "user"]
|
||
|
||
model_config = ConfigDict(
|
||
populate_by_name=True,
|
||
validate_assignment=True,
|
||
protected_namespaces=(),
|
||
extra="allow",
|
||
)
|
||
|
||
|
||
def to_str(self) -> str:
|
||
"""Returns the string representation of the model using alias"""
|
||
return pprint.pformat(self.model_dump(by_alias=True))
|
||
|
||
def to_json(self) -> str:
|
||
"""Returns the JSON representation of the model using alias"""
|
||
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
||
return self.model_dump_json(by_alias=True, exclude_unset=True, exclude_none=True)
|
||
|
||
@classmethod
|
||
def from_json(cls, json_str: str) -> Optional[Self]:
|
||
"""Create an instance of AgentProxy from a JSON string"""
|
||
return cls.from_dict(json.loads(json_str))
|
||
|
||
def to_dict(self) -> Dict[str, Any]:
|
||
"""Return the dictionary representation of the model using alias.
|
||
|
||
This has the following differences from calling pydantic's
|
||
`self.model_dump(by_alias=True)`:
|
||
|
||
* `None` is only added to the output dict for nullable fields that
|
||
were set at model initialization. Other fields with value `None`
|
||
are ignored.
|
||
"""
|
||
excluded_fields: Set[str] = set([
|
||
])
|
||
|
||
_dict = self.model_dump(
|
||
by_alias=True,
|
||
exclude=excluded_fields,
|
||
exclude_none=True,
|
||
)
|
||
return _dict
|
||
|
||
@classmethod
|
||
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
||
"""Create an instance of AgentProxy from a dict"""
|
||
if obj is None:
|
||
return None
|
||
|
||
if not isinstance(obj, dict):
|
||
return cls.model_validate(obj)
|
||
|
||
_obj = cls.model_validate({
|
||
"aid": obj.get("aid"),
|
||
"authType": obj.get("authType"),
|
||
"bypassList": obj.get("bypassList"),
|
||
"lastModified": obj.get("lastModified"),
|
||
"location": obj.get("location"),
|
||
"isLocalConfigured": obj.get("isLocalConfigured"),
|
||
"name": obj.get("name"),
|
||
"password": obj.get("password"),
|
||
"proxyId": obj.get("proxyId"),
|
||
"type": obj.get("type"),
|
||
"user": obj.get("user")
|
||
})
|
||
return _obj
|
||
|
||
|