pub struct ReportingApi { /* private fields */ }Expand description
The Reporting API interface
Implementations§
Source§impl ReportingApi
impl ReportingApi
Sourcepub fn new(client: VeracodeClient) -> Self
pub fn new(client: VeracodeClient) -> Self
Create a new Reporting API instance
Sourcepub async fn generate_audit_report(
&self,
request: &AuditReportRequest,
) -> Result<String, VeracodeError>
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
Sourcepub async fn get_audit_report(
&self,
report_id: &str,
page: Option<u32>,
) -> Result<ReportResponse, VeracodeError>
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 fromgenerate_audit_reportpage- Optional page number (0-indexed) for pagination
§Returns
The report response with status and audit log data
§Errors
Returns VeracodeError if the request fails
Sourcepub async fn poll_report_status(
&self,
report_id: &str,
max_attempts: Option<u32>,
initial_delay_secs: Option<u64>,
) -> Result<ReportResponse, VeracodeError>
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 pollmax_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
Sourcepub async fn get_all_audit_log_pages(
&self,
report_id: &str,
) -> Result<Vec<AuditLogEntry>, VeracodeError>
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
Sourcepub async fn get_audit_logs(
&self,
request: &AuditReportRequest,
) -> Result<Value, VeracodeError>
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
impl Clone for ReportingApi
Source§fn clone(&self) -> ReportingApi
fn clone(&self) -> ReportingApi
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more