rusty_cdk_core/dynamodb/
dto.rs1use serde::Serialize;
2use serde_json::Value;
3use crate::{dto_methods, ref_struct};
4use crate::shared::Id;
5
6ref_struct!(TableRef);
7
8#[derive(Debug, Serialize)]
9pub struct Table {
10 #[serde(skip)]
11 pub(super) id: Id,
12 #[serde(skip)]
13 pub(super) resource_id: String,
14 #[serde(rename = "Type")]
15 pub(super) r#type: String,
16 #[serde(rename = "Properties")]
17 pub(super) properties: TableProperties,
18}
19dto_methods!(Table);
20
21#[derive(Debug, Serialize)]
22pub struct TableProperties {
23 #[serde(rename = "KeySchema")]
24 pub(super) key_schema: Vec<KeySchema>,
25 #[serde(rename = "AttributeDefinitions")]
26 pub(super) attribute_definitions: Vec<AttributeDefinition>,
27 #[serde(rename = "BillingMode")]
28 pub(super) billing_mode: String,
29 #[serde(rename = "ProvisionedThroughput", skip_serializing_if = "Option::is_none")]
30 pub(super) provisioned_throughput: Option<ProvisionedThroughput>,
31 #[serde(rename = "OnDemandThroughput", skip_serializing_if = "Option::is_none")]
32 pub(super) on_demand_throughput: Option<OnDemandThroughput>,
33 }
41
42#[derive(Debug, Serialize)]
43pub struct AttributeDefinition {
44 #[serde(rename = "AttributeName")]
45 pub(super) attribute_name: String,
46 #[serde(rename = "AttributeType")]
47 pub(super) attribute_type: String,
48}
49
50#[derive(Debug, Serialize)]
51pub struct KeySchema {
52 #[serde(rename = "AttributeName")]
53 pub(super) attribute_name: String,
54 #[serde(rename = "KeyType")]
55 pub(super) key_type: String,
56}
57
58#[derive(Debug, Serialize)]
59pub struct ProvisionedThroughput {
60 #[serde(rename = "ReadCapacityUnits")]
61 pub(super) read_capacity: u32,
62 #[serde(rename = "WriteCapacityUnits")]
63 pub(super) write_capacity: u32,
64}
65
66#[derive(Debug, Serialize)]
67pub struct OnDemandThroughput {
68 #[serde(rename = "MaxReadRequestUnits", skip_serializing_if = "Option::is_none")]
69 pub(super) max_read_capacity: Option<u32>,
70 #[serde(rename = "MaxWriteRequestUnits", skip_serializing_if = "Option::is_none")]
71 pub(super) max_write_capacity: Option<u32>,
72}