Make it possible to create hosts without addresses

This commit is contained in:
Nicholas Rempel 2022-01-18 16:12:06 -08:00 committed by masalachai
parent c0ebbf6b52
commit 4615d63b13
1 changed files with 3 additions and 3 deletions

View File

@ -13,12 +13,12 @@ impl<'a> Command for HostCreate<'a> {
} }
impl<'a> HostCreate<'a> { impl<'a> HostCreate<'a> {
pub fn new(host: &'a str, addresses: &'a [HostAddr]) -> Self { pub fn new(host: &'a str, addresses: Option<&'a [HostAddr]>) -> Self {
Self { Self {
host: HostCreateRequestData { host: HostCreateRequestData {
xmlns: XMLNS, xmlns: XMLNS,
name: host.into(), name: host.into(),
addresses: Some(addresses), addresses,
}, },
} }
} }
@ -84,7 +84,7 @@ mod tests {
HostAddr::new("v6", "2404:6800:4001:801::200e"), HostAddr::new("v6", "2404:6800:4001:801::200e"),
]; ];
let object = HostCreate::new("host1.eppdev-1.com", addresses); let object = HostCreate::new("host1.eppdev-1.com", Some(addresses));
let serialized = let serialized =
<HostCreate as Transaction<NoExtension>>::serialize_request(&object, None, CLTRID) <HostCreate as Transaction<NoExtension>>::serialize_request(&object, None, CLTRID)