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
+ Request entity for CreateAlertRequest information.
3
+ """
4
+
5
+ from baiducloud_python_sdk_core.abstract_model import AbstractModel
6
+
7
+
8
+ class CreateAlertRequest(AbstractModel):
9
+ """
10
+ Request entity for CreateAlertRequest operation.
11
+
12
+ This class encapsulates all parameters for the API request.
13
+ """
14
+
15
+ def __init__(
16
+ self,
17
+ instance_id,
18
+ alert_name,
19
+ expr,
20
+ cprom_for,
21
+ description,
22
+ notify_rule_id,
23
+ enable=None,
24
+ severity=None,
25
+ labels=None,
26
+ annotations=None,
27
+ ):
28
+ """
29
+ Initialize CreateAlertRequest request entity.
30
+
31
+ :param instance_id: instance_id parameter
32
+ :type instance_id: str (required)
33
+
34
+ :param alert_name: 告警名称
35
+ :type alert_name: str (required)
36
+
37
+ :param expr: 告警规则,promQL查询语句
38
+ :type expr: str (required)
39
+
40
+ :param cprom_for: 告警持续时间
41
+ :type cprom_for: str (required)
42
+
43
+ :param description: 告警内容
44
+ :type description: str (required)
45
+
46
+ :param notify_rule_id: 通知策略ID
47
+ :type notify_rule_id: str (required)
48
+
49
+ :param enable: 是否开启告警,创建时默认为true
50
+ :type enable: bool (optional)
51
+
52
+ :param severity: 告警级别,notice/warning/major/critical
53
+ :type severity: str (optional)
54
+
55
+ :param labels: 自定义label键值对
56
+ :type labels: Dict[str, str] (optional)
57
+
58
+ :param annotations: 自定义注解键值对
59
+ :type annotations: Dict[str, str] (optional)
60
+ """
61
+ super().__init__()
62
+ self.instance_id = instance_id
63
+ self.alert_name = alert_name
64
+ self.expr = expr
65
+ self.cprom_for = cprom_for
66
+ self.description = description
67
+ self.notify_rule_id = notify_rule_id
68
+ self.enable = enable
69
+ self.severity = severity
70
+ self.labels = labels
71
+ self.annotations = annotations
72
+
73
+ def to_dict(self):
74
+ """
75
+ Convert the request entity to a dictionary representation.
76
+
77
+ Nested model objects are recursively converted to dictionaries.
78
+
79
+ :return: Dictionary representation of the request
80
+ :rtype: dict
81
+ """
82
+ _map = super().to_dict()
83
+ if _map is not None:
84
+ return _map
85
+ result = dict()
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.notify_rule_id is not None:
95
+ result['notifyRuleId'] = self.notify_rule_id
96
+ if self.enable is not None:
97
+ result['enable'] = self.enable
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 request entity from a dictionary.
109
+
110
+ Nested dictionaries are recursively converted to model objects.
111
+
112
+ :param m: Dictionary containing request data
113
+ :type m: dict
114
+
115
+ :return: Self reference for method chaining
116
+ :rtype: CreateAlertRequest
117
+
118
+ :raises TypeError: If input is not a dictionary or field type mismatch
119
+ :raises ValueError: If nested model conversion fails
120
+ """
121
+ m = m or dict()
122
+ if m.get('instanceId') is not None:
123
+ self.instance_id = m.get('instanceId')
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('notifyRuleId') is not None:
133
+ self.notify_rule_id = m.get('notifyRuleId')
134
+ if m.get('enable') is not None:
135
+ self.enable = m.get('enable')
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,61 @@
1
+ """
2
+ Request entity for CreateAlertResponse information.
3
+ """
4
+
5
+ from baiducloud_python_sdk_core.bce_response import BceResponse
6
+
7
+
8
+ class CreateAlertResponse(BceResponse):
9
+ """
10
+ CreateAlertResponse
11
+ """
12
+
13
+ def __init__(self, alert_id=None):
14
+ """
15
+ Initialize CreateAlertResponse response.
16
+
17
+ :param alert_id: 告警规则ID
18
+ :type alert_id: str (optional)
19
+ """
20
+ super().__init__()
21
+ self.alert_id = alert_id
22
+
23
+ def to_dict(self):
24
+ """
25
+ Convert the response instance to a dictionary representation.
26
+
27
+ Includes metadata from the parent BceResponse class.
28
+ Nested model objects are recursively converted to dictionaries.
29
+
30
+ :return: Dictionary representation of the response
31
+ :rtype: dict
32
+ """
33
+ _map = super().to_dict()
34
+ if _map is not None:
35
+ return _map
36
+ result = dict()
37
+ if self.metadata is not None:
38
+ result['metadata'] = dict(self.metadata)
39
+ if self.alert_id is not None:
40
+ result['alertId'] = self.alert_id
41
+ return result
42
+
43
+ def from_dict(self, m):
44
+ """
45
+ Populate the response instance from a dictionary.
46
+
47
+ Nested dictionaries are recursively converted to model objects.
48
+
49
+ :param m: Dictionary containing response data
50
+ :type m: dict
51
+
52
+ :return: Self reference for method chaining
53
+ :rtype: CreateAlertResponse
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('alertId') is not None:
60
+ self.alert_id = m.get('alertId')
61
+ return self
@@ -0,0 +1,72 @@
1
+ """
2
+ Request entity for CreateCustomScrapeTaskRequest information.
3
+ """
4
+
5
+ from baiducloud_python_sdk_core.abstract_model import AbstractModel
6
+
7
+
8
+ class CreateCustomScrapeTaskRequest(AbstractModel):
9
+ """
10
+ Request entity for CreateCustomScrapeTaskRequest operation.
11
+
12
+ This class encapsulates all parameters for the API request.
13
+ """
14
+
15
+ def __init__(self, instance_id, agent_id, config):
16
+ """
17
+ Initialize CreateCustomScrapeTaskRequest request entity.
18
+
19
+ :param instance_id: instance_id parameter
20
+ :type instance_id: str (required)
21
+
22
+ :param agent_id: agent_id parameter
23
+ :type agent_id: str (required)
24
+
25
+ :param config: 抓取任务配置,示例值见请求示例
26
+ :type config: str (required)
27
+ """
28
+ super().__init__()
29
+ self.instance_id = instance_id
30
+ self.agent_id = agent_id
31
+ self.config = config
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.config is not None:
47
+ result['config'] = self.config
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: CreateCustomScrapeTaskRequest
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('instanceId') is not None:
67
+ self.instance_id = m.get('instanceId')
68
+ if m.get('agentId') is not None:
69
+ self.agent_id = m.get('agentId')
70
+ if m.get('config') is not None:
71
+ self.config = m.get('config')
72
+ return self
@@ -0,0 +1,61 @@
1
+ """
2
+ Request entity for CreateCustomScrapeTaskResponse information.
3
+ """
4
+
5
+ from baiducloud_python_sdk_core.bce_response import BceResponse
6
+
7
+
8
+ class CreateCustomScrapeTaskResponse(BceResponse):
9
+ """
10
+ CreateCustomScrapeTaskResponse
11
+ """
12
+
13
+ def __init__(self, scrape_job_id=None):
14
+ """
15
+ Initialize CreateCustomScrapeTaskResponse response.
16
+
17
+ :param scrape_job_id: 采集任务ID
18
+ :type scrape_job_id: str (optional)
19
+ """
20
+ super().__init__()
21
+ self.scrape_job_id = scrape_job_id
22
+
23
+ def to_dict(self):
24
+ """
25
+ Convert the response instance to a dictionary representation.
26
+
27
+ Includes metadata from the parent BceResponse class.
28
+ Nested model objects are recursively converted to dictionaries.
29
+
30
+ :return: Dictionary representation of the response
31
+ :rtype: dict
32
+ """
33
+ _map = super().to_dict()
34
+ if _map is not None:
35
+ return _map
36
+ result = dict()
37
+ if self.metadata is not None:
38
+ result['metadata'] = dict(self.metadata)
39
+ if self.scrape_job_id is not None:
40
+ result['scrapeJobId'] = self.scrape_job_id
41
+ return result
42
+
43
+ def from_dict(self, m):
44
+ """
45
+ Populate the response instance from a dictionary.
46
+
47
+ Nested dictionaries are recursively converted to model objects.
48
+
49
+ :param m: Dictionary containing response data
50
+ :type m: dict
51
+
52
+ :return: Self reference for method chaining
53
+ :rtype: CreateCustomScrapeTaskResponse
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('scrapeJobId') is not None:
60
+ self.scrape_job_id = m.get('scrapeJobId')
61
+ return self
@@ -0,0 +1,117 @@
1
+ """
2
+ Request entity for CreateInstanceRequest information.
3
+ """
4
+
5
+ from baiducloud_python_sdk_core.abstract_model import AbstractModel
6
+
7
+
8
+ class CreateInstanceRequest(AbstractModel):
9
+ """
10
+ Request entity for CreateInstanceRequest operation.
11
+
12
+ This class encapsulates all parameters for the API request.
13
+ """
14
+
15
+ def __init__(
16
+ self,
17
+ instance_name,
18
+ instance_type=None,
19
+ instance_spec=None,
20
+ retention_period=None,
21
+ need_grafana=None,
22
+ grafana_name=None,
23
+ grafana_admin_password=None,
24
+ ):
25
+ """
26
+ Initialize CreateInstanceRequest request entity.
27
+
28
+ :param instance_name: 实例名称
29
+ :type instance_name: str (required)
30
+
31
+ :param instance_type: 监控实例类型,默认为CCE,代表CCE型监控实例,可选值:CCE、BCM
32
+ :type instance_type: str (optional)
33
+
34
+ :param instance_spec: 实例规格类型,默认为基础版\"free-v1\",可选值:advance-v1,advance-v2,free-v1
35
+ :type instance_spec: str (optional)
36
+
37
+ :param retention_period: 数据存储时长,默认值为 `15d`。
38
+ :type retention_period: str (optional)
39
+
40
+ :param need_grafana: 是否需要创建 Grafana。当前地域无 Grafana 实例时可创建,一个地域仅能创建一个 Grafana 实例。
41
+ :type need_grafana: bool (optional)
42
+
43
+ :param grafana_name: 当 `needGrafana=true` 时提供,Grafana 名称,默认值为 `admin`。
44
+ :type grafana_name: str (optional)
45
+
46
+ :param grafana_admin_password: grafana_admin_password parameter
47
+ :type grafana_admin_password: str (optional)
48
+ """
49
+ super().__init__()
50
+ self.instance_name = instance_name
51
+ self.instance_type = instance_type
52
+ self.instance_spec = instance_spec
53
+ self.retention_period = retention_period
54
+ self.need_grafana = need_grafana
55
+ self.grafana_name = grafana_name
56
+ self.grafana_admin_password = grafana_admin_password
57
+
58
+ def to_dict(self):
59
+ """
60
+ Convert the request entity to a dictionary representation.
61
+
62
+ Nested model objects are recursively converted to dictionaries.
63
+
64
+ :return: Dictionary representation of the request
65
+ :rtype: dict
66
+ """
67
+ _map = super().to_dict()
68
+ if _map is not None:
69
+ return _map
70
+ result = dict()
71
+ if self.instance_name is not None:
72
+ result['instanceName'] = self.instance_name
73
+ if self.instance_type is not None:
74
+ result['instanceType'] = self.instance_type
75
+ if self.instance_spec is not None:
76
+ result['instanceSpec'] = self.instance_spec
77
+ if self.retention_period is not None:
78
+ result['retentionPeriod'] = self.retention_period
79
+ if self.need_grafana is not None:
80
+ result['needGrafana'] = self.need_grafana
81
+ if self.grafana_name is not None:
82
+ result['grafanaName'] = self.grafana_name
83
+ if self.grafana_admin_password is not None:
84
+ result['grafanaAdminPassword'] = self.grafana_admin_password
85
+ return result
86
+
87
+ def from_dict(self, m):
88
+ """
89
+ Populate the request entity from a dictionary.
90
+
91
+ Nested dictionaries are recursively converted to model objects.
92
+
93
+ :param m: Dictionary containing request data
94
+ :type m: dict
95
+
96
+ :return: Self reference for method chaining
97
+ :rtype: CreateInstanceRequest
98
+
99
+ :raises TypeError: If input is not a dictionary or field type mismatch
100
+ :raises ValueError: If nested model conversion fails
101
+ """
102
+ m = m or dict()
103
+ if m.get('instanceName') is not None:
104
+ self.instance_name = m.get('instanceName')
105
+ if m.get('instanceType') is not None:
106
+ self.instance_type = m.get('instanceType')
107
+ if m.get('instanceSpec') is not None:
108
+ self.instance_spec = m.get('instanceSpec')
109
+ if m.get('retentionPeriod') is not None:
110
+ self.retention_period = m.get('retentionPeriod')
111
+ if m.get('needGrafana') is not None:
112
+ self.need_grafana = m.get('needGrafana')
113
+ if m.get('grafanaName') is not None:
114
+ self.grafana_name = m.get('grafanaName')
115
+ if m.get('grafanaAdminPassword') is not None:
116
+ self.grafana_admin_password = m.get('grafanaAdminPassword')
117
+ return self
@@ -0,0 +1,149 @@
1
+ """
2
+ Request entity for CreateNotificationPolicyRequest information.
3
+ """
4
+
5
+ from baiducloud_python_sdk_core.abstract_model import AbstractModel
6
+ from baiducloud_python_sdk_cprom.models.user import User
7
+ from baiducloud_python_sdk_cprom.models.user_group import UserGroup
8
+ from baiducloud_python_sdk_cprom.models.callback_config import CallbackConfig
9
+ from baiducloud_python_sdk_cprom.models.escalate_param import EscalateParam
10
+ from baiducloud_python_sdk_cprom.models.repeat_notify_config import RepeatNotifyConfig
11
+
12
+
13
+ class CreateNotificationPolicyRequest(AbstractModel):
14
+ """
15
+ Request entity for CreateNotificationPolicyRequest operation.
16
+
17
+ This class encapsulates all parameters for the API request.
18
+ """
19
+
20
+ def __init__(
21
+ self,
22
+ notify_rule_name,
23
+ start_time,
24
+ end_time,
25
+ channel=None,
26
+ receiver_type=None,
27
+ users=None,
28
+ user_groups=None,
29
+ webhook_config_list=None,
30
+ escalate_config_list=None,
31
+ repeat_notify_config=None,
32
+ ):
33
+ """
34
+ Initialize CreateNotificationPolicyRequest request entity.
35
+
36
+ :param notify_rule_name: 通知策略名称
37
+ :type notify_rule_name: str (required)
38
+
39
+ :param start_time: 通知开始时间,时间格式 00:00:00
40
+ :type start_time: str (required)
41
+
42
+ :param end_time: 通知结束时间,时间格式 23:59:59
43
+ :type end_time: str (required)
44
+
45
+ :param channel: channel parameter
46
+ :type channel: List[str] (optional)
47
+
48
+ :param receiver_type: receiver_type parameter
49
+ :type receiver_type: str (optional)
50
+
51
+ :param users: 用户列表
52
+ :type users: List[User] (optional)
53
+
54
+ :param user_groups: 用户组列表
55
+ :type user_groups: List[UserGroup] (optional)
56
+
57
+ :param webhook_config_list: webhook 回调配置信息列表
58
+ :type webhook_config_list: List[CallbackConfig] (optional)
59
+
60
+ :param escalate_config_list: 通知策略升级参数列表
61
+ :type escalate_config_list: List[EscalateParam] (optional)
62
+
63
+ :param repeat_notify_config: repeat_notify_config parameter
64
+ :type repeat_notify_config: RepeatNotifyConfig (optional)
65
+ """
66
+ super().__init__()
67
+ self.notify_rule_name = notify_rule_name
68
+ self.start_time = start_time
69
+ self.end_time = end_time
70
+ self.channel = channel
71
+ self.receiver_type = receiver_type
72
+ self.users = users
73
+ self.user_groups = user_groups
74
+ self.webhook_config_list = webhook_config_list
75
+ self.escalate_config_list = escalate_config_list
76
+ self.repeat_notify_config = repeat_notify_config
77
+
78
+ def to_dict(self):
79
+ """
80
+ Convert the request entity to a dictionary representation.
81
+
82
+ Nested model objects are recursively converted to dictionaries.
83
+
84
+ :return: Dictionary representation of the request
85
+ :rtype: dict
86
+ """
87
+ _map = super().to_dict()
88
+ if _map is not None:
89
+ return _map
90
+ result = dict()
91
+ if self.notify_rule_name is not None:
92
+ result['notifyRuleName'] = self.notify_rule_name
93
+ if self.start_time is not None:
94
+ result['startTime'] = self.start_time
95
+ if self.end_time is not None:
96
+ result['endTime'] = self.end_time
97
+ if self.channel is not None:
98
+ result['channel'] = self.channel
99
+ if self.receiver_type is not None:
100
+ result['receiverType'] = self.receiver_type
101
+ if self.users is not None:
102
+ result['users'] = [i.to_dict() for i in self.users]
103
+ if self.user_groups is not None:
104
+ result['userGroups'] = [i.to_dict() for i in self.user_groups]
105
+ if self.webhook_config_list is not None:
106
+ result['webhookConfigList'] = [i.to_dict() for i in self.webhook_config_list]
107
+ if self.escalate_config_list is not None:
108
+ result['escalateConfigList'] = [i.to_dict() for i in self.escalate_config_list]
109
+ if self.repeat_notify_config is not None:
110
+ result['repeatNotifyConfig'] = self.repeat_notify_config.to_dict()
111
+ return result
112
+
113
+ def from_dict(self, m):
114
+ """
115
+ Populate the request entity from a dictionary.
116
+
117
+ Nested dictionaries are recursively converted to model objects.
118
+
119
+ :param m: Dictionary containing request data
120
+ :type m: dict
121
+
122
+ :return: Self reference for method chaining
123
+ :rtype: CreateNotificationPolicyRequest
124
+
125
+ :raises TypeError: If input is not a dictionary or field type mismatch
126
+ :raises ValueError: If nested model conversion fails
127
+ """
128
+ m = m or dict()
129
+ if m.get('notifyRuleName') is not None:
130
+ self.notify_rule_name = m.get('notifyRuleName')
131
+ if m.get('startTime') is not None:
132
+ self.start_time = m.get('startTime')
133
+ if m.get('endTime') is not None:
134
+ self.end_time = m.get('endTime')
135
+ if m.get('channel') is not None:
136
+ self.channel = m.get('channel')
137
+ if m.get('receiverType') is not None:
138
+ self.receiver_type = m.get('receiverType')
139
+ if m.get('users') is not None:
140
+ self.users = [User().from_dict(i) for i in m.get('users')]
141
+ if m.get('userGroups') is not None:
142
+ self.user_groups = [UserGroup().from_dict(i) for i in m.get('userGroups')]
143
+ if m.get('webhookConfigList') is not None:
144
+ self.webhook_config_list = [CallbackConfig().from_dict(i) for i in m.get('webhookConfigList')]
145
+ if m.get('escalateConfigList') is not None:
146
+ self.escalate_config_list = [EscalateParam().from_dict(i) for i in m.get('escalateConfigList')]
147
+ if m.get('repeatNotifyConfig') is not None:
148
+ self.repeat_notify_config = RepeatNotifyConfig().from_dict(m.get('repeatNotifyConfig'))
149
+ return self
@@ -0,0 +1,61 @@
1
+ """
2
+ Request entity for CreateNotificationPolicyResponse information.
3
+ """
4
+
5
+ from baiducloud_python_sdk_core.bce_response import BceResponse
6
+
7
+
8
+ class CreateNotificationPolicyResponse(BceResponse):
9
+ """
10
+ CreateNotificationPolicyResponse
11
+ """
12
+
13
+ def __init__(self, notify_rule_id=None):
14
+ """
15
+ Initialize CreateNotificationPolicyResponse response.
16
+
17
+ :param notify_rule_id: 通知策略ID
18
+ :type notify_rule_id: str (optional)
19
+ """
20
+ super().__init__()
21
+ self.notify_rule_id = notify_rule_id
22
+
23
+ def to_dict(self):
24
+ """
25
+ Convert the response instance to a dictionary representation.
26
+
27
+ Includes metadata from the parent BceResponse class.
28
+ Nested model objects are recursively converted to dictionaries.
29
+
30
+ :return: Dictionary representation of the response
31
+ :rtype: dict
32
+ """
33
+ _map = super().to_dict()
34
+ if _map is not None:
35
+ return _map
36
+ result = dict()
37
+ if self.metadata is not None:
38
+ result['metadata'] = dict(self.metadata)
39
+ if self.notify_rule_id is not None:
40
+ result['notifyRuleId'] = self.notify_rule_id
41
+ return result
42
+
43
+ def from_dict(self, m):
44
+ """
45
+ Populate the response instance from a dictionary.
46
+
47
+ Nested dictionaries are recursively converted to model objects.
48
+
49
+ :param m: Dictionary containing response data
50
+ :type m: dict
51
+
52
+ :return: Self reference for method chaining
53
+ :rtype: CreateNotificationPolicyResponse
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('notifyRuleId') is not None:
60
+ self.notify_rule_id = m.get('notifyRuleId')
61
+ return self