# coding: utf-8
"""
Amorphic Data Platform
Amorphic Data Platform - API Definition documentation
The version of the OpenAPI document: 0.3.0
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 pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr
from typing import Any, ClassVar, Dict, List, Optional
from openapi_client.models.agent_tool_object import AgentToolObject
from openapi_client.models.get_agent_details_response_resource_access_metadata import GetAgentDetailsResponseResourceAccessMetadata
from openapi_client.models.get_agent_details_response_time_range import GetAgentDetailsResponseTimeRange
from typing import Optional, Set
from typing_extensions import Self
[docs]
class GetAgentDetailsResponse(BaseModel):
"""
GetAgentDetailsResponse
""" # noqa: E501
agent_id: Optional[StrictStr] = Field(default=None, alias="AgentId")
agent_name: Optional[StrictStr] = Field(default=None, alias="AgentName")
agent_status: Optional[StrictStr] = Field(default=None, alias="AgentStatus")
description: Optional[StrictStr] = Field(default=None, alias="Description")
instruction: Optional[StrictStr] = Field(default=None, alias="Instruction")
agent_type: Optional[StrictStr] = Field(default=None, alias="AgentType")
agent_version: Optional[StrictStr] = Field(default=None, alias="AgentVersion")
model_id: Optional[StrictStr] = Field(default=None, alias="ModelId")
reference_id: Optional[StrictStr] = Field(default=None, alias="ReferenceId")
agent_alias_id: Optional[StrictStr] = Field(default=None, alias="AgentAliasId")
message: Optional[StrictStr] = Field(default=None, alias="Message")
access_type: Optional[StrictStr] = Field(default=None, alias="AccessType")
created_by: Optional[StrictStr] = Field(default=None, alias="CreatedBy")
creation_time: Optional[StrictStr] = Field(default=None, alias="CreationTime")
last_modified_by: Optional[StrictStr] = Field(default=None, alias="LastModifiedBy")
last_modified_time: Optional[StrictStr] = Field(default=None, alias="LastModifiedTime")
is_enabled: Optional[StrictBool] = Field(default=None, alias="IsEnabled")
agent_sessions: Optional[Dict[str, Any]] = Field(default=None, alias="AgentSessions")
agent_response_type: Optional[StrictStr] = Field(default=None, alias="AgentResponseType")
action_group_id: Optional[StrictStr] = Field(default=None, alias="ActionGroupId")
tools: Optional[List[AgentToolObject]] = Field(default=None, alias="Tools")
resource_access_metadata: Optional[GetAgentDetailsResponseResourceAccessMetadata] = Field(default=None, alias="ResourceAccessMetadata")
presigned_url: Optional[StrictStr] = Field(default=None, description="Generated presigned URL (present when action=generate_presigned_url)", alias="PresignedUrl")
download_url: Optional[StrictStr] = Field(default=None, description="Script download URL (present when action=retrieve-script)", alias="DownloadUrl")
script_exists: Optional[StrictBool] = Field(default=None, description="Whether the script exists (present when action=retrieve-script)", alias="ScriptExists")
s3_location: Optional[StrictStr] = Field(default=None, description="S3 location of the script (present when action=retrieve-script)", alias="S3Location")
expires_in: Optional[StrictInt] = Field(default=None, description="URL expiration time in seconds (present when action=retrieve-script)", alias="ExpiresIn")
logs_count: Optional[StrictInt] = Field(default=None, description="Number of logs for the agent.", alias="LogsCount")
logs: Optional[List[Dict[str, Any]]] = Field(default=None, description="List of logs for the agent.", alias="Logs")
time_range: Optional[GetAgentDetailsResponseTimeRange] = Field(default=None, alias="TimeRange")
__properties: ClassVar[List[str]] = ["AgentId", "AgentName", "AgentStatus", "Description", "Instruction", "AgentType", "AgentVersion", "ModelId", "ReferenceId", "AgentAliasId", "Message", "AccessType", "CreatedBy", "CreationTime", "LastModifiedBy", "LastModifiedTime", "IsEnabled", "AgentSessions", "AgentResponseType", "ActionGroupId", "Tools", "ResourceAccessMetadata", "PresignedUrl", "DownloadUrl", "ScriptExists", "S3Location", "ExpiresIn", "LogsCount", "Logs", "TimeRange"]
model_config = ConfigDict(
populate_by_name=True,
validate_assignment=True,
protected_namespaces=(),
)
[docs]
def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.model_dump(by_alias=True))
[docs]
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 json.dumps(self.to_dict())
[docs]
@classmethod
def from_json(cls, json_str: str) -> Optional[Self]:
"""Create an instance of GetAgentDetailsResponse from a JSON string"""
return cls.from_dict(json.loads(json_str))
[docs]
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,
)
# override the default output from pydantic by calling `to_dict()` of each item in tools (list)
_items = []
if self.tools:
for _item_tools in self.tools:
if _item_tools:
_items.append(_item_tools.to_dict())
_dict['Tools'] = _items
# override the default output from pydantic by calling `to_dict()` of resource_access_metadata
if self.resource_access_metadata:
_dict['ResourceAccessMetadata'] = self.resource_access_metadata.to_dict()
# override the default output from pydantic by calling `to_dict()` of time_range
if self.time_range:
_dict['TimeRange'] = self.time_range.to_dict()
return _dict
[docs]
@classmethod
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
"""Create an instance of GetAgentDetailsResponse from a dict"""
if obj is None:
return None
if not isinstance(obj, dict):
return cls.model_validate(obj)
_obj = cls.model_validate({
"AgentId": obj.get("AgentId"),
"AgentName": obj.get("AgentName"),
"AgentStatus": obj.get("AgentStatus"),
"Description": obj.get("Description"),
"Instruction": obj.get("Instruction"),
"AgentType": obj.get("AgentType"),
"AgentVersion": obj.get("AgentVersion"),
"ModelId": obj.get("ModelId"),
"ReferenceId": obj.get("ReferenceId"),
"AgentAliasId": obj.get("AgentAliasId"),
"Message": obj.get("Message"),
"AccessType": obj.get("AccessType"),
"CreatedBy": obj.get("CreatedBy"),
"CreationTime": obj.get("CreationTime"),
"LastModifiedBy": obj.get("LastModifiedBy"),
"LastModifiedTime": obj.get("LastModifiedTime"),
"IsEnabled": obj.get("IsEnabled"),
"AgentSessions": obj.get("AgentSessions"),
"AgentResponseType": obj.get("AgentResponseType"),
"ActionGroupId": obj.get("ActionGroupId"),
"Tools": [AgentToolObject.from_dict(_item) for _item in obj["Tools"]] if obj.get("Tools") is not None else None,
"ResourceAccessMetadata": GetAgentDetailsResponseResourceAccessMetadata.from_dict(obj["ResourceAccessMetadata"]) if obj.get("ResourceAccessMetadata") is not None else None,
"PresignedUrl": obj.get("PresignedUrl"),
"DownloadUrl": obj.get("DownloadUrl"),
"ScriptExists": obj.get("ScriptExists"),
"S3Location": obj.get("S3Location"),
"ExpiresIn": obj.get("ExpiresIn"),
"LogsCount": obj.get("LogsCount"),
"Logs": obj.get("Logs"),
"TimeRange": GetAgentDetailsResponseTimeRange.from_dict(obj["TimeRange"]) if obj.get("TimeRange") is not None else None
})
return _obj