DSPMGetContianers
This automation script takes asset file data as input, retrieves the container names from this data, and returns a list of all containers.
python · DSPM
Details
| ID | DSPMGetContianers |
|---|---|
| Language | python |
| From Version | 6.10.0 |
| Docker Image | demisto/python3:3.12.13.10116658 |
README
This automation script takes asset file data as input, retrieves the container names from this data, and returns a list of all containers.
Script Data
| Name | Description |
|---|---|
| Script Type | python3 |
| Cortex XSOAR Version | 6.10.0 |
Inputs
| Argument Name | Description |
|---|---|
| asset_files | Asset files data. |
Outputs
| Path | Description | Type |
|---|---|---|
| containers | List of containers. | Unknown |
import demistomock as demisto # noqa: F401 from CommonServerPython import * # noqa: F401 from typing import Any import traceback def get_containers(args: dict[str, Any]) -> CommandResults: """ Function takes asset file data as argument and returns a list of all containers. """ asset_files = args.get("asset_files") containers = [] if not asset_files: raise ValueError("Asset files data is not specified") asset_files = asset_files.get("files") for assets in asset_files: path = assets.get("path") folder_name = path.split("/")[0] containers.append(folder_name) return CommandResults( outputs_prefix="containers", outputs=containers, ) """ MAIN FUNCTION """ def main(): try: return_results(get_containers(demisto.args())) except Exception as ex: demisto.error(traceback.format_exc()) # print the traceback return_error(f"Failed to execute get_containers. Error: {str(ex)}") """ ENTRY POINT """ if __name__ in ("__main__", "__builtin__", "builtins"): main()