#[derive(Clone, Debug, serde::Serialize, serde::Deserialize, Default)]
pub struct ListQuotasParameters {
#[serde(rename = "region", default, skip_serializing_if = "Option::is_none")]
pub region: Option<String>,
}
pub type ListQuotasQuery = ListQuotasParameters;
#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct QuotaListResponse {
#[serde(rename = "quotas")]
pub quotas: Vec<QuotaItem>,
}
#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct QuotaItem {
#[serde(rename = "service")]
pub service: String,
#[serde(rename = "resource_type")]
pub resource_type: String,
#[serde(rename = "scope")]
pub scope: QuotaItemScope,
#[serde(rename = "limit")]
pub limit: i64,
#[serde(rename = "in_use")]
pub in_use: i64,
#[serde(rename = "reserved")]
pub reserved: i64,
#[serde(rename = "available")]
pub available: i64,
#[serde(rename = "is_default")]
pub is_default: bool,
#[serde(rename = "description")]
pub description: String,
}
#[derive(Clone, Debug, PartialEq, Eq)]
pub enum QuotaItemScope {
Regional,
Global,
PerResource,
Unknown(String),
}
impl QuotaItemScope {
pub fn as_str(&self) -> &str {
match self {
Self::Regional => "regional",
Self::Global => "global",
Self::PerResource => "per_resource",
Self::Unknown(value) => value,
}
}
}
impl serde::Serialize for QuotaItemScope {
fn serialize<S: serde::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
serializer.serialize_str(self.as_str())
}
}
impl<'de> serde::Deserialize<'de> for QuotaItemScope {
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
let value = <String as serde::Deserialize>::deserialize(deserializer)?;
Ok(match value.as_str() {
"regional" => Self::Regional,
"global" => Self::Global,
"per_resource" => Self::PerResource,
_ => Self::Unknown(value),
})
}
}
pub type ListQuotasResponse = QuotaListResponse;
pub type ListQuotasItem = QuotaItem;