use serde::{Deserialize, Serialize};
#[derive(Debug, Serialize, Deserialize, Clone)]
pub struct RegistryCredentials {
pub registry_url: String,
pub username: String,
pub password: String,
#[serde(skip_serializing_if = "Option::is_none")]
pub expires_in: Option<u64>,
}
#[derive(Debug, Deserialize)]
pub struct GetRegistryCredsRequest {
pub project: String,
}
#[derive(Debug, Serialize)]
pub struct GetRegistryCredsResponse {
pub credentials: RegistryCredentials,
pub repository: String,
}
#[cfg(feature = "backend")]
#[derive(Debug, Clone, Deserialize)]
pub struct EcrConfig {
pub region: String,
pub account_id: String,
pub access_key_id: Option<String>,
pub secret_access_key: Option<String>,
#[serde(default = "default_repo_prefix")]
pub repo_prefix: String,
pub push_role_arn: String,
#[serde(default)]
pub auto_remove: bool,
}
#[cfg(feature = "backend")]
fn default_repo_prefix() -> String {
"rise/".to_string()
}
#[derive(Debug, Clone, Deserialize)]
pub struct OciClientAuthConfig {
pub registry_url: String,
#[serde(default = "default_namespace")]
pub namespace: String,
#[serde(default)]
pub client_registry_url: Option<String>,
}
fn default_namespace() -> String {
String::new()
}