pub struct AuthorizedKeyEntryList(Vec<AuthorizedKeyEntry>);
Expand description
A list of AuthorizedKeyEntry
s
The list is guaranteed to contain at least one item and be unique (no duplicate SSH public key can exist).
Tuple Fields§
§0: Vec<AuthorizedKeyEntry>
Implementations§
Source§impl AuthorizedKeyEntryList
impl AuthorizedKeyEntryList
Sourcepub fn new(ssh_authorized_keys: Vec<AuthorizedKeyEntry>) -> Result<Self, Error>
pub fn new(ssh_authorized_keys: Vec<AuthorizedKeyEntry>) -> Result<Self, Error>
Creates a new AuthorizedKeyEntryList
§Errors
Returns an error, if a duplicate SSH public key exists in the provided list of
AuthorizedKeyEntry
objects or if the list is empty.
§Examples
use nethsm_config::AuthorizedKeyEntryList;
AuthorizedKeyEntryList::new(vec!["ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPkpXKiNhy39A3bZ1u19a5d4sFwYMBkWQyCbzgUfdKBm user@host".parse()?, "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINP4nWGVLC7kq4EdwgnJTXCjN0l32GL9ZxII6mx9uGqV user@host".parse()?])?;
// this fails because the AuthorizedKeyEntry are duplicates
assert!(AuthorizedKeyEntryList::new(vec!["ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPkpXKiNhy39A3bZ1u19a5d4sFwYMBkWQyCbzgUfdKBm user@host".parse()?, "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPkpXKiNhy39A3bZ1u19a5d4sFwYMBkWQyCbzgUfdKBm user@host".parse()?]).is_err());
// this fails because there are no SSH authorized keys
assert!(AuthorizedKeyEntryList::new(vec![]).is_err());
Trait Implementations§
Source§impl AsRef<[AuthorizedKeyEntry]> for AuthorizedKeyEntryList
impl AsRef<[AuthorizedKeyEntry]> for AuthorizedKeyEntryList
Source§fn as_ref(&self) -> &[AuthorizedKeyEntry]
fn as_ref(&self) -> &[AuthorizedKeyEntry]
Converts this type into a shared reference of the (usually inferred) input type.
Source§impl Clone for AuthorizedKeyEntryList
impl Clone for AuthorizedKeyEntryList
Source§fn clone(&self) -> AuthorizedKeyEntryList
fn clone(&self) -> AuthorizedKeyEntryList
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for AuthorizedKeyEntryList
impl Debug for AuthorizedKeyEntryList
Source§impl<'de> Deserialize<'de> for AuthorizedKeyEntryList
impl<'de> Deserialize<'de> for AuthorizedKeyEntryList
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl From<&AuthorizedKeyEntryList> for Vec<AuthorizedKeyEntry>
impl From<&AuthorizedKeyEntryList> for Vec<AuthorizedKeyEntry>
Source§fn from(value: &AuthorizedKeyEntryList) -> Self
fn from(value: &AuthorizedKeyEntryList) -> Self
Converts to this type from the input type.
Source§impl From<AuthorizedKeyEntryList> for Vec<String>
impl From<AuthorizedKeyEntryList> for Vec<String>
Source§fn from(value: AuthorizedKeyEntryList) -> Self
fn from(value: AuthorizedKeyEntryList) -> Self
Converts to this type from the input type.
Source§impl Hash for AuthorizedKeyEntryList
impl Hash for AuthorizedKeyEntryList
Source§impl PartialEq for AuthorizedKeyEntryList
impl PartialEq for AuthorizedKeyEntryList
Source§impl Serialize for AuthorizedKeyEntryList
impl Serialize for AuthorizedKeyEntryList
impl Eq for AuthorizedKeyEntryList
impl StructuralPartialEq for AuthorizedKeyEntryList
Auto Trait Implementations§
impl Freeze for AuthorizedKeyEntryList
impl RefUnwindSafe for AuthorizedKeyEntryList
impl Send for AuthorizedKeyEntryList
impl Sync for AuthorizedKeyEntryList
impl Unpin for AuthorizedKeyEntryList
impl UnwindSafe for AuthorizedKeyEntryList
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.