本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。
搭CreateAgentAlias
配 AWS 開發套件或 CLI 使用
下列程式碼範例會示範如何使用CreateAgentAlias
。
動作範例是大型程式的程式碼摘錄,必須在內容中執行。您可以在下列程式碼範例的內容中看到此動作:
- Python
-
- 適用於 Python (Boto3) 的 SDK
-
建立代理程式別名。
def create_agent_alias(self, name, agent_id):
"""
Creates an alias of an agent that can be used to deploy the agent.
:param name: The name of the alias.
:param agent_id: The unique identifier of the agent.
:return: Details about the alias that was created.
"""
try:
response = self.client.create_agent_alias(
agentAliasName=name, agentId=agent_id
)
agent_alias = response["agentAlias"]
except ClientError as e:
logger.error(f"Couldn't create agent alias. {e}")
raise
else:
return agent_alias
如需 AWS SDK 開發人員指南和程式碼範例的完整清單,請參閱搭配 AWS SDK 使用此服務。此主題也包含有關入門的資訊和舊版 SDK 的詳細資訊。