use serde::{Deserialize, Serialize};
use std::collections::HashMap;
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct Application {
#[serde(skip_serializing_if = "Option::is_none")]
pub auth_domain: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub default_hostname: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub id: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub location_id: Option<String>,
pub name: String,
#[serde(skip_serializing_if = "Option::is_none")]
pub serving_status: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub ssl_policy: Option<String>,
}
impl Application {
#[cfg(any(test, feature = "test-support"))]
pub fn fixture() -> Self {
Self {
auth_domain: Some("test-auth_domain".into()),
default_hostname: Some("test-default_hostname".into()),
id: Some("test-id".into()),
location_id: Some("test-location_id".into()),
name: "test-application".into(),
serving_status: Some("test-serving_status".into()),
ssl_policy: Some("test-ssl_policy".into()),
}
}
}
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct NetworkSettings {
#[serde(skip_serializing_if = "Option::is_none")]
pub ingress_traffic_allowed: Option<String>,
}
impl NetworkSettings {
#[cfg(any(test, feature = "test-support"))]
pub fn fixture() -> Self {
Self {
ingress_traffic_allowed: Some("test-ingress_traffic_allowed".into()),
}
}
}
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct Service {
#[serde(skip_serializing_if = "Option::is_none")]
pub id: Option<String>,
#[serde(default)]
#[serde(skip_serializing_if = "HashMap::is_empty")]
pub labels: HashMap<String, String>,
pub name: String,
#[serde(skip_serializing_if = "Option::is_none")]
pub network_settings: Option<NetworkSettings>,
}
impl Service {
#[cfg(any(test, feature = "test-support"))]
pub fn fixture() -> Self {
Self {
id: Some("test-id".into()),
labels: Default::default(),
name: "test-service".into(),
network_settings: Some(NetworkSettings::fixture()),
}
}
}
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct ListServicesResponse {
#[serde(default)]
pub services: Vec<Service>,
#[serde(skip_serializing_if = "Option::is_none")]
pub next_page_token: Option<String>,
}
impl ListServicesResponse {
#[cfg(any(test, feature = "test-support"))]
pub fn fixture() -> Self {
Self {
services: vec![],
next_page_token: None,
}
}
}