ReportingApi

Struct ReportingApi 

Source
pub struct ReportingApi { /* private fields */ }
Expand description

The Reporting API interface

Implementations§

Source§

impl ReportingApi

Source

pub fn new(client: VeracodeClient) -> Self

Create a new Reporting API instance

Source

pub async fn generate_audit_report( &self, request: &AuditReportRequest, ) -> Result<String, VeracodeError>

Generate an audit report (step 1 of the process)

§Errors

Returns an error if the API request fails, the resource is not found, or authentication/authorization fails. This sends a request to generate the report. The API returns a report_id which can be used to retrieve the report after it’s generated.

§Arguments
  • request - The audit report request parameters
§Returns

The report ID that can be used to retrieve the generated report

§Errors

Returns VeracodeError if the request fails

Source

pub async fn get_audit_report( &self, report_id: &str, page: Option<u32>, ) -> Result<ReportResponse, VeracodeError>

Retrieve a generated audit report (step 2 of the process)

This retrieves the report content. The report may still be processing, so check the status field in the response.

§Arguments
  • report_id - The report ID returned from generate_audit_report
  • page - Optional page number (0-indexed) for pagination
§Returns

The report response with status and audit log data

§Errors

Returns VeracodeError if the request fails

Source

pub async fn poll_report_status( &self, report_id: &str, max_attempts: Option<u32>, initial_delay_secs: Option<u64>, ) -> Result<ReportResponse, VeracodeError>

Poll for report status until it’s completed or failed

This method polls the report status with exponential backoff until the report is either completed or failed.

§Arguments
  • report_id - The report ID to poll
  • max_attempts - Maximum number of polling attempts (default: 30)
  • initial_delay_secs - Initial delay between polls in seconds (default: 2)
§Returns

The completed report response

§Errors

Returns VeracodeError if polling fails or report generation fails

Source

pub async fn get_all_audit_log_pages( &self, report_id: &str, ) -> Result<Vec<AuditLogEntry>, VeracodeError>

Retrieve all audit logs across all pages (OPTIMIZED)

This method handles pagination automatically and collects all audit log entries from all pages into a single vector. It uses optimized processing that only deserializes the timestamp field and keeps raw JSON for efficiency.

Performance optimizations:

  • Minimal deserialization: Only extracts timestamp field
  • Zero cloning: Keeps raw JSON strings instead of parsing all fields
  • Fast hashing: Uses xxHash (10-50x faster than SHA256) for duplicate detection
§Arguments
  • report_id - The report ID (must be in COMPLETED status)
§Returns

A vector containing all audit log entries from all pages

§Errors

Returns VeracodeError if any page retrieval fails

Source

pub async fn get_audit_logs( &self, request: &AuditReportRequest, ) -> Result<Value, VeracodeError>

Convenience method to generate and retrieve audit logs in one call

This method combines report generation, status polling, and pagination to retrieve all audit logs. It’s the recommended way to retrieve audit logs.

§Arguments
  • request - The audit report request parameters
§Returns

The audit log data as a JSON value containing all entries from all pages

§Errors

Returns VeracodeError if the request fails

Trait Implementations§

Source§

impl Clone for ReportingApi

Source§

fn clone(&self) -> ReportingApi

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more