-
-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathmod.rs
More file actions
94 lines (80 loc) · 3.22 KB
/
Copy pathmod.rs
File metadata and controls
94 lines (80 loc) · 3.22 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
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 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},
};
use stackable_versioned::versioned;
use tpcds::TpcdsConnector;
use tpch::TpchConnector;
use self::delta_lake::DeltaLakeConnector;
#[versioned(version(name = "v1alpha1"), options(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(k8s(
group = "trino.stackable.tech",
kind = "TrinoCatalog",
plural = "trinocatalogs",
namespaced,
crates(
kube_core = "stackable_operator::kube::core",
k8s_openapi = "stackable_operator::k8s_openapi",
schemars = "stackable_operator::schemars"
)
))]
#[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,
#[serde(default)]
/// The `configOverrides` allow overriding arbitrary Trino settings.
/// For example, for Hive you could add `hive.metastore.username: trino`.
pub config_overrides: HashMap<String, 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),
/// 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 crate::crd::catalog::TrinoCatalog;
#[test]
fn test_crd_generation() {
TrinoCatalog::merged_crd(TrinoCatalog::V1Alpha1).unwrap();
}
}