pub struct SandboxApi<'a> { /* private fields */ }Expand description
Veracode Sandbox API operations
Implementations§
Source§impl<'a> SandboxApi<'a>
impl<'a> SandboxApi<'a>
Sourcepub fn new(client: &'a VeracodeClient) -> Self
pub fn new(client: &'a VeracodeClient) -> Self
§Errors
Returns an error if the API request fails, the resource is not found,
or authentication/authorization fails.
Create a new SandboxApi instance
Sourcepub async fn list_sandboxes(
&self,
application_guid: &str,
params: Option<SandboxListParams>,
) -> Result<Vec<Sandbox>, SandboxError>
pub async fn list_sandboxes( &self, application_guid: &str, params: Option<SandboxListParams>, ) -> Result<Vec<Sandbox>, SandboxError>
List all sandboxes for a given application
§Arguments
application_guid- The GUID of the applicationparams- Optional query parameters for filtering
§Returns
A Result containing a list of sandboxes or an error.
§Errors
Returns an error if the API request fails, the sandbox is not found, or authentication/authorization fails.
Sourcepub async fn get_sandbox(
&self,
application_guid: &str,
sandbox_guid: &str,
) -> Result<Sandbox, SandboxError>
pub async fn get_sandbox( &self, application_guid: &str, sandbox_guid: &str, ) -> Result<Sandbox, SandboxError>
Sourcepub async fn create_sandbox(
&self,
application_guid: &str,
request: CreateSandboxRequest,
) -> Result<Sandbox, SandboxError>
pub async fn create_sandbox( &self, application_guid: &str, request: CreateSandboxRequest, ) -> Result<Sandbox, SandboxError>
Sourcepub async fn update_sandbox(
&self,
application_guid: &str,
sandbox_guid: &str,
request: UpdateSandboxRequest,
) -> Result<Sandbox, SandboxError>
pub async fn update_sandbox( &self, application_guid: &str, sandbox_guid: &str, request: UpdateSandboxRequest, ) -> Result<Sandbox, SandboxError>
Update an existing sandbox
§Arguments
application_guid- The GUID of the applicationsandbox_guid- The GUID of the sandbox to updaterequest- The sandbox update request
§Returns
A Result containing the updated sandbox or an error.
§Errors
Returns an error if the API request fails, the sandbox is not found, or authentication/authorization fails.
Sourcepub async fn delete_sandbox(
&self,
application_guid: &str,
sandbox_guid: &str,
) -> Result<(), SandboxError>
pub async fn delete_sandbox( &self, application_guid: &str, sandbox_guid: &str, ) -> Result<(), SandboxError>
Sourcepub async fn promote_sandbox_scan(
&self,
application_guid: &str,
sandbox_guid: &str,
delete_on_promote: bool,
) -> Result<(), SandboxError>
pub async fn promote_sandbox_scan( &self, application_guid: &str, sandbox_guid: &str, delete_on_promote: bool, ) -> Result<(), SandboxError>
Promote a sandbox scan to the policy sandbox
§Arguments
application_guid- The GUID of the applicationsandbox_guid- The GUID of the sandbox to promotedelete_on_promote- Whether to delete the sandbox after promotion
§Returns
A Result indicating success or failure.
§Errors
Returns an error if the API request fails, the sandbox is not found, or authentication/authorization fails.
Sourcepub async fn get_sandbox_scans(
&self,
application_guid: &str,
sandbox_guid: &str,
) -> Result<Vec<SandboxScan>, SandboxError>
pub async fn get_sandbox_scans( &self, application_guid: &str, sandbox_guid: &str, ) -> Result<Vec<SandboxScan>, SandboxError>
Sourcepub async fn sandbox_exists(
&self,
application_guid: &str,
sandbox_guid: &str,
) -> Result<bool, SandboxError>
pub async fn sandbox_exists( &self, application_guid: &str, sandbox_guid: &str, ) -> Result<bool, SandboxError>
Check if a sandbox exists
§Arguments
application_guid- The GUID of the applicationsandbox_guid- The GUID of the sandbox
§Returns
A Result containing a boolean indicating if the sandbox exists.
§Errors
Returns an error if the API request fails, the sandbox is not found, or authentication/authorization fails.
Sourcepub async fn get_sandbox_by_name(
&self,
application_guid: &str,
name: &str,
) -> Result<Option<Sandbox>, SandboxError>
pub async fn get_sandbox_by_name( &self, application_guid: &str, name: &str, ) -> Result<Option<Sandbox>, SandboxError>
Get sandbox by name
§Arguments
application_guid- The GUID of the applicationname- The name of the sandbox to find
§Returns
A Result containing the sandbox if found, or None if not found.
§Errors
Returns an error if the API request fails, the sandbox is not found, or authentication/authorization fails.
Source§impl<'a> SandboxApi<'a>
Convenience methods for common sandbox operations
impl<'a> SandboxApi<'a>
Convenience methods for common sandbox operations
Sourcepub async fn create_simple_sandbox(
&self,
application_guid: &str,
name: &str,
) -> Result<Sandbox, SandboxError>
pub async fn create_simple_sandbox( &self, application_guid: &str, name: &str, ) -> Result<Sandbox, SandboxError>
Create a simple sandbox with just a name
§Arguments
application_guid- The GUID of the applicationname- The name of the sandbox
§Returns
A Result containing the created sandbox or an error.
§Errors
Returns an error if the API request fails, the sandbox is not found, or authentication/authorization fails.
Sourcepub async fn create_auto_recreate_sandbox(
&self,
application_guid: &str,
name: &str,
description: Option<String>,
) -> Result<Sandbox, SandboxError>
pub async fn create_auto_recreate_sandbox( &self, application_guid: &str, name: &str, description: Option<String>, ) -> Result<Sandbox, SandboxError>
Create a sandbox with auto-recreate enabled
§Arguments
application_guid- The GUID of the applicationname- The name of the sandboxdescription- Optional description
§Returns
A Result containing the created sandbox or an error.
§Errors
Returns an error if the API request fails, the sandbox is not found, or authentication/authorization fails.
Sourcepub async fn update_sandbox_name(
&self,
application_guid: &str,
sandbox_guid: &str,
new_name: &str,
) -> Result<Sandbox, SandboxError>
pub async fn update_sandbox_name( &self, application_guid: &str, sandbox_guid: &str, new_name: &str, ) -> Result<Sandbox, SandboxError>
Update sandbox name
§Arguments
application_guid- The GUID of the applicationsandbox_guid- The GUID of the sandboxnew_name- The new name for the sandbox
§Returns
A Result containing the updated sandbox or an error.
§Errors
Returns an error if the API request fails, the sandbox is not found, or authentication/authorization fails.
Sourcepub async fn count_sandboxes(
&self,
application_guid: &str,
) -> Result<u64, SandboxError>
pub async fn count_sandboxes( &self, application_guid: &str, ) -> Result<u64, SandboxError>
Sourcepub async fn get_sandbox_id_from_guid(
&self,
application_guid: &str,
sandbox_guid: &str,
) -> Result<String, SandboxError>
pub async fn get_sandbox_id_from_guid( &self, application_guid: &str, sandbox_guid: &str, ) -> Result<String, SandboxError>
§Errors
Returns an error if the API request fails, the sandbox is not found,
or authentication/authorization fails.
Get numeric sandbox_id from sandbox GUID.
This is needed for XML API operations that require numeric IDs.
§Arguments
application_guid- The GUID of the applicationsandbox_guid- The sandbox GUID
§Returns
§Errors
Returns an error if the API request fails, the sandbox is not found,
or authentication/authorization fails.
A Result containing the numeric sandbox_id as a string.
§Errors
Returns an error if the API request fails, the sandbox is not found, or authentication/authorization fails.
Sourcepub async fn create_sandbox_if_not_exists(
&self,
application_guid: &str,
name: &str,
description: Option<String>,
) -> Result<Sandbox, SandboxError>
pub async fn create_sandbox_if_not_exists( &self, application_guid: &str, name: &str, description: Option<String>, ) -> Result<Sandbox, SandboxError>
Create sandbox if it doesn’t exist, or return existing sandbox.
This method implements the “try-create-or-get” pattern which is safe against TOCTOU race conditions in concurrent environments.
§Arguments
application_guid- The GUID of the applicationname- The name of the sandboxdescription- Optional description for new sandboxes
§Returns
A Result containing the sandbox (existing or newly created).
§Errors
Returns an error if the API request fails or authentication/authorization fails. Does not return an error if the sandbox already exists.