Add email user list

master
Tait Hoyem 2 years ago
parent 97182beef3
commit f3f5d5d558

@ -14,6 +14,7 @@ use crate::{
RegionListResponse, RegionListResponse,
EmailUsageResponse, EmailUsageResponse,
EmailDomainListResponse, EmailDomainListResponse,
EmailUserListResponse,
MonitorCheckListResponse, MonitorCheckListResponse,
MonitorCheckTypesResponse, MonitorCheckTypesResponse,
MonitorContactListResponse, MonitorContactListResponse,
@ -54,12 +55,18 @@ pub enum ZoneSubArgs {
pub enum EmailDomainSubArgs { pub enum EmailDomainSubArgs {
List(EmailDomainListRequest), List(EmailDomainListRequest),
} }
#[derive(Serialize, Deserialize, Debug, clap::Subcommand)]
pub enum EmailUserSubArgs {
List(EmailUserListRequest),
}
#[derive(Serialize, Deserialize, Debug, clap::Subcommand)] #[derive(Serialize, Deserialize, Debug, clap::Subcommand)]
pub enum EmailSubArgs { pub enum EmailSubArgs {
#[clap(subcommand)] #[clap(subcommand)]
Domain(EmailDomainSubArgs), Domain(EmailDomainSubArgs),
Usage(EmailUsageRequest), Usage(EmailUsageRequest),
#[clap(subcommand)]
User(EmailUserSubArgs),
} }
#[derive(Serialize, Deserialize, Debug, clap::Subcommand)] #[derive(Serialize, Deserialize, Debug, clap::Subcommand)]
@ -212,6 +219,7 @@ impl Args {
Self::Region(RegionSubArgs::List(reg_list)) => print_req(reg_list)?, Self::Region(RegionSubArgs::List(reg_list)) => print_req(reg_list)?,
Self::Email(EmailSubArgs::Usage(email_usage)) => print_req(email_usage)?, Self::Email(EmailSubArgs::Usage(email_usage)) => print_req(email_usage)?,
Self::Email(EmailSubArgs::Domain(EmailDomainSubArgs::List(email_domain_list))) => print_req(email_domain_list)?, Self::Email(EmailSubArgs::Domain(EmailDomainSubArgs::List(email_domain_list))) => print_req(email_domain_list)?,
Self::Email(EmailSubArgs::User(EmailUserSubArgs::List(email_user_list))) => print_req(email_user_list)?,
} }
Ok(()) Ok(())
} }
@ -278,3 +286,8 @@ pub struct MonitorCheckTypesRequest {}
#[lunanode_request(response="MonitorContactListResponse", endpoint="monitor/contact-list/")] #[lunanode_request(response="MonitorContactListResponse", endpoint="monitor/contact-list/")]
pub struct MonitorContactListRequest {} pub struct MonitorContactListRequest {}
#[lunanode_request(response="EmailUserListResponse", endpoint="email/user-list/")]
pub struct EmailUserListRequest {
domain_id: i32,
}

@ -583,3 +583,24 @@ pub struct MonitorContactListResponse {
/// A list of contacts in your LunaNode account. This should be deserialized as Option<HashMap<String, Contact>>, but I haven't gotten around to serializing this in that way. TODO. /// A list of contacts in your LunaNode account. This should be deserialized as Option<HashMap<String, Contact>>, but I haven't gotten around to serializing this in that way. TODO.
contacts: Contacts, contacts: Contacts,
} }
#[serde_as]
#[derive(Serialize, Deserialize, Debug)]
pub struct EmailUser {
/// The user's ID.
#[serde_as(as="DisplayFromStr")]
id: i32,
/// The user's email. This may be more strict in the future.
email: String,
#[serde_as(as="DisplayFromStr")]
/// The user's storage usage in MB.
storage: i32,
/// The user's storage usage, with an "MB" or "GB" designation afterwards.
storage_nice: String,
}
#[lunanode_response]
pub struct EmailUserListResponse {
#[serde(flatten)]
users: std::collections::HashMap<String, EmailUser>,
}

Loading…
Cancel
Save