baiducloud-python-sdk-cloudassistant 0.0.1__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.
- baiducloud_python_sdk_cloudassistant/__init__.py +5 -0
- baiducloud_python_sdk_cloudassistant/api/__init__.py +0 -0
- baiducloud_python_sdk_cloudassistant/api/cloudassistant_client.py +418 -0
- baiducloud_python_sdk_cloudassistant/models/__init__.py +54 -0
- baiducloud_python_sdk_cloudassistant/models/action.py +164 -0
- baiducloud_python_sdk_cloudassistant/models/action_filter.py +100 -0
- baiducloud_python_sdk_cloudassistant/models/action_index.py +74 -0
- baiducloud_python_sdk_cloudassistant/models/action_list_request.py +99 -0
- baiducloud_python_sdk_cloudassistant/models/action_list_response.py +94 -0
- baiducloud_python_sdk_cloudassistant/models/action_log_request.py +76 -0
- baiducloud_python_sdk_cloudassistant/models/action_log_response.py +94 -0
- baiducloud_python_sdk_cloudassistant/models/action_page.py +84 -0
- baiducloud_python_sdk_cloudassistant/models/action_run.py +130 -0
- baiducloud_python_sdk_cloudassistant/models/action_run_list_request.py +143 -0
- baiducloud_python_sdk_cloudassistant/models/action_run_list_response.py +94 -0
- baiducloud_python_sdk_cloudassistant/models/action_run_page.py +84 -0
- baiducloud_python_sdk_cloudassistant/models/action_run_request.py +101 -0
- baiducloud_python_sdk_cloudassistant/models/action_run_response.py +93 -0
- baiducloud_python_sdk_cloudassistant/models/agent.py +76 -0
- baiducloud_python_sdk_cloudassistant/models/batch_get_agent_request.py +61 -0
- baiducloud_python_sdk_cloudassistant/models/batch_get_agent_response.py +94 -0
- baiducloud_python_sdk_cloudassistant/models/child_run.py +135 -0
- baiducloud_python_sdk_cloudassistant/models/command.py +135 -0
- baiducloud_python_sdk_cloudassistant/models/command_filter.py +74 -0
- baiducloud_python_sdk_cloudassistant/models/create_action_request.py +105 -0
- baiducloud_python_sdk_cloudassistant/models/create_action_response.py +94 -0
- baiducloud_python_sdk_cloudassistant/models/delete_action_request.py +58 -0
- baiducloud_python_sdk_cloudassistant/models/delete_action_response.py +85 -0
- baiducloud_python_sdk_cloudassistant/models/execution.py +20 -0
- baiducloud_python_sdk_cloudassistant/models/file_upload.py +151 -0
- baiducloud_python_sdk_cloudassistant/models/get_action_request.py +64 -0
- baiducloud_python_sdk_cloudassistant/models/get_action_response.py +94 -0
- baiducloud_python_sdk_cloudassistant/models/get_action_run_request.py +88 -0
- baiducloud_python_sdk_cloudassistant/models/get_action_run_response.py +94 -0
- baiducloud_python_sdk_cloudassistant/models/host.py +58 -0
- baiducloud_python_sdk_cloudassistant/models/id.py +19 -0
- baiducloud_python_sdk_cloudassistant/models/instance_type.py +19 -0
- baiducloud_python_sdk_cloudassistant/models/keyword_type.py +19 -0
- baiducloud_python_sdk_cloudassistant/models/log.py +58 -0
- baiducloud_python_sdk_cloudassistant/models/log_result.py +84 -0
- baiducloud_python_sdk_cloudassistant/models/os.py +19 -0
- baiducloud_python_sdk_cloudassistant/models/output.py +82 -0
- baiducloud_python_sdk_cloudassistant/models/parameter.py +82 -0
- baiducloud_python_sdk_cloudassistant/models/scope.py +19 -0
- baiducloud_python_sdk_cloudassistant/models/state.py +20 -0
- baiducloud_python_sdk_cloudassistant/models/statistics.py +66 -0
- baiducloud_python_sdk_cloudassistant/models/tag.py +66 -0
- baiducloud_python_sdk_cloudassistant/models/target.py +106 -0
- baiducloud_python_sdk_cloudassistant/models/target_import.py +66 -0
- baiducloud_python_sdk_cloudassistant/models/target_selector.py +78 -0
- baiducloud_python_sdk_cloudassistant/models/target_selector_type.py +21 -0
- baiducloud_python_sdk_cloudassistant/models/type.py +19 -0
- baiducloud_python_sdk_cloudassistant/models/update_action_request.py +105 -0
- baiducloud_python_sdk_cloudassistant/models/update_action_response.py +85 -0
- baiducloud_python_sdk_cloudassistant-0.0.1.dist-info/LICENSE +177 -0
- baiducloud_python_sdk_cloudassistant-0.0.1.dist-info/METADATA +76 -0
- baiducloud_python_sdk_cloudassistant-0.0.1.dist-info/RECORD +59 -0
- baiducloud_python_sdk_cloudassistant-0.0.1.dist-info/WHEEL +5 -0
- baiducloud_python_sdk_cloudassistant-0.0.1.dist-info/top_level.txt +1 -0
|
File without changes
|
|
@@ -0,0 +1,418 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Example for cloudassistant client.
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
import copy
|
|
6
|
+
import logging
|
|
7
|
+
|
|
8
|
+
from baiducloud_python_sdk_core import utils, bce_base_client
|
|
9
|
+
from baiducloud_python_sdk_core.auth import bce_v1_signer
|
|
10
|
+
from baiducloud_python_sdk_core.bce_base_client import BceBaseClient
|
|
11
|
+
from baiducloud_python_sdk_core.http import bce_http_client
|
|
12
|
+
from baiducloud_python_sdk_core.http import handler
|
|
13
|
+
from baiducloud_python_sdk_core.http import http_methods
|
|
14
|
+
from baiducloud_python_sdk_cloudassistant.models.action_list_response import ActionListResponse
|
|
15
|
+
from baiducloud_python_sdk_cloudassistant.models.action_log_response import ActionLogResponse
|
|
16
|
+
from baiducloud_python_sdk_cloudassistant.models.action_run_response import ActionRunResponse
|
|
17
|
+
from baiducloud_python_sdk_cloudassistant.models.action_run_list_response import ActionRunListResponse
|
|
18
|
+
from baiducloud_python_sdk_cloudassistant.models.batch_get_agent_response import BatchGetAgentResponse
|
|
19
|
+
from baiducloud_python_sdk_cloudassistant.models.create_action_response import CreateActionResponse
|
|
20
|
+
from baiducloud_python_sdk_cloudassistant.models.delete_action_response import DeleteActionResponse
|
|
21
|
+
from baiducloud_python_sdk_cloudassistant.models.get_action_response import GetActionResponse
|
|
22
|
+
from baiducloud_python_sdk_cloudassistant.models.get_action_run_response import GetActionRunResponse
|
|
23
|
+
from baiducloud_python_sdk_cloudassistant.models.update_action_response import UpdateActionResponse
|
|
24
|
+
|
|
25
|
+
_logger = logging.getLogger(__name__)
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
class CloudassistantClient(BceBaseClient):
|
|
29
|
+
"""
|
|
30
|
+
cloudassistant base sdk client
|
|
31
|
+
"""
|
|
32
|
+
|
|
33
|
+
VERSION_V1 = b'/v1'
|
|
34
|
+
|
|
35
|
+
CONSTANT_CA = b'ca'
|
|
36
|
+
|
|
37
|
+
CONSTANT_ACTION = b'action'
|
|
38
|
+
|
|
39
|
+
CONSTANT_ACTION_RUN = b'actionRun'
|
|
40
|
+
|
|
41
|
+
CONSTANT_AGENT = b'agent'
|
|
42
|
+
|
|
43
|
+
CONSTANT_BATCH = b'batch'
|
|
44
|
+
|
|
45
|
+
CONSTANT_LIST = b'list'
|
|
46
|
+
|
|
47
|
+
CONSTANT_LOG = b'log'
|
|
48
|
+
|
|
49
|
+
def __init__(self, config=None):
|
|
50
|
+
"""
|
|
51
|
+
Initialize the cloudassistant client.
|
|
52
|
+
|
|
53
|
+
:param config: Client configuration
|
|
54
|
+
:type config: baidubce.BceClientConfiguration
|
|
55
|
+
"""
|
|
56
|
+
bce_base_client.BceBaseClient.__init__(self, config)
|
|
57
|
+
|
|
58
|
+
def action_list(self, request, config=None):
|
|
59
|
+
"""
|
|
60
|
+
action_list
|
|
61
|
+
|
|
62
|
+
:param request: Request entity containing all parameters
|
|
63
|
+
:type request: CloudassistantClientRequest
|
|
64
|
+
:param config: Optional request configuration override
|
|
65
|
+
:type config: baiducloud_python_sdk_core.BceClientConfiguration
|
|
66
|
+
|
|
67
|
+
:return: API response containing ActionListResponse data
|
|
68
|
+
:rtype: ActionListResponse
|
|
69
|
+
|
|
70
|
+
:raises BceClientError: Client error (network failure, invalid parameters, etc.)
|
|
71
|
+
:raises BceServerError: Server error (4xx/5xx HTTP status codes)
|
|
72
|
+
"""
|
|
73
|
+
path = utils.append_uri(
|
|
74
|
+
CloudassistantClient.VERSION_V1,
|
|
75
|
+
CloudassistantClient.CONSTANT_CA,
|
|
76
|
+
CloudassistantClient.CONSTANT_ACTION,
|
|
77
|
+
CloudassistantClient.CONSTANT_LIST,
|
|
78
|
+
)
|
|
79
|
+
headers = None
|
|
80
|
+
params = {}
|
|
81
|
+
if request.locale is not None:
|
|
82
|
+
params['locale'] = request.locale
|
|
83
|
+
merged_config = self._create_request_with_host(request, config)
|
|
84
|
+
return self._send_request(
|
|
85
|
+
http_methods.POST,
|
|
86
|
+
path=path,
|
|
87
|
+
body=request.to_json_string(),
|
|
88
|
+
params=params,
|
|
89
|
+
config=merged_config,
|
|
90
|
+
model=ActionListResponse,
|
|
91
|
+
)
|
|
92
|
+
|
|
93
|
+
def action_log(self, request, config=None):
|
|
94
|
+
"""
|
|
95
|
+
action_log
|
|
96
|
+
|
|
97
|
+
:param request: Request entity containing all parameters
|
|
98
|
+
:type request: CloudassistantClientRequest
|
|
99
|
+
:param config: Optional request configuration override
|
|
100
|
+
:type config: baiducloud_python_sdk_core.BceClientConfiguration
|
|
101
|
+
|
|
102
|
+
:return: API response containing ActionLogResponse data
|
|
103
|
+
:rtype: ActionLogResponse
|
|
104
|
+
|
|
105
|
+
:raises BceClientError: Client error (network failure, invalid parameters, etc.)
|
|
106
|
+
:raises BceServerError: Server error (4xx/5xx HTTP status codes)
|
|
107
|
+
"""
|
|
108
|
+
path = utils.append_uri(
|
|
109
|
+
CloudassistantClient.VERSION_V1, CloudassistantClient.CONSTANT_CA, CloudassistantClient.CONSTANT_LOG
|
|
110
|
+
)
|
|
111
|
+
headers = None
|
|
112
|
+
merged_config = self._create_request_with_host(request, config)
|
|
113
|
+
return self._send_request(
|
|
114
|
+
http_methods.POST, path=path, body=request.to_json_string(), config=merged_config, model=ActionLogResponse
|
|
115
|
+
)
|
|
116
|
+
|
|
117
|
+
def action_run(self, request, config=None):
|
|
118
|
+
"""
|
|
119
|
+
action_run
|
|
120
|
+
|
|
121
|
+
:param request: Request entity containing all parameters
|
|
122
|
+
:type request: CloudassistantClientRequest
|
|
123
|
+
:param config: Optional request configuration override
|
|
124
|
+
:type config: baiducloud_python_sdk_core.BceClientConfiguration
|
|
125
|
+
|
|
126
|
+
:return: API response containing ActionRunResponse data
|
|
127
|
+
:rtype: ActionRunResponse
|
|
128
|
+
|
|
129
|
+
:raises BceClientError: Client error (network failure, invalid parameters, etc.)
|
|
130
|
+
:raises BceServerError: Server error (4xx/5xx HTTP status codes)
|
|
131
|
+
"""
|
|
132
|
+
path = utils.append_uri(
|
|
133
|
+
CloudassistantClient.VERSION_V1, CloudassistantClient.CONSTANT_CA, CloudassistantClient.CONSTANT_ACTION_RUN
|
|
134
|
+
)
|
|
135
|
+
headers = None
|
|
136
|
+
params = {}
|
|
137
|
+
if request.locale is not None:
|
|
138
|
+
params['locale'] = request.locale
|
|
139
|
+
merged_config = self._create_request_with_host(request, config)
|
|
140
|
+
return self._send_request(
|
|
141
|
+
http_methods.POST,
|
|
142
|
+
path=path,
|
|
143
|
+
body=request.to_json_string(),
|
|
144
|
+
params=params,
|
|
145
|
+
config=merged_config,
|
|
146
|
+
model=ActionRunResponse,
|
|
147
|
+
)
|
|
148
|
+
|
|
149
|
+
def action_run_list(self, request, config=None):
|
|
150
|
+
"""
|
|
151
|
+
action_run_list
|
|
152
|
+
|
|
153
|
+
:param request: Request entity containing all parameters
|
|
154
|
+
:type request: CloudassistantClientRequest
|
|
155
|
+
:param config: Optional request configuration override
|
|
156
|
+
:type config: baiducloud_python_sdk_core.BceClientConfiguration
|
|
157
|
+
|
|
158
|
+
:return: API response containing ActionRunListResponse data
|
|
159
|
+
:rtype: ActionRunListResponse
|
|
160
|
+
|
|
161
|
+
:raises BceClientError: Client error (network failure, invalid parameters, etc.)
|
|
162
|
+
:raises BceServerError: Server error (4xx/5xx HTTP status codes)
|
|
163
|
+
"""
|
|
164
|
+
path = utils.append_uri(
|
|
165
|
+
CloudassistantClient.VERSION_V1,
|
|
166
|
+
CloudassistantClient.CONSTANT_CA,
|
|
167
|
+
CloudassistantClient.CONSTANT_ACTION_RUN,
|
|
168
|
+
CloudassistantClient.CONSTANT_LIST,
|
|
169
|
+
)
|
|
170
|
+
headers = None
|
|
171
|
+
params = {}
|
|
172
|
+
if request.locale is not None:
|
|
173
|
+
params['locale'] = request.locale
|
|
174
|
+
merged_config = self._create_request_with_host(request, config)
|
|
175
|
+
return self._send_request(
|
|
176
|
+
http_methods.POST,
|
|
177
|
+
path=path,
|
|
178
|
+
body=request.to_json_string(),
|
|
179
|
+
params=params,
|
|
180
|
+
config=merged_config,
|
|
181
|
+
model=ActionRunListResponse,
|
|
182
|
+
)
|
|
183
|
+
|
|
184
|
+
def batch_get_agent(self, request, config=None):
|
|
185
|
+
"""
|
|
186
|
+
batch_get_agent
|
|
187
|
+
|
|
188
|
+
:param request: Request entity containing all parameters
|
|
189
|
+
:type request: CloudassistantClientRequest
|
|
190
|
+
:param config: Optional request configuration override
|
|
191
|
+
:type config: baiducloud_python_sdk_core.BceClientConfiguration
|
|
192
|
+
|
|
193
|
+
:return: API response containing BatchGetAgentResponse data
|
|
194
|
+
:rtype: BatchGetAgentResponse
|
|
195
|
+
|
|
196
|
+
:raises BceClientError: Client error (network failure, invalid parameters, etc.)
|
|
197
|
+
:raises BceServerError: Server error (4xx/5xx HTTP status codes)
|
|
198
|
+
"""
|
|
199
|
+
path = utils.append_uri(
|
|
200
|
+
CloudassistantClient.VERSION_V1,
|
|
201
|
+
CloudassistantClient.CONSTANT_CA,
|
|
202
|
+
CloudassistantClient.CONSTANT_AGENT,
|
|
203
|
+
CloudassistantClient.CONSTANT_BATCH,
|
|
204
|
+
)
|
|
205
|
+
headers = None
|
|
206
|
+
merged_config = self._create_request_with_host(request, config)
|
|
207
|
+
return self._send_request(
|
|
208
|
+
http_methods.POST,
|
|
209
|
+
path=path,
|
|
210
|
+
body=request.to_json_string(),
|
|
211
|
+
config=merged_config,
|
|
212
|
+
model=BatchGetAgentResponse,
|
|
213
|
+
)
|
|
214
|
+
|
|
215
|
+
def create_action(self, request, config=None):
|
|
216
|
+
"""
|
|
217
|
+
create_action
|
|
218
|
+
|
|
219
|
+
:param request: Request entity containing all parameters
|
|
220
|
+
:type request: CloudassistantClientRequest
|
|
221
|
+
:param config: Optional request configuration override
|
|
222
|
+
:type config: baiducloud_python_sdk_core.BceClientConfiguration
|
|
223
|
+
|
|
224
|
+
:return: API response containing CreateActionResponse data
|
|
225
|
+
:rtype: CreateActionResponse
|
|
226
|
+
|
|
227
|
+
:raises BceClientError: Client error (network failure, invalid parameters, etc.)
|
|
228
|
+
:raises BceServerError: Server error (4xx/5xx HTTP status codes)
|
|
229
|
+
"""
|
|
230
|
+
path = utils.append_uri(
|
|
231
|
+
CloudassistantClient.VERSION_V1, CloudassistantClient.CONSTANT_CA, CloudassistantClient.CONSTANT_ACTION
|
|
232
|
+
)
|
|
233
|
+
headers = None
|
|
234
|
+
merged_config = self._create_request_with_host(request, config)
|
|
235
|
+
return self._send_request(
|
|
236
|
+
http_methods.POST,
|
|
237
|
+
path=path,
|
|
238
|
+
body=request.to_json_string(),
|
|
239
|
+
config=merged_config,
|
|
240
|
+
model=CreateActionResponse,
|
|
241
|
+
)
|
|
242
|
+
|
|
243
|
+
def delete_action(self, request, config=None):
|
|
244
|
+
"""
|
|
245
|
+
delete_action
|
|
246
|
+
|
|
247
|
+
:param request: Request entity containing all parameters
|
|
248
|
+
:type request: CloudassistantClientRequest
|
|
249
|
+
:param config: Optional request configuration override
|
|
250
|
+
:type config: baiducloud_python_sdk_core.BceClientConfiguration
|
|
251
|
+
|
|
252
|
+
:return: API response containing DeleteActionResponse data
|
|
253
|
+
:rtype: DeleteActionResponse
|
|
254
|
+
|
|
255
|
+
:raises BceClientError: Client error (network failure, invalid parameters, etc.)
|
|
256
|
+
:raises BceServerError: Server error (4xx/5xx HTTP status codes)
|
|
257
|
+
"""
|
|
258
|
+
path = utils.append_uri(
|
|
259
|
+
CloudassistantClient.VERSION_V1,
|
|
260
|
+
CloudassistantClient.CONSTANT_CA,
|
|
261
|
+
CloudassistantClient.CONSTANT_ACTION,
|
|
262
|
+
request.id,
|
|
263
|
+
)
|
|
264
|
+
headers = None
|
|
265
|
+
merged_config = self._create_request_with_host(request, config)
|
|
266
|
+
return self._send_request(http_methods.DELETE, path=path, config=merged_config, model=DeleteActionResponse)
|
|
267
|
+
|
|
268
|
+
def get_action(self, request, config=None):
|
|
269
|
+
"""
|
|
270
|
+
get_action
|
|
271
|
+
|
|
272
|
+
:param request: Request entity containing all parameters
|
|
273
|
+
:type request: CloudassistantClientRequest
|
|
274
|
+
:param config: Optional request configuration override
|
|
275
|
+
:type config: baiducloud_python_sdk_core.BceClientConfiguration
|
|
276
|
+
|
|
277
|
+
:return: API response containing GetActionResponse data
|
|
278
|
+
:rtype: GetActionResponse
|
|
279
|
+
|
|
280
|
+
:raises BceClientError: Client error (network failure, invalid parameters, etc.)
|
|
281
|
+
:raises BceServerError: Server error (4xx/5xx HTTP status codes)
|
|
282
|
+
"""
|
|
283
|
+
path = utils.append_uri(
|
|
284
|
+
CloudassistantClient.VERSION_V1, CloudassistantClient.CONSTANT_CA, CloudassistantClient.CONSTANT_ACTION
|
|
285
|
+
)
|
|
286
|
+
headers = None
|
|
287
|
+
params = {}
|
|
288
|
+
if request.id is not None:
|
|
289
|
+
params['id'] = request.id
|
|
290
|
+
if request.locale is not None:
|
|
291
|
+
params['locale'] = request.locale
|
|
292
|
+
merged_config = self._create_request_with_host(request, config)
|
|
293
|
+
return self._send_request(
|
|
294
|
+
http_methods.GET, path=path, params=params, config=merged_config, model=GetActionResponse
|
|
295
|
+
)
|
|
296
|
+
|
|
297
|
+
def get_action_run(self, request, config=None):
|
|
298
|
+
"""
|
|
299
|
+
get_action_run
|
|
300
|
+
|
|
301
|
+
:param request: Request entity containing all parameters
|
|
302
|
+
:type request: CloudassistantClientRequest
|
|
303
|
+
:param config: Optional request configuration override
|
|
304
|
+
:type config: baiducloud_python_sdk_core.BceClientConfiguration
|
|
305
|
+
|
|
306
|
+
:return: API response containing GetActionRunResponse data
|
|
307
|
+
:rtype: GetActionRunResponse
|
|
308
|
+
|
|
309
|
+
:raises BceClientError: Client error (network failure, invalid parameters, etc.)
|
|
310
|
+
:raises BceServerError: Server error (4xx/5xx HTTP status codes)
|
|
311
|
+
"""
|
|
312
|
+
path = utils.append_uri(
|
|
313
|
+
CloudassistantClient.VERSION_V1, CloudassistantClient.CONSTANT_CA, CloudassistantClient.CONSTANT_ACTION_RUN
|
|
314
|
+
)
|
|
315
|
+
headers = None
|
|
316
|
+
params = {}
|
|
317
|
+
if request.id is not None:
|
|
318
|
+
params['id'] = request.id
|
|
319
|
+
if request.with_log is not None:
|
|
320
|
+
params['withLog'] = request.with_log
|
|
321
|
+
if request.page_no is not None:
|
|
322
|
+
params['pageNo'] = request.page_no
|
|
323
|
+
if request.page_size is not None:
|
|
324
|
+
params['pageSize'] = request.page_size
|
|
325
|
+
if request.child_run_state is not None:
|
|
326
|
+
params['childRunState'] = request.child_run_state
|
|
327
|
+
if request.locale is not None:
|
|
328
|
+
params['locale'] = request.locale
|
|
329
|
+
merged_config = self._create_request_with_host(request, config)
|
|
330
|
+
return self._send_request(
|
|
331
|
+
http_methods.GET, path=path, params=params, config=merged_config, model=GetActionRunResponse
|
|
332
|
+
)
|
|
333
|
+
|
|
334
|
+
def update_action(self, request, config=None):
|
|
335
|
+
"""
|
|
336
|
+
update_action
|
|
337
|
+
|
|
338
|
+
:param request: Request entity containing all parameters
|
|
339
|
+
:type request: CloudassistantClientRequest
|
|
340
|
+
:param config: Optional request configuration override
|
|
341
|
+
:type config: baiducloud_python_sdk_core.BceClientConfiguration
|
|
342
|
+
|
|
343
|
+
:return: API response containing UpdateActionResponse data
|
|
344
|
+
:rtype: UpdateActionResponse
|
|
345
|
+
|
|
346
|
+
:raises BceClientError: Client error (network failure, invalid parameters, etc.)
|
|
347
|
+
:raises BceServerError: Server error (4xx/5xx HTTP status codes)
|
|
348
|
+
"""
|
|
349
|
+
path = utils.append_uri(
|
|
350
|
+
CloudassistantClient.VERSION_V1, CloudassistantClient.CONSTANT_CA, CloudassistantClient.CONSTANT_ACTION
|
|
351
|
+
)
|
|
352
|
+
headers = None
|
|
353
|
+
merged_config = self._create_request_with_host(request, config)
|
|
354
|
+
return self._send_request(
|
|
355
|
+
http_methods.PUT,
|
|
356
|
+
path=path,
|
|
357
|
+
body=request.to_json_string(),
|
|
358
|
+
config=merged_config,
|
|
359
|
+
model=UpdateActionResponse,
|
|
360
|
+
)
|
|
361
|
+
|
|
362
|
+
def _merge_config(self, config=None):
|
|
363
|
+
"""
|
|
364
|
+
:param config:
|
|
365
|
+
:type config: baiducloud_python_sdk_core.BceClientConfiguration
|
|
366
|
+
"""
|
|
367
|
+
if config is None:
|
|
368
|
+
return self.config
|
|
369
|
+
else:
|
|
370
|
+
new_config = copy.copy(self.config)
|
|
371
|
+
new_config.merge_non_none_values(config)
|
|
372
|
+
return new_config
|
|
373
|
+
|
|
374
|
+
def _send_request(
|
|
375
|
+
self, http_method, path, body=None, headers=None, params=None, config=None, body_parser=None, model=None
|
|
376
|
+
):
|
|
377
|
+
"""
|
|
378
|
+
Send an HTTP request to the service endpoint.
|
|
379
|
+
|
|
380
|
+
:param http_method: HTTP method (GET, POST, PUT, DELETE, etc.)
|
|
381
|
+
:type http_method: bytes
|
|
382
|
+
:param path: Request path
|
|
383
|
+
:type path: bytes
|
|
384
|
+
:param body: Optional request body
|
|
385
|
+
:type body: str or bytes
|
|
386
|
+
:param headers: Optional HTTP headers
|
|
387
|
+
:type headers: dict
|
|
388
|
+
:param params: Optional query parameters
|
|
389
|
+
:type params: dict
|
|
390
|
+
:param config: Optional request configuration override
|
|
391
|
+
:type config: baiducloud_python_sdk_core.BceClientConfiguration
|
|
392
|
+
:param body_parser: Optional custom body parser function
|
|
393
|
+
:type body_parser: callable
|
|
394
|
+
:param model: Optional response model class for deserialization
|
|
395
|
+
:type model: class
|
|
396
|
+
|
|
397
|
+
:return: API response
|
|
398
|
+
:rtype: baiducloud_python_sdk_core.bce_response.BceResponse
|
|
399
|
+
|
|
400
|
+
:raises BceClientError: Client error (network connection failure, SSL errors, etc.)
|
|
401
|
+
:raises BceServerError: Server returned error response
|
|
402
|
+
"""
|
|
403
|
+
config = self._merge_config(config)
|
|
404
|
+
if body_parser is None:
|
|
405
|
+
body_parser = handler.parse_json
|
|
406
|
+
if headers is None:
|
|
407
|
+
headers = {b'Accept': b'*/*', b'Content-Type': b'application/json;charset=utf-8'}
|
|
408
|
+
return bce_http_client.send_request(
|
|
409
|
+
config,
|
|
410
|
+
bce_v1_signer.sign,
|
|
411
|
+
[handler.parse_error, body_parser],
|
|
412
|
+
http_method,
|
|
413
|
+
path,
|
|
414
|
+
body,
|
|
415
|
+
headers,
|
|
416
|
+
params,
|
|
417
|
+
model=model,
|
|
418
|
+
)
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Models for cloudassistant SDK.
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
from .action import Action
|
|
6
|
+
from .action_filter import ActionFilter
|
|
7
|
+
from .action_index import ActionIndex
|
|
8
|
+
from .action_list_request import ActionListRequest
|
|
9
|
+
from .action_list_response import ActionListResponse
|
|
10
|
+
from .action_log_request import ActionLogRequest
|
|
11
|
+
from .action_log_response import ActionLogResponse
|
|
12
|
+
from .action_page import ActionPage
|
|
13
|
+
from .action_run import ActionRun
|
|
14
|
+
from .action_run_list_request import ActionRunListRequest
|
|
15
|
+
from .action_run_list_response import ActionRunListResponse
|
|
16
|
+
from .action_run_page import ActionRunPage
|
|
17
|
+
from .action_run_request import ActionRunRequest
|
|
18
|
+
from .action_run_response import ActionRunResponse
|
|
19
|
+
from .agent import Agent
|
|
20
|
+
from .batch_get_agent_request import BatchGetAgentRequest
|
|
21
|
+
from .batch_get_agent_response import BatchGetAgentResponse
|
|
22
|
+
from .child_run import ChildRun
|
|
23
|
+
from .command import Command
|
|
24
|
+
from .command_filter import CommandFilter
|
|
25
|
+
from .create_action_request import CreateActionRequest
|
|
26
|
+
from .create_action_response import CreateActionResponse
|
|
27
|
+
from .delete_action_response import DeleteActionResponse
|
|
28
|
+
from .execution import Execution
|
|
29
|
+
from .file_upload import FileUpload
|
|
30
|
+
from .get_action_response import GetActionResponse
|
|
31
|
+
from .get_action_run_response import GetActionRunResponse
|
|
32
|
+
from .host import Host
|
|
33
|
+
from .id import Id
|
|
34
|
+
from .instance_type import InstanceType
|
|
35
|
+
from .keyword_type import KeywordType
|
|
36
|
+
from .log import Log
|
|
37
|
+
from .log_result import LogResult
|
|
38
|
+
from .os import Os
|
|
39
|
+
from .output import Output
|
|
40
|
+
from .parameter import Parameter
|
|
41
|
+
from .scope import Scope
|
|
42
|
+
from .state import State
|
|
43
|
+
from .statistics import Statistics
|
|
44
|
+
from .tag import Tag
|
|
45
|
+
from .target import Target
|
|
46
|
+
from .target_import import TargetImport
|
|
47
|
+
from .target_selector import TargetSelector
|
|
48
|
+
from .target_selector_type import TargetSelectorType
|
|
49
|
+
from .type import Type
|
|
50
|
+
from .update_action_request import UpdateActionRequest
|
|
51
|
+
from .update_action_response import UpdateActionResponse
|
|
52
|
+
from .get_action_run_request import GetActionRunRequest
|
|
53
|
+
from .get_action_request import GetActionRequest
|
|
54
|
+
from .delete_action_request import DeleteActionRequest
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Action information
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
from baiducloud_python_sdk_core.abstract_model import AbstractModel
|
|
6
|
+
|
|
7
|
+
from baiducloud_python_sdk_cloudassistant.models.command import Command
|
|
8
|
+
|
|
9
|
+
from baiducloud_python_sdk_cloudassistant.models.file_upload import FileUpload
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class Action(AbstractModel):
|
|
13
|
+
"""
|
|
14
|
+
Action
|
|
15
|
+
"""
|
|
16
|
+
|
|
17
|
+
def __init__(
|
|
18
|
+
self,
|
|
19
|
+
id=None,
|
|
20
|
+
ref=None,
|
|
21
|
+
type=None,
|
|
22
|
+
name=None,
|
|
23
|
+
alias=None,
|
|
24
|
+
description=None,
|
|
25
|
+
timeout_second=None,
|
|
26
|
+
command=None,
|
|
27
|
+
file_upload=None,
|
|
28
|
+
supported_instance_types=None,
|
|
29
|
+
created_timestamp=None,
|
|
30
|
+
updated_timestamp=None,
|
|
31
|
+
):
|
|
32
|
+
"""
|
|
33
|
+
Initialize Action instance.
|
|
34
|
+
|
|
35
|
+
:param id: 命令ID,系统自动生成,仅被保存的命令拥有
|
|
36
|
+
:type id: str (optional)
|
|
37
|
+
|
|
38
|
+
:param ref: Action ID,仅用于更新命令接口。通常引用已有的 Action ID,例如命令执行场景(命令列表查询不返回)
|
|
39
|
+
:type ref: str (optional)
|
|
40
|
+
|
|
41
|
+
:param type: Action类型。COMMAND(命令),FILE_UPLOAD(上传文件)
|
|
42
|
+
:type type: str (optional)
|
|
43
|
+
|
|
44
|
+
:param name: 命令名称,仅被保存的命令拥有
|
|
45
|
+
:type name: str (optional)
|
|
46
|
+
|
|
47
|
+
:param alias: Action 别名
|
|
48
|
+
:type alias: str (optional)
|
|
49
|
+
|
|
50
|
+
:param description: Action 描述
|
|
51
|
+
:type description: str (optional)
|
|
52
|
+
|
|
53
|
+
:param timeout_second: 动作的超时时间(秒)
|
|
54
|
+
:type timeout_second: int (optional)
|
|
55
|
+
|
|
56
|
+
:param command: command attribute
|
|
57
|
+
:type command: Command (optional)
|
|
58
|
+
|
|
59
|
+
:param file_upload: file_upload attribute
|
|
60
|
+
:type file_upload: FileUpload (optional)
|
|
61
|
+
|
|
62
|
+
:param supported_instance_types: 此公共命令支持的实例类型列表,根据命令创建执行时,根据此字段确定展示那些实例列表,目前支持:BCC、BBC、HPAS
|
|
63
|
+
:type supported_instance_types: List[str] (optional)
|
|
64
|
+
|
|
65
|
+
:param created_timestamp: 命令创建时间。unix时间戳(毫秒)
|
|
66
|
+
:type created_timestamp: int (optional)
|
|
67
|
+
|
|
68
|
+
:param updated_timestamp: 命令最后一次被修改时间。unix时间戳(毫秒)
|
|
69
|
+
:type updated_timestamp: int (optional)
|
|
70
|
+
"""
|
|
71
|
+
super().__init__()
|
|
72
|
+
self.id = id
|
|
73
|
+
self.ref = ref
|
|
74
|
+
self.type = type
|
|
75
|
+
self.name = name
|
|
76
|
+
self.alias = alias
|
|
77
|
+
self.description = description
|
|
78
|
+
self.timeout_second = timeout_second
|
|
79
|
+
self.command = command
|
|
80
|
+
self.file_upload = file_upload
|
|
81
|
+
self.supported_instance_types = supported_instance_types
|
|
82
|
+
self.created_timestamp = created_timestamp
|
|
83
|
+
self.updated_timestamp = updated_timestamp
|
|
84
|
+
|
|
85
|
+
def to_dict(self):
|
|
86
|
+
"""
|
|
87
|
+
Convert the model instance to a dictionary representation.
|
|
88
|
+
|
|
89
|
+
Nested model objects are recursively converted to dictionaries.
|
|
90
|
+
|
|
91
|
+
:return: Dictionary representation of the model
|
|
92
|
+
:rtype: dict
|
|
93
|
+
"""
|
|
94
|
+
_map = super().to_dict()
|
|
95
|
+
if _map is not None:
|
|
96
|
+
return _map
|
|
97
|
+
result = dict()
|
|
98
|
+
if self.id is not None:
|
|
99
|
+
result['id'] = self.id
|
|
100
|
+
if self.ref is not None:
|
|
101
|
+
result['ref'] = self.ref
|
|
102
|
+
if self.type is not None:
|
|
103
|
+
result['type'] = self.type
|
|
104
|
+
if self.name is not None:
|
|
105
|
+
result['name'] = self.name
|
|
106
|
+
if self.alias is not None:
|
|
107
|
+
result['alias'] = self.alias
|
|
108
|
+
if self.description is not None:
|
|
109
|
+
result['description'] = self.description
|
|
110
|
+
if self.timeout_second is not None:
|
|
111
|
+
result['timeoutSecond'] = self.timeout_second
|
|
112
|
+
if self.command is not None:
|
|
113
|
+
result['command'] = self.command.to_dict()
|
|
114
|
+
if self.file_upload is not None:
|
|
115
|
+
result['fileUpload'] = self.file_upload.to_dict()
|
|
116
|
+
if self.supported_instance_types is not None:
|
|
117
|
+
result['supportedInstanceTypes'] = self.supported_instance_types
|
|
118
|
+
if self.created_timestamp is not None:
|
|
119
|
+
result['createdTimestamp'] = self.created_timestamp
|
|
120
|
+
if self.updated_timestamp is not None:
|
|
121
|
+
result['updatedTimestamp'] = self.updated_timestamp
|
|
122
|
+
return result
|
|
123
|
+
|
|
124
|
+
def from_dict(self, m):
|
|
125
|
+
"""
|
|
126
|
+
Populate the model instance from a dictionary.
|
|
127
|
+
|
|
128
|
+
Nested dictionaries are recursively converted to model objects.
|
|
129
|
+
|
|
130
|
+
:param m: Dictionary containing model data
|
|
131
|
+
:type m: dict
|
|
132
|
+
|
|
133
|
+
:return: Self reference for method chaining
|
|
134
|
+
:rtype: Action
|
|
135
|
+
|
|
136
|
+
:raises TypeError: If input is not a dictionary type
|
|
137
|
+
:raises ValueError: If nested model conversion fails
|
|
138
|
+
"""
|
|
139
|
+
m = m or dict()
|
|
140
|
+
if m.get('id') is not None:
|
|
141
|
+
self.id = m.get('id')
|
|
142
|
+
if m.get('ref') is not None:
|
|
143
|
+
self.ref = m.get('ref')
|
|
144
|
+
if m.get('type') is not None:
|
|
145
|
+
self.type = m.get('type')
|
|
146
|
+
if m.get('name') is not None:
|
|
147
|
+
self.name = m.get('name')
|
|
148
|
+
if m.get('alias') is not None:
|
|
149
|
+
self.alias = m.get('alias')
|
|
150
|
+
if m.get('description') is not None:
|
|
151
|
+
self.description = m.get('description')
|
|
152
|
+
if m.get('timeoutSecond') is not None:
|
|
153
|
+
self.timeout_second = m.get('timeoutSecond')
|
|
154
|
+
if m.get('command') is not None:
|
|
155
|
+
self.command = Command().from_dict(m.get('command'))
|
|
156
|
+
if m.get('fileUpload') is not None:
|
|
157
|
+
self.file_upload = FileUpload().from_dict(m.get('fileUpload'))
|
|
158
|
+
if m.get('supportedInstanceTypes') is not None:
|
|
159
|
+
self.supported_instance_types = m.get('supportedInstanceTypes')
|
|
160
|
+
if m.get('createdTimestamp') is not None:
|
|
161
|
+
self.created_timestamp = m.get('createdTimestamp')
|
|
162
|
+
if m.get('updatedTimestamp') is not None:
|
|
163
|
+
self.updated_timestamp = m.get('updatedTimestamp')
|
|
164
|
+
return self
|