rusty_cdk_core/apigateway/
dto.rs

1use serde::Serialize;
2use serde_json::Value;
3use crate::{dto_methods, ref_struct};
4use crate::shared::Id;
5
6ref_struct!(ApiGatewayV2ApiRef);
7
8#[derive(Debug, Serialize)]
9pub struct ApiGatewayV2Api {
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: ApiGatewayV2ApiProperties,
18}
19dto_methods!(ApiGatewayV2Api);
20
21#[derive(Debug, Serialize)]
22pub struct ApiGatewayV2ApiProperties {
23    #[serde(rename = "Name", skip_serializing_if = "Option::is_none")]
24    pub(super) name: Option<String>,
25    #[serde(rename = "ProtocolType")]
26    pub(super) protocol_type: String,
27    #[serde(rename = "DisableExecuteApiEndpoint", skip_serializing_if = "Option::is_none")]
28    pub(super) disable_execute_api_endpoint: Option<bool>,
29    #[serde(rename = "CorsConfiguration", skip_serializing_if = "Option::is_none")]
30    pub(super) cors_configuration: Option<CorsConfiguration>,
31}
32
33#[derive(Debug, Serialize)]
34pub struct CorsConfiguration {
35    #[serde(rename = "AllowCredentials", skip_serializing_if = "Option::is_none")]
36    pub(super) allow_credentials: Option<bool>,
37    #[serde(rename = "AllowHeaders", skip_serializing_if = "Option::is_none")]
38    pub(super) allow_headers: Option<Vec<String>>,
39    #[serde(rename = "AllowMethods", skip_serializing_if = "Option::is_none")]
40    pub(super) allow_methods: Option<Vec<String>>,
41    #[serde(rename = "AllowOrigins", skip_serializing_if = "Option::is_none")]
42    pub(super) allow_origins: Option<Vec<String>>,
43    #[serde(rename = "ExposeHeaders", skip_serializing_if = "Option::is_none")]
44    pub(super) expose_headers: Option<Vec<String>>,
45    #[serde(rename = "MaxAge", skip_serializing_if = "Option::is_none")]
46    pub(super) max_age: Option<u64>,
47}
48
49ref_struct!(ApiGatewayV2StageRef);
50
51#[derive(Debug, Serialize)]
52pub struct ApiGatewayV2Stage {
53    #[serde(skip)]
54    pub(super) id: Id,
55    #[serde(skip)]
56    pub(super) resource_id: String,
57    #[serde(rename = "Type")]
58    pub(super) r#type: String,
59    #[serde(rename = "Properties")]
60    pub(super) properties: ApiGatewayV2StageProperties,
61}
62dto_methods!(ApiGatewayV2Stage);
63
64#[derive(Debug, Serialize)]
65pub struct ApiGatewayV2StageProperties {
66    #[serde(rename = "ApiId")]
67    pub(super) api_id: Value,
68    #[serde(rename = "StageName")]
69    pub(super) stage_name: String,
70    #[serde(rename = "AutoDeploy")]
71    pub(super) auto_deploy: bool,
72    #[serde(rename = "DefaultRouteSettings", skip_serializing_if = "Option::is_none")]
73    pub(super) default_route_settings: Option<RouteSettings>,
74    #[serde(rename = "RouteSettings", skip_serializing_if = "Option::is_none")]
75    pub(super) route_settings: Option<Value>,
76}
77
78ref_struct!(ApiGatewayV2IntegrationRef);
79
80#[derive(Debug, Serialize)]
81pub struct ApiGatewayV2Integration {
82    #[serde(skip)]
83    pub(super) id: Id,
84    #[serde(skip)]
85    pub(super) resource_id: String,
86    #[serde(rename = "Type")]
87    pub(super) r#type: String,
88    #[serde(rename = "Properties")]
89    pub(super) properties: ApiGatewayV2IntegrationProperties,
90}
91dto_methods!(ApiGatewayV2Integration);
92
93#[derive(Debug, Serialize)]
94pub struct ApiGatewayV2IntegrationProperties {
95    #[serde(rename = "ApiId")]
96    pub(super) api_id: Value,
97    #[serde(rename = "IntegrationType")]
98    pub(super) integration_type: String,
99    #[serde(rename = "CredentialsArn", skip_serializing_if = "Option::is_none")]
100    pub(super) integration_method: Option<String>,
101    #[serde(rename = "IntegrationUri", skip_serializing_if = "Option::is_none")]
102    pub(super) integration_uri: Option<Value>,
103    #[serde(rename = "PassthroughBehavior", skip_serializing_if = "Option::is_none")]
104    pub(super) passthrough_behavior: Option<String>,
105    #[serde(rename = "PayloadFormatVersion", skip_serializing_if = "Option::is_none")]
106    pub(super) payload_format_version: Option<String>,
107    #[serde(rename = "RequestParameters", skip_serializing_if = "Option::is_none")]
108    pub(super) request_parameters: Option<Value>,
109    #[serde(rename = "RequestTemplates", skip_serializing_if = "Option::is_none")]
110    pub(super) request_templates: Option<Value>,
111    #[serde(rename = "ResponseParameters", skip_serializing_if = "Option::is_none")]
112    pub(super) response_parameters: Option<Value>,
113    #[serde(rename = "TimeoutInMillis", skip_serializing_if = "Option::is_none")]
114    pub(super) timeout_in_millis: Option<u32>,
115}
116
117ref_struct!(ApiGatewayV2RouteRef);
118
119#[derive(Debug, Serialize)]
120pub struct ApiGatewayV2Route {
121    #[serde(skip)]
122    pub(super) id: Id,
123    #[serde(skip)]
124    pub(super) resource_id: String,
125    #[serde(rename = "Type")]
126    pub(super) r#type: String,
127    #[serde(rename = "Properties")]
128    pub(super) properties: ApiGatewayV2RouteProperties,
129}
130dto_methods!(ApiGatewayV2Route);
131
132#[derive(Debug, Serialize)]
133pub struct ApiGatewayV2RouteProperties {
134    #[serde(rename = "ApiId")]
135    pub(super) api_id: Value,
136    #[serde(rename = "RouteKey")]
137    pub(super) route_key: String,
138    #[serde(rename = "Target", skip_serializing_if = "Option::is_none")]
139    pub(super) target: Option<Value>,
140}
141
142#[derive(Debug, Serialize)]
143pub struct RouteSettings {
144    #[serde(rename = "ThrottlingBurstLimit", skip_serializing_if = "Option::is_none")]
145    pub(super) throttling_burst_limit: Option<u32>,
146    #[serde(rename = "ThrottlingRateLimit", skip_serializing_if = "Option::is_none")]
147    pub(super) throttling_rate_limit: Option<f64>,
148}