agentrun-inner-test 0.0.62__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.
Potentially problematic release.
This version of agentrun-inner-test might be problematic. Click here for more details.
- agentrun/__init__.py +358 -0
- agentrun/agent_runtime/__client_async_template.py +466 -0
- agentrun/agent_runtime/__endpoint_async_template.py +345 -0
- agentrun/agent_runtime/__init__.py +53 -0
- agentrun/agent_runtime/__runtime_async_template.py +477 -0
- agentrun/agent_runtime/api/__data_async_template.py +58 -0
- agentrun/agent_runtime/api/__init__.py +6 -0
- agentrun/agent_runtime/api/control.py +1362 -0
- agentrun/agent_runtime/api/data.py +98 -0
- agentrun/agent_runtime/client.py +868 -0
- agentrun/agent_runtime/endpoint.py +649 -0
- agentrun/agent_runtime/model.py +362 -0
- agentrun/agent_runtime/runtime.py +904 -0
- agentrun/credential/__client_async_template.py +177 -0
- agentrun/credential/__credential_async_template.py +216 -0
- agentrun/credential/__init__.py +28 -0
- agentrun/credential/api/__init__.py +5 -0
- agentrun/credential/api/control.py +606 -0
- agentrun/credential/client.py +319 -0
- agentrun/credential/credential.py +381 -0
- agentrun/credential/model.py +248 -0
- agentrun/integration/__init__.py +21 -0
- agentrun/integration/agentscope/__init__.py +13 -0
- agentrun/integration/agentscope/adapter.py +17 -0
- agentrun/integration/agentscope/builtin.py +88 -0
- agentrun/integration/agentscope/message_adapter.py +185 -0
- agentrun/integration/agentscope/model_adapter.py +60 -0
- agentrun/integration/agentscope/tool_adapter.py +59 -0
- agentrun/integration/builtin/__init__.py +18 -0
- agentrun/integration/builtin/knowledgebase.py +137 -0
- agentrun/integration/builtin/model.py +93 -0
- agentrun/integration/builtin/sandbox.py +1234 -0
- agentrun/integration/builtin/toolset.py +47 -0
- agentrun/integration/crewai/__init__.py +13 -0
- agentrun/integration/crewai/adapter.py +9 -0
- agentrun/integration/crewai/builtin.py +88 -0
- agentrun/integration/crewai/model_adapter.py +31 -0
- agentrun/integration/crewai/tool_adapter.py +26 -0
- agentrun/integration/google_adk/__init__.py +13 -0
- agentrun/integration/google_adk/adapter.py +15 -0
- agentrun/integration/google_adk/builtin.py +88 -0
- agentrun/integration/google_adk/message_adapter.py +144 -0
- agentrun/integration/google_adk/model_adapter.py +46 -0
- agentrun/integration/google_adk/tool_adapter.py +235 -0
- agentrun/integration/langchain/__init__.py +31 -0
- agentrun/integration/langchain/adapter.py +15 -0
- agentrun/integration/langchain/builtin.py +94 -0
- agentrun/integration/langchain/message_adapter.py +141 -0
- agentrun/integration/langchain/model_adapter.py +37 -0
- agentrun/integration/langchain/tool_adapter.py +50 -0
- agentrun/integration/langgraph/__init__.py +36 -0
- agentrun/integration/langgraph/adapter.py +20 -0
- agentrun/integration/langgraph/agent_converter.py +1073 -0
- agentrun/integration/langgraph/builtin.py +88 -0
- agentrun/integration/pydantic_ai/__init__.py +13 -0
- agentrun/integration/pydantic_ai/adapter.py +13 -0
- agentrun/integration/pydantic_ai/builtin.py +88 -0
- agentrun/integration/pydantic_ai/model_adapter.py +44 -0
- agentrun/integration/pydantic_ai/tool_adapter.py +19 -0
- agentrun/integration/utils/__init__.py +112 -0
- agentrun/integration/utils/adapter.py +560 -0
- agentrun/integration/utils/canonical.py +164 -0
- agentrun/integration/utils/converter.py +134 -0
- agentrun/integration/utils/model.py +110 -0
- agentrun/integration/utils/tool.py +1759 -0
- agentrun/knowledgebase/__client_async_template.py +173 -0
- agentrun/knowledgebase/__init__.py +53 -0
- agentrun/knowledgebase/__knowledgebase_async_template.py +438 -0
- agentrun/knowledgebase/api/__data_async_template.py +414 -0
- agentrun/knowledgebase/api/__init__.py +19 -0
- agentrun/knowledgebase/api/control.py +606 -0
- agentrun/knowledgebase/api/data.py +624 -0
- agentrun/knowledgebase/client.py +311 -0
- agentrun/knowledgebase/knowledgebase.py +748 -0
- agentrun/knowledgebase/model.py +270 -0
- agentrun/memory_collection/__client_async_template.py +178 -0
- agentrun/memory_collection/__init__.py +37 -0
- agentrun/memory_collection/__memory_collection_async_template.py +457 -0
- agentrun/memory_collection/api/__init__.py +5 -0
- agentrun/memory_collection/api/control.py +610 -0
- agentrun/memory_collection/client.py +323 -0
- agentrun/memory_collection/memory_collection.py +844 -0
- agentrun/memory_collection/model.py +162 -0
- agentrun/model/__client_async_template.py +357 -0
- agentrun/model/__init__.py +57 -0
- agentrun/model/__model_proxy_async_template.py +270 -0
- agentrun/model/__model_service_async_template.py +267 -0
- agentrun/model/api/__init__.py +6 -0
- agentrun/model/api/control.py +1173 -0
- agentrun/model/api/data.py +196 -0
- agentrun/model/client.py +674 -0
- agentrun/model/model.py +235 -0
- agentrun/model/model_proxy.py +439 -0
- agentrun/model/model_service.py +438 -0
- agentrun/sandbox/__aio_sandbox_async_template.py +523 -0
- agentrun/sandbox/__browser_sandbox_async_template.py +110 -0
- agentrun/sandbox/__client_async_template.py +491 -0
- agentrun/sandbox/__code_interpreter_sandbox_async_template.py +463 -0
- agentrun/sandbox/__init__.py +69 -0
- agentrun/sandbox/__sandbox_async_template.py +463 -0
- agentrun/sandbox/__template_async_template.py +152 -0
- agentrun/sandbox/aio_sandbox.py +912 -0
- agentrun/sandbox/api/__aio_data_async_template.py +335 -0
- agentrun/sandbox/api/__browser_data_async_template.py +140 -0
- agentrun/sandbox/api/__code_interpreter_data_async_template.py +206 -0
- agentrun/sandbox/api/__init__.py +19 -0
- agentrun/sandbox/api/__sandbox_data_async_template.py +107 -0
- agentrun/sandbox/api/aio_data.py +551 -0
- agentrun/sandbox/api/browser_data.py +172 -0
- agentrun/sandbox/api/code_interpreter_data.py +396 -0
- agentrun/sandbox/api/control.py +1051 -0
- agentrun/sandbox/api/playwright_async.py +492 -0
- agentrun/sandbox/api/playwright_sync.py +492 -0
- agentrun/sandbox/api/sandbox_data.py +154 -0
- agentrun/sandbox/browser_sandbox.py +185 -0
- agentrun/sandbox/client.py +925 -0
- agentrun/sandbox/code_interpreter_sandbox.py +823 -0
- agentrun/sandbox/model.py +384 -0
- agentrun/sandbox/sandbox.py +848 -0
- agentrun/sandbox/template.py +217 -0
- agentrun/server/__init__.py +191 -0
- agentrun/server/agui_normalizer.py +180 -0
- agentrun/server/agui_protocol.py +797 -0
- agentrun/server/invoker.py +309 -0
- agentrun/server/model.py +427 -0
- agentrun/server/openai_protocol.py +535 -0
- agentrun/server/protocol.py +140 -0
- agentrun/server/server.py +208 -0
- agentrun/toolset/__client_async_template.py +62 -0
- agentrun/toolset/__init__.py +51 -0
- agentrun/toolset/__toolset_async_template.py +204 -0
- agentrun/toolset/api/__init__.py +17 -0
- agentrun/toolset/api/control.py +262 -0
- agentrun/toolset/api/mcp.py +100 -0
- agentrun/toolset/api/openapi.py +1251 -0
- agentrun/toolset/client.py +102 -0
- agentrun/toolset/model.py +321 -0
- agentrun/toolset/toolset.py +271 -0
- agentrun/utils/__data_api_async_template.py +721 -0
- agentrun/utils/__init__.py +5 -0
- agentrun/utils/__resource_async_template.py +158 -0
- agentrun/utils/config.py +270 -0
- agentrun/utils/control_api.py +105 -0
- agentrun/utils/data_api.py +1121 -0
- agentrun/utils/exception.py +151 -0
- agentrun/utils/helper.py +108 -0
- agentrun/utils/log.py +77 -0
- agentrun/utils/model.py +168 -0
- agentrun/utils/resource.py +291 -0
- agentrun_inner_test-0.0.62.dist-info/METADATA +265 -0
- agentrun_inner_test-0.0.62.dist-info/RECORD +154 -0
- agentrun_inner_test-0.0.62.dist-info/WHEEL +5 -0
- agentrun_inner_test-0.0.62.dist-info/licenses/LICENSE +201 -0
- agentrun_inner_test-0.0.62.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,606 @@
|
|
|
1
|
+
"""
|
|
2
|
+
This file is auto generated by the code generation script.
|
|
3
|
+
Do not modify this file manually.
|
|
4
|
+
Use the `make codegen` command to regenerate.
|
|
5
|
+
|
|
6
|
+
当前文件为自动生成的控制 API 客户端代码。请勿手动修改此文件。
|
|
7
|
+
使用 `make codegen` 命令重新生成。
|
|
8
|
+
|
|
9
|
+
source: codegen/configs/credential_control_api.yaml
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
Credential 管控链路 API
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
from typing import Dict, Optional
|
|
16
|
+
|
|
17
|
+
from alibabacloud_agentrun20250910.models import (
|
|
18
|
+
CreateCredentialInput,
|
|
19
|
+
CreateCredentialRequest,
|
|
20
|
+
Credential,
|
|
21
|
+
ListCredentialsOutput,
|
|
22
|
+
ListCredentialsRequest,
|
|
23
|
+
UpdateCredentialInput,
|
|
24
|
+
UpdateCredentialRequest,
|
|
25
|
+
)
|
|
26
|
+
from alibabacloud_tea_openapi.exceptions._client import ClientException
|
|
27
|
+
from alibabacloud_tea_openapi.exceptions._server import ServerException
|
|
28
|
+
from darabonba.runtime import RuntimeOptions
|
|
29
|
+
import pydash
|
|
30
|
+
|
|
31
|
+
from agentrun.utils.config import Config
|
|
32
|
+
from agentrun.utils.control_api import ControlAPI
|
|
33
|
+
from agentrun.utils.exception import ClientError, ServerError
|
|
34
|
+
from agentrun.utils.log import logger
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
class CredentialControlAPI(ControlAPI):
|
|
38
|
+
"""Credential 管控链路 API"""
|
|
39
|
+
|
|
40
|
+
def __init__(self, config: Optional[Config] = None):
|
|
41
|
+
"""初始化 API 客户端
|
|
42
|
+
|
|
43
|
+
Args:
|
|
44
|
+
config: 全局配置对象
|
|
45
|
+
"""
|
|
46
|
+
super().__init__(config)
|
|
47
|
+
|
|
48
|
+
def create_credential(
|
|
49
|
+
self,
|
|
50
|
+
input: CreateCredentialInput,
|
|
51
|
+
headers: Optional[Dict[str, str]] = None,
|
|
52
|
+
config: Optional[Config] = None,
|
|
53
|
+
) -> Credential:
|
|
54
|
+
"""创建凭证
|
|
55
|
+
|
|
56
|
+
Args:
|
|
57
|
+
input: 凭证配置
|
|
58
|
+
|
|
59
|
+
headers: 请求头
|
|
60
|
+
config: 配置
|
|
61
|
+
|
|
62
|
+
Returns:
|
|
63
|
+
Credential: 创建的凭证对象
|
|
64
|
+
|
|
65
|
+
Raises:
|
|
66
|
+
AgentRuntimeError: 调用失败时抛出
|
|
67
|
+
ClientError: 客户端错误
|
|
68
|
+
ServerError: 服务器错误
|
|
69
|
+
APIError: 运行时错误
|
|
70
|
+
"""
|
|
71
|
+
|
|
72
|
+
try:
|
|
73
|
+
client = self._get_client(config)
|
|
74
|
+
response = client.create_credential_with_options(
|
|
75
|
+
CreateCredentialRequest(body=input),
|
|
76
|
+
headers=headers or {},
|
|
77
|
+
runtime=RuntimeOptions(),
|
|
78
|
+
)
|
|
79
|
+
|
|
80
|
+
logger.debug(
|
|
81
|
+
"request api create_credential, request Request ID:"
|
|
82
|
+
f" {response.body.request_id}\n request: {[input.to_map(),]}\n"
|
|
83
|
+
f" response: {response.body.data}"
|
|
84
|
+
)
|
|
85
|
+
|
|
86
|
+
return response.body.data
|
|
87
|
+
except ClientException as e:
|
|
88
|
+
raise ClientError(
|
|
89
|
+
e.status_code,
|
|
90
|
+
pydash.get(e, "data.message", pydash.get(e, "message", "")),
|
|
91
|
+
request_id=e.request_id,
|
|
92
|
+
request=[
|
|
93
|
+
input,
|
|
94
|
+
],
|
|
95
|
+
) from e
|
|
96
|
+
except ServerException as e:
|
|
97
|
+
raise ServerError(
|
|
98
|
+
e.status_code,
|
|
99
|
+
pydash.get(e, "data.message", pydash.get(e, "message", "")),
|
|
100
|
+
request_id=e.request_id,
|
|
101
|
+
) from e
|
|
102
|
+
|
|
103
|
+
async def create_credential_async(
|
|
104
|
+
self,
|
|
105
|
+
input: CreateCredentialInput,
|
|
106
|
+
headers: Optional[Dict[str, str]] = None,
|
|
107
|
+
config: Optional[Config] = None,
|
|
108
|
+
) -> Credential:
|
|
109
|
+
"""创建凭证
|
|
110
|
+
|
|
111
|
+
Args:
|
|
112
|
+
input: 凭证配置
|
|
113
|
+
|
|
114
|
+
headers: 请求头
|
|
115
|
+
config: 配置
|
|
116
|
+
|
|
117
|
+
Returns:
|
|
118
|
+
Credential: 创建的凭证对象
|
|
119
|
+
|
|
120
|
+
Raises:
|
|
121
|
+
AgentRuntimeError: 调用失败时抛出
|
|
122
|
+
ClientError: 客户端错误
|
|
123
|
+
ServerError: 服务器错误
|
|
124
|
+
APIError: 运行时错误
|
|
125
|
+
"""
|
|
126
|
+
|
|
127
|
+
try:
|
|
128
|
+
client = self._get_client(config)
|
|
129
|
+
response = await client.create_credential_with_options_async(
|
|
130
|
+
CreateCredentialRequest(body=input),
|
|
131
|
+
headers=headers or {},
|
|
132
|
+
runtime=RuntimeOptions(),
|
|
133
|
+
)
|
|
134
|
+
|
|
135
|
+
logger.debug(
|
|
136
|
+
"request api create_credential, request Request ID:"
|
|
137
|
+
f" {response.body.request_id}\n request: {[input.to_map(),]}\n"
|
|
138
|
+
f" response: {response.body.data}"
|
|
139
|
+
)
|
|
140
|
+
|
|
141
|
+
return response.body.data
|
|
142
|
+
except ClientException as e:
|
|
143
|
+
raise ClientError(
|
|
144
|
+
e.status_code,
|
|
145
|
+
e.data.get("message", e.message),
|
|
146
|
+
request_id=e.request_id,
|
|
147
|
+
request=[
|
|
148
|
+
input,
|
|
149
|
+
],
|
|
150
|
+
) from e
|
|
151
|
+
except ServerException as e:
|
|
152
|
+
raise ServerError(
|
|
153
|
+
e.status_code,
|
|
154
|
+
e.data.get("message", e.message),
|
|
155
|
+
request_id=e.request_id,
|
|
156
|
+
) from e
|
|
157
|
+
|
|
158
|
+
def delete_credential(
|
|
159
|
+
self,
|
|
160
|
+
credential_name: str,
|
|
161
|
+
headers: Optional[Dict[str, str]] = None,
|
|
162
|
+
config: Optional[Config] = None,
|
|
163
|
+
) -> Credential:
|
|
164
|
+
"""删除凭证
|
|
165
|
+
|
|
166
|
+
Args:
|
|
167
|
+
credential_name: 凭证名称
|
|
168
|
+
|
|
169
|
+
headers: 请求头
|
|
170
|
+
config: 配置
|
|
171
|
+
|
|
172
|
+
Returns:
|
|
173
|
+
Credential: 删除凭证的结果
|
|
174
|
+
|
|
175
|
+
Raises:
|
|
176
|
+
AgentRuntimeError: 调用失败时抛出
|
|
177
|
+
ClientError: 客户端错误
|
|
178
|
+
ServerError: 服务器错误
|
|
179
|
+
APIError: 运行时错误
|
|
180
|
+
"""
|
|
181
|
+
|
|
182
|
+
try:
|
|
183
|
+
client = self._get_client(config)
|
|
184
|
+
response = client.delete_credential_with_options(
|
|
185
|
+
credential_name,
|
|
186
|
+
headers=headers or {},
|
|
187
|
+
runtime=RuntimeOptions(),
|
|
188
|
+
)
|
|
189
|
+
|
|
190
|
+
logger.debug(
|
|
191
|
+
"request api delete_credential, request Request ID:"
|
|
192
|
+
f" {response.body.request_id}\n request:"
|
|
193
|
+
f" {[credential_name,]}\n response: {response.body.data}"
|
|
194
|
+
)
|
|
195
|
+
|
|
196
|
+
return response.body.data
|
|
197
|
+
except ClientException as e:
|
|
198
|
+
raise ClientError(
|
|
199
|
+
e.status_code,
|
|
200
|
+
pydash.get(e, "data.message", pydash.get(e, "message", "")),
|
|
201
|
+
request_id=e.request_id,
|
|
202
|
+
request=[
|
|
203
|
+
credential_name,
|
|
204
|
+
],
|
|
205
|
+
) from e
|
|
206
|
+
except ServerException as e:
|
|
207
|
+
raise ServerError(
|
|
208
|
+
e.status_code,
|
|
209
|
+
pydash.get(e, "data.message", pydash.get(e, "message", "")),
|
|
210
|
+
request_id=e.request_id,
|
|
211
|
+
) from e
|
|
212
|
+
|
|
213
|
+
async def delete_credential_async(
|
|
214
|
+
self,
|
|
215
|
+
credential_name: str,
|
|
216
|
+
headers: Optional[Dict[str, str]] = None,
|
|
217
|
+
config: Optional[Config] = None,
|
|
218
|
+
) -> Credential:
|
|
219
|
+
"""删除凭证
|
|
220
|
+
|
|
221
|
+
Args:
|
|
222
|
+
credential_name: 凭证名称
|
|
223
|
+
|
|
224
|
+
headers: 请求头
|
|
225
|
+
config: 配置
|
|
226
|
+
|
|
227
|
+
Returns:
|
|
228
|
+
Credential: 删除凭证的结果
|
|
229
|
+
|
|
230
|
+
Raises:
|
|
231
|
+
AgentRuntimeError: 调用失败时抛出
|
|
232
|
+
ClientError: 客户端错误
|
|
233
|
+
ServerError: 服务器错误
|
|
234
|
+
APIError: 运行时错误
|
|
235
|
+
"""
|
|
236
|
+
|
|
237
|
+
try:
|
|
238
|
+
client = self._get_client(config)
|
|
239
|
+
response = await client.delete_credential_with_options_async(
|
|
240
|
+
credential_name,
|
|
241
|
+
headers=headers or {},
|
|
242
|
+
runtime=RuntimeOptions(),
|
|
243
|
+
)
|
|
244
|
+
|
|
245
|
+
logger.debug(
|
|
246
|
+
"request api delete_credential, request Request ID:"
|
|
247
|
+
f" {response.body.request_id}\n request:"
|
|
248
|
+
f" {[credential_name,]}\n response: {response.body.data}"
|
|
249
|
+
)
|
|
250
|
+
|
|
251
|
+
return response.body.data
|
|
252
|
+
except ClientException as e:
|
|
253
|
+
raise ClientError(
|
|
254
|
+
e.status_code,
|
|
255
|
+
e.data.get("message", e.message),
|
|
256
|
+
request_id=e.request_id,
|
|
257
|
+
request=[
|
|
258
|
+
credential_name,
|
|
259
|
+
],
|
|
260
|
+
) from e
|
|
261
|
+
except ServerException as e:
|
|
262
|
+
raise ServerError(
|
|
263
|
+
e.status_code,
|
|
264
|
+
e.data.get("message", e.message),
|
|
265
|
+
request_id=e.request_id,
|
|
266
|
+
) from e
|
|
267
|
+
|
|
268
|
+
def update_credential(
|
|
269
|
+
self,
|
|
270
|
+
credential_name: str,
|
|
271
|
+
input: UpdateCredentialInput,
|
|
272
|
+
headers: Optional[Dict[str, str]] = None,
|
|
273
|
+
config: Optional[Config] = None,
|
|
274
|
+
) -> Credential:
|
|
275
|
+
"""更新凭证
|
|
276
|
+
|
|
277
|
+
Args:
|
|
278
|
+
credential_name: 凭证名称
|
|
279
|
+
input: 凭证配置
|
|
280
|
+
|
|
281
|
+
headers: 请求头
|
|
282
|
+
config: 配置
|
|
283
|
+
|
|
284
|
+
Returns:
|
|
285
|
+
Credential: 更新后的凭证对象
|
|
286
|
+
|
|
287
|
+
Raises:
|
|
288
|
+
AgentRuntimeError: 调用失败时抛出
|
|
289
|
+
ClientError: 客户端错误
|
|
290
|
+
ServerError: 服务器错误
|
|
291
|
+
APIError: 运行时错误
|
|
292
|
+
"""
|
|
293
|
+
|
|
294
|
+
try:
|
|
295
|
+
client = self._get_client(config)
|
|
296
|
+
response = client.update_credential_with_options(
|
|
297
|
+
credential_name,
|
|
298
|
+
UpdateCredentialRequest(body=input),
|
|
299
|
+
headers=headers or {},
|
|
300
|
+
runtime=RuntimeOptions(),
|
|
301
|
+
)
|
|
302
|
+
|
|
303
|
+
logger.debug(
|
|
304
|
+
"request api update_credential, request Request ID:"
|
|
305
|
+
f" {response.body.request_id}\n request:"
|
|
306
|
+
f" {[credential_name,input.to_map(),]}\n response:"
|
|
307
|
+
f" {response.body.data}"
|
|
308
|
+
)
|
|
309
|
+
|
|
310
|
+
return response.body.data
|
|
311
|
+
except ClientException as e:
|
|
312
|
+
raise ClientError(
|
|
313
|
+
e.status_code,
|
|
314
|
+
pydash.get(e, "data.message", pydash.get(e, "message", "")),
|
|
315
|
+
request_id=e.request_id,
|
|
316
|
+
request=[
|
|
317
|
+
credential_name,
|
|
318
|
+
input,
|
|
319
|
+
],
|
|
320
|
+
) from e
|
|
321
|
+
except ServerException as e:
|
|
322
|
+
raise ServerError(
|
|
323
|
+
e.status_code,
|
|
324
|
+
pydash.get(e, "data.message", pydash.get(e, "message", "")),
|
|
325
|
+
request_id=e.request_id,
|
|
326
|
+
) from e
|
|
327
|
+
|
|
328
|
+
async def update_credential_async(
|
|
329
|
+
self,
|
|
330
|
+
credential_name: str,
|
|
331
|
+
input: UpdateCredentialInput,
|
|
332
|
+
headers: Optional[Dict[str, str]] = None,
|
|
333
|
+
config: Optional[Config] = None,
|
|
334
|
+
) -> Credential:
|
|
335
|
+
"""更新凭证
|
|
336
|
+
|
|
337
|
+
Args:
|
|
338
|
+
credential_name: 凭证名称
|
|
339
|
+
input: 凭证配置
|
|
340
|
+
|
|
341
|
+
headers: 请求头
|
|
342
|
+
config: 配置
|
|
343
|
+
|
|
344
|
+
Returns:
|
|
345
|
+
Credential: 更新后的凭证对象
|
|
346
|
+
|
|
347
|
+
Raises:
|
|
348
|
+
AgentRuntimeError: 调用失败时抛出
|
|
349
|
+
ClientError: 客户端错误
|
|
350
|
+
ServerError: 服务器错误
|
|
351
|
+
APIError: 运行时错误
|
|
352
|
+
"""
|
|
353
|
+
|
|
354
|
+
try:
|
|
355
|
+
client = self._get_client(config)
|
|
356
|
+
response = await client.update_credential_with_options_async(
|
|
357
|
+
credential_name,
|
|
358
|
+
UpdateCredentialRequest(body=input),
|
|
359
|
+
headers=headers or {},
|
|
360
|
+
runtime=RuntimeOptions(),
|
|
361
|
+
)
|
|
362
|
+
|
|
363
|
+
logger.debug(
|
|
364
|
+
"request api update_credential, request Request ID:"
|
|
365
|
+
f" {response.body.request_id}\n request:"
|
|
366
|
+
f" {[credential_name,input.to_map(),]}\n response:"
|
|
367
|
+
f" {response.body.data}"
|
|
368
|
+
)
|
|
369
|
+
|
|
370
|
+
return response.body.data
|
|
371
|
+
except ClientException as e:
|
|
372
|
+
raise ClientError(
|
|
373
|
+
e.status_code,
|
|
374
|
+
e.data.get("message", e.message),
|
|
375
|
+
request_id=e.request_id,
|
|
376
|
+
request=[
|
|
377
|
+
credential_name,
|
|
378
|
+
input,
|
|
379
|
+
],
|
|
380
|
+
) from e
|
|
381
|
+
except ServerException as e:
|
|
382
|
+
raise ServerError(
|
|
383
|
+
e.status_code,
|
|
384
|
+
e.data.get("message", e.message),
|
|
385
|
+
request_id=e.request_id,
|
|
386
|
+
) from e
|
|
387
|
+
|
|
388
|
+
def get_credential(
|
|
389
|
+
self,
|
|
390
|
+
credential_name: str,
|
|
391
|
+
headers: Optional[Dict[str, str]] = None,
|
|
392
|
+
config: Optional[Config] = None,
|
|
393
|
+
) -> Credential:
|
|
394
|
+
"""获取凭证
|
|
395
|
+
|
|
396
|
+
Args:
|
|
397
|
+
credential_name: 凭证名称
|
|
398
|
+
|
|
399
|
+
headers: 请求头
|
|
400
|
+
config: 配置
|
|
401
|
+
|
|
402
|
+
Returns:
|
|
403
|
+
Credential: 凭证对象
|
|
404
|
+
|
|
405
|
+
Raises:
|
|
406
|
+
AgentRuntimeError: 调用失败时抛出
|
|
407
|
+
ClientError: 客户端错误
|
|
408
|
+
ServerError: 服务器错误
|
|
409
|
+
APIError: 运行时错误
|
|
410
|
+
"""
|
|
411
|
+
|
|
412
|
+
try:
|
|
413
|
+
client = self._get_client(config)
|
|
414
|
+
response = client.get_credential_with_options(
|
|
415
|
+
credential_name,
|
|
416
|
+
headers=headers or {},
|
|
417
|
+
runtime=RuntimeOptions(),
|
|
418
|
+
)
|
|
419
|
+
|
|
420
|
+
logger.debug(
|
|
421
|
+
"request api get_credential, request Request ID:"
|
|
422
|
+
f" {response.body.request_id}\n request:"
|
|
423
|
+
f" {[credential_name,]}\n response: {response.body.data}"
|
|
424
|
+
)
|
|
425
|
+
|
|
426
|
+
return response.body.data
|
|
427
|
+
except ClientException as e:
|
|
428
|
+
raise ClientError(
|
|
429
|
+
e.status_code,
|
|
430
|
+
pydash.get(e, "data.message", pydash.get(e, "message", "")),
|
|
431
|
+
request_id=e.request_id,
|
|
432
|
+
request=[
|
|
433
|
+
credential_name,
|
|
434
|
+
],
|
|
435
|
+
) from e
|
|
436
|
+
except ServerException as e:
|
|
437
|
+
raise ServerError(
|
|
438
|
+
e.status_code,
|
|
439
|
+
pydash.get(e, "data.message", pydash.get(e, "message", "")),
|
|
440
|
+
request_id=e.request_id,
|
|
441
|
+
) from e
|
|
442
|
+
|
|
443
|
+
async def get_credential_async(
|
|
444
|
+
self,
|
|
445
|
+
credential_name: str,
|
|
446
|
+
headers: Optional[Dict[str, str]] = None,
|
|
447
|
+
config: Optional[Config] = None,
|
|
448
|
+
) -> Credential:
|
|
449
|
+
"""获取凭证
|
|
450
|
+
|
|
451
|
+
Args:
|
|
452
|
+
credential_name: 凭证名称
|
|
453
|
+
|
|
454
|
+
headers: 请求头
|
|
455
|
+
config: 配置
|
|
456
|
+
|
|
457
|
+
Returns:
|
|
458
|
+
Credential: 凭证对象
|
|
459
|
+
|
|
460
|
+
Raises:
|
|
461
|
+
AgentRuntimeError: 调用失败时抛出
|
|
462
|
+
ClientError: 客户端错误
|
|
463
|
+
ServerError: 服务器错误
|
|
464
|
+
APIError: 运行时错误
|
|
465
|
+
"""
|
|
466
|
+
|
|
467
|
+
try:
|
|
468
|
+
client = self._get_client(config)
|
|
469
|
+
response = await client.get_credential_with_options_async(
|
|
470
|
+
credential_name,
|
|
471
|
+
headers=headers or {},
|
|
472
|
+
runtime=RuntimeOptions(),
|
|
473
|
+
)
|
|
474
|
+
|
|
475
|
+
logger.debug(
|
|
476
|
+
"request api get_credential, request Request ID:"
|
|
477
|
+
f" {response.body.request_id}\n request:"
|
|
478
|
+
f" {[credential_name,]}\n response: {response.body.data}"
|
|
479
|
+
)
|
|
480
|
+
|
|
481
|
+
return response.body.data
|
|
482
|
+
except ClientException as e:
|
|
483
|
+
raise ClientError(
|
|
484
|
+
e.status_code,
|
|
485
|
+
e.data.get("message", e.message),
|
|
486
|
+
request_id=e.request_id,
|
|
487
|
+
request=[
|
|
488
|
+
credential_name,
|
|
489
|
+
],
|
|
490
|
+
) from e
|
|
491
|
+
except ServerException as e:
|
|
492
|
+
raise ServerError(
|
|
493
|
+
e.status_code,
|
|
494
|
+
e.data.get("message", e.message),
|
|
495
|
+
request_id=e.request_id,
|
|
496
|
+
) from e
|
|
497
|
+
|
|
498
|
+
def list_credentials(
|
|
499
|
+
self,
|
|
500
|
+
input: ListCredentialsRequest,
|
|
501
|
+
headers: Optional[Dict[str, str]] = None,
|
|
502
|
+
config: Optional[Config] = None,
|
|
503
|
+
) -> ListCredentialsOutput:
|
|
504
|
+
"""列出凭证
|
|
505
|
+
|
|
506
|
+
Args:
|
|
507
|
+
input: 查询参数
|
|
508
|
+
|
|
509
|
+
headers: 请求头
|
|
510
|
+
config: 配置
|
|
511
|
+
|
|
512
|
+
Returns:
|
|
513
|
+
ListCredentialsOutput: 凭证列表
|
|
514
|
+
|
|
515
|
+
Raises:
|
|
516
|
+
AgentRuntimeError: 调用失败时抛出
|
|
517
|
+
ClientError: 客户端错误
|
|
518
|
+
ServerError: 服务器错误
|
|
519
|
+
APIError: 运行时错误
|
|
520
|
+
"""
|
|
521
|
+
|
|
522
|
+
try:
|
|
523
|
+
client = self._get_client(config)
|
|
524
|
+
response = client.list_credentials_with_options(
|
|
525
|
+
input,
|
|
526
|
+
headers=headers or {},
|
|
527
|
+
runtime=RuntimeOptions(),
|
|
528
|
+
)
|
|
529
|
+
|
|
530
|
+
logger.debug(
|
|
531
|
+
"request api list_credentials, request Request ID:"
|
|
532
|
+
f" {response.body.request_id}\n request: {[input.to_map(),]}\n"
|
|
533
|
+
f" response: {response.body.data}"
|
|
534
|
+
)
|
|
535
|
+
|
|
536
|
+
return response.body.data
|
|
537
|
+
except ClientException as e:
|
|
538
|
+
raise ClientError(
|
|
539
|
+
e.status_code,
|
|
540
|
+
pydash.get(e, "data.message", pydash.get(e, "message", "")),
|
|
541
|
+
request_id=e.request_id,
|
|
542
|
+
request=[
|
|
543
|
+
input,
|
|
544
|
+
],
|
|
545
|
+
) from e
|
|
546
|
+
except ServerException as e:
|
|
547
|
+
raise ServerError(
|
|
548
|
+
e.status_code,
|
|
549
|
+
pydash.get(e, "data.message", pydash.get(e, "message", "")),
|
|
550
|
+
request_id=e.request_id,
|
|
551
|
+
) from e
|
|
552
|
+
|
|
553
|
+
async def list_credentials_async(
|
|
554
|
+
self,
|
|
555
|
+
input: ListCredentialsRequest,
|
|
556
|
+
headers: Optional[Dict[str, str]] = None,
|
|
557
|
+
config: Optional[Config] = None,
|
|
558
|
+
) -> ListCredentialsOutput:
|
|
559
|
+
"""列出凭证
|
|
560
|
+
|
|
561
|
+
Args:
|
|
562
|
+
input: 查询参数
|
|
563
|
+
|
|
564
|
+
headers: 请求头
|
|
565
|
+
config: 配置
|
|
566
|
+
|
|
567
|
+
Returns:
|
|
568
|
+
ListCredentialsOutput: 凭证列表
|
|
569
|
+
|
|
570
|
+
Raises:
|
|
571
|
+
AgentRuntimeError: 调用失败时抛出
|
|
572
|
+
ClientError: 客户端错误
|
|
573
|
+
ServerError: 服务器错误
|
|
574
|
+
APIError: 运行时错误
|
|
575
|
+
"""
|
|
576
|
+
|
|
577
|
+
try:
|
|
578
|
+
client = self._get_client(config)
|
|
579
|
+
response = await client.list_credentials_with_options_async(
|
|
580
|
+
input,
|
|
581
|
+
headers=headers or {},
|
|
582
|
+
runtime=RuntimeOptions(),
|
|
583
|
+
)
|
|
584
|
+
|
|
585
|
+
logger.debug(
|
|
586
|
+
"request api list_credentials, request Request ID:"
|
|
587
|
+
f" {response.body.request_id}\n request: {[input.to_map(),]}\n"
|
|
588
|
+
f" response: {response.body.data}"
|
|
589
|
+
)
|
|
590
|
+
|
|
591
|
+
return response.body.data
|
|
592
|
+
except ClientException as e:
|
|
593
|
+
raise ClientError(
|
|
594
|
+
e.status_code,
|
|
595
|
+
e.data.get("message", e.message),
|
|
596
|
+
request_id=e.request_id,
|
|
597
|
+
request=[
|
|
598
|
+
input,
|
|
599
|
+
],
|
|
600
|
+
) from e
|
|
601
|
+
except ServerException as e:
|
|
602
|
+
raise ServerError(
|
|
603
|
+
e.status_code,
|
|
604
|
+
e.data.get("message", e.message),
|
|
605
|
+
request_id=e.request_id,
|
|
606
|
+
) from e
|