use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(test, derive(Default))]
pub struct DedicatedDatabase {
#[serde(rename = "$id")]
pub id: String,
#[serde(rename = "$createdAt")]
pub created_at: String,
#[serde(rename = "$updatedAt")]
pub updated_at: String,
#[serde(rename = "projectId")]
pub project_id: String,
#[serde(rename = "name")]
pub name: String,
#[serde(rename = "api")]
pub api: String,
#[serde(rename = "engine")]
pub engine: String,
#[serde(rename = "version")]
pub version: String,
#[serde(rename = "specification")]
pub specification: String,
#[serde(rename = "backend")]
pub backend: String,
#[serde(rename = "hostname")]
pub hostname: String,
#[serde(rename = "connectionPort")]
pub connection_port: i64,
#[serde(rename = "connectionUser")]
pub connection_user: String,
#[serde(rename = "connectionPassword")]
pub connection_password: String,
#[serde(rename = "connectionString")]
pub connection_string: String,
#[serde(rename = "ssl")]
pub ssl: bool,
#[serde(rename = "status")]
pub status: String,
#[serde(rename = "containerStatus")]
pub container_status: String,
#[serde(rename = "lastAccessedAt")]
#[serde(skip_serializing_if = "Option::is_none")]
pub last_accessed_at: Option<String>,
#[serde(rename = "idleUntil")]
#[serde(skip_serializing_if = "Option::is_none")]
pub idle_until: Option<String>,
#[serde(rename = "lifecycleState")]
pub lifecycle_state: String,
#[serde(rename = "idleTimeoutMinutes")]
pub idle_timeout_minutes: i64,
#[serde(rename = "cpu")]
pub cpu: i64,
#[serde(rename = "memory")]
pub memory: i64,
#[serde(rename = "storage")]
pub storage: i64,
#[serde(rename = "storageClass")]
pub storage_class: String,
#[serde(rename = "storageMaxGb")]
pub storage_max_gb: i64,
#[serde(rename = "nodePool")]
pub node_pool: String,
#[serde(rename = "replicas")]
pub replicas: i64,
#[serde(rename = "syncMode")]
pub sync_mode: String,
#[serde(rename = "crossRegionReplicas")]
pub cross_region_replicas: i64,
#[serde(rename = "networkMaxConnections")]
pub network_max_connections: i64,
#[serde(rename = "networkIdleTimeoutSeconds")]
pub network_idle_timeout_seconds: i64,
#[serde(rename = "networkIPAllowlist")]
pub network_ip_allowlist: Vec<String>,
#[serde(rename = "backupEnabled")]
pub backup_enabled: bool,
#[serde(rename = "pitr")]
pub pitr: bool,
#[serde(rename = "pitrRetentionDays")]
pub pitr_retention_days: i64,
#[serde(rename = "storageAutoscaling")]
pub storage_autoscaling: bool,
#[serde(rename = "storageAutoscalingThresholdPercent")]
pub storage_autoscaling_threshold_percent: i64,
#[serde(rename = "storageAutoscalingMaxGb")]
pub storage_autoscaling_max_gb: i64,
#[serde(rename = "maintenanceWindowDay")]
pub maintenance_window_day: String,
#[serde(rename = "maintenanceWindowHourUtc")]
pub maintenance_window_hour_utc: i64,
#[serde(rename = "metricsEnabled")]
pub metrics_enabled: bool,
#[serde(rename = "sqlApiEnabled")]
pub sql_api_enabled: bool,
#[serde(rename = "sqlApiAllowedStatements")]
pub sql_api_allowed_statements: Vec<String>,
#[serde(rename = "sqlApiMaxRows")]
pub sql_api_max_rows: i64,
#[serde(rename = "sqlApiMaxBytes")]
pub sql_api_max_bytes: i64,
#[serde(rename = "sqlApiTimeoutSeconds")]
pub sql_api_timeout_seconds: i64,
#[serde(rename = "error")]
pub error: String,
}
impl DedicatedDatabase {
pub fn id(&self) -> &String {
&self.id
}
pub fn created_at(&self) -> &String {
&self.created_at
}
pub fn updated_at(&self) -> &String {
&self.updated_at
}
pub fn project_id(&self) -> &String {
&self.project_id
}
pub fn name(&self) -> &String {
&self.name
}
pub fn api(&self) -> &String {
&self.api
}
pub fn engine(&self) -> &String {
&self.engine
}
pub fn version(&self) -> &String {
&self.version
}
pub fn specification(&self) -> &String {
&self.specification
}
pub fn backend(&self) -> &String {
&self.backend
}
pub fn hostname(&self) -> &String {
&self.hostname
}
pub fn connection_port(&self) -> &i64 {
&self.connection_port
}
pub fn connection_user(&self) -> &String {
&self.connection_user
}
pub fn connection_password(&self) -> &String {
&self.connection_password
}
pub fn connection_string(&self) -> &String {
&self.connection_string
}
pub fn ssl(&self) -> &bool {
&self.ssl
}
pub fn status(&self) -> &String {
&self.status
}
pub fn container_status(&self) -> &String {
&self.container_status
}
pub fn set_last_accessed_at(mut self, last_accessed_at: String) -> Self {
self.last_accessed_at = Some(last_accessed_at);
self
}
pub fn last_accessed_at(&self) -> Option<&String> {
self.last_accessed_at.as_ref()
}
pub fn set_idle_until(mut self, idle_until: String) -> Self {
self.idle_until = Some(idle_until);
self
}
pub fn idle_until(&self) -> Option<&String> {
self.idle_until.as_ref()
}
pub fn lifecycle_state(&self) -> &String {
&self.lifecycle_state
}
pub fn idle_timeout_minutes(&self) -> &i64 {
&self.idle_timeout_minutes
}
pub fn cpu(&self) -> &i64 {
&self.cpu
}
pub fn memory(&self) -> &i64 {
&self.memory
}
pub fn storage(&self) -> &i64 {
&self.storage
}
pub fn storage_class(&self) -> &String {
&self.storage_class
}
pub fn storage_max_gb(&self) -> &i64 {
&self.storage_max_gb
}
pub fn node_pool(&self) -> &String {
&self.node_pool
}
pub fn replicas(&self) -> &i64 {
&self.replicas
}
pub fn sync_mode(&self) -> &String {
&self.sync_mode
}
pub fn cross_region_replicas(&self) -> &i64 {
&self.cross_region_replicas
}
pub fn network_max_connections(&self) -> &i64 {
&self.network_max_connections
}
pub fn network_idle_timeout_seconds(&self) -> &i64 {
&self.network_idle_timeout_seconds
}
pub fn network_ip_allowlist(&self) -> &Vec<String> {
&self.network_ip_allowlist
}
pub fn backup_enabled(&self) -> &bool {
&self.backup_enabled
}
pub fn pitr(&self) -> &bool {
&self.pitr
}
pub fn pitr_retention_days(&self) -> &i64 {
&self.pitr_retention_days
}
pub fn storage_autoscaling(&self) -> &bool {
&self.storage_autoscaling
}
pub fn storage_autoscaling_threshold_percent(&self) -> &i64 {
&self.storage_autoscaling_threshold_percent
}
pub fn storage_autoscaling_max_gb(&self) -> &i64 {
&self.storage_autoscaling_max_gb
}
pub fn maintenance_window_day(&self) -> &String {
&self.maintenance_window_day
}
pub fn maintenance_window_hour_utc(&self) -> &i64 {
&self.maintenance_window_hour_utc
}
pub fn metrics_enabled(&self) -> &bool {
&self.metrics_enabled
}
pub fn sql_api_enabled(&self) -> &bool {
&self.sql_api_enabled
}
pub fn sql_api_allowed_statements(&self) -> &Vec<String> {
&self.sql_api_allowed_statements
}
pub fn sql_api_max_rows(&self) -> &i64 {
&self.sql_api_max_rows
}
pub fn sql_api_max_bytes(&self) -> &i64 {
&self.sql_api_max_bytes
}
pub fn sql_api_timeout_seconds(&self) -> &i64 {
&self.sql_api_timeout_seconds
}
pub fn error(&self) -> &String {
&self.error
}
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_dedicated_database_creation() {
let _model = <DedicatedDatabase as Default>::default();
let _ = _model.id();
let _ = _model.created_at();
let _ = _model.updated_at();
let _ = _model.project_id();
let _ = _model.name();
let _ = _model.api();
let _ = _model.engine();
let _ = _model.version();
let _ = _model.specification();
let _ = _model.backend();
let _ = _model.hostname();
let _ = _model.connection_port();
let _ = _model.connection_user();
let _ = _model.connection_password();
let _ = _model.connection_string();
let _ = _model.ssl();
let _ = _model.status();
let _ = _model.container_status();
let _ = _model.lifecycle_state();
let _ = _model.idle_timeout_minutes();
let _ = _model.cpu();
let _ = _model.memory();
let _ = _model.storage();
let _ = _model.storage_class();
let _ = _model.storage_max_gb();
let _ = _model.node_pool();
let _ = _model.replicas();
let _ = _model.sync_mode();
let _ = _model.cross_region_replicas();
let _ = _model.network_max_connections();
let _ = _model.network_idle_timeout_seconds();
let _ = _model.network_ip_allowlist();
let _ = _model.backup_enabled();
let _ = _model.pitr();
let _ = _model.pitr_retention_days();
let _ = _model.storage_autoscaling();
let _ = _model.storage_autoscaling_threshold_percent();
let _ = _model.storage_autoscaling_max_gb();
let _ = _model.maintenance_window_day();
let _ = _model.maintenance_window_hour_utc();
let _ = _model.metrics_enabled();
let _ = _model.sql_api_enabled();
let _ = _model.sql_api_allowed_statements();
let _ = _model.sql_api_max_rows();
let _ = _model.sql_api_max_bytes();
let _ = _model.sql_api_timeout_seconds();
let _ = _model.error();
}
#[test]
fn test_dedicated_database_serialization() {
let model = <DedicatedDatabase as Default>::default();
let json = serde_json::to_string(&model);
assert!(json.is_ok());
let deserialized: Result<DedicatedDatabase, _> = serde_json::from_str(&json.unwrap());
assert!(deserialized.is_ok());
}
}