Struct kmip_protocol::client::Client
source · [−]pub struct Client<T> { /* private fields */ }
Expand description
A client for serializing KMIP and deserializing KMIP responses to/from an established read/write stream.
Use the ClientBuilder to build a Client instance to work with.
Implementations
sourceimpl<T: ReadWrite> Client<T>
impl<T: ReadWrite> Client<T>
pub fn inner(&self) -> Arc<Mutex<T>>
sourcepub fn do_request(&self, payload: RequestPayload) -> Result<ResponsePayload>
pub fn do_request(&self, payload: RequestPayload) -> Result<ResponsePayload>
Serialize the given request to the stream and deserialize the response.
Automatically constructs the request message wrapper around the payload including the RequestHeader and BatchItem.
Only supports a single batch item.
Sets the request operation to RequestPayload::operation().
Errors
Will fail if there is a problem serializing the request, writing to or reading from the stream, deserializing the response or if the response does not indicate operation success or contains more than one batch item.
Currently always returns Error::Unknown even though richer cause information is available.
sourcepub fn query(&self) -> Result<QueryResponsePayload>
pub fn query(&self) -> Result<QueryResponsePayload>
Serialize a KMIP 1.0 Query request.
See also: do_request()
sourcepub fn create_rsa_key_pair(
&self,
key_length: i32,
private_key_name: String,
public_key_name: String
) -> Result<(String, String)>
pub fn create_rsa_key_pair(
&self,
key_length: i32,
private_key_name: String,
public_key_name: String
) -> Result<(String, String)>
Serialize a KMIP 1.0 Create Key Pair request to create an RSA key pair.
See also: do_request()
Creates an RSA key pair.
To create keys of other types or with other parameters you must compose the Create Key Pair request manually and pass it to do_request() directly.
sourcepub fn rng_retrieve(&self, num_bytes: i32) -> Result<RNGRetrieveResponsePayload>
pub fn rng_retrieve(&self, num_bytes: i32) -> Result<RNGRetrieveResponsePayload>
Serialize a KMIP 1.2 Rng Retrieve operation to retrieve a number of random bytes.
See also: do_request()
sourcepub fn sign(
&self,
private_key_id: &str,
in_bytes: &[u8]
) -> Result<SignResponsePayload>
pub fn sign(
&self,
private_key_id: &str,
in_bytes: &[u8]
) -> Result<SignResponsePayload>
Serialize a KMIP 1.2 Sign operation to sign the given bytes with the given private key ID.
See also: do_request()
sourcepub fn activate_key(&self, private_key_id: &str) -> Result<()>
pub fn activate_key(&self, private_key_id: &str) -> Result<()>
Serialize a KMIP 1.0 Activate operation to activate a given private key ID.
See also: do_request()
To activate other kinds of managed object you must compose the Activate request manually and pass it to do_request() directly.
sourcepub fn revoke_key(&self, private_key_id: &str) -> Result<()>
pub fn revoke_key(&self, private_key_id: &str) -> Result<()>
Serialize a KMIP 1.0 Revoke operation to deactivate a given private key ID.
See also: do_request()
To deactivate other kinds of managed object you must compose the Revoke request manually and pass it to do_request() directly.
sourcepub fn destroy_key(&self, key_id: &str) -> Result<()>
pub fn destroy_key(&self, key_id: &str) -> Result<()>
Serialize a KMIP 1.0 Destroy operation to destroy a given private key ID.
See also: do_request()
To destroy other kinds of managed object you must compose the Destroy request manually and pass it to do_request() directly.
sourcepub fn rename_key(
&self,
key_id: &str,
new_name: String
) -> Result<ModifyAttributeResponsePayload>
pub fn rename_key(
&self,
key_id: &str,
new_name: String
) -> Result<ModifyAttributeResponsePayload>
Serialize a KMIP 1.0 ModifyAttribute operation to rename a given key ID.
See also: do_request()
To modify other attributes of managed objects you must compose the Modify Attribute request manually and pass it to do_request() directly.
sourcepub fn get_key(&self, key_id: &str) -> Result<GetResponsePayload>
pub fn get_key(&self, key_id: &str) -> Result<GetResponsePayload>
Serialize a KMIP 1.0 Get operation to get the details of a given key ID.
See also: do_request()
sourceimpl<T> Client<T>
impl<T> Client<T>
sourcepub fn last_req_diag_str(&self) -> Option<String>
pub fn last_req_diag_str(&self) -> Option<String>
Get a clone of the client’s last req diag str.
sourcepub fn last_res_diag_str(&self) -> Option<String>
pub fn last_res_diag_str(&self) -> Option<String>
Get a clone of the client’s last res diag str.
sourcepub fn connection_error_count(&self) -> u8
pub fn connection_error_count(&self) -> u8
Get the count of connection errors experienced by this Client.
Trait Implementations
Auto Trait Implementations
impl<T> !RefUnwindSafe for Client<T>
impl<T> Send for Client<T> where
T: Send,
impl<T> !Sync for Client<T>
impl<T> Unpin for Client<T>
impl<T> UnwindSafe for Client<T>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more