added calls for host operations

This commit is contained in:
Ritesh Chitlangi 2021-07-24 03:23:01 +08:00
parent f4ee674161
commit 5b4eb8509e
32 changed files with 542 additions and 59 deletions

View File

@ -5,7 +5,8 @@ use epp_client::EppClient;
use epp_client::epp::object::{StringValueTrait}; use epp_client::epp::object::{StringValueTrait};
use epp_client::{epp::request, epp::xml::EppXml}; use epp_client::{epp::request, epp::xml::EppXml};
use epp_client::epp::object::data::{ use epp_client::epp::object::data::{
PostalInfo, Address, Phone, DomainContact, ContactStatus, DomainStatus, HostObjList, HostAttrList, HostAttr, HostAddr PostalInfo, Address, Phone, DomainContact, ContactStatus, DomainStatus, HostObjList, HostAttrList, HostAttr, HostAddr,
Host, HostStatus
}; };
use epp_client::epp::*; use epp_client::epp::*;
@ -193,6 +194,72 @@ async fn query_transfer(client: &mut EppClient) {
println!("{}\n\n", transfer_query.serialize().unwrap()); println!("{}\n\n", transfer_query.serialize().unwrap());
} }
async fn check_hosts(client: &mut EppClient) {
let hosts_check = EppHostCheck::new(vec!["host1.eppdev-1.com", "ns1.testing.com"], gen_client_tr_id("eppdev").unwrap().as_str());
client.transact::<_, EppHostCheckResponse>(&hosts_check).await.unwrap();
}
async fn create_host(client: &mut EppClient) {
let host = Host {
name: "host1.eppdev-1.com".to_string_value(),
addresses: Some(vec![
HostAddr::new("v4", "29.245.122.14"),
HostAddr::new("v6", "2400:6180:100:d0::8d6:4001"),
])
};
let host_create = EppHostCreate::new(host, gen_client_tr_id("eppdev").unwrap().as_str());
// println!("{}", host_create.serialize().unwrap());
client.transact::<_, EppHostCreateResponse>(&host_create).await.unwrap();
}
async fn query_host(client: &mut EppClient) {
let host_info = EppHostInfo::new("host2.eppdev-1.com", gen_client_tr_id("eppdev").unwrap().as_str());
// println!("{}", host_info.serialize().unwrap());
client.transact::<_, EppHostInfoResponse>(&host_info).await.unwrap();
}
async fn update_host(client: &mut EppClient) {
let addr = vec![
HostAddr::new("v6", "2400:6180:100:d0::8d6:4001"),
];
let add = HostAddRemove {
addresses: Some(addr),
statuses: None,
};
let remove = HostAddRemove {
addresses: None,
statuses: Some(vec![
HostStatus {
status: "clientDeleteProhibited".to_string()
}
]),
};
let mut host_update = EppHostUpdate::new("host1.eppdev-1.com", gen_client_tr_id("eppdev").unwrap().as_str());
host_update.add(add);
// host_update.remove(remove);
host_update.info(HostChangeInfo { name: "host2.eppdev-1.com".to_string_value() });
// println!("{}", host_update.serialize().unwrap());
client.transact::<_, EppHostUpdateResponse>(&host_update).await.unwrap();
}
async fn delete_host(client: &mut EppClient) {
let host_delete = EppHostDelete::new("host2.eppdev-1.com", gen_client_tr_id("eppdev").unwrap().as_str());
client.transact::<_, EppHostDeleteResponse>(&host_delete).await.unwrap();
}
async fn hello(client: &mut EppClient) { async fn hello(client: &mut EppClient) {
let greeting = client.hello().await.unwrap(); let greeting = client.hello().await.unwrap();
@ -227,7 +294,7 @@ async fn main() {
// create_domain(&mut client).await; // create_domain(&mut client).await;
// query_domain(&mut client).await; query_domain(&mut client).await;
// update_domain(&mut client).await; // update_domain(&mut client).await;
@ -244,4 +311,14 @@ async fn main() {
// reject_transfer(&mut client).await; // reject_transfer(&mut client).await;
// cancel_transfer(&mut client).await; // cancel_transfer(&mut client).await;
// check_hosts(&mut client).await;
// create_host(&mut client).await;
// query_host(&mut client).await;
// update_host(&mut client).await;
// delete_host(&mut client).await;
} }

View File

@ -17,6 +17,7 @@ pub struct EppClientConnection {
port: u16, port: u16,
username: String, username: String,
password: String, password: String,
ext_uris: Option<Vec<String>>,
} }
#[derive(Serialize, Deserialize, Debug)] #[derive(Serialize, Deserialize, Debug)]
@ -38,6 +39,9 @@ impl EppClientConnection {
pub fn credentials(&self) -> (String, String) { pub fn credentials(&self) -> (String, String) {
(self.username.to_string(), self.password.to_string()) (self.username.to_string(), self.password.to_string())
} }
pub fn ext_uris(&self) -> Option<&Vec<String>> {
self.ext_uris.as_ref()
}
} }
impl EppClientConfig { impl EppClientConfig {

View File

@ -22,13 +22,24 @@ async fn connect(registry: &'static str) -> Result<EppClient, Box<dyn Error>> {
tokio::spawn(async move { tokio::spawn(async move {
let stream = epp_connect(&registry_creds).await.unwrap(); let stream = epp_connect(&registry_creds).await.unwrap();
let credentials = registry_creds.credentials(); let credentials = registry_creds.credentials();
let ext_uris = registry_creds.ext_uris();
let ext_uris = match ext_uris {
Some(uris) => Some(
uris
.iter()
.map(|u| u.to_string())
.collect::<Vec<String>>()
),
None => None,
};
let connection = EppConnection::new( let connection = EppConnection::new(
registry.to_string(), registry.to_string(),
stream stream
).await.unwrap(); ).await.unwrap();
let client = EppClient::build(connection, credentials).await.unwrap(); let client = EppClient::build(connection, credentials, ext_uris).await.unwrap();
tx.send(client).unwrap(); tx.send(client).unwrap();
}); });
@ -40,6 +51,7 @@ async fn connect(registry: &'static str) -> Result<EppClient, Box<dyn Error>> {
pub struct EppClient { pub struct EppClient {
credentials: (String, String), credentials: (String, String),
ext_uris: Option<Vec<String>>,
connection: EppConnection, connection: EppConnection,
// pub client_tr_id_fn: Arc<dyn Fn(&EppClient) -> String + Send + Sync>, // pub client_tr_id_fn: Arc<dyn Fn(&EppClient) -> String + Send + Sync>,
} }
@ -66,15 +78,16 @@ impl EppClient {
connect(registry).await connect(registry).await
} }
async fn build(connection: EppConnection, credentials: (String, String)) -> Result<EppClient, Box<dyn Error>> { async fn build(connection: EppConnection, credentials: (String, String), ext_uris: Option<Vec<String>>) -> Result<EppClient, Box<dyn Error>> {
let mut client = EppClient { let mut client = EppClient {
connection: connection, connection: connection,
credentials: credentials, credentials: credentials,
ext_uris: ext_uris,
// client_tr_id_fn: Arc::new(default_client_tr_id_fn), // client_tr_id_fn: Arc::new(default_client_tr_id_fn),
}; };
let client_tr_id = generate_client_tr_id(&client.credentials.0)?; let client_tr_id = generate_client_tr_id(&client.credentials.0)?;
let login_request = EppLogin::new(&client.credentials.0, &client.credentials.1, client_tr_id.as_str()); let login_request = EppLogin::new(&client.credentials.0, &client.credentials.1, &client.ext_uris, client_tr_id.as_str());
client.transact::<_, EppCommandResponse>(&login_request).await?; client.transact::<_, EppCommandResponse>(&login_request).await?;

View File

@ -17,6 +17,12 @@ pub use request::domain::info::*;
pub use request::domain::renew::*; pub use request::domain::renew::*;
pub use request::domain::transfer::*; pub use request::domain::transfer::*;
pub use request::domain::update::*; pub use request::domain::update::*;
pub use request::host::check::*;
pub use request::host::create::*;
pub use request::host::delete::*;
pub use request::host::info::*;
pub use request::host::update::*;
pub use request::message::poll::*;
pub use response::contact::check::*; pub use response::contact::check::*;
pub use response::contact::create::*; pub use response::contact::create::*;
@ -30,3 +36,9 @@ pub use response::domain::info::*;
pub use response::domain::renew::*; pub use response::domain::renew::*;
pub use response::domain::transfer::*; pub use response::domain::transfer::*;
pub use response::domain::update::*; pub use response::domain::update::*;
pub use response::host::check::*;
pub use response::host::create::*;
pub use response::host::delete::*;
pub use response::host::info::*;
pub use response::host::update::*;
pub use response::message::poll::*;

View File

@ -1,6 +1,9 @@
use crate::epp::object::{StringValue, StringValueTrait}; use crate::epp::object::{StringValue, StringValueTrait};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
pub type DomainStatus = ContactStatus;
pub type HostStatus = ContactStatus;
#[derive(Serialize, Deserialize, Debug)] #[derive(Serialize, Deserialize, Debug)]
pub enum DomainNsList { pub enum DomainNsList {
HostAttrList(HostAttrList), HostAttrList(HostAttrList),
@ -38,6 +41,13 @@ impl HostAddr {
} }
} }
#[derive(Serialize, Deserialize, Debug)]
pub struct Host {
pub name: StringValue,
#[serde(rename = "addr")]
pub addresses: Option<Vec<HostAddr>>,
}
#[derive(Serialize, Deserialize, Debug)] #[derive(Serialize, Deserialize, Debug)]
pub struct HostAttr { pub struct HostAttr {
#[serde(rename = "hostName")] #[serde(rename = "hostName")]
@ -86,12 +96,6 @@ impl Period {
} }
} }
#[derive(Serialize, Deserialize, Debug)]
pub struct DomainStatus {
#[serde(rename = "s")]
pub status: String,
}
#[derive(Serialize, Deserialize, Debug)] #[derive(Serialize, Deserialize, Debug)]
pub struct ContactStatus { pub struct ContactStatus {
#[serde(rename = "s")] #[serde(rename = "s")]

View File

@ -1,5 +1,7 @@
pub mod contact; pub mod contact;
pub mod domain; pub mod domain;
pub mod host;
pub mod message;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use std::error::Error; use std::error::Error;
@ -9,7 +11,7 @@ use crate::epp::command::Command;
use crate::epp::object::{ use crate::epp::object::{
ElementName, EppObject, Options, ServiceExtension, Services, StringValue, StringValueTrait, ElementName, EppObject, Options, ServiceExtension, Services, StringValue, StringValueTrait,
}; };
use crate::epp::xml::{EPP_LANG, EPP_VERSION}; use crate::epp::xml::{EPP_CONTACT_XMLNS, EPP_DOMAIN_XMLNS, EPP_HOST_XMLNS, EPP_LANG, EPP_VERSION};
use epp_client_macros::*; use epp_client_macros::*;
pub type EppHello = EppObject<Hello>; pub type EppHello = EppObject<Hello>;
@ -44,7 +46,21 @@ pub struct Login {
} }
impl EppLogin { impl EppLogin {
pub fn new(username: &str, password: &str, client_tr_id: &str) -> EppLogin { pub fn new(
username: &str,
password: &str,
ext_uris: &Option<Vec<String>>,
client_tr_id: &str,
) -> EppLogin {
let ext_uris = match ext_uris {
Some(uris) => Some(
uris.iter()
.map(|u| u.to_string_value())
.collect::<Vec<StringValue>>(),
),
None => None,
};
let login = Login { let login = Login {
username: username.to_string_value(), username: username.to_string_value(),
password: password.to_string_value(), password: password.to_string_value(),
@ -54,15 +70,11 @@ impl EppLogin {
}, },
services: Services { services: Services {
obj_uris: vec![ obj_uris: vec![
"urn:ietf:params:xml:ns:host-1.0".to_string_value(), EPP_HOST_XMLNS.to_string_value(),
"urn:ietf:params:xml:ns:contact-1.0".to_string_value(), EPP_CONTACT_XMLNS.to_string_value(),
"urn:ietf:params:xml:ns:domain-1.0".to_string_value(), EPP_DOMAIN_XMLNS.to_string_value(),
], ],
svc_ext: Some(ServiceExtension { svc_ext: Some(ServiceExtension { ext_uris: ext_uris }),
ext_uris: Some(vec![
"http://schema.ispapi.net/epp/xml/keyvalue-1.0".to_string_value()
]),
}),
}, },
}; };

View File

@ -9,7 +9,7 @@ pub type EppContactCheck = EppObject<Command<ContactCheck>>;
#[derive(Serialize, Deserialize, Debug)] #[derive(Serialize, Deserialize, Debug)]
pub struct ContactList { pub struct ContactList {
pub xmlns: String, xmlns: String,
#[serde(rename = "id")] #[serde(rename = "id")]
pub contact_ids: Vec<StringValue>, pub contact_ids: Vec<StringValue>,
} }

View File

@ -9,8 +9,8 @@ pub type EppContactDelete = EppObject<Command<ContactDelete>>;
#[derive(Serialize, Deserialize, Debug)] #[derive(Serialize, Deserialize, Debug)]
pub struct ContactDeleteData { pub struct ContactDeleteData {
pub xmlns: String, xmlns: String,
pub id: StringValue, id: StringValue,
} }
#[derive(Serialize, Deserialize, Debug, ElementName)] #[derive(Serialize, Deserialize, Debug, ElementName)]

View File

@ -9,7 +9,7 @@ use serde::{Deserialize, Serialize};
pub type EppContactInfo = EppObject<Command<ContactInfo>>; pub type EppContactInfo = EppObject<Command<ContactInfo>>;
#[derive(Serialize, Deserialize, Debug)] #[derive(Serialize, Deserialize, Debug)]
pub struct ContactQuery { pub struct ContactInfoData {
xmlns: String, xmlns: String,
id: StringValue, id: StringValue,
#[serde(rename = "authInfo")] #[serde(rename = "authInfo")]
@ -20,14 +20,14 @@ pub struct ContactQuery {
#[element_name(name = "info")] #[element_name(name = "info")]
pub struct ContactInfo { pub struct ContactInfo {
#[serde(rename = "info")] #[serde(rename = "info")]
query: ContactQuery, info: ContactInfoData,
} }
impl EppContactInfo { impl EppContactInfo {
pub fn new(id: &str, auth_password: &str, client_tr_id: &str) -> EppContactInfo { pub fn new(id: &str, auth_password: &str, client_tr_id: &str) -> EppContactInfo {
EppObject::build(Command::<ContactInfo> { EppObject::build(Command::<ContactInfo> {
command: ContactInfo { command: ContactInfo {
query: ContactQuery { info: ContactInfoData {
xmlns: EPP_CONTACT_XMLNS.to_string(), xmlns: EPP_CONTACT_XMLNS.to_string(),
id: id.to_string_value(), id: id.to_string_value(),
auth_info: AuthInfo::new(auth_password), auth_info: AuthInfo::new(auth_password),

View File

@ -9,8 +9,8 @@ pub type EppDomainDelete = EppObject<Command<DomainDelete>>;
#[derive(Serialize, Deserialize, Debug)] #[derive(Serialize, Deserialize, Debug)]
pub struct DomainDeleteData { pub struct DomainDeleteData {
pub xmlns: String, xmlns: String,
pub name: StringValue, name: StringValue,
} }
#[derive(Serialize, Deserialize, Debug, ElementName)] #[derive(Serialize, Deserialize, Debug, ElementName)]

View File

@ -0,0 +1,5 @@
pub mod check;
pub mod create;
pub mod delete;
pub mod info;
pub mod update;

View File

@ -0,0 +1,43 @@
use epp_client_macros::*;
use crate::epp::command::Command;
use crate::epp::object::{ElementName, EppObject, StringValue, StringValueTrait};
use crate::epp::xml::EPP_HOST_XMLNS;
use serde::{Deserialize, Serialize};
pub type EppHostCheck = EppObject<Command<HostCheck>>;
#[derive(Serialize, Deserialize, Debug)]
pub struct HostList {
xmlns: String,
#[serde(rename = "name")]
pub hosts: Vec<StringValue>,
}
#[derive(Serialize, Deserialize, Debug, ElementName)]
#[element_name(name = "check")]
pub struct HostCheck {
#[serde(rename = "check")]
list: HostList,
}
impl EppHostCheck {
pub fn new(hosts: Vec<&str>, client_tr_id: &str) -> EppHostCheck {
let hosts = hosts
.iter()
.filter_map(|d| Some(d.to_string_value()))
.collect::<Vec<StringValue>>();
let host_check = HostCheck {
list: HostList {
xmlns: EPP_HOST_XMLNS.to_string(),
hosts: hosts,
},
};
EppObject::build(Command::<HostCheck> {
command: host_check,
client_tr_id: client_tr_id.to_string_value(),
})
}
}

View File

@ -0,0 +1,41 @@
use epp_client_macros::*;
use crate::epp::command::Command;
use crate::epp::object::data::{Host, HostAddr};
use crate::epp::object::{ElementName, EppObject, StringValue, StringValueTrait};
use crate::epp::xml::EPP_HOST_XMLNS;
use serde::{Deserialize, Serialize};
pub type EppHostCreate = EppObject<Command<HostCreate>>;
#[derive(Serialize, Deserialize, Debug)]
pub struct HostCreateData {
xmlns: String,
pub name: StringValue,
#[serde(rename = "addr")]
pub addresses: Option<Vec<HostAddr>>,
}
#[derive(Serialize, Deserialize, Debug, ElementName)]
#[element_name(name = "create")]
pub struct HostCreate {
#[serde(rename = "create")]
host: HostCreateData,
}
impl EppHostCreate {
pub fn new(host: Host, client_tr_id: &str) -> EppHostCreate {
let host_create = HostCreate {
host: HostCreateData {
xmlns: EPP_HOST_XMLNS.to_string(),
name: host.name,
addresses: host.addresses,
},
};
EppObject::build(Command::<HostCreate> {
command: host_create,
client_tr_id: client_tr_id.to_string_value(),
})
}
}

View File

@ -0,0 +1,35 @@
use epp_client_macros::*;
use crate::epp::command::Command;
use crate::epp::object::{ElementName, EppObject, StringValue, StringValueTrait};
use crate::epp::xml::EPP_HOST_XMLNS;
use serde::{Deserialize, Serialize};
pub type EppHostDelete = EppObject<Command<HostDelete>>;
#[derive(Serialize, Deserialize, Debug)]
pub struct HostDeleteData {
xmlns: String,
name: StringValue,
}
#[derive(Serialize, Deserialize, Debug, ElementName)]
#[element_name(name = "delete")]
pub struct HostDelete {
#[serde(rename = "delete")]
host: HostDeleteData,
}
impl EppHostDelete {
pub fn new(name: &str, client_tr_id: &str) -> EppHostDelete {
EppObject::build(Command::<HostDelete> {
command: HostDelete {
host: HostDeleteData {
xmlns: EPP_HOST_XMLNS.to_string(),
name: name.to_string_value(),
},
},
client_tr_id: client_tr_id.to_string_value(),
})
}
}

View File

@ -0,0 +1,35 @@
use epp_client_macros::*;
use crate::epp::command::Command;
use crate::epp::object::{ElementName, EppObject, StringValue, StringValueTrait};
use crate::epp::xml::EPP_HOST_XMLNS;
use serde::{Deserialize, Serialize};
pub type EppHostInfo = EppObject<Command<HostInfo>>;
#[derive(Serialize, Deserialize, Debug)]
pub struct HostInfoData {
xmlns: String,
name: StringValue,
}
#[derive(Serialize, Deserialize, Debug, ElementName)]
#[element_name(name = "info")]
pub struct HostInfo {
#[serde(rename = "info")]
info: HostInfoData,
}
impl EppHostInfo {
pub fn new(name: &str, client_tr_id: &str) -> EppHostInfo {
EppObject::build(Command::<HostInfo> {
command: HostInfo {
info: HostInfoData {
xmlns: EPP_HOST_XMLNS.to_string(),
name: name.to_string_value(),
},
},
client_tr_id: client_tr_id.to_string_value(),
})
}
}

View File

@ -0,0 +1,69 @@
use epp_client_macros::*;
use crate::epp::command::Command;
use crate::epp::object::data::{HostAddr, HostStatus};
use crate::epp::object::{ElementName, EppObject, StringValue, StringValueTrait};
use crate::epp::xml::EPP_HOST_XMLNS;
use serde::{Deserialize, Serialize};
pub type EppHostUpdate = EppObject<Command<HostUpdate>>;
#[derive(Serialize, Deserialize, Debug)]
pub struct HostChangeInfo {
pub name: StringValue,
}
#[derive(Serialize, Deserialize, Debug)]
pub struct HostAddRemove {
#[serde(rename = "addr")]
pub addresses: Option<Vec<HostAddr>>,
#[serde(rename = "status")]
pub statuses: Option<Vec<HostStatus>>,
}
#[derive(Serialize, Deserialize, Debug)]
pub struct HostUpdateData {
xmlns: String,
name: StringValue,
add: Option<HostAddRemove>,
#[serde(rename = "rem")]
remove: Option<HostAddRemove>,
#[serde(rename = "chg")]
change_info: Option<HostChangeInfo>,
}
#[derive(Serialize, Deserialize, Debug, ElementName)]
#[element_name(name = "update")]
pub struct HostUpdate {
#[serde(rename = "update")]
host: HostUpdateData,
}
impl EppHostUpdate {
pub fn new(name: &str, client_tr_id: &str) -> EppHostUpdate {
EppObject::build(Command::<HostUpdate> {
command: HostUpdate {
host: HostUpdateData {
xmlns: EPP_HOST_XMLNS.to_string(),
name: name.to_string_value(),
add: None,
remove: None,
change_info: None,
},
},
client_tr_id: client_tr_id.to_string_value(),
})
}
pub fn info(&mut self, info: HostChangeInfo) {
self.data.command.host.change_info = Some(info);
}
pub fn add(&mut self, add: HostAddRemove) {
self.data.command.host.add = Some(add);
}
pub fn remove(&mut self, remove: HostAddRemove) {
self.data.command.host.remove = Some(remove);
}
}

View File

@ -0,0 +1 @@
pub mod poll;

View File

@ -0,0 +1,24 @@
use epp_client_macros::*;
use crate::epp::command::Command;
use crate::epp::object::{ElementName, EppObject, StringValueTrait};
use serde::{Deserialize, Serialize};
pub type EppMessagePoll = EppObject<Command<MessagePoll>>;
#[derive(Serialize, Deserialize, Debug, ElementName)]
#[element_name(name = "poll")]
pub struct MessagePoll {
op: String,
}
impl EppMessagePoll {
pub fn new(client_tr_id: &str) -> EppMessagePoll {
EppObject::build(Command::<MessagePoll> {
command: MessagePoll {
op: "req".to_string(),
},
client_tr_id: client_tr_id.to_string_value(),
})
}
}

View File

@ -1,5 +1,7 @@
pub mod contact; pub mod contact;
pub mod domain; pub mod domain;
pub mod host;
pub mod message;
use epp_client_macros::*; use epp_client_macros::*;
use serde::{Deserialize, Deserializer, Serialize}; use serde::{Deserialize, Deserializer, Serialize};
@ -57,7 +59,7 @@ pub struct All;
#[derive(Serialize, Deserialize, Debug, PartialEq)] #[derive(Serialize, Deserialize, Debug, PartialEq)]
pub struct Access { pub struct Access {
all: All, pub all: All,
} }
#[derive(Serialize, Deserialize, Debug, PartialEq)] #[derive(Serialize, Deserialize, Debug, PartialEq)]
@ -68,8 +70,8 @@ pub struct Prov;
#[derive(Serialize, Deserialize, Debug, PartialEq)] #[derive(Serialize, Deserialize, Debug, PartialEq)]
pub struct Purpose { pub struct Purpose {
admin: Admin, pub admin: Admin,
prov: Prov, pub prov: Prov,
} }
#[derive(Serialize, Deserialize, Debug, PartialEq)] #[derive(Serialize, Deserialize, Debug, PartialEq)]
@ -80,8 +82,8 @@ pub struct Public;
#[derive(Serialize, Deserialize, Debug, PartialEq)] #[derive(Serialize, Deserialize, Debug, PartialEq)]
pub struct Recipient { pub struct Recipient {
ours: Ours, pub ours: Ours,
public: Public, pub public: Public,
} }
#[derive(Serialize, Deserialize, Debug, PartialEq)] #[derive(Serialize, Deserialize, Debug, PartialEq)]
@ -89,20 +91,20 @@ pub struct Stated;
#[derive(Serialize, Deserialize, Debug, PartialEq)] #[derive(Serialize, Deserialize, Debug, PartialEq)]
pub struct Retention { pub struct Retention {
stated: Stated, pub stated: Stated,
} }
#[derive(Serialize, Deserialize, Debug, PartialEq)] #[derive(Serialize, Deserialize, Debug, PartialEq)]
pub struct Statement { pub struct Statement {
purpose: Purpose, pub purpose: Purpose,
recipient: Recipient, pub recipient: Recipient,
retention: Retention, pub retention: Retention,
} }
#[derive(Serialize, Deserialize, Debug, PartialEq)] #[derive(Serialize, Deserialize, Debug, PartialEq)]
pub struct Dcp { pub struct Dcp {
access: Access, pub access: Access,
statement: Statement, pub statement: Statement,
} }
#[derive(Serialize, Deserialize, Debug, PartialEq, ElementName)] #[derive(Serialize, Deserialize, Debug, PartialEq, ElementName)]
@ -110,12 +112,12 @@ pub struct Dcp {
#[element_name(name = "greeting")] #[element_name(name = "greeting")]
pub struct Greeting { pub struct Greeting {
#[serde(rename = "svID")] #[serde(rename = "svID")]
service_id: String, pub service_id: String,
#[serde(rename = "svDate")] #[serde(rename = "svDate")]
service_date: String, pub service_date: String,
#[serde(rename = "svcMenu")] #[serde(rename = "svcMenu")]
svc_menu: ServiceMenu, pub svc_menu: ServiceMenu,
dcp: Dcp, pub dcp: Dcp,
} }
#[derive(Serialize, Deserialize, Debug, PartialEq)] #[derive(Serialize, Deserialize, Debug, PartialEq)]
@ -130,8 +132,8 @@ pub struct ResultValue {
#[derive(Serialize, Deserialize, Debug, PartialEq)] #[derive(Serialize, Deserialize, Debug, PartialEq)]
pub struct ExtValue { pub struct ExtValue {
value: ResultValue, pub value: ResultValue,
reason: StringValue, pub reason: StringValue,
} }
#[derive(Serialize, Deserialize, Debug, PartialEq)] #[derive(Serialize, Deserialize, Debug, PartialEq)]

View File

@ -9,11 +9,11 @@ pub type EppDomainCreateResponse = EppObject<CommandResponse<DomainCreateResult>
pub struct DomainCreateData { pub struct DomainCreateData {
#[serde(rename = "xmlns:domain")] #[serde(rename = "xmlns:domain")]
xmlns: String, xmlns: String,
name: StringValue, pub name: StringValue,
#[serde(rename = "crDate")] #[serde(rename = "crDate")]
created_at: StringValue, pub created_at: StringValue,
#[serde(rename = "exDate")] #[serde(rename = "exDate")]
expiry_date: StringValue, pub expiry_date: StringValue,
} }
#[derive(Serialize, Deserialize, Debug)] #[derive(Serialize, Deserialize, Debug)]

View File

@ -53,5 +53,5 @@ pub struct DomainInfoData {
#[derive(Serialize, Deserialize, Debug)] #[derive(Serialize, Deserialize, Debug)]
pub struct DomainInfoResult { pub struct DomainInfoResult {
#[serde(rename = "infData")] #[serde(rename = "infData")]
pub check_data: DomainInfoData, pub info_data: DomainInfoData,
} }

View File

@ -9,9 +9,9 @@ pub type EppDomainRenewResponse = EppObject<CommandResponse<DomainRenewResult>>;
pub struct DomainRenewData { pub struct DomainRenewData {
#[serde(rename = "xmlns:domain")] #[serde(rename = "xmlns:domain")]
xmlns: String, xmlns: String,
name: StringValue, pub name: StringValue,
#[serde(rename = "exDate")] #[serde(rename = "exDate")]
expiry_date: StringValue, pub expiry_date: StringValue,
} }
#[derive(Serialize, Deserialize, Debug)] #[derive(Serialize, Deserialize, Debug)]

View File

@ -14,19 +14,19 @@ pub type EppDomainTransferQueryResponse = EppObject<CommandResponse<DomainTransf
pub struct DomainTransferData { pub struct DomainTransferData {
#[serde(rename = "xmlns:domain")] #[serde(rename = "xmlns:domain")]
xmlns: String, xmlns: String,
name: StringValue, pub name: StringValue,
#[serde(rename = "trStatus")] #[serde(rename = "trStatus")]
transfer_status: StringValue, pub transfer_status: StringValue,
#[serde(rename = "reID")] #[serde(rename = "reID")]
requester_id: StringValue, pub requester_id: StringValue,
#[serde(rename = "reDate")] #[serde(rename = "reDate")]
request_date: StringValue, pub request_date: StringValue,
#[serde(rename = "acID")] #[serde(rename = "acID")]
responder_id: StringValue, pub responder_id: StringValue,
#[serde(rename = "acDate")] #[serde(rename = "acDate")]
respond_by_date: StringValue, pub respond_by_date: StringValue,
#[serde(rename = "exDate")] #[serde(rename = "exDate")]
expiry_date: StringValue, pub expiry_date: StringValue,
} }
#[derive(Serialize, Deserialize, Debug)] #[derive(Serialize, Deserialize, Debug)]

View File

@ -0,0 +1,5 @@
pub mod check;
pub mod create;
pub mod delete;
pub mod info;
pub mod update;

View File

@ -0,0 +1,34 @@
use serde::{Deserialize, Serialize};
use crate::epp::object::{EppObject, StringValue};
use crate::epp::response::CommandResponse;
pub type EppHostCheckResponse = EppObject<CommandResponse<HostCheckResult>>;
#[derive(Serialize, Deserialize, Debug)]
pub struct HostCheck {
#[serde(rename = "$value")]
pub name: StringValue,
#[serde(rename = "avail")]
pub available: u16,
}
#[derive(Serialize, Deserialize, Debug)]
pub struct HostCheckDataItem {
pub name: HostCheck,
pub reason: Option<StringValue>,
}
#[derive(Serialize, Deserialize, Debug)]
pub struct HostCheckData {
#[serde(rename = "xmlns:host")]
xmlns: String,
#[serde(rename = "cd")]
pub host_list: Vec<HostCheckDataItem>,
}
#[derive(Serialize, Deserialize, Debug)]
pub struct HostCheckResult {
#[serde(rename = "chkData")]
pub check_data: HostCheckData,
}

View File

@ -0,0 +1,21 @@
use serde::{Deserialize, Serialize};
use crate::epp::object::{EppObject, StringValue};
use crate::epp::response::CommandResponse;
pub type EppHostCreateResponse = EppObject<CommandResponse<HostCreateResult>>;
#[derive(Serialize, Deserialize, Debug)]
pub struct HostCreateData {
#[serde(rename = "xmlns:host")]
xmlns: String,
pub name: StringValue,
#[serde(rename = "crDate")]
pub created_at: StringValue,
}
#[derive(Serialize, Deserialize, Debug)]
pub struct HostCreateResult {
#[serde(rename = "creData")]
pub check_data: HostCreateData,
}

View File

@ -0,0 +1,3 @@
use crate::epp::response::EppCommandResponse;
pub type EppHostDeleteResponse = EppCommandResponse;

View File

@ -0,0 +1,37 @@
use serde::{Deserialize, Serialize};
use crate::epp::object::data::{HostAddr, HostStatus};
use crate::epp::object::{EppObject, StringValue};
use crate::epp::response::CommandResponse;
pub type EppHostInfoResponse = EppObject<CommandResponse<HostInfoResult>>;
#[derive(Serialize, Deserialize, Debug)]
pub struct HostInfoData {
#[serde(rename = "xmlns:host")]
xmlns: String,
pub name: StringValue,
pub roid: StringValue,
#[serde(rename = "status")]
pub statuses: Vec<HostStatus>,
#[serde(rename = "addr")]
pub addresses: Vec<HostAddr>,
#[serde(rename = "clID")]
pub client_id: StringValue,
#[serde(rename = "crID")]
pub creator_id: StringValue,
#[serde(rename = "crDate")]
pub created_at: StringValue,
#[serde(rename = "upID")]
pub updater_id: Option<StringValue>,
#[serde(rename = "upDate")]
pub updated_at: Option<StringValue>,
#[serde(rename = "trDate")]
pub transferred_at: Option<StringValue>,
}
#[derive(Serialize, Deserialize, Debug)]
pub struct HostInfoResult {
#[serde(rename = "infData")]
pub info_data: HostInfoData,
}

View File

@ -0,0 +1,3 @@
use crate::epp::response::EppCommandResponse;
pub type EppHostUpdateResponse = EppCommandResponse;

View File

@ -0,0 +1 @@
pub mod poll;

View File

@ -0,0 +1 @@

View File

@ -9,6 +9,7 @@ pub const EPP_XSI_SCHEMA_LOCATION: &str = "urn:ietf:params:xml:ns:epp-1.0 epp-1.
pub const EPP_DOMAIN_XMLNS: &str = "urn:ietf:params:xml:ns:domain-1.0"; pub const EPP_DOMAIN_XMLNS: &str = "urn:ietf:params:xml:ns:domain-1.0";
pub const EPP_CONTACT_XMLNS: &str = "urn:ietf:params:xml:ns:contact-1.0"; pub const EPP_CONTACT_XMLNS: &str = "urn:ietf:params:xml:ns:contact-1.0";
pub const EPP_HOST_XMLNS: &str = "urn:ietf:params:xml:ns:host-1.0";
pub const EPP_VERSION: &str = "1.0"; pub const EPP_VERSION: &str = "1.0";
pub const EPP_LANG: &str = "en"; pub const EPP_LANG: &str = "en";