-
-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathmod.rs
More file actions
117 lines (98 loc) · 4.16 KB
/
Copy pathmod.rs
File metadata and controls
117 lines (98 loc) · 4.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
pub mod black_hole;
pub mod commons;
pub mod delta_lake;
pub mod generic;
pub mod google_sheet;
pub mod hive;
pub mod iceberg;
pub mod postgresql;
pub mod tpcds;
pub mod tpch;
use std::collections::HashMap;
use black_hole::BlackHoleConnector;
use generic::GenericConnector;
use google_sheet::GoogleSheetConnector;
use hive::HiveConnector;
use iceberg::IcebergConnector;
use serde::{Deserialize, Serialize};
use stackable_operator::{
kube::CustomResource,
schemars::{self, JsonSchema},
versioned::versioned,
};
use tpcds::TpcdsConnector;
use tpch::TpchConnector;
use self::delta_lake::DeltaLakeConnector;
use crate::crd::catalog::postgresql::PostgresqlConnector;
#[versioned(
version(name = "v1alpha1"),
crates(
kube_core = "stackable_operator::kube::core",
kube_client = "stackable_operator::kube::client",
k8s_openapi = "stackable_operator::k8s_openapi",
schemars = "stackable_operator::schemars",
versioned = "stackable_operator::versioned",
),
skip(from)
)]
pub mod versioned {
/// The TrinoCatalog resource can be used to define catalogs in Kubernetes objects.
/// Read more about it in the [Trino operator concept docs](DOCS_BASE_URL_PLACEHOLDER/trino/concepts)
/// and the [Trino operator usage guide](DOCS_BASE_URL_PLACEHOLDER/trino/usage-guide/catalogs/).
/// The documentation also contains a list of all the supported backends.
#[versioned(crd(group = "trino.stackable.tech", plural = "trinocatalogs", namespaced,))]
#[derive(Clone, CustomResource, Debug, Deserialize, JsonSchema, PartialEq, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct TrinoCatalogSpec {
/// The `connector` defines which connector is used.
pub connector: TrinoCatalogConnector,
/// The `configOverrides` allow overriding arbitrary Trino settings.
/// For example, for Hive you could add `hive.metastore.username: trino`.
#[serde(default)]
pub config_overrides: HashMap<String, String>,
/// List of config properties which should be removed.
///
/// This is helpful, because Trino fails to start in case you have any unused config
/// properties. The removals are executed after the `configOverrides`.
///
/// This field is experimental, and might be replaced by a more generic mechanism to edit config properties
#[serde(default, rename = "experimentalConfigRemovals")]
pub config_removals: Vec<String>,
}
}
#[derive(Clone, Debug, Deserialize, JsonSchema, PartialEq, Serialize)]
#[serde(rename_all = "camelCase")]
pub enum TrinoCatalogConnector {
/// A [Black Hole](DOCS_BASE_URL_PLACEHOLDER/trino/usage-guide/catalogs/black-hole) connector.
BlackHole(BlackHoleConnector),
/// An [Delta Lake](DOCS_BASE_URL_PLACEHOLDER/trino/usage-guide/catalogs/delta-lake) connector.
DeltaLake(DeltaLakeConnector),
/// A [Google sheets](DOCS_BASE_URL_PLACEHOLDER/trino/usage-guide/catalogs/google-sheets) connector.
GoogleSheet(GoogleSheetConnector),
/// A [generic](DOCS_BASE_URL_PLACEHOLDER/trino/usage-guide/catalogs/generic) connector.
Generic(GenericConnector),
/// An [Apache Hive](DOCS_BASE_URL_PLACEHOLDER/trino/usage-guide/catalogs/hive) connector.
Hive(HiveConnector),
/// An [Apache Iceberg](DOCS_BASE_URL_PLACEHOLDER/trino/usage-guide/catalogs/iceberg) connector.
Iceberg(IcebergConnector),
/// An [PostgreSQL](DOCS_BASE_URL_PLACEHOLDER/trino/usage-guide/catalogs/postgresql) connector.
Postgresql(PostgresqlConnector),
/// A [TPC-DS](DOCS_BASE_URL_PLACEHOLDER/trino/usage-guide/catalogs/tpcds) connector.
Tpcds(TpcdsConnector),
/// A [TPC-H](DOCS_BASE_URL_PLACEHOLDER/trino/usage-guide/catalogs/tpch) connector.
Tpch(TpchConnector),
}
#[cfg(test)]
mod tests {
use stackable_operator::versioned::test_utils::RoundtripTestData;
use super::{TrinoCatalog, TrinoCatalogVersion, v1alpha1};
#[test]
fn test_crd_generation() {
TrinoCatalog::merged_crd(TrinoCatalogVersion::V1Alpha1).unwrap();
}
impl RoundtripTestData for v1alpha1::TrinoCatalogSpec {
fn roundtrip_test_data() -> Vec<Self> {
vec![]
}
}
}