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.
Files changed (59) hide show
  1. baiducloud_python_sdk_cloudassistant/__init__.py +5 -0
  2. baiducloud_python_sdk_cloudassistant/api/__init__.py +0 -0
  3. baiducloud_python_sdk_cloudassistant/api/cloudassistant_client.py +418 -0
  4. baiducloud_python_sdk_cloudassistant/models/__init__.py +54 -0
  5. baiducloud_python_sdk_cloudassistant/models/action.py +164 -0
  6. baiducloud_python_sdk_cloudassistant/models/action_filter.py +100 -0
  7. baiducloud_python_sdk_cloudassistant/models/action_index.py +74 -0
  8. baiducloud_python_sdk_cloudassistant/models/action_list_request.py +99 -0
  9. baiducloud_python_sdk_cloudassistant/models/action_list_response.py +94 -0
  10. baiducloud_python_sdk_cloudassistant/models/action_log_request.py +76 -0
  11. baiducloud_python_sdk_cloudassistant/models/action_log_response.py +94 -0
  12. baiducloud_python_sdk_cloudassistant/models/action_page.py +84 -0
  13. baiducloud_python_sdk_cloudassistant/models/action_run.py +130 -0
  14. baiducloud_python_sdk_cloudassistant/models/action_run_list_request.py +143 -0
  15. baiducloud_python_sdk_cloudassistant/models/action_run_list_response.py +94 -0
  16. baiducloud_python_sdk_cloudassistant/models/action_run_page.py +84 -0
  17. baiducloud_python_sdk_cloudassistant/models/action_run_request.py +101 -0
  18. baiducloud_python_sdk_cloudassistant/models/action_run_response.py +93 -0
  19. baiducloud_python_sdk_cloudassistant/models/agent.py +76 -0
  20. baiducloud_python_sdk_cloudassistant/models/batch_get_agent_request.py +61 -0
  21. baiducloud_python_sdk_cloudassistant/models/batch_get_agent_response.py +94 -0
  22. baiducloud_python_sdk_cloudassistant/models/child_run.py +135 -0
  23. baiducloud_python_sdk_cloudassistant/models/command.py +135 -0
  24. baiducloud_python_sdk_cloudassistant/models/command_filter.py +74 -0
  25. baiducloud_python_sdk_cloudassistant/models/create_action_request.py +105 -0
  26. baiducloud_python_sdk_cloudassistant/models/create_action_response.py +94 -0
  27. baiducloud_python_sdk_cloudassistant/models/delete_action_request.py +58 -0
  28. baiducloud_python_sdk_cloudassistant/models/delete_action_response.py +85 -0
  29. baiducloud_python_sdk_cloudassistant/models/execution.py +20 -0
  30. baiducloud_python_sdk_cloudassistant/models/file_upload.py +151 -0
  31. baiducloud_python_sdk_cloudassistant/models/get_action_request.py +64 -0
  32. baiducloud_python_sdk_cloudassistant/models/get_action_response.py +94 -0
  33. baiducloud_python_sdk_cloudassistant/models/get_action_run_request.py +88 -0
  34. baiducloud_python_sdk_cloudassistant/models/get_action_run_response.py +94 -0
  35. baiducloud_python_sdk_cloudassistant/models/host.py +58 -0
  36. baiducloud_python_sdk_cloudassistant/models/id.py +19 -0
  37. baiducloud_python_sdk_cloudassistant/models/instance_type.py +19 -0
  38. baiducloud_python_sdk_cloudassistant/models/keyword_type.py +19 -0
  39. baiducloud_python_sdk_cloudassistant/models/log.py +58 -0
  40. baiducloud_python_sdk_cloudassistant/models/log_result.py +84 -0
  41. baiducloud_python_sdk_cloudassistant/models/os.py +19 -0
  42. baiducloud_python_sdk_cloudassistant/models/output.py +82 -0
  43. baiducloud_python_sdk_cloudassistant/models/parameter.py +82 -0
  44. baiducloud_python_sdk_cloudassistant/models/scope.py +19 -0
  45. baiducloud_python_sdk_cloudassistant/models/state.py +20 -0
  46. baiducloud_python_sdk_cloudassistant/models/statistics.py +66 -0
  47. baiducloud_python_sdk_cloudassistant/models/tag.py +66 -0
  48. baiducloud_python_sdk_cloudassistant/models/target.py +106 -0
  49. baiducloud_python_sdk_cloudassistant/models/target_import.py +66 -0
  50. baiducloud_python_sdk_cloudassistant/models/target_selector.py +78 -0
  51. baiducloud_python_sdk_cloudassistant/models/target_selector_type.py +21 -0
  52. baiducloud_python_sdk_cloudassistant/models/type.py +19 -0
  53. baiducloud_python_sdk_cloudassistant/models/update_action_request.py +105 -0
  54. baiducloud_python_sdk_cloudassistant/models/update_action_response.py +85 -0
  55. baiducloud_python_sdk_cloudassistant-0.0.1.dist-info/LICENSE +177 -0
  56. baiducloud_python_sdk_cloudassistant-0.0.1.dist-info/METADATA +76 -0
  57. baiducloud_python_sdk_cloudassistant-0.0.1.dist-info/RECORD +59 -0
  58. baiducloud_python_sdk_cloudassistant-0.0.1.dist-info/WHEEL +5 -0
  59. baiducloud_python_sdk_cloudassistant-0.0.1.dist-info/top_level.txt +1 -0
@@ -0,0 +1,76 @@
1
+ """
2
+ Agent information
3
+ """
4
+
5
+ from baiducloud_python_sdk_core.abstract_model import AbstractModel
6
+
7
+ from baiducloud_python_sdk_cloudassistant.models.host import Host
8
+
9
+
10
+ class Agent(AbstractModel):
11
+ """
12
+ Agent
13
+ """
14
+
15
+ def __init__(self, host=None, state=None, version=None):
16
+ """
17
+ Initialize Agent instance.
18
+
19
+ :param host: host attribute
20
+ :type host: Host (optional)
21
+
22
+ :param state: bsm-agent状态。枚举值:ONLINE(在线),OFFLINE(离线)
23
+ :type state: str (optional)
24
+
25
+ :param version: bsm-agent版本号,如4.2.0.1
26
+ :type version: str (optional)
27
+ """
28
+ super().__init__()
29
+ self.host = host
30
+ self.state = state
31
+ self.version = version
32
+
33
+ def to_dict(self):
34
+ """
35
+ Convert the model instance to a dictionary representation.
36
+
37
+ Nested model objects are recursively converted to dictionaries.
38
+
39
+ :return: Dictionary representation of the model
40
+ :rtype: dict
41
+ """
42
+ _map = super().to_dict()
43
+ if _map is not None:
44
+ return _map
45
+ result = dict()
46
+ if self.host is not None:
47
+ result['host'] = self.host.to_dict()
48
+ if self.state is not None:
49
+ result['state'] = self.state
50
+ if self.version is not None:
51
+ result['version'] = self.version
52
+ return result
53
+
54
+ def from_dict(self, m):
55
+ """
56
+ Populate the model instance from a dictionary.
57
+
58
+ Nested dictionaries are recursively converted to model objects.
59
+
60
+ :param m: Dictionary containing model data
61
+ :type m: dict
62
+
63
+ :return: Self reference for method chaining
64
+ :rtype: Agent
65
+
66
+ :raises TypeError: If input is not a dictionary type
67
+ :raises ValueError: If nested model conversion fails
68
+ """
69
+ m = m or dict()
70
+ if m.get('host') is not None:
71
+ self.host = Host().from_dict(m.get('host'))
72
+ if m.get('state') is not None:
73
+ self.state = m.get('state')
74
+ if m.get('version') is not None:
75
+ self.version = m.get('version')
76
+ return self
@@ -0,0 +1,61 @@
1
+ """
2
+ Request entity for BatchGetAgentRequest information.
3
+ """
4
+
5
+ from baiducloud_python_sdk_core.abstract_model import AbstractModel
6
+ from baiducloud_python_sdk_cloudassistant.models.host import Host
7
+
8
+
9
+ class BatchGetAgentRequest(AbstractModel):
10
+ """
11
+ Request entity for BatchGetAgentRequest operation.
12
+
13
+ This class encapsulates all parameters for the API request.
14
+ """
15
+
16
+ def __init__(self, hosts):
17
+ """
18
+ Initialize BatchGetAgentRequest request entity.
19
+
20
+ :param hosts: 虚机列表
21
+ :type hosts: List[Host] (required)
22
+ """
23
+ super().__init__()
24
+ self.hosts = hosts
25
+
26
+ def to_dict(self):
27
+ """
28
+ Convert the request entity to a dictionary representation.
29
+
30
+ Nested model objects are recursively converted to dictionaries.
31
+
32
+ :return: Dictionary representation of the request
33
+ :rtype: dict
34
+ """
35
+ _map = super().to_dict()
36
+ if _map is not None:
37
+ return _map
38
+ result = dict()
39
+ if self.hosts is not None:
40
+ result['hosts'] = [i.to_dict() for i in self.hosts]
41
+ return result
42
+
43
+ def from_dict(self, m):
44
+ """
45
+ Populate the request entity from a dictionary.
46
+
47
+ Nested dictionaries are recursively converted to model objects.
48
+
49
+ :param m: Dictionary containing request data
50
+ :type m: dict
51
+
52
+ :return: Self reference for method chaining
53
+ :rtype: BatchGetAgentRequest
54
+
55
+ :raises TypeError: If input is not a dictionary or field type mismatch
56
+ :raises ValueError: If nested model conversion fails
57
+ """
58
+ m = m or dict()
59
+ if m.get('hosts') is not None:
60
+ self.hosts = [Host().from_dict(i) for i in m.get('hosts')]
61
+ return self
@@ -0,0 +1,94 @@
1
+ """
2
+ Request entity for BatchGetAgentResponse information.
3
+ """
4
+
5
+ from baiducloud_python_sdk_core.bce_response import BceResponse
6
+ from baiducloud_python_sdk_cloudassistant.models.agent import Agent
7
+
8
+
9
+ class BatchGetAgentResponse(BceResponse):
10
+ """
11
+ BatchGetAgentResponse
12
+ """
13
+
14
+ def __init__(self, request_id=None, code=None, message=None, success=None, result=None):
15
+ """
16
+ Initialize BatchGetAgentResponse response.
17
+
18
+ :param request_id: 请求id
19
+ :type request_id: str (optional)
20
+
21
+ :param code: 响应状态,成功为success
22
+ :type code: str (optional)
23
+
24
+ :param message: 错误信息
25
+ :type message: str (optional)
26
+
27
+ :param success: 请求是否处理成功
28
+ :type success: bool (optional)
29
+
30
+ :param result: 虚机bsm-agent状态
31
+ :type result: List[Agent] (optional)
32
+ """
33
+ super().__init__()
34
+ self.request_id = request_id
35
+ self.code = code
36
+ self.message = message
37
+ self.success = success
38
+ self.result = result
39
+
40
+ def to_dict(self):
41
+ """
42
+ Convert the response instance to a dictionary representation.
43
+
44
+ Includes metadata from the parent BceResponse class.
45
+ Nested model objects are recursively converted to dictionaries.
46
+
47
+ :return: Dictionary representation of the response
48
+ :rtype: dict
49
+ """
50
+ _map = super().to_dict()
51
+ if _map is not None:
52
+ return _map
53
+ result = dict()
54
+ if self.metadata is not None:
55
+ result['metadata'] = dict(self.metadata)
56
+ if self.request_id is not None:
57
+ result['requestId'] = self.request_id
58
+ if self.code is not None:
59
+ result['code'] = self.code
60
+ if self.message is not None:
61
+ result['message'] = self.message
62
+ if self.success is not None:
63
+ result['success'] = self.success
64
+ if self.result is not None:
65
+ result['result'] = [i.to_dict() for i in self.result]
66
+ return result
67
+
68
+ def from_dict(self, m):
69
+ """
70
+ Populate the response instance from a dictionary.
71
+
72
+ Nested dictionaries are recursively converted to model objects.
73
+
74
+ :param m: Dictionary containing response data
75
+ :type m: dict
76
+
77
+ :return: Self reference for method chaining
78
+ :rtype: BatchGetAgentResponse
79
+
80
+ :raises TypeError: If input is not a dictionary or field type mismatch
81
+ :raises ValueError: If nested model conversion fails
82
+ """
83
+ m = m or dict()
84
+ if m.get('requestId') is not None:
85
+ self.request_id = m.get('requestId')
86
+ if m.get('code') is not None:
87
+ self.code = m.get('code')
88
+ if m.get('message') is not None:
89
+ self.message = m.get('message')
90
+ if m.get('success') is not None:
91
+ self.success = m.get('success')
92
+ if m.get('result') is not None:
93
+ self.result = [Agent().from_dict(i) for i in m.get('result')]
94
+ return self
@@ -0,0 +1,135 @@
1
+ """
2
+ ChildRun information
3
+ """
4
+
5
+ from baiducloud_python_sdk_core.abstract_model import AbstractModel
6
+
7
+ from baiducloud_python_sdk_cloudassistant.models.output import Output
8
+
9
+
10
+ class ChildRun(AbstractModel):
11
+ """
12
+ ChildRun
13
+ """
14
+
15
+ def __init__(
16
+ self,
17
+ id=None,
18
+ state=None,
19
+ target=None,
20
+ created_timestamp=None,
21
+ finished_timestamp=None,
22
+ output=None,
23
+ log=None,
24
+ error_code=None,
25
+ fail_reason=None,
26
+ ):
27
+ """
28
+ Initialize ChildRun instance.
29
+
30
+ :param id: 子执行ID
31
+ :type id: str (optional)
32
+
33
+ :param state: 执行状态。枚举值:FAILED(执行失败),RUNNING(执行中),SUCCESS(执行完成)
34
+ :type state: str (optional)
35
+
36
+ :param target: 子执行对应的实例信息
37
+ :type target: object (optional)
38
+
39
+ :param created_timestamp: 子执行开始时间。unix时间戳,单位:毫秒
40
+ :type created_timestamp: int (optional)
41
+
42
+ :param finished_timestamp: 子执行结束时间,仅执行结束时返回。unix时间戳,单位:毫秒。
43
+ :type finished_timestamp: int (optional)
44
+
45
+ :param output: output attribute
46
+ :type output: Output (optional)
47
+
48
+ :param log: 子执行日志内容,仅当请求参数 withLog=true 时返回
49
+ :type log: str (optional)
50
+
51
+ :param error_code: 错误码
52
+ :type error_code: str (optional)
53
+
54
+ :param fail_reason: 子执行失败原因
55
+ :type fail_reason: str (optional)
56
+ """
57
+ super().__init__()
58
+ self.id = id
59
+ self.state = state
60
+ self.target = target
61
+ self.created_timestamp = created_timestamp
62
+ self.finished_timestamp = finished_timestamp
63
+ self.output = output
64
+ self.log = log
65
+ self.error_code = error_code
66
+ self.fail_reason = fail_reason
67
+
68
+ def to_dict(self):
69
+ """
70
+ Convert the model instance to a dictionary representation.
71
+
72
+ Nested model objects are recursively converted to dictionaries.
73
+
74
+ :return: Dictionary representation of the model
75
+ :rtype: dict
76
+ """
77
+ _map = super().to_dict()
78
+ if _map is not None:
79
+ return _map
80
+ result = dict()
81
+ if self.id is not None:
82
+ result['id'] = self.id
83
+ if self.state is not None:
84
+ result['state'] = self.state
85
+ if self.target is not None:
86
+ result['target'] = self.target
87
+ if self.created_timestamp is not None:
88
+ result['createdTimestamp'] = self.created_timestamp
89
+ if self.finished_timestamp is not None:
90
+ result['finishedTimestamp'] = self.finished_timestamp
91
+ if self.output is not None:
92
+ result['output'] = self.output.to_dict()
93
+ if self.log is not None:
94
+ result['log'] = self.log
95
+ if self.error_code is not None:
96
+ result['errorCode'] = self.error_code
97
+ if self.fail_reason is not None:
98
+ result['failReason'] = self.fail_reason
99
+ return result
100
+
101
+ def from_dict(self, m):
102
+ """
103
+ Populate the model instance from a dictionary.
104
+
105
+ Nested dictionaries are recursively converted to model objects.
106
+
107
+ :param m: Dictionary containing model data
108
+ :type m: dict
109
+
110
+ :return: Self reference for method chaining
111
+ :rtype: ChildRun
112
+
113
+ :raises TypeError: If input is not a dictionary type
114
+ :raises ValueError: If nested model conversion fails
115
+ """
116
+ m = m or dict()
117
+ if m.get('id') is not None:
118
+ self.id = m.get('id')
119
+ if m.get('state') is not None:
120
+ self.state = m.get('state')
121
+ if m.get('target') is not None:
122
+ self.target = m.get('target')
123
+ if m.get('createdTimestamp') is not None:
124
+ self.created_timestamp = m.get('createdTimestamp')
125
+ if m.get('finishedTimestamp') is not None:
126
+ self.finished_timestamp = m.get('finishedTimestamp')
127
+ if m.get('output') is not None:
128
+ self.output = Output().from_dict(m.get('output'))
129
+ if m.get('log') is not None:
130
+ self.log = m.get('log')
131
+ if m.get('errorCode') is not None:
132
+ self.error_code = m.get('errorCode')
133
+ if m.get('failReason') is not None:
134
+ self.fail_reason = m.get('failReason')
135
+ return self
@@ -0,0 +1,135 @@
1
+ """
2
+ Command information
3
+ """
4
+
5
+ from baiducloud_python_sdk_core.abstract_model import AbstractModel
6
+
7
+ from baiducloud_python_sdk_cloudassistant.models.parameter import Parameter
8
+
9
+
10
+ class Command(AbstractModel):
11
+ """
12
+ Command
13
+ """
14
+
15
+ def __init__(
16
+ self,
17
+ type=None,
18
+ content=None,
19
+ scope=None,
20
+ enable_parameter=None,
21
+ parameters=None,
22
+ user=None,
23
+ work_dir=None,
24
+ exec_params=None,
25
+ wait_on_agent_milli=None,
26
+ ):
27
+ """
28
+ Initialize Command instance.
29
+
30
+ :param type: 脚本类型
31
+ :type type: str (optional)
32
+
33
+ :param content: 命令脚本内容
34
+ :type content: str (optional)
35
+
36
+ :param scope: 命令可见范围。GLOBAL公共命令,INDIVIDUAL个人命令
37
+ :type scope: str (optional)
38
+
39
+ :param enable_parameter: 命令是否包含参数
40
+ :type enable_parameter: bool (optional)
41
+
42
+ :param parameters: 命令参数列表
43
+ :type parameters: List[Parameter] (optional)
44
+
45
+ :param user: 命令在虚机的执行用户
46
+ :type user: str (optional)
47
+
48
+ :param work_dir: 命令在虚机的执行路径
49
+ :type work_dir: str (optional)
50
+
51
+ :param exec_params: 命令执行时的实际参数值,仅在查询 ActionRun 详情时返回
52
+ :type exec_params: object (optional)
53
+
54
+ :param wait_on_agent_milli: Agent等待时间(毫秒)
55
+ :type wait_on_agent_milli: int (optional)
56
+ """
57
+ super().__init__()
58
+ self.type = type
59
+ self.content = content
60
+ self.scope = scope
61
+ self.enable_parameter = enable_parameter
62
+ self.parameters = parameters
63
+ self.user = user
64
+ self.work_dir = work_dir
65
+ self.exec_params = exec_params
66
+ self.wait_on_agent_milli = wait_on_agent_milli
67
+
68
+ def to_dict(self):
69
+ """
70
+ Convert the model instance to a dictionary representation.
71
+
72
+ Nested model objects are recursively converted to dictionaries.
73
+
74
+ :return: Dictionary representation of the model
75
+ :rtype: dict
76
+ """
77
+ _map = super().to_dict()
78
+ if _map is not None:
79
+ return _map
80
+ result = dict()
81
+ if self.type is not None:
82
+ result['type'] = self.type
83
+ if self.content is not None:
84
+ result['content'] = self.content
85
+ if self.scope is not None:
86
+ result['scope'] = self.scope
87
+ if self.enable_parameter is not None:
88
+ result['enableParameter'] = self.enable_parameter
89
+ if self.parameters is not None:
90
+ result['parameters'] = [i.to_dict() for i in self.parameters]
91
+ if self.user is not None:
92
+ result['user'] = self.user
93
+ if self.work_dir is not None:
94
+ result['workDir'] = self.work_dir
95
+ if self.exec_params is not None:
96
+ result['execParams'] = self.exec_params
97
+ if self.wait_on_agent_milli is not None:
98
+ result['waitOnAgentMilli'] = self.wait_on_agent_milli
99
+ return result
100
+
101
+ def from_dict(self, m):
102
+ """
103
+ Populate the model instance from a dictionary.
104
+
105
+ Nested dictionaries are recursively converted to model objects.
106
+
107
+ :param m: Dictionary containing model data
108
+ :type m: dict
109
+
110
+ :return: Self reference for method chaining
111
+ :rtype: Command
112
+
113
+ :raises TypeError: If input is not a dictionary type
114
+ :raises ValueError: If nested model conversion fails
115
+ """
116
+ m = m or dict()
117
+ if m.get('type') is not None:
118
+ self.type = m.get('type')
119
+ if m.get('content') is not None:
120
+ self.content = m.get('content')
121
+ if m.get('scope') is not None:
122
+ self.scope = m.get('scope')
123
+ if m.get('enableParameter') is not None:
124
+ self.enable_parameter = m.get('enableParameter')
125
+ if m.get('parameters') is not None:
126
+ self.parameters = [Parameter().from_dict(i) for i in m.get('parameters')]
127
+ if m.get('user') is not None:
128
+ self.user = m.get('user')
129
+ if m.get('workDir') is not None:
130
+ self.work_dir = m.get('workDir')
131
+ if m.get('execParams') is not None:
132
+ self.exec_params = m.get('execParams')
133
+ if m.get('waitOnAgentMilli') is not None:
134
+ self.wait_on_agent_milli = m.get('waitOnAgentMilli')
135
+ return self
@@ -0,0 +1,74 @@
1
+ """
2
+ CommandFilter information
3
+ """
4
+
5
+ from baiducloud_python_sdk_core.abstract_model import AbstractModel
6
+
7
+
8
+ class CommandFilter(AbstractModel):
9
+ """
10
+ CommandFilter
11
+ """
12
+
13
+ def __init__(self, scope=None, name=None, type=None):
14
+ """
15
+ Initialize CommandFilter instance.
16
+
17
+ :param scope: 按命令可见范围筛选。枚举值:INDIVIDUAL(个人命令),GLOBAL(公共命令)
18
+ :type scope: str (optional)
19
+
20
+ :param name: 按命令名称筛选
21
+ :type name: str (optional)
22
+
23
+ :param type: 按命令类型筛选。枚举值:SHELL,POWERSHELL
24
+ :type type: str (optional)
25
+ """
26
+ super().__init__()
27
+ self.scope = scope
28
+ self.name = name
29
+ self.type = type
30
+
31
+ def to_dict(self):
32
+ """
33
+ Convert the model instance to a dictionary representation.
34
+
35
+ Nested model objects are recursively converted to dictionaries.
36
+
37
+ :return: Dictionary representation of the model
38
+ :rtype: dict
39
+ """
40
+ _map = super().to_dict()
41
+ if _map is not None:
42
+ return _map
43
+ result = dict()
44
+ if self.scope is not None:
45
+ result['scope'] = self.scope
46
+ if self.name is not None:
47
+ result['name'] = self.name
48
+ if self.type is not None:
49
+ result['type'] = self.type
50
+ return result
51
+
52
+ def from_dict(self, m):
53
+ """
54
+ Populate the model instance from a dictionary.
55
+
56
+ Nested dictionaries are recursively converted to model objects.
57
+
58
+ :param m: Dictionary containing model data
59
+ :type m: dict
60
+
61
+ :return: Self reference for method chaining
62
+ :rtype: CommandFilter
63
+
64
+ :raises TypeError: If input is not a dictionary type
65
+ :raises ValueError: If nested model conversion fails
66
+ """
67
+ m = m or dict()
68
+ if m.get('scope') is not None:
69
+ self.scope = m.get('scope')
70
+ if m.get('name') is not None:
71
+ self.name = m.get('name')
72
+ if m.get('type') is not None:
73
+ self.type = m.get('type')
74
+ return self
@@ -0,0 +1,105 @@
1
+ """
2
+ Request entity for CreateActionRequest information.
3
+ """
4
+
5
+ from baiducloud_python_sdk_core.abstract_model import AbstractModel
6
+ from baiducloud_python_sdk_cloudassistant.models.action import Action
7
+ from baiducloud_python_sdk_cloudassistant.models.target import Target
8
+ from baiducloud_python_sdk_cloudassistant.models.target_selector import TargetSelector
9
+
10
+
11
+ class CreateActionRequest(AbstractModel):
12
+ """
13
+ Request entity for CreateActionRequest operation.
14
+
15
+ This class encapsulates all parameters for the API request.
16
+ """
17
+
18
+ def __init__(
19
+ self, execution, action, parameters=None, target_selector_type=None, targets=None, target_selector=None
20
+ ):
21
+ """
22
+ Initialize CreateActionRequest request entity.
23
+
24
+ :param execution: 执行动作。SAVE(仅保存),RUN(仅执行),SAVE_AND_RUN(保存并执行)
25
+ :type execution: str (required)
26
+
27
+ :param action: action parameter
28
+ :type action: Action (required)
29
+
30
+ :param parameters: 执行命令时的参数值,仅在命令有参数且需要执行时需要
31
+ :type parameters: object (optional)
32
+
33
+ :param target_selector_type: target_selector_type parameter
34
+ :type target_selector_type: str (optional)
35
+
36
+ :param targets: 实例ID列表,仅在targetSelectorType为INSTANCES_LIST时需要
37
+ :type targets: List[Target] (optional)
38
+
39
+ :param target_selector: target_selector parameter
40
+ :type target_selector: TargetSelector (optional)
41
+ """
42
+ super().__init__()
43
+ self.execution = execution
44
+ self.action = action
45
+ self.parameters = parameters
46
+ self.target_selector_type = target_selector_type
47
+ self.targets = targets
48
+ self.target_selector = target_selector
49
+
50
+ def to_dict(self):
51
+ """
52
+ Convert the request entity to a dictionary representation.
53
+
54
+ Nested model objects are recursively converted to dictionaries.
55
+
56
+ :return: Dictionary representation of the request
57
+ :rtype: dict
58
+ """
59
+ _map = super().to_dict()
60
+ if _map is not None:
61
+ return _map
62
+ result = dict()
63
+ if self.execution is not None:
64
+ result['execution'] = self.execution
65
+ if self.action is not None:
66
+ result['action'] = self.action.to_dict()
67
+ if self.parameters is not None:
68
+ result['parameters'] = self.parameters
69
+ if self.target_selector_type is not None:
70
+ result['targetSelectorType'] = self.target_selector_type
71
+ if self.targets is not None:
72
+ result['targets'] = [i.to_dict() for i in self.targets]
73
+ if self.target_selector is not None:
74
+ result['targetSelector'] = self.target_selector.to_dict()
75
+ return result
76
+
77
+ def from_dict(self, m):
78
+ """
79
+ Populate the request entity from a dictionary.
80
+
81
+ Nested dictionaries are recursively converted to model objects.
82
+
83
+ :param m: Dictionary containing request data
84
+ :type m: dict
85
+
86
+ :return: Self reference for method chaining
87
+ :rtype: CreateActionRequest
88
+
89
+ :raises TypeError: If input is not a dictionary or field type mismatch
90
+ :raises ValueError: If nested model conversion fails
91
+ """
92
+ m = m or dict()
93
+ if m.get('execution') is not None:
94
+ self.execution = m.get('execution')
95
+ if m.get('action') is not None:
96
+ self.action = Action().from_dict(m.get('action'))
97
+ if m.get('parameters') is not None:
98
+ self.parameters = m.get('parameters')
99
+ if m.get('targetSelectorType') is not None:
100
+ self.target_selector_type = m.get('targetSelectorType')
101
+ if m.get('targets') is not None:
102
+ self.targets = [Target().from_dict(i) for i in m.get('targets')]
103
+ if m.get('targetSelector') is not None:
104
+ self.target_selector = TargetSelector().from_dict(m.get('targetSelector'))
105
+ return self