rusty_cdk_core/appsync/
dto.rs

1use serde_json::Value;
2use serde::Serialize;
3use crate::{dto_methods, ref_struct};
4use crate::shared::Id;
5
6ref_struct!(AppSyncApiRef);
7
8#[derive(Debug, Serialize)]
9pub struct AppSyncApi {
10    #[serde(skip)]
11    pub(crate) id: Id,
12    #[serde(skip)]
13    pub(crate) resource_id: String,
14    #[serde(rename = "Type")]
15    pub(crate) r#type: String,
16    #[serde(rename = "Properties")]
17    pub(crate) properties: AppSyncApiProperties,
18}
19dto_methods!(AppSyncApi);
20
21#[derive(Debug, Serialize)]
22pub struct AppSyncApiProperties {
23    #[serde(rename = "Name")]
24    pub(crate) name: String,
25    #[serde(rename = "EventConfig", skip_serializing_if = "Option::is_none")]
26    pub(crate) event_config: Option<EventConfig>,
27}
28
29#[derive(Debug, Serialize)]
30pub struct EventConfig {
31    #[serde(rename = "AuthProviders")]
32    pub(crate) auth_providers: Vec<AuthProvider>,
33    #[serde(rename = "ConnectionAuthModes")]
34    pub(crate) connection_auth_modes: Vec<AppSyncAuthMode>,
35    #[serde(rename = "DefaultPublishAuthModes")]
36    pub(crate) default_auth_modes: Vec<AppSyncAuthMode>,
37    #[serde(rename = "DefaultSubscribeAuthModes")]
38    pub(crate) default_subscribe_auth_modes: Vec<AppSyncAuthMode>,
39    #[serde(rename = "LogConfig", skip_serializing_if = "Option::is_none")]
40    pub(crate) log_config: Option<EventLogConfig>,
41}
42
43#[derive(Debug, Serialize)]
44pub struct AuthProvider {
45    #[serde(rename = "AuthType")]
46    pub(crate) auth_type: String,
47    #[serde(rename = "CognitoConfig", skip_serializing_if = "Option::is_none")]
48    pub(crate) cognito_config: Option<CognitoConfig>,
49    #[serde(rename = "LambdaAuthorizerConfig", skip_serializing_if = "Option::is_none")]
50    pub(crate) lambda_auth_config: Option<LambdaAuthorizerConfig>,
51    #[serde(rename = "OpenIDConnectConfig", skip_serializing_if = "Option::is_none")]
52    pub(crate) open_id_connect_config: Option<OpenIDConnectConfig>,
53}
54
55#[derive(Debug, Serialize)]
56pub struct CognitoConfig {
57    #[serde(rename = "AwsRegion")]
58    pub(crate) aws_region: String,
59    #[serde(rename = "UserPoolId")]
60    pub(crate) user_pool_id: String,
61    // AppIdClientRegex: String
62}
63
64#[derive(Debug, Serialize)]
65pub struct LambdaAuthorizerConfig {
66    #[serde(rename = "AuthorizerResultTtlInSeconds", skip_serializing_if = "Option::is_none")]
67    pub(crate) authorizer_result_ttl_seconds: Option<u16>,
68    #[serde(rename = "AuthorizerUri")]
69    pub(crate) authorizer_uri: String,
70    // IdentityValidationExpression: String
71}
72
73#[derive(Debug, Serialize)]
74pub struct OpenIDConnectConfig {
75    #[serde(rename = "AuthTTL", skip_serializing_if = "Option::is_none")]
76    pub(crate) auth_ttl_millis: Option<u32>,
77    #[serde(rename = "ClientId", skip_serializing_if = "Option::is_none")]
78    pub(crate) client_id: Option<String>,
79    #[serde(rename = "IatTTL", skip_serializing_if = "Option::is_none")]
80    pub(crate) iat_ttl_millis: Option<u32>,
81    #[serde(rename = "Issuer")]
82    pub(crate) issuer: String
83}
84
85#[derive(Debug, Serialize)]
86pub struct AppSyncAuthMode {
87    #[serde(rename = "AuthType", skip_serializing_if = "Option::is_none")]
88    pub(crate) auth_type: Option<String>
89}
90
91#[derive(Debug, Serialize)]
92pub struct EventLogConfig {
93    #[serde(rename = "CloudWatchLogsRoleArn")]
94    pub(crate) cloudwatch_logs_role_arn: String,
95    #[serde(rename = "LogLevel")]
96    pub(crate) log_level: String
97}
98
99ref_struct!(ChannelNamespaceRef);
100
101#[derive(Debug, Serialize)]
102pub struct ChannelNamespace {
103    #[serde(skip)]
104    pub(crate) id: Id,
105    #[serde(skip)]
106    pub(crate) resource_id: String,
107    #[serde(rename = "Type")]
108    pub(crate) r#type: String,
109    #[serde(rename = "Properties")]
110    pub(crate) properties: ChannelNamespaceProperties,
111}
112dto_methods!(ChannelNamespace);
113
114#[derive(Debug, Serialize)]
115pub struct ChannelNamespaceProperties {
116    #[serde(rename = "ApiId")]
117    pub(crate) api_id: Value,
118    #[serde(rename = "Name")]
119    pub(crate) name: String,
120    #[serde(rename = "PublishAuthModes", skip_serializing_if = "Option::is_none")]
121    pub(crate) publish_auth_modes: Option<Vec<AppSyncAuthMode>>,
122    #[serde(rename = "SubscribeAuthModes", skip_serializing_if = "Option::is_none")]
123    pub(crate) subscribe_auth_modes: Option<Vec<AppSyncAuthMode>>,
124    // CodeHandlers: String
125    // CodeS3Location: String
126    // HandlerConfigs
127}