baiducloud-python-sdk-cprom 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 (95) hide show
  1. baiducloud_python_sdk_cprom/__init__.py +5 -0
  2. baiducloud_python_sdk_cprom/api/__init__.py +0 -0
  3. baiducloud_python_sdk_cprom/api/cprom_client.py +1197 -0
  4. baiducloud_python_sdk_cprom/models/__init__.py +90 -0
  5. baiducloud_python_sdk_cprom/models/bind_cluster_request.py +72 -0
  6. baiducloud_python_sdk_cprom/models/bind_cluster_response.py +61 -0
  7. baiducloud_python_sdk_cprom/models/callback_config.py +68 -0
  8. baiducloud_python_sdk_cprom/models/claim_alert_event_request.py +68 -0
  9. baiducloud_python_sdk_cprom/models/claim_alert_event_response.py +78 -0
  10. baiducloud_python_sdk_cprom/models/claim_condition.py +58 -0
  11. baiducloud_python_sdk_cprom/models/claimed_info.py +82 -0
  12. baiducloud_python_sdk_cprom/models/create_alert_request.py +142 -0
  13. baiducloud_python_sdk_cprom/models/create_alert_response.py +61 -0
  14. baiducloud_python_sdk_cprom/models/create_custom_scrape_task_request.py +72 -0
  15. baiducloud_python_sdk_cprom/models/create_custom_scrape_task_response.py +61 -0
  16. baiducloud_python_sdk_cprom/models/create_instance_request.py +117 -0
  17. baiducloud_python_sdk_cprom/models/create_notification_policy_request.py +149 -0
  18. baiducloud_python_sdk_cprom/models/create_notification_policy_response.py +61 -0
  19. baiducloud_python_sdk_cprom/models/create_podmonitor_request.py +98 -0
  20. baiducloud_python_sdk_cprom/models/create_podmonitor_response.py +61 -0
  21. baiducloud_python_sdk_cprom/models/create_service_monitor_request.py +98 -0
  22. baiducloud_python_sdk_cprom/models/create_service_monitor_response.py +61 -0
  23. baiducloud_python_sdk_cprom/models/delete_alert_request.py +64 -0
  24. baiducloud_python_sdk_cprom/models/delete_custom_scrape_task_request.py +70 -0
  25. baiducloud_python_sdk_cprom/models/delete_instance_request.py +64 -0
  26. baiducloud_python_sdk_cprom/models/delete_notification_policy_request.py +58 -0
  27. baiducloud_python_sdk_cprom/models/delete_podmonitor_request.py +70 -0
  28. baiducloud_python_sdk_cprom/models/delete_service_monitor_request.py +70 -0
  29. baiducloud_python_sdk_cprom/models/endpoint.py +82 -0
  30. baiducloud_python_sdk_cprom/models/escalate_param.py +78 -0
  31. baiducloud_python_sdk_cprom/models/event.py +216 -0
  32. baiducloud_python_sdk_cprom/models/event_claim_detail.py +74 -0
  33. baiducloud_python_sdk_cprom/models/generate_instance_token_request.py +72 -0
  34. baiducloud_python_sdk_cprom/models/get_alert_detail_request.py +64 -0
  35. baiducloud_python_sdk_cprom/models/get_alert_detail_response.py +136 -0
  36. baiducloud_python_sdk_cprom/models/get_alert_event_detail_request.py +58 -0
  37. baiducloud_python_sdk_cprom/models/get_alert_event_detail_response.py +218 -0
  38. baiducloud_python_sdk_cprom/models/get_cluster_bind_status_request.py +58 -0
  39. baiducloud_python_sdk_cprom/models/get_cluster_bind_status_response.py +77 -0
  40. baiducloud_python_sdk_cprom/models/get_notification_policy_request.py +58 -0
  41. baiducloud_python_sdk_cprom/models/get_notification_policy_response.py +167 -0
  42. baiducloud_python_sdk_cprom/models/label_selector.py +58 -0
  43. baiducloud_python_sdk_cprom/models/list_alert_events_request.py +159 -0
  44. baiducloud_python_sdk_cprom/models/list_alert_events_response.py +102 -0
  45. baiducloud_python_sdk_cprom/models/list_alert_templates_response.py +62 -0
  46. baiducloud_python_sdk_cprom/models/list_alerts_request.py +82 -0
  47. baiducloud_python_sdk_cprom/models/list_alerts_response.py +128 -0
  48. baiducloud_python_sdk_cprom/models/list_bindable_cloud_products_response.py +62 -0
  49. baiducloud_python_sdk_cprom/models/list_instances_request.py +82 -0
  50. baiducloud_python_sdk_cprom/models/list_instances_response.py +102 -0
  51. baiducloud_python_sdk_cprom/models/list_notification_policies_request.py +76 -0
  52. baiducloud_python_sdk_cprom/models/list_notification_policies_response.py +128 -0
  53. baiducloud_python_sdk_cprom/models/list_pod_monitors_request.py +110 -0
  54. baiducloud_python_sdk_cprom/models/list_pod_monitors_response.py +137 -0
  55. baiducloud_python_sdk_cprom/models/list_related_cloud_products_request.py +58 -0
  56. baiducloud_python_sdk_cprom/models/list_related_cloud_products_response.py +61 -0
  57. baiducloud_python_sdk_cprom/models/list_service_monitors_request.py +110 -0
  58. baiducloud_python_sdk_cprom/models/list_service_monitors_response.py +137 -0
  59. baiducloud_python_sdk_cprom/models/mentioned_user_config.py +66 -0
  60. baiducloud_python_sdk_cprom/models/monitor_instance.py +135 -0
  61. baiducloud_python_sdk_cprom/models/namespace_selector.py +58 -0
  62. baiducloud_python_sdk_cprom/models/notify_action.py +96 -0
  63. baiducloud_python_sdk_cprom/models/notify_rule.py +179 -0
  64. baiducloud_python_sdk_cprom/models/object_meta.py +66 -0
  65. baiducloud_python_sdk_cprom/models/pod_metrics_endpoint.py +74 -0
  66. baiducloud_python_sdk_cprom/models/pod_monitor.py +86 -0
  67. baiducloud_python_sdk_cprom/models/pod_monitor_item.py +92 -0
  68. baiducloud_python_sdk_cprom/models/pod_monitor_spec.py +80 -0
  69. baiducloud_python_sdk_cprom/models/remote_read_request.py +90 -0
  70. baiducloud_python_sdk_cprom/models/remote_read_response.py +127 -0
  71. baiducloud_python_sdk_cprom/models/remote_write_request.py +90 -0
  72. baiducloud_python_sdk_cprom/models/repeat_notify_config.py +90 -0
  73. baiducloud_python_sdk_cprom/models/rule_detail.py +142 -0
  74. baiducloud_python_sdk_cprom/models/rule_template.py +82 -0
  75. baiducloud_python_sdk_cprom/models/scope_detail.py +74 -0
  76. baiducloud_python_sdk_cprom/models/service_monitor.py +86 -0
  77. baiducloud_python_sdk_cprom/models/service_monitor_endpoint.py +74 -0
  78. baiducloud_python_sdk_cprom/models/service_monitor_item.py +92 -0
  79. baiducloud_python_sdk_cprom/models/service_monitor_spec.py +80 -0
  80. baiducloud_python_sdk_cprom/models/status.py +74 -0
  81. baiducloud_python_sdk_cprom/models/toggle_pod_monitor_service_request.py +70 -0
  82. baiducloud_python_sdk_cprom/models/toggle_service_monitor_service_request.py +70 -0
  83. baiducloud_python_sdk_cprom/models/update_alert_request.py +149 -0
  84. baiducloud_python_sdk_cprom/models/update_notification_policy_request.py +156 -0
  85. baiducloud_python_sdk_cprom/models/update_pod_monitor_request.py +87 -0
  86. baiducloud_python_sdk_cprom/models/update_related_cloud_products_request.py +66 -0
  87. baiducloud_python_sdk_cprom/models/update_service_monitor_request.py +87 -0
  88. baiducloud_python_sdk_cprom/models/user.py +90 -0
  89. baiducloud_python_sdk_cprom/models/user_group.py +74 -0
  90. baiducloud_python_sdk_cprom/models/webhook_detail.py +102 -0
  91. baiducloud_python_sdk_cprom-0.0.1.dist-info/LICENSE +177 -0
  92. baiducloud_python_sdk_cprom-0.0.1.dist-info/METADATA +76 -0
  93. baiducloud_python_sdk_cprom-0.0.1.dist-info/RECORD +95 -0
  94. baiducloud_python_sdk_cprom-0.0.1.dist-info/WHEEL +5 -0
  95. baiducloud_python_sdk_cprom-0.0.1.dist-info/top_level.txt +1 -0
@@ -0,0 +1,142 @@
1
+ """
2
+ RuleDetail information
3
+ """
4
+
5
+ from baiducloud_python_sdk_core.abstract_model import AbstractModel
6
+
7
+
8
+ class RuleDetail(AbstractModel):
9
+ """
10
+ RuleDetail
11
+ """
12
+
13
+ def __init__(
14
+ self,
15
+ alert_id=None,
16
+ alert_name=None,
17
+ expr=None,
18
+ cprom_for=None,
19
+ description=None,
20
+ enable=None,
21
+ notify_rule_id=None,
22
+ severity=None,
23
+ labels=None,
24
+ annotations=None,
25
+ ):
26
+ """
27
+ Initialize RuleDetail instance.
28
+
29
+ :param alert_id: 告警ID
30
+ :type alert_id: str (optional)
31
+
32
+ :param alert_name: 告警名称
33
+ :type alert_name: str (optional)
34
+
35
+ :param expr: 告警规则,promQL查询语句
36
+ :type expr: str (optional)
37
+
38
+ :param cprom_for: 告警持续时间
39
+ :type cprom_for: str (optional)
40
+
41
+ :param description: 告警内容
42
+ :type description: str (optional)
43
+
44
+ :param enable: 是否开启告警
45
+ :type enable: bool (optional)
46
+
47
+ :param notify_rule_id: 通知策略ID
48
+ :type notify_rule_id: str (optional)
49
+
50
+ :param severity: 告警级别,取值为 `notice`、`warning`、`major`、`critical`
51
+ :type severity: str (optional)
52
+
53
+ :param labels: 标签列表, 告警级别等
54
+ :type labels: Dict[str, str] (optional)
55
+
56
+ :param annotations: 注解列表
57
+ :type annotations: Dict[str, str] (optional)
58
+ """
59
+ super().__init__()
60
+ self.alert_id = alert_id
61
+ self.alert_name = alert_name
62
+ self.expr = expr
63
+ self.cprom_for = cprom_for
64
+ self.description = description
65
+ self.enable = enable
66
+ self.notify_rule_id = notify_rule_id
67
+ self.severity = severity
68
+ self.labels = labels
69
+ self.annotations = annotations
70
+
71
+ def to_dict(self):
72
+ """
73
+ Convert the model instance to a dictionary representation.
74
+
75
+ Nested model objects are recursively converted to dictionaries.
76
+
77
+ :return: Dictionary representation of the model
78
+ :rtype: dict
79
+ """
80
+ _map = super().to_dict()
81
+ if _map is not None:
82
+ return _map
83
+ result = dict()
84
+ if self.alert_id is not None:
85
+ result['alertId'] = self.alert_id
86
+ if self.alert_name is not None:
87
+ result['alertName'] = self.alert_name
88
+ if self.expr is not None:
89
+ result['expr'] = self.expr
90
+ if self.cprom_for is not None:
91
+ result['for'] = self.cprom_for
92
+ if self.description is not None:
93
+ result['description'] = self.description
94
+ if self.enable is not None:
95
+ result['enable'] = self.enable
96
+ if self.notify_rule_id is not None:
97
+ result['notifyRuleId'] = self.notify_rule_id
98
+ if self.severity is not None:
99
+ result['severity'] = self.severity
100
+ if self.labels is not None:
101
+ result['labels'] = self.labels
102
+ if self.annotations is not None:
103
+ result['annotations'] = self.annotations
104
+ return result
105
+
106
+ def from_dict(self, m):
107
+ """
108
+ Populate the model instance from a dictionary.
109
+
110
+ Nested dictionaries are recursively converted to model objects.
111
+
112
+ :param m: Dictionary containing model data
113
+ :type m: dict
114
+
115
+ :return: Self reference for method chaining
116
+ :rtype: RuleDetail
117
+
118
+ :raises TypeError: If input is not a dictionary type
119
+ :raises ValueError: If nested model conversion fails
120
+ """
121
+ m = m or dict()
122
+ if m.get('alertId') is not None:
123
+ self.alert_id = m.get('alertId')
124
+ if m.get('alertName') is not None:
125
+ self.alert_name = m.get('alertName')
126
+ if m.get('expr') is not None:
127
+ self.expr = m.get('expr')
128
+ if m.get('for') is not None:
129
+ self.cprom_for = m.get('for')
130
+ if m.get('description') is not None:
131
+ self.description = m.get('description')
132
+ if m.get('enable') is not None:
133
+ self.enable = m.get('enable')
134
+ if m.get('notifyRuleId') is not None:
135
+ self.notify_rule_id = m.get('notifyRuleId')
136
+ if m.get('severity') is not None:
137
+ self.severity = m.get('severity')
138
+ if m.get('labels') is not None:
139
+ self.labels = m.get('labels')
140
+ if m.get('annotations') is not None:
141
+ self.annotations = m.get('annotations')
142
+ return self
@@ -0,0 +1,82 @@
1
+ """
2
+ RuleTemplate information
3
+ """
4
+
5
+ from baiducloud_python_sdk_core.abstract_model import AbstractModel
6
+
7
+
8
+ class RuleTemplate(AbstractModel):
9
+ """
10
+ RuleTemplate
11
+ """
12
+
13
+ def __init__(self, alert_name=None, expr=None, cprom_for=None, description=None):
14
+ """
15
+ Initialize RuleTemplate instance.
16
+
17
+ :param alert_name: 告警名称
18
+ :type alert_name: str (optional)
19
+
20
+ :param expr: 告警规则,promQL查询语句
21
+ :type expr: str (optional)
22
+
23
+ :param cprom_for: 告警持续时间
24
+ :type cprom_for: str (optional)
25
+
26
+ :param description: 告警内容
27
+ :type description: str (optional)
28
+ """
29
+ super().__init__()
30
+ self.alert_name = alert_name
31
+ self.expr = expr
32
+ self.cprom_for = cprom_for
33
+ self.description = description
34
+
35
+ def to_dict(self):
36
+ """
37
+ Convert the model instance to a dictionary representation.
38
+
39
+ Nested model objects are recursively converted to dictionaries.
40
+
41
+ :return: Dictionary representation of the model
42
+ :rtype: dict
43
+ """
44
+ _map = super().to_dict()
45
+ if _map is not None:
46
+ return _map
47
+ result = dict()
48
+ if self.alert_name is not None:
49
+ result['alertName'] = self.alert_name
50
+ if self.expr is not None:
51
+ result['expr'] = self.expr
52
+ if self.cprom_for is not None:
53
+ result['for'] = self.cprom_for
54
+ if self.description is not None:
55
+ result['description'] = self.description
56
+ return result
57
+
58
+ def from_dict(self, m):
59
+ """
60
+ Populate the model instance from a dictionary.
61
+
62
+ Nested dictionaries are recursively converted to model objects.
63
+
64
+ :param m: Dictionary containing model data
65
+ :type m: dict
66
+
67
+ :return: Self reference for method chaining
68
+ :rtype: RuleTemplate
69
+
70
+ :raises TypeError: If input is not a dictionary type
71
+ :raises ValueError: If nested model conversion fails
72
+ """
73
+ m = m or dict()
74
+ if m.get('alertName') is not None:
75
+ self.alert_name = m.get('alertName')
76
+ if m.get('expr') is not None:
77
+ self.expr = m.get('expr')
78
+ if m.get('for') is not None:
79
+ self.cprom_for = m.get('for')
80
+ if m.get('description') is not None:
81
+ self.description = m.get('description')
82
+ return self
@@ -0,0 +1,74 @@
1
+ """
2
+ ScopeDetail information
3
+ """
4
+
5
+ from baiducloud_python_sdk_core.abstract_model import AbstractModel
6
+
7
+
8
+ class ScopeDetail(AbstractModel):
9
+ """
10
+ ScopeDetail
11
+ """
12
+
13
+ def __init__(self, scope_name=None, humanization=None, doc_link=None):
14
+ """
15
+ Initialize ScopeDetail instance.
16
+
17
+ :param scope_name: 云产品英文名称,如 `BCE_BCC`
18
+ :type scope_name: str (optional)
19
+
20
+ :param humanization: 云产品说明
21
+ :type humanization: str (optional)
22
+
23
+ :param doc_link: BCM 文档链接
24
+ :type doc_link: str (optional)
25
+ """
26
+ super().__init__()
27
+ self.scope_name = scope_name
28
+ self.humanization = humanization
29
+ self.doc_link = doc_link
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_name is not None:
45
+ result['scopeName'] = self.scope_name
46
+ if self.humanization is not None:
47
+ result['humanization'] = self.humanization
48
+ if self.doc_link is not None:
49
+ result['docLink'] = self.doc_link
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: ScopeDetail
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('scopeName') is not None:
69
+ self.scope_name = m.get('scopeName')
70
+ if m.get('humanization') is not None:
71
+ self.humanization = m.get('humanization')
72
+ if m.get('docLink') is not None:
73
+ self.doc_link = m.get('docLink')
74
+ return self
@@ -0,0 +1,86 @@
1
+ """
2
+ ServiceMonitor information
3
+ """
4
+
5
+ from baiducloud_python_sdk_core.abstract_model import AbstractModel
6
+
7
+ from baiducloud_python_sdk_cprom.models.object_meta import ObjectMeta
8
+
9
+ from baiducloud_python_sdk_cprom.models.service_monitor_spec import ServiceMonitorSpec
10
+
11
+
12
+ class ServiceMonitor(AbstractModel):
13
+ """
14
+ ServiceMonitor
15
+ """
16
+
17
+ def __init__(self, api_version=None, kind=None, metadata=None, spec=None):
18
+ """
19
+ Initialize ServiceMonitor instance.
20
+
21
+ :param api_version: 固定值:monitoring.coreos.com/v1
22
+ :type api_version: str (optional)
23
+
24
+ :param kind: 固定值:ServiceMonitor
25
+ :type kind: str (optional)
26
+
27
+ :param metadata: metadata attribute
28
+ :type metadata: ObjectMeta (optional)
29
+
30
+ :param spec: spec attribute
31
+ :type spec: ServiceMonitorSpec (optional)
32
+ """
33
+ super().__init__()
34
+ self.api_version = api_version
35
+ self.kind = kind
36
+ self.metadata = metadata
37
+ self.spec = spec
38
+
39
+ def to_dict(self):
40
+ """
41
+ Convert the model instance to a dictionary representation.
42
+
43
+ Nested model objects are recursively converted to dictionaries.
44
+
45
+ :return: Dictionary representation of the model
46
+ :rtype: dict
47
+ """
48
+ _map = super().to_dict()
49
+ if _map is not None:
50
+ return _map
51
+ result = dict()
52
+ if self.api_version is not None:
53
+ result['apiVersion'] = self.api_version
54
+ if self.kind is not None:
55
+ result['kind'] = self.kind
56
+ if self.metadata is not None:
57
+ result['metadata'] = self.metadata.to_dict()
58
+ if self.spec is not None:
59
+ result['spec'] = self.spec.to_dict()
60
+ return result
61
+
62
+ def from_dict(self, m):
63
+ """
64
+ Populate the model instance from a dictionary.
65
+
66
+ Nested dictionaries are recursively converted to model objects.
67
+
68
+ :param m: Dictionary containing model data
69
+ :type m: dict
70
+
71
+ :return: Self reference for method chaining
72
+ :rtype: ServiceMonitor
73
+
74
+ :raises TypeError: If input is not a dictionary type
75
+ :raises ValueError: If nested model conversion fails
76
+ """
77
+ m = m or dict()
78
+ if m.get('apiVersion') is not None:
79
+ self.api_version = m.get('apiVersion')
80
+ if m.get('kind') is not None:
81
+ self.kind = m.get('kind')
82
+ if m.get('metadata') is not None:
83
+ self.metadata = ObjectMeta().from_dict(m.get('metadata'))
84
+ if m.get('spec') is not None:
85
+ self.spec = ServiceMonitorSpec().from_dict(m.get('spec'))
86
+ return self
@@ -0,0 +1,74 @@
1
+ """
2
+ ServiceMonitorEndpoint information
3
+ """
4
+
5
+ from baiducloud_python_sdk_core.abstract_model import AbstractModel
6
+
7
+
8
+ class ServiceMonitorEndpoint(AbstractModel):
9
+ """
10
+ ServiceMonitorEndpoint
11
+ """
12
+
13
+ def __init__(self, interval=None, path=None, port=None):
14
+ """
15
+ Initialize ServiceMonitorEndpoint instance.
16
+
17
+ :param interval: 采集间隔,如:15s,可不传,默认为 15s
18
+ :type interval: str (optional)
19
+
20
+ :param path: 采集路径,如:/metrics 可不传,默认为 /metrics
21
+ :type path: str (optional)
22
+
23
+ :param port: 对应 Service 的 port name,注意不是端口号
24
+ :type port: str (optional)
25
+ """
26
+ super().__init__()
27
+ self.interval = interval
28
+ self.path = path
29
+ self.port = port
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.interval is not None:
45
+ result['interval'] = self.interval
46
+ if self.path is not None:
47
+ result['path'] = self.path
48
+ if self.port is not None:
49
+ result['port'] = self.port
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: ServiceMonitorEndpoint
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('interval') is not None:
69
+ self.interval = m.get('interval')
70
+ if m.get('path') is not None:
71
+ self.path = m.get('path')
72
+ if m.get('port') is not None:
73
+ self.port = m.get('port')
74
+ return self
@@ -0,0 +1,92 @@
1
+ """
2
+ ServiceMonitorItem information
3
+ """
4
+
5
+ from baiducloud_python_sdk_core.abstract_model import AbstractModel
6
+
7
+ from baiducloud_python_sdk_cprom.models.endpoint import Endpoint
8
+
9
+
10
+ class ServiceMonitorItem(AbstractModel):
11
+ """
12
+ ServiceMonitorItem
13
+ """
14
+
15
+ def __init__(self, service_monitor_name=None, namespace=None, enable=None, create_time=None, endpoints=None):
16
+ """
17
+ Initialize ServiceMonitorItem instance.
18
+
19
+ :param service_monitor_name: Service Monitor名称
20
+ :type service_monitor_name: str (optional)
21
+
22
+ :param namespace: Service Monitor命名空间
23
+ :type namespace: str (optional)
24
+
25
+ :param enable: 是否启用:true/false
26
+ :type enable: str (optional)
27
+
28
+ :param create_time: 创建时间
29
+ :type create_time: str (optional)
30
+
31
+ :param endpoints: 端点信息
32
+ :type endpoints: List[Endpoint] (optional)
33
+ """
34
+ super().__init__()
35
+ self.service_monitor_name = service_monitor_name
36
+ self.namespace = namespace
37
+ self.enable = enable
38
+ self.create_time = create_time
39
+ self.endpoints = endpoints
40
+
41
+ def to_dict(self):
42
+ """
43
+ Convert the model instance to a dictionary representation.
44
+
45
+ Nested model objects are recursively converted to dictionaries.
46
+
47
+ :return: Dictionary representation of the model
48
+ :rtype: dict
49
+ """
50
+ _map = super().to_dict()
51
+ if _map is not None:
52
+ return _map
53
+ result = dict()
54
+ if self.service_monitor_name is not None:
55
+ result['serviceMonitorName'] = self.service_monitor_name
56
+ if self.namespace is not None:
57
+ result['namespace'] = self.namespace
58
+ if self.enable is not None:
59
+ result['enable'] = self.enable
60
+ if self.create_time is not None:
61
+ result['createTime'] = self.create_time
62
+ if self.endpoints is not None:
63
+ result['endpoints'] = [i.to_dict() for i in self.endpoints]
64
+ return result
65
+
66
+ def from_dict(self, m):
67
+ """
68
+ Populate the model instance from a dictionary.
69
+
70
+ Nested dictionaries are recursively converted to model objects.
71
+
72
+ :param m: Dictionary containing model data
73
+ :type m: dict
74
+
75
+ :return: Self reference for method chaining
76
+ :rtype: ServiceMonitorItem
77
+
78
+ :raises TypeError: If input is not a dictionary type
79
+ :raises ValueError: If nested model conversion fails
80
+ """
81
+ m = m or dict()
82
+ if m.get('serviceMonitorName') is not None:
83
+ self.service_monitor_name = m.get('serviceMonitorName')
84
+ if m.get('namespace') is not None:
85
+ self.namespace = m.get('namespace')
86
+ if m.get('enable') is not None:
87
+ self.enable = m.get('enable')
88
+ if m.get('createTime') is not None:
89
+ self.create_time = m.get('createTime')
90
+ if m.get('endpoints') is not None:
91
+ self.endpoints = [Endpoint().from_dict(i) for i in m.get('endpoints')]
92
+ return self
@@ -0,0 +1,80 @@
1
+ """
2
+ ServiceMonitorSpec information
3
+ """
4
+
5
+ from baiducloud_python_sdk_core.abstract_model import AbstractModel
6
+
7
+ from baiducloud_python_sdk_cprom.models.service_monitor_endpoint import ServiceMonitorEndpoint
8
+
9
+ from baiducloud_python_sdk_cprom.models.namespace_selector import NamespaceSelector
10
+
11
+ from baiducloud_python_sdk_cprom.models.label_selector import LabelSelector
12
+
13
+
14
+ class ServiceMonitorSpec(AbstractModel):
15
+ """
16
+ ServiceMonitorSpec
17
+ """
18
+
19
+ def __init__(self, endpoints=None, namespace_selector=None, selector=None):
20
+ """
21
+ Initialize ServiceMonitorSpec instance.
22
+
23
+ :param endpoints: 采集端点配置列表
24
+ :type endpoints: List[ServiceMonitorEndpoint] (optional)
25
+
26
+ :param namespace_selector: namespace_selector attribute
27
+ :type namespace_selector: NamespaceSelector (optional)
28
+
29
+ :param selector: selector attribute
30
+ :type selector: LabelSelector (optional)
31
+ """
32
+ super().__init__()
33
+ self.endpoints = endpoints
34
+ self.namespace_selector = namespace_selector
35
+ self.selector = selector
36
+
37
+ def to_dict(self):
38
+ """
39
+ Convert the model instance to a dictionary representation.
40
+
41
+ Nested model objects are recursively converted to dictionaries.
42
+
43
+ :return: Dictionary representation of the model
44
+ :rtype: dict
45
+ """
46
+ _map = super().to_dict()
47
+ if _map is not None:
48
+ return _map
49
+ result = dict()
50
+ if self.endpoints is not None:
51
+ result['endpoints'] = [i.to_dict() for i in self.endpoints]
52
+ if self.namespace_selector is not None:
53
+ result['namespaceSelector'] = self.namespace_selector.to_dict()
54
+ if self.selector is not None:
55
+ result['selector'] = self.selector.to_dict()
56
+ return result
57
+
58
+ def from_dict(self, m):
59
+ """
60
+ Populate the model instance from a dictionary.
61
+
62
+ Nested dictionaries are recursively converted to model objects.
63
+
64
+ :param m: Dictionary containing model data
65
+ :type m: dict
66
+
67
+ :return: Self reference for method chaining
68
+ :rtype: ServiceMonitorSpec
69
+
70
+ :raises TypeError: If input is not a dictionary type
71
+ :raises ValueError: If nested model conversion fails
72
+ """
73
+ m = m or dict()
74
+ if m.get('endpoints') is not None:
75
+ self.endpoints = [ServiceMonitorEndpoint().from_dict(i) for i in m.get('endpoints')]
76
+ if m.get('namespaceSelector') is not None:
77
+ self.namespace_selector = NamespaceSelector().from_dict(m.get('namespaceSelector'))
78
+ if m.get('selector') is not None:
79
+ self.selector = LabelSelector().from_dict(m.get('selector'))
80
+ return self