Struct auditor::client::AuditorClient
source · pub struct AuditorClient { /* private fields */ }
Expand description
The AuditorClient
handles the interaction with the Auditor instances and allows one to add
records to the database, update records in the database and retrieve the records from the
database.
It is constructed using the AuditorClientBuilder
.
Implementations§
source§impl AuditorClient
impl AuditorClient
sourcepub async fn health_check(&self) -> bool
pub async fn health_check(&self) -> bool
Returns true
if the Auditor instance is healthy, false
otherwise.
sourcepub async fn add(&self, record: &RecordAdd) -> Result<(), ClientError>
pub async fn add(&self, record: &RecordAdd) -> Result<(), ClientError>
Push a record to the Auditor instance.
§Errors
ClientError::RecordExists
- If the record already exists in the database.ClientError::ReqwestError
- If there was an error sending the HTTP request.
sourcepub async fn bulk_insert(
&self,
records: &Vec<RecordAdd>
) -> Result<(), ClientError>
pub async fn bulk_insert( &self, records: &Vec<RecordAdd> ) -> Result<(), ClientError>
Push multiple record to the Auditor instance as a vec.
§Errors
ClientError::RecordExists
- If the record already exists in the database.ClientError::ReqwestError
- If there was an error sending the HTTP request.
sourcepub async fn update(&self, record: &RecordUpdate) -> Result<(), ClientError>
pub async fn update(&self, record: &RecordUpdate) -> Result<(), ClientError>
Update an existing record in the Auditor instance.
§Errors
ClientError::ReqwestError
- If there was an error sending the HTTP request.
sourcepub async fn get(&self) -> Result<Vec<Record>, ClientError>
pub async fn get(&self) -> Result<Vec<Record>, ClientError>
Gets all records from the Auditors database.
§Errors
ClientError::ReqwestError
- If there was an error sending the HTTP request.
sourcepub async fn get_started_since(
&self,
since: &DateTime<Utc>
) -> Result<Vec<Record>, ClientError>
👎Deprecated since 0.4.0: please use advanced_query
instead
pub async fn get_started_since( &self, since: &DateTime<Utc> ) -> Result<Vec<Record>, ClientError>
advanced_query
insteadGet all records in the database with a started timestamp after since
.
§Errors
ClientError::ReqwestError
- If there was an error sending the HTTP request.
sourcepub async fn get_stopped_since(
&self,
since: &DateTime<Utc>
) -> Result<Vec<Record>, ClientError>
👎Deprecated since 0.4.0: please use advanced_query
instead
pub async fn get_stopped_since( &self, since: &DateTime<Utc> ) -> Result<Vec<Record>, ClientError>
advanced_query
insteadGet all records in the database with a stopped timestamp after since
.
§Errors
ClientError::ReqwestError
- If there was an error sending the HTTP request.
sourcepub async fn advanced_query(
&self,
query_string: String
) -> Result<Vec<Record>, ClientError>
pub async fn advanced_query( &self, query_string: String ) -> Result<Vec<Record>, ClientError>
Get records from AUDITOR server using custom query.
§Errors
ClientError::ReqwestError
- If there was an error sending the HTTP request.
sourcepub async fn get_single_record(
&self,
record_id: String
) -> Result<Record, ClientError>
pub async fn get_single_record( &self, record_id: String ) -> Result<Record, ClientError>
Get single record from AUDITOR server using record_id.
§Errors
ClientError::ReqwestError
- If there was an error sending the HTTP request.
Trait Implementations§
source§impl Clone for AuditorClient
impl Clone for AuditorClient
source§fn clone(&self) -> AuditorClient
fn clone(&self) -> AuditorClient
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 moreAuto Trait Implementations§
impl Freeze for AuditorClient
impl !RefUnwindSafe for AuditorClient
impl Send for AuditorClient
impl Sync for AuditorClient
impl Unpin for AuditorClient
impl !UnwindSafe for AuditorClient
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> FutureExt for T
impl<T> FutureExt for T
source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more