rusty_cdk_core/sns/
dto.rs

1use serde::Serialize;
2use serde_json::Value;
3use crate::{dto_methods, ref_struct_with_id_methods};
4use crate::iam::PolicyDocument;
5use crate::shared::Id;
6
7ref_struct_with_id_methods!(TopicRef);
8
9#[derive(Debug, Serialize)]
10pub struct Topic {
11    #[serde(skip)]
12    pub(super) id: Id,
13    #[serde(skip)]
14    pub(super) resource_id: String,
15    #[serde(rename = "Type")]
16    pub(super) r#type: String,
17    #[serde(rename = "Properties")]
18    pub(super) properties: TopicProperties,
19}
20dto_methods!(Topic);
21
22#[derive(Debug, Serialize)]
23pub struct TopicProperties {
24    #[serde(rename = "TopicName", skip_serializing_if = "Option::is_none")]
25    pub(super) topic_name: Option<String>,
26    #[serde(rename = "FifoTopic", skip_serializing_if = "Option::is_none")]
27    pub(super) fifo_topic: Option<bool>,
28    #[serde(rename = "ContentBasedDeduplication", skip_serializing_if = "Option::is_none")]
29    pub(super) content_based_deduplication: Option<bool>,
30    #[serde(rename = "FifoThroughputScope", skip_serializing_if = "Option::is_none")]
31    pub(super) fifo_throughput_scope: Option<String>,
32}
33
34ref_struct_with_id_methods!(TopicPolicyRef);
35
36#[derive(Debug, Serialize)]
37pub struct TopicPolicy {
38    #[serde(skip)]
39    pub(super) id: Id,
40    #[serde(skip)]
41    pub(super) resource_id: String,
42    #[serde(rename = "Type")]
43    pub(super) r#type: String,
44    #[serde(rename = "Properties")]
45    pub(crate) properties: TopicPolicyProperties,
46}
47dto_methods!(TopicPolicy);
48
49#[derive(Debug, Serialize)]
50pub struct TopicPolicyProperties {
51    #[serde(rename = "PolicyDocument")]
52    pub(crate) doc: PolicyDocument,
53    #[serde(rename = "Topics")]
54    pub(super) topics: Vec<Value>,
55}
56
57#[derive(Debug, Serialize)]
58pub struct Subscription {
59    #[serde(skip)]
60    pub(super) id: Id,
61    #[serde(skip)]
62    pub(super) resource_id: String,
63    #[serde(rename = "Type")]
64    pub(super) r#type: String,
65    #[serde(rename = "Properties")]
66    pub(super) properties: SnsSubscriptionProperties,
67}
68dto_methods!(Subscription);
69
70#[derive(Debug, Serialize)]
71pub struct SnsSubscriptionProperties {
72    #[serde(rename = "Protocol")]
73    pub(super) protocol: String,
74    #[serde(rename = "Endpoint")]
75    pub(super) endpoint: Value,
76    #[serde(rename = "TopicArn")]
77    pub(super) topic_arn: Value
78}