Skip to content

Commit c9e2d99

Browse files
authored
Removed network static enum (#22)
1 parent aff063f commit c9e2d99

File tree

3 files changed

+4
-30
lines changed

3 files changed

+4
-30
lines changed

Diff for: operator/src/controller.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use serde::{Deserialize, Serialize};
99
use std::{sync::Arc, time::Duration};
1010
use tracing::{error, info};
1111

12-
use crate::{build_api_key, build_hostname, patch_resource_status, Error, Metrics, Network, Result, State};
12+
use crate::{build_api_key, build_hostname, patch_resource_status, Error, Metrics, Result, State};
1313

1414
pub static CARDANO_NODE_PORT_FINALIZER: &str = "cardanonodeports.demeter.run";
1515

@@ -30,7 +30,7 @@ pub static CARDANO_NODE_PORT_FINALIZER: &str = "cardanonodeports.demeter.run";
3030
"#)]
3131
#[serde(rename_all = "camelCase")]
3232
pub struct CardanoNodePortSpec {
33-
pub network: Network,
33+
pub network: String,
3434
pub version: String,
3535
pub throughput_tier: String,
3636
}

Diff for: operator/src/lib.rs

-26
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
use std::fmt::{self, Display, Formatter};
2-
31
use prometheus::Registry;
4-
use schemars::JsonSchema;
5-
use serde::{Deserialize, Serialize};
62
use thiserror::Error;
73

84
#[derive(Error, Debug)]
@@ -78,28 +74,6 @@ impl Default for State {
7874
}
7975
}
8076

81-
#[derive(Debug, Clone, Deserialize, Serialize, JsonSchema)]
82-
pub enum Network {
83-
#[serde(rename = "mainnet")]
84-
Mainnet,
85-
#[serde(rename = "preprod")]
86-
Preprod,
87-
#[serde(rename = "preview")]
88-
Preview,
89-
#[serde(rename = "sanchonet")]
90-
Sanchonet,
91-
}
92-
impl Display for Network {
93-
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
94-
match self {
95-
Network::Mainnet => write!(f, "mainnet"),
96-
Network::Preprod => write!(f, "preprod"),
97-
Network::Preview => write!(f, "preview"),
98-
Network::Sanchonet => write!(f, "sanchonet"),
99-
}
100-
}
101-
}
102-
10377
pub use k8s_openapi;
10478
pub use kube;
10579

Diff for: operator/src/utils.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use kube::{
88
};
99
use serde_json::json;
1010

11-
use crate::{get_config, CardanoNodePort, Error, Network};
11+
use crate::{get_config, CardanoNodePort, Error};
1212

1313
pub async fn patch_resource_status(
1414
client: Client,
@@ -26,7 +26,7 @@ pub async fn patch_resource_status(
2626
Ok(())
2727
}
2828

29-
pub fn build_hostname(network: &Network, version: &str, key: &str) -> String {
29+
pub fn build_hostname(network: &str, version: &str, key: &str) -> String {
3030
let config = get_config();
3131
let extension_name = &config.extension_name;
3232
let dns_zone = &config.dns_zone;

0 commit comments

Comments
 (0)