baiducloud-python-sdk-as 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_as/__init__.py +5 -0
- baiducloud_python_sdk_as/api/__init__.py +0 -0
- baiducloud_python_sdk_as/api/as_client.py +626 -0
- baiducloud_python_sdk_as/models/__init__.py +78 -0
- baiducloud_python_sdk_as/models/action_type.py +20 -0
- baiducloud_python_sdk_as/models/adjust_num_v2_request.py +72 -0
- baiducloud_python_sdk_as/models/adjust_num_v2_response.py +80 -0
- baiducloud_python_sdk_as/models/alarm_rule.py +135 -0
- baiducloud_python_sdk_as/models/as_alarm_rule.py +189 -0
- baiducloud_python_sdk_as/models/as_eip.py +90 -0
- baiducloud_python_sdk_as/models/as_group.py +186 -0
- baiducloud_python_sdk_as/models/as_record.py +202 -0
- baiducloud_python_sdk_as/models/assign_tag_info.py +76 -0
- baiducloud_python_sdk_as/models/attach_node_v2_request.py +72 -0
- baiducloud_python_sdk_as/models/attach_node_v2_response.py +78 -0
- baiducloud_python_sdk_as/models/bcc_name_config.py +82 -0
- baiducloud_python_sdk_as/models/billing_info.py +68 -0
- baiducloud_python_sdk_as/models/blb_info.py +82 -0
- baiducloud_python_sdk_as/models/cds_info.py +82 -0
- baiducloud_python_sdk_as/models/check_detail.py +74 -0
- baiducloud_python_sdk_as/models/check_entity.py +76 -0
- baiducloud_python_sdk_as/models/cmd_config.py +142 -0
- baiducloud_python_sdk_as/models/create_as_group_v2_request.py +245 -0
- baiducloud_python_sdk_as/models/create_as_group_v2_response.py +69 -0
- baiducloud_python_sdk_as/models/create_rule_v2_request.py +172 -0
- baiducloud_python_sdk_as/models/create_rule_v2_response.py +61 -0
- baiducloud_python_sdk_as/models/dag_model.py +58 -0
- baiducloud_python_sdk_as/models/delete_as_group_v2_request.py +60 -0
- baiducloud_python_sdk_as/models/delete_rule_v2_request.py +58 -0
- baiducloud_python_sdk_as/models/detach_node_v2_request.py +72 -0
- baiducloud_python_sdk_as/models/detach_node_v2_response.py +78 -0
- baiducloud_python_sdk_as/models/dimension.py +66 -0
- baiducloud_python_sdk_as/models/eip_config.py +112 -0
- baiducloud_python_sdk_as/models/eip_group_bandwidth.py +74 -0
- baiducloud_python_sdk_as/models/eip_group_decrease.py +58 -0
- baiducloud_python_sdk_as/models/eip_group_increase.py +66 -0
- baiducloud_python_sdk_as/models/eip_info.py +82 -0
- baiducloud_python_sdk_as/models/ephemeral_disk.py +66 -0
- baiducloud_python_sdk_as/models/exec_cmd_strategy_type.py +19 -0
- baiducloud_python_sdk_as/models/exec_rule_v2_request.py +72 -0
- baiducloud_python_sdk_as/models/exec_rule_v2_response.py +80 -0
- baiducloud_python_sdk_as/models/expect_action.py +74 -0
- baiducloud_python_sdk_as/models/get_as_group_v2_request.py +58 -0
- baiducloud_python_sdk_as/models/get_as_group_v2_response.py +279 -0
- baiducloud_python_sdk_as/models/get_rule_v2_request.py +58 -0
- baiducloud_python_sdk_as/models/get_rule_v2_response.py +218 -0
- baiducloud_python_sdk_as/models/group_config.py +90 -0
- baiducloud_python_sdk_as/models/health_check_config.py +66 -0
- baiducloud_python_sdk_as/models/health_check_state.py +102 -0
- baiducloud_python_sdk_as/models/list_as_group_v2_request.py +96 -0
- baiducloud_python_sdk_as/models/list_as_group_v2_response.py +102 -0
- baiducloud_python_sdk_as/models/list_as_node_v2_request.py +94 -0
- baiducloud_python_sdk_as/models/list_as_node_v2_response.py +102 -0
- baiducloud_python_sdk_as/models/list_rule_v2_request.py +94 -0
- baiducloud_python_sdk_as/models/list_rule_v2_response.py +102 -0
- baiducloud_python_sdk_as/models/list_task_v2_request.py +94 -0
- baiducloud_python_sdk_as/models/list_task_v2_response.py +102 -0
- baiducloud_python_sdk_as/models/monitor_object.py +84 -0
- baiducloud_python_sdk_as/models/node.py +245 -0
- baiducloud_python_sdk_as/models/node_info.py +373 -0
- baiducloud_python_sdk_as/models/period_type.py +21 -0
- baiducloud_python_sdk_as/models/policy_resource.py +70 -0
- baiducloud_python_sdk_as/models/reservation.py +58 -0
- baiducloud_python_sdk_as/models/resource.py +66 -0
- baiducloud_python_sdk_as/models/rule.py +216 -0
- baiducloud_python_sdk_as/models/scale_condition.py +160 -0
- baiducloud_python_sdk_as/models/scaling_down_v2_request.py +72 -0
- baiducloud_python_sdk_as/models/scaling_down_v2_response.py +78 -0
- baiducloud_python_sdk_as/models/scaling_up_v2_request.py +88 -0
- baiducloud_python_sdk_as/models/scaling_up_v2_response.py +80 -0
- baiducloud_python_sdk_as/models/state.py +19 -0
- baiducloud_python_sdk_as/models/status.py +41 -0
- baiducloud_python_sdk_as/models/tag_info.py +66 -0
- baiducloud_python_sdk_as/models/type.py +20 -0
- baiducloud_python_sdk_as/models/update_is_managed_v2_request.py +80 -0
- baiducloud_python_sdk_as/models/update_protect_v2_request.py +80 -0
- baiducloud_python_sdk_as/models/vpc_info.py +74 -0
- baiducloud_python_sdk_as/models/zone_info.py +100 -0
- baiducloud_python_sdk_as-0.0.1.dist-info/LICENSE +177 -0
- baiducloud_python_sdk_as-0.0.1.dist-info/METADATA +76 -0
- baiducloud_python_sdk_as-0.0.1.dist-info/RECORD +83 -0
- baiducloud_python_sdk_as-0.0.1.dist-info/WHEEL +5 -0
- baiducloud_python_sdk_as-0.0.1.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"""
|
|
2
|
+
PeriodType information
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class PeriodType:
|
|
7
|
+
"""
|
|
8
|
+
Enum class for PeriodType
|
|
9
|
+
Allowed values: DAY, WEEK, MONTH, CRONEXPRESSION
|
|
10
|
+
"""
|
|
11
|
+
|
|
12
|
+
DAY = 'DAY'
|
|
13
|
+
WEEK = 'WEEK'
|
|
14
|
+
MONTH = 'MONTH'
|
|
15
|
+
CRONEXPRESSION = 'CronExpression'
|
|
16
|
+
|
|
17
|
+
@staticmethod
|
|
18
|
+
def is_valid(value):
|
|
19
|
+
"""Check if the value is valid for this enum"""
|
|
20
|
+
valid_values = ['DAY', 'WEEK', 'MONTH', 'CronExpression']
|
|
21
|
+
return value in valid_values
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"""
|
|
2
|
+
PolicyResource information
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
from baiducloud_python_sdk_core.abstract_model import AbstractModel
|
|
6
|
+
|
|
7
|
+
from baiducloud_python_sdk_as.models.dimension import Dimension
|
|
8
|
+
|
|
9
|
+
from baiducloud_python_sdk_as.models.dimension import Dimension
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class PolicyResource(AbstractModel):
|
|
13
|
+
"""
|
|
14
|
+
PolicyResource
|
|
15
|
+
"""
|
|
16
|
+
|
|
17
|
+
def __init__(self, identifiers=None, metric_dimensions=None):
|
|
18
|
+
"""
|
|
19
|
+
Initialize PolicyResource instance.
|
|
20
|
+
|
|
21
|
+
:param identifiers: 实例维度
|
|
22
|
+
:type identifiers: List[Dimension] (optional)
|
|
23
|
+
|
|
24
|
+
:param metric_dimensions: 指标维度
|
|
25
|
+
:type metric_dimensions: List[Dimension] (optional)
|
|
26
|
+
"""
|
|
27
|
+
super().__init__()
|
|
28
|
+
self.identifiers = identifiers
|
|
29
|
+
self.metric_dimensions = metric_dimensions
|
|
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.identifiers is not None:
|
|
45
|
+
result['identifiers'] = [i.to_dict() for i in self.identifiers]
|
|
46
|
+
if self.metric_dimensions is not None:
|
|
47
|
+
result['metricDimensions'] = [i.to_dict() for i in self.metric_dimensions]
|
|
48
|
+
return result
|
|
49
|
+
|
|
50
|
+
def from_dict(self, m):
|
|
51
|
+
"""
|
|
52
|
+
Populate the model instance from a dictionary.
|
|
53
|
+
|
|
54
|
+
Nested dictionaries are recursively converted to model objects.
|
|
55
|
+
|
|
56
|
+
:param m: Dictionary containing model data
|
|
57
|
+
:type m: dict
|
|
58
|
+
|
|
59
|
+
:return: Self reference for method chaining
|
|
60
|
+
:rtype: PolicyResource
|
|
61
|
+
|
|
62
|
+
:raises TypeError: If input is not a dictionary type
|
|
63
|
+
:raises ValueError: If nested model conversion fails
|
|
64
|
+
"""
|
|
65
|
+
m = m or dict()
|
|
66
|
+
if m.get('identifiers') is not None:
|
|
67
|
+
self.identifiers = [Dimension().from_dict(i) for i in m.get('identifiers')]
|
|
68
|
+
if m.get('metricDimensions') is not None:
|
|
69
|
+
self.metric_dimensions = [Dimension().from_dict(i) for i in m.get('metricDimensions')]
|
|
70
|
+
return self
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Reservation information
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
from baiducloud_python_sdk_core.abstract_model import AbstractModel
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class Reservation(AbstractModel):
|
|
9
|
+
"""
|
|
10
|
+
Reservation
|
|
11
|
+
"""
|
|
12
|
+
|
|
13
|
+
def __init__(self, reservation_length_in_month=None):
|
|
14
|
+
"""
|
|
15
|
+
Initialize Reservation instance.
|
|
16
|
+
|
|
17
|
+
:param reservation_length_in_month: 时长,[1,2,3,4,5,6,7,8,9,12,24,36]
|
|
18
|
+
:type reservation_length_in_month: int (optional)
|
|
19
|
+
"""
|
|
20
|
+
super().__init__()
|
|
21
|
+
self.reservation_length_in_month = reservation_length_in_month
|
|
22
|
+
|
|
23
|
+
def to_dict(self):
|
|
24
|
+
"""
|
|
25
|
+
Convert the model instance to a dictionary representation.
|
|
26
|
+
|
|
27
|
+
Nested model objects are recursively converted to dictionaries.
|
|
28
|
+
|
|
29
|
+
:return: Dictionary representation of the model
|
|
30
|
+
:rtype: dict
|
|
31
|
+
"""
|
|
32
|
+
_map = super().to_dict()
|
|
33
|
+
if _map is not None:
|
|
34
|
+
return _map
|
|
35
|
+
result = dict()
|
|
36
|
+
if self.reservation_length_in_month is not None:
|
|
37
|
+
result['reservationLengthInMonth'] = self.reservation_length_in_month
|
|
38
|
+
return result
|
|
39
|
+
|
|
40
|
+
def from_dict(self, m):
|
|
41
|
+
"""
|
|
42
|
+
Populate the model instance from a dictionary.
|
|
43
|
+
|
|
44
|
+
Nested dictionaries are recursively converted to model objects.
|
|
45
|
+
|
|
46
|
+
:param m: Dictionary containing model data
|
|
47
|
+
:type m: dict
|
|
48
|
+
|
|
49
|
+
:return: Self reference for method chaining
|
|
50
|
+
:rtype: Reservation
|
|
51
|
+
|
|
52
|
+
:raises TypeError: If input is not a dictionary type
|
|
53
|
+
:raises ValueError: If nested model conversion fails
|
|
54
|
+
"""
|
|
55
|
+
m = m or dict()
|
|
56
|
+
if m.get('reservationLengthInMonth') is not None:
|
|
57
|
+
self.reservation_length_in_month = m.get('reservationLengthInMonth')
|
|
58
|
+
return self
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Resource information
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
from baiducloud_python_sdk_core.abstract_model import AbstractModel
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class Resource(AbstractModel):
|
|
9
|
+
"""
|
|
10
|
+
Resource
|
|
11
|
+
"""
|
|
12
|
+
|
|
13
|
+
def __init__(self, type=None, id=None):
|
|
14
|
+
"""
|
|
15
|
+
Initialize Resource instance.
|
|
16
|
+
|
|
17
|
+
:param type: 资源类型
|
|
18
|
+
:type type: str (optional)
|
|
19
|
+
|
|
20
|
+
:param id: 资源标识,结构由资源类型决定
|
|
21
|
+
:type id: object (optional)
|
|
22
|
+
"""
|
|
23
|
+
super().__init__()
|
|
24
|
+
self.type = type
|
|
25
|
+
self.id = id
|
|
26
|
+
|
|
27
|
+
def to_dict(self):
|
|
28
|
+
"""
|
|
29
|
+
Convert the model instance to a dictionary representation.
|
|
30
|
+
|
|
31
|
+
Nested model objects are recursively converted to dictionaries.
|
|
32
|
+
|
|
33
|
+
:return: Dictionary representation of the model
|
|
34
|
+
:rtype: dict
|
|
35
|
+
"""
|
|
36
|
+
_map = super().to_dict()
|
|
37
|
+
if _map is not None:
|
|
38
|
+
return _map
|
|
39
|
+
result = dict()
|
|
40
|
+
if self.type is not None:
|
|
41
|
+
result['type'] = self.type
|
|
42
|
+
if self.id is not None:
|
|
43
|
+
result['id'] = self.id
|
|
44
|
+
return result
|
|
45
|
+
|
|
46
|
+
def from_dict(self, m):
|
|
47
|
+
"""
|
|
48
|
+
Populate the model instance from a dictionary.
|
|
49
|
+
|
|
50
|
+
Nested dictionaries are recursively converted to model objects.
|
|
51
|
+
|
|
52
|
+
:param m: Dictionary containing model data
|
|
53
|
+
:type m: dict
|
|
54
|
+
|
|
55
|
+
:return: Self reference for method chaining
|
|
56
|
+
:rtype: Resource
|
|
57
|
+
|
|
58
|
+
:raises TypeError: If input is not a dictionary type
|
|
59
|
+
:raises ValueError: If nested model conversion fails
|
|
60
|
+
"""
|
|
61
|
+
m = m or dict()
|
|
62
|
+
if m.get('type') is not None:
|
|
63
|
+
self.type = m.get('type')
|
|
64
|
+
if m.get('id') is not None:
|
|
65
|
+
self.id = m.get('id')
|
|
66
|
+
return self
|
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Rule information
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
from baiducloud_python_sdk_core.abstract_model import AbstractModel
|
|
6
|
+
|
|
7
|
+
from baiducloud_python_sdk_as.models.as_alarm_rule import AsAlarmRule
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class Rule(AbstractModel):
|
|
11
|
+
"""
|
|
12
|
+
Rule
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
def __init__(
|
|
16
|
+
self,
|
|
17
|
+
rule_id=None,
|
|
18
|
+
rule_name=None,
|
|
19
|
+
group_id=None,
|
|
20
|
+
account_id=None,
|
|
21
|
+
state=None,
|
|
22
|
+
type=None,
|
|
23
|
+
cron_time=None,
|
|
24
|
+
action_type=None,
|
|
25
|
+
action_num=None,
|
|
26
|
+
cooldown_in_sec=None,
|
|
27
|
+
create_time=None,
|
|
28
|
+
last_execution_time=None,
|
|
29
|
+
last_schedule_time=None,
|
|
30
|
+
period_start_time=None,
|
|
31
|
+
period_end_time=None,
|
|
32
|
+
period_type=None,
|
|
33
|
+
period_value=None,
|
|
34
|
+
as_alarm_rule=None,
|
|
35
|
+
):
|
|
36
|
+
"""
|
|
37
|
+
Initialize Rule instance.
|
|
38
|
+
|
|
39
|
+
:param rule_id: 规则ID
|
|
40
|
+
:type rule_id: str (optional)
|
|
41
|
+
|
|
42
|
+
:param rule_name: 规则名称
|
|
43
|
+
:type rule_name: str (optional)
|
|
44
|
+
|
|
45
|
+
:param group_id: 伸缩组ID
|
|
46
|
+
:type group_id: str (optional)
|
|
47
|
+
|
|
48
|
+
:param account_id: 用户ID
|
|
49
|
+
:type account_id: str (optional)
|
|
50
|
+
|
|
51
|
+
:param state: 规则的状态
|
|
52
|
+
:type state: str (optional)
|
|
53
|
+
|
|
54
|
+
:param type: 规则的类型
|
|
55
|
+
:type type: str (optional)
|
|
56
|
+
|
|
57
|
+
:param cron_time: 定时规则或周期规则:当日执行时间。如12:30。
|
|
58
|
+
:type cron_time: str (optional)
|
|
59
|
+
|
|
60
|
+
:param action_type: 动作类型。包括:INCREASE(扩容),DECREASE(缩容),ADJUST(调整至)
|
|
61
|
+
:type action_type: str (optional)
|
|
62
|
+
|
|
63
|
+
:param action_num: 动作数量
|
|
64
|
+
:type action_num: int (optional)
|
|
65
|
+
|
|
66
|
+
:param cooldown_in_sec: 冷却时间(秒)
|
|
67
|
+
:type cooldown_in_sec: int (optional)
|
|
68
|
+
|
|
69
|
+
:param create_time: 规则创建时间
|
|
70
|
+
:type create_time: str (optional)
|
|
71
|
+
|
|
72
|
+
:param last_execution_time: 规则最后修改时间
|
|
73
|
+
:type last_execution_time: str (optional)
|
|
74
|
+
|
|
75
|
+
:param last_schedule_time: 规则最后执行时间
|
|
76
|
+
:type last_schedule_time: str (optional)
|
|
77
|
+
|
|
78
|
+
:param period_start_time: 周期规则:周期有效期开始时间。如:2023-12-10T12:00:00Z
|
|
79
|
+
:type period_start_time: str (optional)
|
|
80
|
+
|
|
81
|
+
:param period_end_time: 周期规则:周期有效期结束时间。如:2023-12-11T12:00:00Z
|
|
82
|
+
:type period_end_time: str (optional)
|
|
83
|
+
|
|
84
|
+
:param period_type: 周期规则:周期单位,可选值为DAY/WEEK/MONTH/CronExpression
|
|
85
|
+
:type period_type: str (optional)
|
|
86
|
+
|
|
87
|
+
:param period_value: 周期规则:周期触发日期,1-7标识周1-周日,1-31表示1号到31号,与periodType相关
|
|
88
|
+
:type period_value: int (optional)
|
|
89
|
+
|
|
90
|
+
:param as_alarm_rule: as_alarm_rule attribute
|
|
91
|
+
:type as_alarm_rule: AsAlarmRule (optional)
|
|
92
|
+
"""
|
|
93
|
+
super().__init__()
|
|
94
|
+
self.rule_id = rule_id
|
|
95
|
+
self.rule_name = rule_name
|
|
96
|
+
self.group_id = group_id
|
|
97
|
+
self.account_id = account_id
|
|
98
|
+
self.state = state
|
|
99
|
+
self.type = type
|
|
100
|
+
self.cron_time = cron_time
|
|
101
|
+
self.action_type = action_type
|
|
102
|
+
self.action_num = action_num
|
|
103
|
+
self.cooldown_in_sec = cooldown_in_sec
|
|
104
|
+
self.create_time = create_time
|
|
105
|
+
self.last_execution_time = last_execution_time
|
|
106
|
+
self.last_schedule_time = last_schedule_time
|
|
107
|
+
self.period_start_time = period_start_time
|
|
108
|
+
self.period_end_time = period_end_time
|
|
109
|
+
self.period_type = period_type
|
|
110
|
+
self.period_value = period_value
|
|
111
|
+
self.as_alarm_rule = as_alarm_rule
|
|
112
|
+
|
|
113
|
+
def to_dict(self):
|
|
114
|
+
"""
|
|
115
|
+
Convert the model instance to a dictionary representation.
|
|
116
|
+
|
|
117
|
+
Nested model objects are recursively converted to dictionaries.
|
|
118
|
+
|
|
119
|
+
:return: Dictionary representation of the model
|
|
120
|
+
:rtype: dict
|
|
121
|
+
"""
|
|
122
|
+
_map = super().to_dict()
|
|
123
|
+
if _map is not None:
|
|
124
|
+
return _map
|
|
125
|
+
result = dict()
|
|
126
|
+
if self.rule_id is not None:
|
|
127
|
+
result['ruleId'] = self.rule_id
|
|
128
|
+
if self.rule_name is not None:
|
|
129
|
+
result['ruleName'] = self.rule_name
|
|
130
|
+
if self.group_id is not None:
|
|
131
|
+
result['groupId'] = self.group_id
|
|
132
|
+
if self.account_id is not None:
|
|
133
|
+
result['accountId'] = self.account_id
|
|
134
|
+
if self.state is not None:
|
|
135
|
+
result['state'] = self.state
|
|
136
|
+
if self.type is not None:
|
|
137
|
+
result['type'] = self.type
|
|
138
|
+
if self.cron_time is not None:
|
|
139
|
+
result['cronTime'] = self.cron_time
|
|
140
|
+
if self.action_type is not None:
|
|
141
|
+
result['actionType'] = self.action_type
|
|
142
|
+
if self.action_num is not None:
|
|
143
|
+
result['actionNum'] = self.action_num
|
|
144
|
+
if self.cooldown_in_sec is not None:
|
|
145
|
+
result['cooldownInSec'] = self.cooldown_in_sec
|
|
146
|
+
if self.create_time is not None:
|
|
147
|
+
result['createTime'] = self.create_time
|
|
148
|
+
if self.last_execution_time is not None:
|
|
149
|
+
result['lastExecutionTime'] = self.last_execution_time
|
|
150
|
+
if self.last_schedule_time is not None:
|
|
151
|
+
result['lastScheduleTime'] = self.last_schedule_time
|
|
152
|
+
if self.period_start_time is not None:
|
|
153
|
+
result['periodStartTime'] = self.period_start_time
|
|
154
|
+
if self.period_end_time is not None:
|
|
155
|
+
result['periodEndTime'] = self.period_end_time
|
|
156
|
+
if self.period_type is not None:
|
|
157
|
+
result['periodType'] = self.period_type
|
|
158
|
+
if self.period_value is not None:
|
|
159
|
+
result['periodValue'] = self.period_value
|
|
160
|
+
if self.as_alarm_rule is not None:
|
|
161
|
+
result['asAlarmRule'] = self.as_alarm_rule.to_dict()
|
|
162
|
+
return result
|
|
163
|
+
|
|
164
|
+
def from_dict(self, m):
|
|
165
|
+
"""
|
|
166
|
+
Populate the model instance from a dictionary.
|
|
167
|
+
|
|
168
|
+
Nested dictionaries are recursively converted to model objects.
|
|
169
|
+
|
|
170
|
+
:param m: Dictionary containing model data
|
|
171
|
+
:type m: dict
|
|
172
|
+
|
|
173
|
+
:return: Self reference for method chaining
|
|
174
|
+
:rtype: Rule
|
|
175
|
+
|
|
176
|
+
:raises TypeError: If input is not a dictionary type
|
|
177
|
+
:raises ValueError: If nested model conversion fails
|
|
178
|
+
"""
|
|
179
|
+
m = m or dict()
|
|
180
|
+
if m.get('ruleId') is not None:
|
|
181
|
+
self.rule_id = m.get('ruleId')
|
|
182
|
+
if m.get('ruleName') is not None:
|
|
183
|
+
self.rule_name = m.get('ruleName')
|
|
184
|
+
if m.get('groupId') is not None:
|
|
185
|
+
self.group_id = m.get('groupId')
|
|
186
|
+
if m.get('accountId') is not None:
|
|
187
|
+
self.account_id = m.get('accountId')
|
|
188
|
+
if m.get('state') is not None:
|
|
189
|
+
self.state = m.get('state')
|
|
190
|
+
if m.get('type') is not None:
|
|
191
|
+
self.type = m.get('type')
|
|
192
|
+
if m.get('cronTime') is not None:
|
|
193
|
+
self.cron_time = m.get('cronTime')
|
|
194
|
+
if m.get('actionType') is not None:
|
|
195
|
+
self.action_type = m.get('actionType')
|
|
196
|
+
if m.get('actionNum') is not None:
|
|
197
|
+
self.action_num = m.get('actionNum')
|
|
198
|
+
if m.get('cooldownInSec') is not None:
|
|
199
|
+
self.cooldown_in_sec = m.get('cooldownInSec')
|
|
200
|
+
if m.get('createTime') is not None:
|
|
201
|
+
self.create_time = m.get('createTime')
|
|
202
|
+
if m.get('lastExecutionTime') is not None:
|
|
203
|
+
self.last_execution_time = m.get('lastExecutionTime')
|
|
204
|
+
if m.get('lastScheduleTime') is not None:
|
|
205
|
+
self.last_schedule_time = m.get('lastScheduleTime')
|
|
206
|
+
if m.get('periodStartTime') is not None:
|
|
207
|
+
self.period_start_time = m.get('periodStartTime')
|
|
208
|
+
if m.get('periodEndTime') is not None:
|
|
209
|
+
self.period_end_time = m.get('periodEndTime')
|
|
210
|
+
if m.get('periodType') is not None:
|
|
211
|
+
self.period_type = m.get('periodType')
|
|
212
|
+
if m.get('periodValue') is not None:
|
|
213
|
+
self.period_value = m.get('periodValue')
|
|
214
|
+
if m.get('asAlarmRule') is not None:
|
|
215
|
+
self.as_alarm_rule = AsAlarmRule().from_dict(m.get('asAlarmRule'))
|
|
216
|
+
return self
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
"""
|
|
2
|
+
ScaleCondition information
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
from baiducloud_python_sdk_core.abstract_model import AbstractModel
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class ScaleCondition(AbstractModel):
|
|
9
|
+
"""
|
|
10
|
+
ScaleCondition
|
|
11
|
+
"""
|
|
12
|
+
|
|
13
|
+
def __init__(
|
|
14
|
+
self,
|
|
15
|
+
target_type=None,
|
|
16
|
+
target_id=None,
|
|
17
|
+
indicator=None,
|
|
18
|
+
threshold=None,
|
|
19
|
+
unit=None,
|
|
20
|
+
comparison_operator=None,
|
|
21
|
+
cron_time=None,
|
|
22
|
+
trigger_time=None,
|
|
23
|
+
type=None,
|
|
24
|
+
period_type=None,
|
|
25
|
+
period_value=None,
|
|
26
|
+
alarm_rule=None,
|
|
27
|
+
):
|
|
28
|
+
"""
|
|
29
|
+
Initialize ScaleCondition instance.
|
|
30
|
+
|
|
31
|
+
:param target_type: 指标类型,如伸缩组指标为ASG
|
|
32
|
+
:type target_type: str (optional)
|
|
33
|
+
|
|
34
|
+
:param target_id: 报警监控实例,如伸缩组ID:asg-CClxxxxx
|
|
35
|
+
:type target_id: str (optional)
|
|
36
|
+
|
|
37
|
+
:param indicator: 监控指标。如伸缩组CPU使用率均值为CPUUsagePercent_Average
|
|
38
|
+
:type indicator: str (optional)
|
|
39
|
+
|
|
40
|
+
:param threshold: 阈值
|
|
41
|
+
:type threshold: str (optional)
|
|
42
|
+
|
|
43
|
+
:param unit: 单位
|
|
44
|
+
:type unit: str (optional)
|
|
45
|
+
|
|
46
|
+
:param comparison_operator: 比较运算符,支持'>','<','='
|
|
47
|
+
:type comparison_operator: str (optional)
|
|
48
|
+
|
|
49
|
+
:param cron_time: 定时规则或周期规则:当日执行时间。如12:30
|
|
50
|
+
:type cron_time: str (optional)
|
|
51
|
+
|
|
52
|
+
:param trigger_time: 不重复触发时间
|
|
53
|
+
:type trigger_time: str (optional)
|
|
54
|
+
|
|
55
|
+
:param type: 包括:CRONTAB(定时伸缩),ALARM(报警触发伸缩),PERIOD(周期伸缩)
|
|
56
|
+
:type type: str (optional)
|
|
57
|
+
|
|
58
|
+
:param period_type: 周期单位,可选值为DAY/WEEK/MONTH/CronExpression
|
|
59
|
+
:type period_type: str (optional)
|
|
60
|
+
|
|
61
|
+
:param period_value: 周期触发日期,1-7标识周1-周日,1-31表示1号到31号,与periodType相关
|
|
62
|
+
:type period_value: int (optional)
|
|
63
|
+
|
|
64
|
+
:param alarm_rule: 报警类规则
|
|
65
|
+
:type alarm_rule: str (optional)
|
|
66
|
+
"""
|
|
67
|
+
super().__init__()
|
|
68
|
+
self.target_type = target_type
|
|
69
|
+
self.target_id = target_id
|
|
70
|
+
self.indicator = indicator
|
|
71
|
+
self.threshold = threshold
|
|
72
|
+
self.unit = unit
|
|
73
|
+
self.comparison_operator = comparison_operator
|
|
74
|
+
self.cron_time = cron_time
|
|
75
|
+
self.trigger_time = trigger_time
|
|
76
|
+
self.type = type
|
|
77
|
+
self.period_type = period_type
|
|
78
|
+
self.period_value = period_value
|
|
79
|
+
self.alarm_rule = alarm_rule
|
|
80
|
+
|
|
81
|
+
def to_dict(self):
|
|
82
|
+
"""
|
|
83
|
+
Convert the model instance to a dictionary representation.
|
|
84
|
+
|
|
85
|
+
Nested model objects are recursively converted to dictionaries.
|
|
86
|
+
|
|
87
|
+
:return: Dictionary representation of the model
|
|
88
|
+
:rtype: dict
|
|
89
|
+
"""
|
|
90
|
+
_map = super().to_dict()
|
|
91
|
+
if _map is not None:
|
|
92
|
+
return _map
|
|
93
|
+
result = dict()
|
|
94
|
+
if self.target_type is not None:
|
|
95
|
+
result['targetType'] = self.target_type
|
|
96
|
+
if self.target_id is not None:
|
|
97
|
+
result['targetId'] = self.target_id
|
|
98
|
+
if self.indicator is not None:
|
|
99
|
+
result['indicator'] = self.indicator
|
|
100
|
+
if self.threshold is not None:
|
|
101
|
+
result['threshold'] = self.threshold
|
|
102
|
+
if self.unit is not None:
|
|
103
|
+
result['unit'] = self.unit
|
|
104
|
+
if self.comparison_operator is not None:
|
|
105
|
+
result['comparisonOperator'] = self.comparison_operator
|
|
106
|
+
if self.cron_time is not None:
|
|
107
|
+
result['cronTime'] = self.cron_time
|
|
108
|
+
if self.trigger_time is not None:
|
|
109
|
+
result['triggerTime'] = self.trigger_time
|
|
110
|
+
if self.type is not None:
|
|
111
|
+
result['type'] = self.type
|
|
112
|
+
if self.period_type is not None:
|
|
113
|
+
result['periodType'] = self.period_type
|
|
114
|
+
if self.period_value is not None:
|
|
115
|
+
result['periodValue'] = self.period_value
|
|
116
|
+
if self.alarm_rule is not None:
|
|
117
|
+
result['alarmRule'] = self.alarm_rule
|
|
118
|
+
return result
|
|
119
|
+
|
|
120
|
+
def from_dict(self, m):
|
|
121
|
+
"""
|
|
122
|
+
Populate the model instance from a dictionary.
|
|
123
|
+
|
|
124
|
+
Nested dictionaries are recursively converted to model objects.
|
|
125
|
+
|
|
126
|
+
:param m: Dictionary containing model data
|
|
127
|
+
:type m: dict
|
|
128
|
+
|
|
129
|
+
:return: Self reference for method chaining
|
|
130
|
+
:rtype: ScaleCondition
|
|
131
|
+
|
|
132
|
+
:raises TypeError: If input is not a dictionary type
|
|
133
|
+
:raises ValueError: If nested model conversion fails
|
|
134
|
+
"""
|
|
135
|
+
m = m or dict()
|
|
136
|
+
if m.get('targetType') is not None:
|
|
137
|
+
self.target_type = m.get('targetType')
|
|
138
|
+
if m.get('targetId') is not None:
|
|
139
|
+
self.target_id = m.get('targetId')
|
|
140
|
+
if m.get('indicator') is not None:
|
|
141
|
+
self.indicator = m.get('indicator')
|
|
142
|
+
if m.get('threshold') is not None:
|
|
143
|
+
self.threshold = m.get('threshold')
|
|
144
|
+
if m.get('unit') is not None:
|
|
145
|
+
self.unit = m.get('unit')
|
|
146
|
+
if m.get('comparisonOperator') is not None:
|
|
147
|
+
self.comparison_operator = m.get('comparisonOperator')
|
|
148
|
+
if m.get('cronTime') is not None:
|
|
149
|
+
self.cron_time = m.get('cronTime')
|
|
150
|
+
if m.get('triggerTime') is not None:
|
|
151
|
+
self.trigger_time = m.get('triggerTime')
|
|
152
|
+
if m.get('type') is not None:
|
|
153
|
+
self.type = m.get('type')
|
|
154
|
+
if m.get('periodType') is not None:
|
|
155
|
+
self.period_type = m.get('periodType')
|
|
156
|
+
if m.get('periodValue') is not None:
|
|
157
|
+
self.period_value = m.get('periodValue')
|
|
158
|
+
if m.get('alarmRule') is not None:
|
|
159
|
+
self.alarm_rule = m.get('alarmRule')
|
|
160
|
+
return self
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Request entity for ScalingDownV2Request information.
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
from baiducloud_python_sdk_core.abstract_model import AbstractModel
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class ScalingDownV2Request(AbstractModel):
|
|
9
|
+
"""
|
|
10
|
+
Request entity for ScalingDownV2Request operation.
|
|
11
|
+
|
|
12
|
+
This class encapsulates all parameters for the API request.
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
def __init__(self, group_id, scaling_down, nodes):
|
|
16
|
+
"""
|
|
17
|
+
Initialize ScalingDownV2Request request entity.
|
|
18
|
+
|
|
19
|
+
:param group_id: group_id parameter
|
|
20
|
+
:type group_id: str (required)
|
|
21
|
+
|
|
22
|
+
:param scaling_down: scaling_down parameter
|
|
23
|
+
:type scaling_down: str (required)
|
|
24
|
+
|
|
25
|
+
:param nodes: 期望缩容的节点列表
|
|
26
|
+
:type nodes: List[str] (required)
|
|
27
|
+
"""
|
|
28
|
+
super().__init__()
|
|
29
|
+
self.group_id = group_id
|
|
30
|
+
self.scaling_down = scaling_down
|
|
31
|
+
self.nodes = nodes
|
|
32
|
+
|
|
33
|
+
def to_dict(self):
|
|
34
|
+
"""
|
|
35
|
+
Convert the request entity to a dictionary representation.
|
|
36
|
+
|
|
37
|
+
Nested model objects are recursively converted to dictionaries.
|
|
38
|
+
|
|
39
|
+
:return: Dictionary representation of the request
|
|
40
|
+
:rtype: dict
|
|
41
|
+
"""
|
|
42
|
+
_map = super().to_dict()
|
|
43
|
+
if _map is not None:
|
|
44
|
+
return _map
|
|
45
|
+
result = dict()
|
|
46
|
+
if self.nodes is not None:
|
|
47
|
+
result['nodes'] = self.nodes
|
|
48
|
+
return result
|
|
49
|
+
|
|
50
|
+
def from_dict(self, m):
|
|
51
|
+
"""
|
|
52
|
+
Populate the request entity from a dictionary.
|
|
53
|
+
|
|
54
|
+
Nested dictionaries are recursively converted to model objects.
|
|
55
|
+
|
|
56
|
+
:param m: Dictionary containing request data
|
|
57
|
+
:type m: dict
|
|
58
|
+
|
|
59
|
+
:return: Self reference for method chaining
|
|
60
|
+
:rtype: ScalingDownV2Request
|
|
61
|
+
|
|
62
|
+
:raises TypeError: If input is not a dictionary or field type mismatch
|
|
63
|
+
:raises ValueError: If nested model conversion fails
|
|
64
|
+
"""
|
|
65
|
+
m = m or dict()
|
|
66
|
+
if m.get('groupId') is not None:
|
|
67
|
+
self.group_id = m.get('groupId')
|
|
68
|
+
if m.get('scalingDown') is not None:
|
|
69
|
+
self.scaling_down = m.get('scalingDown')
|
|
70
|
+
if m.get('nodes') is not None:
|
|
71
|
+
self.nodes = m.get('nodes')
|
|
72
|
+
return self
|