Skip to main content

winterbaume_keyspaces/
types.rs

1use std::collections::HashMap;
2
3use chrono::{DateTime, Utc};
4
5/// In-memory representation of a keyspace.
6#[derive(Debug, Clone)]
7pub struct Keyspace {
8    pub name: String,
9    pub arn: String,
10    pub replication_strategy: String,
11    pub replication_regions: Vec<String>,
12    pub tags: HashMap<String, String>,
13    pub creation_timestamp: DateTime<Utc>,
14    pub status: String,
15}
16
17/// In-memory representation of a table within a keyspace.
18#[derive(Debug, Clone)]
19pub struct Table {
20    pub keyspace_name: String,
21    pub table_name: String,
22    pub arn: String,
23    pub schema_definition: SchemaDefinition,
24    pub capacity_mode: String,
25    pub read_capacity_units: Option<i64>,
26    pub write_capacity_units: Option<i64>,
27    pub encryption_type: String,
28    pub kms_key_identifier: Option<String>,
29    pub point_in_time_recovery_enabled: bool,
30    pub ttl_status: String,
31    pub default_time_to_live: Option<i32>,
32    pub comment: String,
33    pub client_side_timestamps_enabled: bool,
34    pub tags: HashMap<String, String>,
35    pub creation_timestamp: DateTime<Utc>,
36    pub status: String,
37}
38
39/// In-memory representation of a user-defined type.
40#[derive(Debug, Clone)]
41pub struct UserDefinedType {
42    pub keyspace_name: String,
43    pub type_name: String,
44    pub field_definitions: Vec<FieldDefinition>,
45    pub creation_timestamp: DateTime<Utc>,
46    pub status: String,
47}
48
49#[derive(Debug, Clone)]
50pub struct SchemaDefinition {
51    pub all_columns: Vec<ColumnDefinition>,
52    pub partition_keys: Vec<String>,
53    pub clustering_keys: Vec<ClusteringKey>,
54    pub static_columns: Vec<String>,
55}
56
57#[derive(Debug, Clone)]
58pub struct ColumnDefinition {
59    pub name: String,
60    pub column_type: String,
61}
62
63#[derive(Debug, Clone)]
64pub struct ClusteringKey {
65    pub name: String,
66    pub order_by: String,
67}
68
69#[derive(Debug, Clone)]
70pub struct FieldDefinition {
71    pub name: String,
72    pub field_type: String,
73}