Appearance
Removing a scanner from a project
INFERENCE DEFEND
This article is meant for Inference Defend users.
ROLES AND PERMISSIONS
To complete the tasks described in this section, make sure you have the required permissions.
If you no longer require a specific scanner in a project, you can either disable it or remove it from a project completely.
Disable a scanner
If you want to keep a scanner in a project but prevent it from scanning, you can disable it.
In this scenario, we are going to disable the first scanner present in the list of available scanners.
To disable a scanner:
Add your token and project ID values to the following sample:
pythonfrom calypsoai import CalypsoAI from calypsoai.datatypes import ProjectConfigScanner # Define the URL and token for CalypsoAI CALYPSOAI_URL = "https://www.us1.calypsoai.app" CALYPSOAI_TOKEN = "ADD-YOUR-TOKEN-HERE" # Initialize the CalypsoAI client cai = CalypsoAI(url=CALYPSOAI_URL, token=CALYPSOAI_TOKEN) # Get all scanners scanners = [scanner for scanner in cai.scanners.iterate()] # Disable the scanner cai.projects.update( project="ADD-YOUR-PROJECT-ID-HERE", scanners=[ProjectConfigScanner(id=scanners[0].id, enabled=False)] )
- In
scanners
, make sureenabled
is set toFalse
.
- In
Run the script.
If the request is successful, you receive theNone
response.THE NONE RESPONSE
Confirm the scanner is disabled by checking the scanner properties in the project.
RE-ENABLING A SCANNER
To re-enable a scanner, in
scanners
, setenabled
toTrue
.
Remove a scanner
If you no longer require a scanner in a project, you can remove it.
REMOVING A SCANNER
Unlike disabling a scanner, if you remove a scanner from a project, you must add it to the project again if you want to use it.
In this scenario, we are going to remove a scanner from a project using the project ID and scanner ID.
To remove a scanner:
Add your token, project ID, and scanner ID values to the following sample:
pythonfrom calypsoai import CalypsoAI # Define the URL and token for CalypsoAI CALYPSOAI_URL = "https://www.us1.calypsoai.app" CALYPSOAI_TOKEN = "ADD-YOUR-TOKEN-HERE" # Initialize the CalypsoAI client cai = CalypsoAI(url=CALYPSOAI_URL, token=CALYPSOAI_TOKEN) # Remove the scanner response = cai.client.projects.scanners.deleteScannerId(project="ADD-YOUR-PROJECT-ID-HERE", scannerId="ADD-YOUR-SCANNER-ID-HERE") # Print the response print(response.model_dump_json(indent=2))
Run the script.
Analyze the response.
json{ "message": "Scanner removed from the project" }