pub struct ScanApi { /* private fields */ }Expand description
Veracode Scan API operations
Implementations§
Source§impl ScanApi
impl ScanApi
Sourcepub fn new(client: VeracodeClient) -> Self
pub fn new(client: VeracodeClient) -> Self
§Errors
Returns an error if the API request fails, the resource is not found,
or authentication/authorization fails.
Create a new ScanApi instance
Sourcepub async fn upload_file(
&self,
request: &UploadFileRequest,
) -> Result<UploadedFile, ScanError>
pub async fn upload_file( &self, request: &UploadFileRequest, ) -> Result<UploadedFile, ScanError>
Sourcepub async fn upload_large_file(
&self,
request: UploadLargeFileRequest,
) -> Result<UploadedFile, ScanError>
pub async fn upload_large_file( &self, request: UploadLargeFileRequest, ) -> Result<UploadedFile, ScanError>
Upload a large file using the uploadlargefile.do endpoint
This method uploads large files (up to 2GB) to an existing build. Unlike uploadfile.do, this endpoint requires a build to exist before uploading. It automatically creates a build if one doesn’t exist.
§Arguments
request- The upload large file request
§Returns
A Result containing the uploaded file information or an error.
§Errors
Returns an error if the API request fails, the scan operation fails, or authentication/authorization fails.
Sourcepub async fn upload_large_file_with_progress<F>(
&self,
request: UploadLargeFileRequest,
progress_callback: F,
) -> Result<UploadedFile, ScanError>
pub async fn upload_large_file_with_progress<F>( &self, request: UploadLargeFileRequest, progress_callback: F, ) -> Result<UploadedFile, ScanError>
Upload a large file with progress tracking
§Errors
Returns an error if the API request fails, the scan operation fails,
or authentication/authorization fails.
This method provides the same functionality as upload_large_file but with
progress tracking capabilities through a callback function.
§Arguments
request- The upload large file request
§Errors
Returns an error if the API request fails, the scan operation fails, or authentication/authorization fails.
progress_callback- Callback function for progress updates (bytes_uploaded,total_bytes, percentage)
§Returns
A Result containing the uploaded file information or an error.
§Errors
Returns an error if the API request fails, the scan operation fails, or authentication/authorization fails.
Sourcepub async fn upload_file_smart(
&self,
request: &UploadFileRequest,
) -> Result<UploadedFile, ScanError>
pub async fn upload_file_smart( &self, request: &UploadFileRequest, ) -> Result<UploadedFile, ScanError>
Intelligently choose between uploadfile.do and uploadlargefile.do
This method automatically selects the appropriate upload endpoint based on file size and other factors, similar to the Java API wrapper behavior.
§Arguments
request- The upload file request (converted to appropriate format)
§Returns
A Result containing the uploaded file information or an error.
§Errors
Returns an error if the API request fails, the scan operation fails, or authentication/authorization fails.
Sourcepub async fn begin_prescan(
&self,
request: &BeginPreScanRequest,
) -> Result<(), ScanError>
pub async fn begin_prescan( &self, request: &BeginPreScanRequest, ) -> Result<(), ScanError>
Sourcepub async fn get_prescan_results(
&self,
app_id: &str,
sandbox_id: Option<&str>,
build_id: Option<&str>,
) -> Result<PreScanResults, ScanError>
pub async fn get_prescan_results( &self, app_id: &str, sandbox_id: Option<&str>, build_id: Option<&str>, ) -> Result<PreScanResults, ScanError>
Get pre-scan results for an application or sandbox
§Arguments
app_id- The application IDsandbox_id- The sandbox ID (optional)build_id- The build ID (optional)
§Returns
A Result containing the pre-scan results or an error.
§Errors
Returns an error if the API request fails, the scan operation fails, or authentication/authorization fails.
Sourcepub async fn begin_scan(
&self,
request: &BeginScanRequest,
) -> Result<(), ScanError>
pub async fn begin_scan( &self, request: &BeginScanRequest, ) -> Result<(), ScanError>
Sourcepub async fn get_file_list(
&self,
app_id: &str,
sandbox_id: Option<&str>,
build_id: Option<&str>,
) -> Result<Vec<UploadedFile>, ScanError>
pub async fn get_file_list( &self, app_id: &str, sandbox_id: Option<&str>, build_id: Option<&str>, ) -> Result<Vec<UploadedFile>, ScanError>
Get list of uploaded files for an application or sandbox
§Arguments
app_id- The application IDsandbox_id- The sandbox ID (optional)build_id- The build ID (optional)
§Returns
A Result containing the list of uploaded files or an error.
§Errors
Returns an error if the API request fails, the scan operation fails, or authentication/authorization fails.
Sourcepub async fn remove_file(
&self,
app_id: &str,
file_id: &str,
sandbox_id: Option<&str>,
) -> Result<(), ScanError>
pub async fn remove_file( &self, app_id: &str, file_id: &str, sandbox_id: Option<&str>, ) -> Result<(), ScanError>
Remove a file from an application or sandbox
§Arguments
app_id- The application IDfile_id- The file ID to removesandbox_id- The sandbox ID (optional)
§Returns
A Result indicating success or an error.
§Errors
Returns an error if the API request fails, the scan operation fails, or authentication/authorization fails.
Sourcepub async fn delete_build(
&self,
app_id: &str,
build_id: &str,
sandbox_id: Option<&str>,
) -> Result<(), ScanError>
pub async fn delete_build( &self, app_id: &str, build_id: &str, sandbox_id: Option<&str>, ) -> Result<(), ScanError>
Delete a build from an application or sandbox
This removes all uploaded files and scan data for a specific build.
§Arguments
app_id- The application IDbuild_id- The build ID to deletesandbox_id- The sandbox ID (optional)
§Returns
A Result indicating success or an error.
§Errors
Returns an error if the API request fails, the scan operation fails, or authentication/authorization fails.
Sourcepub async fn delete_all_builds(
&self,
app_id: &str,
sandbox_id: Option<&str>,
) -> Result<(), ScanError>
pub async fn delete_all_builds( &self, app_id: &str, sandbox_id: Option<&str>, ) -> Result<(), ScanError>
Delete all builds for an application or sandbox
This removes all uploaded files and scan data for all builds. Use with caution as this is irreversible.
§Arguments
app_id- The application IDsandbox_id- The sandbox ID (optional)
§Returns
A Result indicating success or an error.
§Errors
Returns an error if the API request fails, the scan operation fails, or authentication/authorization fails.
Sourcepub async fn get_build_info(
&self,
app_id: &str,
build_id: Option<&str>,
sandbox_id: Option<&str>,
) -> Result<ScanInfo, ScanError>
pub async fn get_build_info( &self, app_id: &str, build_id: Option<&str>, sandbox_id: Option<&str>, ) -> Result<ScanInfo, ScanError>
Get build information for an application or sandbox
§Arguments
app_id- The application IDbuild_id- The build ID (optional)sandbox_id- The sandbox ID (optional)
§Returns
A Result containing the scan information or an error.
§Errors
Returns an error if the API request fails, the scan operation fails, or authentication/authorization fails.
Source§impl ScanApi
Convenience methods for common scan operations
impl ScanApi
Convenience methods for common scan operations
Sourcepub async fn upload_file_to_sandbox(
&self,
app_id: &str,
file_path: &str,
sandbox_id: &str,
) -> Result<UploadedFile, ScanError>
pub async fn upload_file_to_sandbox( &self, app_id: &str, file_path: &str, sandbox_id: &str, ) -> Result<UploadedFile, ScanError>
Upload a file to a sandbox with simple parameters
§Arguments
app_id- The application IDfile_path- Path to the file to uploadsandbox_id- The sandbox ID
§Returns
A Result containing the uploaded file information or an error.
§Errors
Returns an error if the API request fails, the scan operation fails, or authentication/authorization fails.
Sourcepub async fn upload_file_to_app(
&self,
app_id: &str,
file_path: &str,
) -> Result<UploadedFile, ScanError>
pub async fn upload_file_to_app( &self, app_id: &str, file_path: &str, ) -> Result<UploadedFile, ScanError>
Upload a file to an application (non-sandbox)
§Arguments
app_id- The application IDfile_path- Path to the file to upload
§Returns
A Result containing the uploaded file information or an error.
§Errors
Returns an error if the API request fails, the scan operation fails, or authentication/authorization fails.
Sourcepub async fn upload_large_file_to_sandbox(
&self,
app_id: &str,
file_path: &str,
sandbox_id: &str,
filename: Option<&str>,
) -> Result<UploadedFile, ScanError>
pub async fn upload_large_file_to_sandbox( &self, app_id: &str, file_path: &str, sandbox_id: &str, filename: Option<&str>, ) -> Result<UploadedFile, ScanError>
Upload a large file to a sandbox using uploadlargefile.do
§Arguments
app_id- The application IDfile_path- Path to the file to uploadsandbox_id- The sandbox IDfilename- Optional filename for flaw matching
§Returns
A Result containing the uploaded file information or an error.
§Errors
Returns an error if the API request fails, the scan operation fails, or authentication/authorization fails.
Sourcepub async fn upload_large_file_to_app(
&self,
app_id: &str,
file_path: &str,
filename: Option<&str>,
) -> Result<UploadedFile, ScanError>
pub async fn upload_large_file_to_app( &self, app_id: &str, file_path: &str, filename: Option<&str>, ) -> Result<UploadedFile, ScanError>
Upload a large file to an application using uploadlargefile.do
§Arguments
app_id- The application IDfile_path- Path to the file to uploadfilename- Optional filename for flaw matching
§Returns
A Result containing the uploaded file information or an error.
§Errors
Returns an error if the API request fails, the scan operation fails, or authentication/authorization fails.
Sourcepub async fn upload_large_file_to_sandbox_with_progress<F>(
&self,
app_id: &str,
file_path: &str,
sandbox_id: &str,
filename: Option<&str>,
progress_callback: F,
) -> Result<UploadedFile, ScanError>
pub async fn upload_large_file_to_sandbox_with_progress<F>( &self, app_id: &str, file_path: &str, sandbox_id: &str, filename: Option<&str>, progress_callback: F, ) -> Result<UploadedFile, ScanError>
Upload a large file with progress tracking to a sandbox
§Arguments
app_id- The application IDfile_path- Path to the file to uploadsandbox_id- The sandbox IDfilename- Optional filename for flaw matchingprogress_callback- Callback for progress updates
§Returns
A Result containing the uploaded file information or an error.
§Errors
Returns an error if the API request fails, the scan operation fails, or authentication/authorization fails.
Sourcepub async fn begin_sandbox_prescan(
&self,
app_id: &str,
sandbox_id: &str,
) -> Result<(), ScanError>
pub async fn begin_sandbox_prescan( &self, app_id: &str, sandbox_id: &str, ) -> Result<(), ScanError>
Sourcepub async fn begin_sandbox_scan_all_modules(
&self,
app_id: &str,
sandbox_id: &str,
) -> Result<(), ScanError>
pub async fn begin_sandbox_scan_all_modules( &self, app_id: &str, sandbox_id: &str, ) -> Result<(), ScanError>
Sourcepub async fn upload_and_scan_sandbox(
&self,
app_id: &str,
sandbox_id: &str,
file_path: &str,
) -> Result<String, ScanError>
pub async fn upload_and_scan_sandbox( &self, app_id: &str, sandbox_id: &str, file_path: &str, ) -> Result<String, ScanError>
Complete workflow: upload file, pre-scan, and begin scan for sandbox
§Arguments
app_id- The application IDsandbox_id- The sandbox IDfile_path- Path to the file to upload
§Returns
A Result containing the scan build ID or an error.
§Errors
Returns an error if the API request fails, the scan operation fails, or authentication/authorization fails.