ds_event_stream_rs_sdk/model/topics.rs
1//! Topics module.
2//!
3//! ## Overview
4//! This module contains the topics for the DS Event Stream.
5//!
6//! ## Features
7//! * Get the topics for the DS Event Stream.
8//!
9//! ### Example
10//! ```
11//! use ds_event_stream_rs_sdk::model::topics::Topic;
12//!
13//! let topic = Topic::DsPipelineJobRequested;
14//! assert_eq!(topic.to_string(), "ds.pipeline..job.requested.v1");
15//! ```
16
17use regex::Regex;
18use strum::{AsRefStr, Display, EnumIter, EnumString, IntoEnumIterator};
19
20use crate::utils::error::UtilsError;
21
22// region: --> Topic
23
24///
25/// This enum contains all the topics for the DS Event Stream.
26///
27/// # Topics
28///
29/// * `IdpIdentityUserCreated` - The event when an identity user is created.
30/// * `IdpIdentityUserUpdated` - The event when an identity user is updated.
31/// * `IdpIdentityUserDeleted` - The event when an identity user is deleted.
32/// * `IdpIdentityUserAuthenticated` - The event when an identity user is authenticated.
33/// * `IdpIdentityTenantCreated` - The event when an identity tenant is created.
34/// * `IdpIdentityTenantUpdated` - The event when an identity tenant is updated.
35/// * `IdpIdentityTenantDeleted` - The event when an identity tenant is deleted.
36///
37/// * `DsPipelineJobRequested` - The event when a pipeline job is requested.
38/// * `DsPipelineJobStarted` - The event when a pipeline job is started.
39/// * `DsPipelineJobCompleted` - The event when a pipeline job is completed.
40/// * `DsPipelineJobFailed` - The event when a pipeline job is failed.
41///
42/// * `DsPipelineInjectionTaskRequested` - The event when a pipeline injection task is requested.
43/// * `DsPipelineInjectionTaskQueued` - The event when a pipeline injection task is queued.
44/// * `DsPipelineInjectionTaskStarted` - The event when a pipeline injection task is started.
45/// * `DsPipelineInjectionTaskCompleted` - The event when a pipeline injection task is completed.
46/// * `DsPipelineInjectionTaskFailed` - The event when a pipeline injection task is failed.
47/// * `DsPipelineInjectionMetricCreated` - The event when a pipeline injection metric is created.
48///
49/// * `DsPipelineTransformTaskRequested` - The event when a pipeline transform task is requested.
50/// * `DsPipelineTransformTaskQueued` - The event when a pipeline transform task is queued.
51/// * `DsPipelineTransformTaskStarted` - The event when a pipeline transform task is started.
52/// * `DsPipelineTransformTaskCompleted` - The event when a pipeline transform task is completed.
53/// * `DsPipelineTransformTaskFailed` - The event when a pipeline transform task is failed.
54/// * `DsPipelineTransformMetricCreated` - The event when a pipeline transform metric is created.
55///
56/// * `DsPipelineMigratorTaskRequested` - The event when a pipeline migrator task is requested.
57/// * `DsPipelineMigratorTaskQueued` - The event when a pipeline migrator task is queued.
58/// * `DsPipelineMigratorTaskStarted` - The event when a pipeline migrator task is started.
59/// * `DsPipelineMigratorTaskCompleted` - The event when a pipeline migrator task is completed.
60/// * `DsPipelineMigratorTaskFailed` - The event when a pipeline migrator task is failed.
61/// * `DsPipelineMigratorMetricCreated` - The event when a pipeline migrator metric is created.
62///
63/// * `DsPipelineSynchronizerJobRequested` - The event when a pipeline synchronizer job is requested.
64/// * `DsPipelineSynchronizerJobQueued` - The event when a pipeline synchronizer job is queued.
65/// * `DsPipelineSynchronizerJobStarted` - The event when a pipeline synchronizer job is started.
66/// * `DsPipelineSynchronizerJobCompleted` - The event when a pipeline synchronizer job is completed.
67/// * `DsPipelineSynchronizerJobFailed` - The event when a pipeline synchronizer job is failed.
68///
69/// * `DsPipelineSynchronizerTaskRequested` - The event when a pipeline synchronizer task is requested.
70/// * `DsPipelineSynchronizerTaskQueued` - The event when a pipeline synchronizer task is queued.
71/// * `DsPipelineSynchronizerTaskStarted` - The event when a pipeline synchronizer task is started.
72/// * `DsPipelineSynchronizerTaskCompleted` - The event when a pipeline synchronizer task is completed.
73/// * `DsPipelineSynchronizerTaskFailed` - The event when a pipeline synchronizer task is failed.
74/// * `DsPipelineSynchronizerMetricCreated` - The event when a pipeline synchronizer metric is created.
75///
76/// * `DsPipelineCloneJobRequested` - The event when a pipeline clone job is requested.
77/// * `DsPipelineCloneJobQueued` - The event when a pipeline clone job is queued.
78/// * `DsPipelineCloneJobStarted` - The event when a pipeline clone job is started.
79/// * `DsPipelineCloneJobCompleted` - The event when a pipeline clone job is completed.
80/// * `DsPipelineCloneJobFailed` - The event when a pipeline clone job is failed.
81/// * `DsPipelineCloneMetricCreated` - The event when a pipeline clone metric is created.
82///
83/// * `DsPipelineCloneTaskRequested` - The event when a pipeline clone task is requested.
84/// * `DsPipelineCloneTaskQueued` - The event when a pipeline clone task is queued.
85/// * `DsPipelineCloneTaskStarted` - The event when a pipeline clone task is started.
86/// * `DsPipelineCloneTaskCompleted` - The event when a pipeline clone task is completed.
87/// * `DsPipelineCloneTaskFailed` - The event when a pipeline clone task is failed.
88///
89/// * `DsWorkflowPipelineJobRequested` - The event when a workflow pipeline job is requested.
90/// * `DsWorkflowPipelineJobQueued` - The event when a workflow pipeline job is queued.
91/// * `DsWorkflowPipelineJobStarted` - The event when a workflow pipeline job is started.
92/// * `DsWorkflowPipelineJobCompleted` - The event when a workflow pipeline job is completed.
93/// * `DsWorkflowPipelineJobFailed` - The event when a workflow pipeline job is failed.
94///
95/// * `DsWorkflowPipelineTaskStarted` - The event when a workflow pipeline task is started.
96/// * `DsWorkflowPipelineTaskCompleted` - The event when a workflow pipeline task is completed.
97/// * `DsWorkflowPipelineTaskFailed` - The event when a workflow pipeline task is failed.
98///
99/// * `DsWorkflowPipelineCreated` - The event when a workflow pipeline is created.
100/// * `DsWorkflowPipelineUpdated` - The event when a workflow pipeline is updated.
101/// * `DsWorkflowPipelineDeleted` - The event when a workflow pipeline is deleted.
102///
103/// * `DsWorkflowDatasetCreated` - The event when a workflow dataset is created.
104/// * `DsWorkflowDatasetUpdated` - The event when a workflow dataset is updated.
105/// * `DsWorkflowDatasetDeleted` - The event when a workflow dataset is deleted.
106///
107/// * `DsWorkflowLinkedServiceCreated` - The event when a workflow linked service is created.
108/// * `DsWorkflowLinkedServiceUpdated` - The event when a workflow linked service is updated.
109/// * `DsWorkflowLinkedServiceDeleted` - The event when a workflow linked service is deleted.
110///
111/// * `DsCoreProvisionJobRequested` - The event when a core provision job is requested.
112/// * `DsCoreProvisionJobCompleted` - The event when a core provision job is completed.
113/// * `DsCoreProvisionJobFailed` - The event when a core provision job is failed.
114///
115/// * `DsCoreConfigInfoUpdated` - The event when a core config info is updated.
116/// * `DsCoreConfigStatusUpdated` - The event when a core config status is updated.
117///
118/// * `DsCoreBillingUsageCreated` - The event when a core billing usage is created.
119
120#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Display, AsRefStr, EnumString, EnumIter)]
121pub enum Topic {
122 // IDP Identity User Events
123 #[strum(serialize = "idp.identity..user.created.v1")]
124 IdpIdentityUserCreated,
125 #[strum(serialize = "idp.identity..user.updated.v1")]
126 IdpIdentityUserUpdated,
127 #[strum(serialize = "idp.identity..user.deleted.v1")]
128 IdpIdentityUserDeleted,
129 #[strum(serialize = "idp.identity..user.authenticated.v1")]
130 IdpIdentityUserAuthenticated,
131
132 // IDP Identity Tenant Events
133 #[strum(serialize = "idp.identity..tenant.created.v1")]
134 IdpIdentityTenantCreated,
135 #[strum(serialize = "idp.identity..tenant.updated.v1")]
136 IdpIdentityTenantUpdated,
137 #[strum(serialize = "idp.identity..tenant.deleted.v1")]
138 IdpIdentityTenantDeleted,
139
140 // DS Pipeline Job Events
141 #[strum(serialize = "ds.pipeline..job.requested.v1")]
142 DsPipelineJobRequested,
143 #[strum(serialize = "ds.pipeline..job.started.v1")]
144 DsPipelineJobStarted,
145 #[strum(serialize = "ds.pipeline..job.completed.v1")]
146 DsPipelineJobCompleted,
147 #[strum(serialize = "ds.pipeline..job.failed.v1")]
148 DsPipelineJobFailed,
149
150 // DS Pipeline Injection Task Events
151 #[strum(serialize = "ds.pipeline.injection.task.requested.v1")]
152 DsPipelineInjectionTaskRequested,
153 #[strum(serialize = "ds.pipeline.injection.task.queued.v1")]
154 DsPipelineInjectionTaskQueued,
155 #[strum(serialize = "ds.pipeline.injection.task.started.v1")]
156 DsPipelineInjectionTaskStarted,
157 #[strum(serialize = "ds.pipeline.injection.task.completed.v1")]
158 DsPipelineInjectionTaskCompleted,
159 #[strum(serialize = "ds.pipeline.injection.task.failed.v1")]
160 DsPipelineInjectionTaskFailed,
161 #[strum(serialize = "ds.pipeline.injection.metric.created.v1")]
162 DsPipelineInjectionMetricCreated,
163
164 // DS Pipeline Transform Task Events
165 #[strum(serialize = "ds.pipeline.transform.task.requested.v1")]
166 DsPipelineTransformTaskRequested,
167 #[strum(serialize = "ds.pipeline.transform.task.queued.v1")]
168 DsPipelineTransformTaskQueued,
169 #[strum(serialize = "ds.pipeline.transform.task.started.v1")]
170 DsPipelineTransformTaskStarted,
171 #[strum(serialize = "ds.pipeline.transform.task.completed.v1")]
172 DsPipelineTransformTaskCompleted,
173 #[strum(serialize = "ds.pipeline.transform.task.failed.v1")]
174 DsPipelineTransformTaskFailed,
175 #[strum(serialize = "ds.pipeline.transform.metric.created.v1")]
176 DsPipelineTransformMetricCreated,
177
178 // DS Pipeline Migrator Task Events
179 #[strum(serialize = "ds.pipeline.migrator.task.requested.v1")]
180 DsPipelineMigratorTaskRequested,
181 #[strum(serialize = "ds.pipeline.migrator.task.queued.v1")]
182 DsPipelineMigratorTaskQueued,
183 #[strum(serialize = "ds.pipeline.migrator.task.started.v1")]
184 DsPipelineMigratorTaskStarted,
185 #[strum(serialize = "ds.pipeline.migrator.task.completed.v1")]
186 DsPipelineMigratorTaskCompleted,
187 #[strum(serialize = "ds.pipeline.migrator.task.failed.v1")]
188 DsPipelineMigratorTaskFailed,
189 #[strum(serialize = "ds.pipeline.migrator.metric.created.v1")]
190 DsPipelineMigratorMetricCreated,
191
192 // DS Pipeline Synchronizer Job Events
193 #[strum(serialize = "ds.pipeline.synchronizer.job.requested.v1")]
194 DsPipelineSynchronizerJobRequested,
195 #[strum(serialize = "ds.pipeline.synchronizer.job.queued.v1")]
196 DsPipelineSynchronizerJobQueued,
197 #[strum(serialize = "ds.pipeline.synchronizer.job.started.v1")]
198 DsPipelineSynchronizerJobStarted,
199 #[strum(serialize = "ds.pipeline.synchronizer.job.completed.v1")]
200 DsPipelineSynchronizerJobCompleted,
201 #[strum(serialize = "ds.pipeline.synchronizer.job.failed.v1")]
202 DsPipelineSynchronizerJobFailed,
203
204 // DS Pipeline Synchronizer Task Events
205 #[strum(serialize = "ds.pipeline.synchronizer.task.requested.v1")]
206 DsPipelineSynchronizerTaskRequested,
207 #[strum(serialize = "ds.pipeline.synchronizer.task.queued.v1")]
208 DsPipelineSynchronizerTaskQueued,
209 #[strum(serialize = "ds.pipeline.synchronizer.task.started.v1")]
210 DsPipelineSynchronizerTaskStarted,
211 #[strum(serialize = "ds.pipeline.synchronizer.task.completed.v1")]
212 DsPipelineSynchronizerTaskCompleted,
213 #[strum(serialize = "ds.pipeline.synchronizer.task.failed.v1")]
214 DsPipelineSynchronizerTaskFailed,
215 #[strum(serialize = "ds.pipeline.synchronizer.metric.created.v1")]
216 DsPipelineSynchronizerMetricCreated,
217
218 // DS Pipeline Clone Job Events
219 #[strum(serialize = "ds.pipeline.clone.job.requested.v1")]
220 DsPipelineCloneJobRequested,
221 #[strum(serialize = "ds.pipeline.clone.job.queued.v1")]
222 DsPipelineCloneJobQueued,
223 #[strum(serialize = "ds.pipeline.clone.job.started.v1")]
224 DsPipelineCloneJobStarted,
225 #[strum(serialize = "ds.pipeline.clone.job.completed.v1")]
226 DsPipelineCloneJobCompleted,
227 #[strum(serialize = "ds.pipeline.clone.job.failed.v1")]
228 DsPipelineCloneJobFailed,
229 #[strum(serialize = "ds.pipeline.clone.metric.created.v1")]
230 DsPipelineCloneMetricCreated,
231
232 // DS Pipeline Clone Task Events
233 #[strum(serialize = "ds.pipeline.clone.task.requested.v1")]
234 DsPipelineCloneTaskRequested,
235 #[strum(serialize = "ds.pipeline.clone.task.queued.v1")]
236 DsPipelineCloneTaskQueued,
237 #[strum(serialize = "ds.pipeline.clone.task.started.v1")]
238 DsPipelineCloneTaskStarted,
239 #[strum(serialize = "ds.pipeline.clone.task.completed.v1")]
240 DsPipelineCloneTaskCompleted,
241 #[strum(serialize = "ds.pipeline.clone.task.failed.v1")]
242 DsPipelineCloneTaskFailed,
243
244 // DS Workflow Pipeline Job Events
245 #[strum(serialize = "ds.workflow.pipeline.job.requested.v1")]
246 DsWorkflowPipelineJobRequested,
247 #[strum(serialize = "ds.workflow.pipeline.job.queued.v1")]
248 DsWorkflowPipelineJobQueued,
249 #[strum(serialize = "ds.workflow.pipeline.job.started.v1")]
250 DsWorkflowPipelineJobStarted,
251 #[strum(serialize = "ds.workflow.pipeline.job.completed.v1")]
252 DsWorkflowPipelineJobCompleted,
253 #[strum(serialize = "ds.workflow.pipeline.job.failed.v1")]
254 DsWorkflowPipelineJobFailed,
255
256 // DS Workflow Pipeline Task Events
257 #[strum(serialize = "ds.workflow.pipeline.task.started.v1")]
258 DsWorkflowPipelineTaskStarted,
259 #[strum(serialize = "ds.workflow.pipeline.task.completed.v1")]
260 DsWorkflowPipelineTaskCompleted,
261 #[strum(serialize = "ds.workflow.pipeline.task.failed.v1")]
262 DsWorkflowPipelineTaskFailed,
263
264 // DS Workflow Pipeline Events
265 #[strum(serialize = "ds.workflow..pipeline.created.v1")]
266 DsWorkflowPipelineCreated,
267 #[strum(serialize = "ds.workflow..pipeline.updated.v1")]
268 DsWorkflowPipelineUpdated,
269 #[strum(serialize = "ds.workflow..pipeline.deleted.v1")]
270 DsWorkflowPipelineDeleted,
271
272 // DS Workflow Dataset Events
273 #[strum(serialize = "ds.workflow..dataset.created.v1")]
274 DsWorkflowDatasetCreated,
275 #[strum(serialize = "ds.workflow..dataset.updated.v1")]
276 DsWorkflowDatasetUpdated,
277 #[strum(serialize = "ds.workflow..dataset.deleted.v1")]
278 DsWorkflowDatasetDeleted,
279
280 // DS Workflow Linked Service Events
281 #[strum(serialize = "ds.workflow..linked-service.created.v1")]
282 DsWorkflowLinkedServiceCreated,
283 #[strum(serialize = "ds.workflow..linked-service.updated.v1")]
284 DsWorkflowLinkedServiceUpdated,
285 #[strum(serialize = "ds.workflow..linked-service.deleted.v1")]
286 DsWorkflowLinkedServiceDeleted,
287
288 // DS Core Provision Job Events
289 #[strum(serialize = "ds.core.provision.job.requested.v1")]
290 DsCoreProvisionJobRequested,
291 #[strum(serialize = "ds.core.provision.job.completed.v1")]
292 DsCoreProvisionJobCompleted,
293 #[strum(serialize = "ds.core.provision.job.failed.v1")]
294 DsCoreProvisionJobFailed,
295
296 // DS Core Config Events
297 #[strum(serialize = "ds.core.config.info.updated.v1")]
298 DsCoreConfigInfoUpdated,
299 #[strum(serialize = "ds.core.config.status.updated.v1")]
300 DsCoreConfigStatusUpdated,
301
302 // DS Core Billing Events
303 #[strum(serialize = "ds.core.billing.usage.created.v1")]
304 DsCoreBillingUsageCreated,
305}
306
307impl Topic {
308 /// Get all the topics for the DS Event Stream.
309 ///
310 /// # Returns
311 /// A vector of all topics for the DS Event Stream.
312 ///
313 /// # Example
314 /// ```
315 /// use ds_event_stream_rs_sdk::model::topics::Topic;
316 /// let topics = Topic::get_all_topics();
317 /// assert!(!topics.is_empty());
318 /// ```
319 pub fn get_all_topics() -> Vec<Topic> {
320 Self::iter().collect()
321 }
322
323 /// Filter topics by regex pattern.
324 ///
325 /// # Arguments
326 /// * `pattern` - A regex pattern to match against topic names
327 ///
328 /// # Returns
329 /// A vector of topics that match the pattern
330 ///
331 /// # Example
332 /// ```
333 /// use ds_event_stream_rs_sdk::model::topics::Topic;
334 /// let pipeline_topics = Topic::filter_by_pattern(r"ds\.pipeline\.").unwrap();
335 /// assert!(!pipeline_topics.is_empty());
336 /// ```
337 pub fn filter_by_pattern(pattern: &str) -> Result<Vec<Topic>, UtilsError> {
338 let regex = Regex::new(pattern)?;
339 let topics = Self::iter().filter(|topic| regex.is_match(topic.as_ref())).collect();
340 Ok(topics)
341 }
342}
343
344// endregion: --> Topic