pub struct VeracodeConfig {
pub credentials: VeracodeCredentials,
pub base_url: String,
pub rest_base_url: String,
pub xml_base_url: String,
pub region: VeracodeRegion,
pub validate_certificates: bool,
pub retry_config: RetryConfig,
pub connect_timeout: u64,
pub request_timeout: u64,
pub proxy_url: Option<String>,
pub proxy_username: Option<SecretString>,
pub proxy_password: Option<SecretString>,
}Expand description
Configuration for the Veracode API client.
This struct contains all the necessary configuration for connecting to the Veracode APIs, including authentication credentials and regional settings. It automatically manages both REST API (api.veracode.) and XML API (analysiscenter.veracode.) endpoints based on the selected region.
Fields§
§credentials: VeracodeCredentialsARC-based credentials for thread-safe access
base_url: StringBase URL for the current client instance
rest_base_url: StringREST API base URL (api.veracode.*)
xml_base_url: StringXML API base URL (analysiscenter.veracode.*)
region: VeracodeRegionVeracode region for your account
validate_certificates: boolWhether to validate TLS certificates (default: true)
retry_config: RetryConfigRetry configuration for HTTP requests
connect_timeout: u64HTTP connection timeout in seconds (default: 30)
request_timeout: u64HTTP request timeout in seconds (default: 300)
proxy_url: Option<String>HTTP/HTTPS proxy URL (optional)
proxy_username: Option<SecretString>Proxy authentication username (optional)
proxy_password: Option<SecretString>Proxy authentication password (optional)
Implementations§
Source§impl VeracodeConfig
impl VeracodeConfig
Sourcepub fn new(api_id: &str, api_key: &str) -> Self
pub fn new(api_id: &str, api_key: &str) -> Self
Create a new configuration for the Commercial region.
This creates a configuration that supports both REST API (api.veracode.)
and XML API (analysiscenter.veracode.) endpoints. The base_url defaults
to REST API for most modules, while sandbox scan operations automatically
use the XML API endpoint.
§Arguments
api_id- Your Veracode API IDapi_key- Your Veracode API key
§Returns
A new VeracodeConfig instance configured for the Commercial region.
Sourcepub fn from_arc_credentials(
api_id: Arc<SecretString>,
api_key: Arc<SecretString>,
) -> Self
pub fn from_arc_credentials( api_id: Arc<SecretString>, api_key: Arc<SecretString>, ) -> Self
Create a new configuration with ARC-based credentials
This method allows direct use of ARC pointers for credential sharing across threads and components.
Sourcepub fn with_region(self, region: VeracodeRegion) -> Self
pub fn with_region(self, region: VeracodeRegion) -> Self
Set the region for this configuration.
This will automatically update both REST and XML API URLs to match the region. All modules will use the appropriate regional endpoint for their API type.
§Arguments
region- The Veracode region to use
§Returns
The updated configuration instance (for method chaining).
Sourcepub fn with_certificate_validation_disabled(self) -> Self
pub fn with_certificate_validation_disabled(self) -> Self
Disable certificate validation for development environments.
WARNING: This should only be used in development environments with self-signed certificates. Never use this in production.
§Returns
The updated configuration instance (for method chaining).
Sourcepub fn with_retry_config(self, retry_config: RetryConfig) -> Self
pub fn with_retry_config(self, retry_config: RetryConfig) -> Self
Sourcepub fn with_retries_disabled(self) -> Self
pub fn with_retries_disabled(self) -> Self
Disable retries for HTTP requests.
This will set the retry configuration to perform no retries on failed requests. Useful for scenarios where you want to handle errors immediately without any delays.
§Returns
The updated configuration instance (for method chaining).
Sourcepub fn with_connect_timeout(self, timeout_seconds: u64) -> Self
pub fn with_connect_timeout(self, timeout_seconds: u64) -> Self
Sourcepub fn with_request_timeout(self, timeout_seconds: u64) -> Self
pub fn with_request_timeout(self, timeout_seconds: u64) -> Self
Sourcepub fn with_timeouts(
self,
connect_timeout_seconds: u64,
request_timeout_seconds: u64,
) -> Self
pub fn with_timeouts( self, connect_timeout_seconds: u64, request_timeout_seconds: u64, ) -> Self
Sourcepub fn api_id_arc(&self) -> Arc<SecretString>
pub fn api_id_arc(&self) -> Arc<SecretString>
Get ARC pointer to API ID for sharing across threads
Sourcepub fn api_key_arc(&self) -> Arc<SecretString>
pub fn api_key_arc(&self) -> Arc<SecretString>
Get ARC pointer to API key for sharing across threads
Sourcepub fn with_proxy(self, proxy_url: impl Into<String>) -> Self
pub fn with_proxy(self, proxy_url: impl Into<String>) -> Self
Set the HTTP/HTTPS proxy URL.
Configures an HTTP or HTTPS proxy for all requests. The proxy URL should include
the protocol (http:// or https://). Credentials can be embedded in the URL or
set separately using with_proxy_auth().
§Arguments
proxy_url- The proxy URL (e.g., “http://proxy.example.com:8080”)
§Returns
The updated configuration instance (for method chaining).
§Examples
use veracode_platform::VeracodeConfig;
// Without authentication
let config = VeracodeConfig::new("api_id", "api_key")
.with_proxy("http://proxy.example.com:8080");
// With embedded credentials (less secure)
let config = VeracodeConfig::new("api_id", "api_key")
.with_proxy("http://user:pass@proxy.example.com:8080");Sourcepub fn with_proxy_auth(
self,
username: impl Into<String>,
password: impl Into<String>,
) -> Self
pub fn with_proxy_auth( self, username: impl Into<String>, password: impl Into<String>, ) -> Self
Set proxy authentication credentials.
Configures username and password for proxy authentication using HTTP Basic Auth.
This is more secure than embedding credentials in the proxy URL as the credentials
are stored using SecretString and properly redacted in debug output.
§Arguments
username- The proxy usernamepassword- The proxy password
§Returns
The updated configuration instance (for method chaining).
§Examples
use veracode_platform::VeracodeConfig;
let config = VeracodeConfig::new("api_id", "api_key")
.with_proxy("http://proxy.example.com:8080")
.with_proxy_auth("username", "password");Trait Implementations§
Source§impl Clone for VeracodeConfig
impl Clone for VeracodeConfig
Source§fn clone(&self) -> VeracodeConfig
fn clone(&self) -> VeracodeConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more