pub struct VeracodeClient { /* private fields */ }
Expand description
Core Veracode API client.
This struct provides the foundational HTTP client with HMAC authentication for making requests to any Veracode API endpoint.
Implementations§
Source§impl VeracodeClient
Application-specific methods that build on the core client.
impl VeracodeClient
Application-specific methods that build on the core client.
Sourcepub async fn get_applications(
&self,
query: Option<ApplicationQuery>,
) -> Result<ApplicationsResponse, VeracodeError>
pub async fn get_applications( &self, query: Option<ApplicationQuery>, ) -> Result<ApplicationsResponse, VeracodeError>
Sourcepub async fn get_application(
&self,
guid: &str,
) -> Result<Application, VeracodeError>
pub async fn get_application( &self, guid: &str, ) -> Result<Application, VeracodeError>
Sourcepub async fn create_application(
&self,
request: &CreateApplicationRequest,
) -> Result<Application, VeracodeError>
pub async fn create_application( &self, request: &CreateApplicationRequest, ) -> Result<Application, VeracodeError>
Sourcepub async fn update_application(
&self,
guid: &str,
request: &UpdateApplicationRequest,
) -> Result<Application, VeracodeError>
pub async fn update_application( &self, guid: &str, request: &UpdateApplicationRequest, ) -> Result<Application, VeracodeError>
Sourcepub async fn delete_application(&self, guid: &str) -> Result<(), VeracodeError>
pub async fn delete_application(&self, guid: &str) -> Result<(), VeracodeError>
Sourcepub async fn get_non_compliant_applications(
&self,
) -> Result<Vec<Application>, VeracodeError>
pub async fn get_non_compliant_applications( &self, ) -> Result<Vec<Application>, VeracodeError>
Get applications that failed policy compliance.
§Returns
A Result
containing a Vec<Application>
of non-compliant applications.
Sourcepub async fn get_applications_modified_after(
&self,
date: &str,
) -> Result<Vec<Application>, VeracodeError>
pub async fn get_applications_modified_after( &self, date: &str, ) -> Result<Vec<Application>, VeracodeError>
Sourcepub async fn search_applications_by_name(
&self,
name: &str,
) -> Result<Vec<Application>, VeracodeError>
pub async fn search_applications_by_name( &self, name: &str, ) -> Result<Vec<Application>, VeracodeError>
Sourcepub async fn get_all_applications(
&self,
) -> Result<Vec<Application>, VeracodeError>
pub async fn get_all_applications( &self, ) -> Result<Vec<Application>, VeracodeError>
Get all applications with automatic pagination.
§Returns
A Result
containing a Vec<Application>
of all applications.
Sourcepub async fn get_application_by_name(
&self,
name: &str,
) -> Result<Option<Application>, VeracodeError>
pub async fn get_application_by_name( &self, name: &str, ) -> Result<Option<Application>, VeracodeError>
Sourcepub async fn application_exists_by_name(
&self,
name: &str,
) -> Result<bool, VeracodeError>
pub async fn application_exists_by_name( &self, name: &str, ) -> Result<bool, VeracodeError>
Sourcepub async fn get_app_id_from_guid(
&self,
guid: &str,
) -> Result<String, VeracodeError>
pub async fn get_app_id_from_guid( &self, guid: &str, ) -> Result<String, VeracodeError>
Sourcepub async fn create_application_if_not_exists(
&self,
name: &str,
business_criticality: BusinessCriticality,
description: Option<String>,
team_names: Option<Vec<String>>,
) -> Result<Application, VeracodeError>
pub async fn create_application_if_not_exists( &self, name: &str, business_criticality: BusinessCriticality, description: Option<String>, team_names: Option<Vec<String>>, ) -> Result<Application, VeracodeError>
Create application if it doesn’t exist, or return existing application.
This method implements the “check and create” pattern commonly needed for automated workflows.
§Arguments
name
- The name of the applicationbusiness_criticality
- Business criticality level (required for creation)description
- Optional description for new applicationsteam_names
- Optional list of team names to assign to the application
§Returns
A Result
containing the application (existing or newly created).
Sourcepub async fn create_application_if_not_exists_with_team_guids(
&self,
name: &str,
business_criticality: BusinessCriticality,
description: Option<String>,
team_guids: Option<Vec<String>>,
) -> Result<Application, VeracodeError>
pub async fn create_application_if_not_exists_with_team_guids( &self, name: &str, business_criticality: BusinessCriticality, description: Option<String>, team_guids: Option<Vec<String>>, ) -> Result<Application, VeracodeError>
Create application if it doesn’t exist, or return existing application (with team GUIDs).
This method allows specifying teams by their GUID, which is the preferred approach for programmatic application creation.
§Arguments
name
- The name of the applicationbusiness_criticality
- Business criticality level (required for creation)description
- Optional description for new applicationsteam_guids
- Optional list of team GUIDs to assign to the application
§Returns
A Result
containing the application (existing or newly created).
Sourcepub async fn create_application_if_not_exists_simple(
&self,
name: &str,
business_criticality: BusinessCriticality,
description: Option<String>,
) -> Result<Application, VeracodeError>
pub async fn create_application_if_not_exists_simple( &self, name: &str, business_criticality: BusinessCriticality, description: Option<String>, ) -> Result<Application, VeracodeError>
Create application if it doesn’t exist, or return existing application (without teams).
This is a convenience method that maintains backward compatibility for callers that don’t need to specify teams.
§Arguments
name
- The name of the applicationbusiness_criticality
- Business criticality level (required for creation)description
- Optional description for new applications
§Returns
A Result
containing the application (existing or newly created).
Source§impl VeracodeClient
impl VeracodeClient
Sourcepub fn new(config: VeracodeConfig) -> Result<Self, VeracodeError>
pub fn new(config: VeracodeConfig) -> Result<Self, VeracodeError>
Sourcepub fn config(&self) -> &VeracodeConfig
pub fn config(&self) -> &VeracodeConfig
Get access to the configuration
Sourcepub fn generate_auth_header(
&self,
method: &str,
url: &str,
) -> Result<String, VeracodeError>
pub fn generate_auth_header( &self, method: &str, url: &str, ) -> Result<String, VeracodeError>
Generate authorization header for HMAC authentication
Sourcepub async fn get(
&self,
endpoint: &str,
query_params: Option<&[(String, String)]>,
) -> Result<Response, VeracodeError>
pub async fn get( &self, endpoint: &str, query_params: Option<&[(String, String)]>, ) -> Result<Response, VeracodeError>
Sourcepub async fn post<T: Serialize>(
&self,
endpoint: &str,
body: Option<&T>,
) -> Result<Response, VeracodeError>
pub async fn post<T: Serialize>( &self, endpoint: &str, body: Option<&T>, ) -> Result<Response, VeracodeError>
Sourcepub async fn put<T: Serialize>(
&self,
endpoint: &str,
body: Option<&T>,
) -> Result<Response, VeracodeError>
pub async fn put<T: Serialize>( &self, endpoint: &str, body: Option<&T>, ) -> Result<Response, VeracodeError>
Sourcepub async fn handle_response(
response: Response,
) -> Result<Response, VeracodeError>
pub async fn handle_response( response: Response, ) -> Result<Response, VeracodeError>
Sourcepub async fn get_with_query(
&self,
endpoint: &str,
query_params: Option<Vec<(String, String)>>,
) -> Result<Response, VeracodeError>
pub async fn get_with_query( &self, endpoint: &str, query_params: Option<Vec<(String, String)>>, ) -> Result<Response, VeracodeError>
Make a GET request with full URL construction and query parameter handling.
This is a higher-level method that builds the full URL and handles query parameters.
§Arguments
endpoint
- The API endpoint pathquery_params
- Optional query parameters
§Returns
A Result
containing the HTTP response, pre-processed for success/failure.
Sourcepub async fn post_with_response<T: Serialize>(
&self,
endpoint: &str,
body: Option<&T>,
) -> Result<Response, VeracodeError>
pub async fn post_with_response<T: Serialize>( &self, endpoint: &str, body: Option<&T>, ) -> Result<Response, VeracodeError>
Sourcepub async fn put_with_response<T: Serialize>(
&self,
endpoint: &str,
body: Option<&T>,
) -> Result<Response, VeracodeError>
pub async fn put_with_response<T: Serialize>( &self, endpoint: &str, body: Option<&T>, ) -> Result<Response, VeracodeError>
Sourcepub async fn delete_with_response(
&self,
endpoint: &str,
) -> Result<Response, VeracodeError>
pub async fn delete_with_response( &self, endpoint: &str, ) -> Result<Response, VeracodeError>
Sourcepub async fn get_paginated(
&self,
endpoint: &str,
base_query_params: Option<Vec<(String, String)>>,
page_size: Option<u32>,
) -> Result<String, VeracodeError>
pub async fn get_paginated( &self, endpoint: &str, base_query_params: Option<Vec<(String, String)>>, page_size: Option<u32>, ) -> Result<String, VeracodeError>
Make paginated GET requests to collect all results.
This method automatically handles pagination by making multiple requests and combining all results into a single response.
§Arguments
endpoint
- The API endpoint pathbase_query_params
- Base query parameters (non-pagination)page_size
- Number of items per page (default: 500)
§Returns
A Result
containing all paginated results as a single response body string.
Sourcepub async fn get_with_params(
&self,
endpoint: &str,
params: &[(&str, &str)],
) -> Result<Response, VeracodeError>
pub async fn get_with_params( &self, endpoint: &str, params: &[(&str, &str)], ) -> Result<Response, VeracodeError>
Sourcepub async fn post_form(
&self,
endpoint: &str,
params: &[(&str, &str)],
) -> Result<Response, VeracodeError>
pub async fn post_form( &self, endpoint: &str, params: &[(&str, &str)], ) -> Result<Response, VeracodeError>
Sourcepub async fn upload_file_multipart(
&self,
endpoint: &str,
params: HashMap<&str, &str>,
file_field_name: &str,
filename: &str,
file_data: Vec<u8>,
) -> Result<Response, VeracodeError>
pub async fn upload_file_multipart( &self, endpoint: &str, params: HashMap<&str, &str>, file_field_name: &str, filename: &str, file_data: Vec<u8>, ) -> Result<Response, VeracodeError>
Sourcepub async fn upload_file_multipart_put(
&self,
url: &str,
file_field_name: &str,
filename: &str,
file_data: Vec<u8>,
additional_headers: Option<HashMap<&str, &str>>,
) -> Result<Response, VeracodeError>
pub async fn upload_file_multipart_put( &self, url: &str, file_field_name: &str, filename: &str, file_data: Vec<u8>, additional_headers: Option<HashMap<&str, &str>>, ) -> Result<Response, VeracodeError>
Upload a file using multipart form data with PUT method (for pipeline scans)
§Arguments
url
- The full URL to upload tofile_field_name
- Name of the file fieldfilename
- Name of the filefile_data
- File data as bytesadditional_headers
- Additional headers to include
§Returns
A Result
containing the response or an error.
Sourcepub async fn upload_file_with_query_params(
&self,
endpoint: &str,
query_params: &[(&str, &str)],
file_field_name: &str,
filename: &str,
file_data: Vec<u8>,
) -> Result<Response, VeracodeError>
pub async fn upload_file_with_query_params( &self, endpoint: &str, query_params: &[(&str, &str)], file_field_name: &str, filename: &str, file_data: Vec<u8>, ) -> Result<Response, VeracodeError>
Upload a file with query parameters (like Java implementation)
This method mimics the Java API wrapper’s approach where parameters are added to the query string and the file is uploaded separately.
Memory optimization: Uses Cow for strings and Arc for file data to minimize cloning during retry attempts. Automatically retries on transient failures.
§Arguments
endpoint
- The API endpoint to callquery_params
- Query parameters as key-value pairsfile_field_name
- Name of the file fieldfilename
- Name of the filefile_data
- File data as bytes
§Returns
A Result
containing the response or an error.
Sourcepub async fn post_with_query_params(
&self,
endpoint: &str,
query_params: &[(&str, &str)],
) -> Result<Response, VeracodeError>
pub async fn post_with_query_params( &self, endpoint: &str, query_params: &[(&str, &str)], ) -> Result<Response, VeracodeError>
Make a POST request with query parameters (like Java implementation for XML API)
This method mimics the Java API wrapper’s approach for POST operations where parameters are added to the query string rather than form data.
§Arguments
endpoint
- The API endpoint to callquery_params
- Query parameters as key-value pairs
§Returns
A Result
containing the response or an error.
Sourcepub async fn get_with_query_params(
&self,
endpoint: &str,
query_params: &[(&str, &str)],
) -> Result<Response, VeracodeError>
pub async fn get_with_query_params( &self, endpoint: &str, query_params: &[(&str, &str)], ) -> Result<Response, VeracodeError>
Make a GET request with query parameters (like Java implementation for XML API)
This method mimics the Java API wrapper’s approach for GET operations where parameters are added to the query string.
§Arguments
endpoint
- The API endpoint to callquery_params
- Query parameters as key-value pairs
§Returns
A Result
containing the response or an error.
Sourcepub async fn upload_large_file_chunked<F>(
&self,
endpoint: &str,
query_params: &[(&str, &str)],
file_path: &str,
content_type: Option<&str>,
progress_callback: Option<F>,
) -> Result<Response, VeracodeError>
pub async fn upload_large_file_chunked<F>( &self, endpoint: &str, query_params: &[(&str, &str)], file_path: &str, content_type: Option<&str>, progress_callback: Option<F>, ) -> Result<Response, VeracodeError>
Upload a large file using chunked streaming (for uploadlargefile.do)
This method implements chunked upload functionality similar to the Java API wrapper. It uploads files in chunks and provides progress tracking capabilities.
§Arguments
endpoint
- The API endpoint to callquery_params
- Query parameters as key-value pairsfile_path
- Path to the file to uploadcontent_type
- Content type for the file (default: binary/octet-stream)progress_callback
- Optional callback for progress tracking
§Returns
A Result
containing the response or an error.
Sourcepub async fn upload_file_binary(
&self,
endpoint: &str,
query_params: &[(&str, &str)],
file_data: Vec<u8>,
content_type: &str,
) -> Result<Response, VeracodeError>
pub async fn upload_file_binary( &self, endpoint: &str, query_params: &[(&str, &str)], file_data: Vec<u8>, content_type: &str, ) -> Result<Response, VeracodeError>
Upload a file with binary data (optimized for uploadlargefile.do)
This method uploads a file as raw binary data without multipart encoding, which is the expected format for the uploadlargefile.do endpoint.
Memory optimization: Uses Arc for file data and Cow for strings to minimize allocations during retry attempts. Automatically retries on transient failures.
§Arguments
endpoint
- The API endpoint to callquery_params
- Query parameters as key-value pairsfile_data
- File data as bytescontent_type
- Content type for the file
§Returns
A Result
containing the response or an error.
Source§impl VeracodeClient
impl VeracodeClient
Sourcepub fn applications_api(&self) -> &Self
pub fn applications_api(&self) -> &Self
Get an applications API instance. Uses REST API (api.veracode.*).
Sourcepub fn sandbox_api(&self) -> SandboxApi<'_>
pub fn sandbox_api(&self) -> SandboxApi<'_>
Get a sandbox API instance. Uses REST API (api.veracode.*).
Sourcepub fn identity_api(&self) -> IdentityApi<'_>
pub fn identity_api(&self) -> IdentityApi<'_>
Get an identity API instance. Uses REST API (api.veracode.*).
Sourcepub fn pipeline_api(&self) -> PipelineApi
pub fn pipeline_api(&self) -> PipelineApi
Get a pipeline scan API instance. Uses REST API (api.veracode.*).
Sourcepub fn policy_api(&self) -> PolicyApi<'_>
pub fn policy_api(&self) -> PolicyApi<'_>
Get a policy API instance. Uses REST API (api.veracode.*).
Sourcepub fn findings_api(&self) -> FindingsApi
pub fn findings_api(&self) -> FindingsApi
Get a findings API instance. Uses REST API (api.veracode.*).
Sourcepub fn scan_api(&self) -> ScanApi
pub fn scan_api(&self) -> ScanApi
Get a scan API instance. Uses XML API (analysiscenter.veracode.*) for both sandbox and application scans.
Sourcepub fn build_api(&self) -> BuildApi
pub fn build_api(&self) -> BuildApi
Get a build API instance. Uses XML API (analysiscenter.veracode.*) for build management operations.
Sourcepub fn workflow(&self) -> VeracodeWorkflow
pub fn workflow(&self) -> VeracodeWorkflow
Get a workflow helper instance. Provides high-level operations that combine multiple API calls.
Trait Implementations§
Source§impl Clone for VeracodeClient
impl Clone for VeracodeClient
Source§fn clone(&self) -> VeracodeClient
fn clone(&self) -> VeracodeClient
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more