Conversation
|
It's a big design decision, but I was thinking something similar when I was putting this together. The more that gets added, the bigger ChronicleClient is going to get. There are going to be other design decisions made at some point I guess as the project grows, such as can the documentation live in the README Fow now, there will be other implications with helpers, documentation etc. as well Do you want me to put something together and refactor these functions into it to see what it looks like? |
Another approach I see to reduce burden from ChronicleClient is to have SOAR namespace. And SOAR service (namespace) will have all soar methods. below is example: And user can access soar method as : |
|
I agree that this is probably the best appraoch, and avoids having users create a new client. I've refactored this PR into a |
|
@PaperMtn, would it be possible to create FR/Issue with endpoints that are implemented for these PRs (all parts)? It would help to have centralized discussion on common approach and reviews. Thanks! |
|
I've created a FR: [#207] |
* main: test: expand auth error detection in case CLI integration tests
# By Mihir Vala (13) and others # Via Mihir Vala (5) and GitHub (4) * main: (21 commits) chore:minor error log formatting chore: fixed feed integration tests chore: bump version and added changelog chore: minor refactoring and improvements chore: fixed list methods for integration tests. feat: implement remove_none_values helper feat: add remove_none_values helper chore: refactor to use formatting helpers and param building pattern chore: update test cases for format_id helper usage chore: fixed unit tests for new request utils refactor: remove explicit api_version parameters from chronicle request calls and added as_list. feat: refactor remaining modules to use request helpers. chore: minor changelog refactor chore: bump version to 0.38.0 chore: bump version to 0.36.0 and update changelog. Added local config doc. chore: add scope parameter to config load/save and improve argument handling. added view local config support. Upgrade GitHub Actions for Node 24 compatibility Upgrade GitHub Actions to latest versions chore: linting fix feat(cli): add SECOPS_LOCAL_CONFIG_DIR env var support ... # Conflicts: # src/secops/chronicle/utils/format_utils.py # tests/chronicle/utils/test_format_utils.py
# By Mihir Vala (9) and Isha Shree (2) # Via Mihir Vala (2) and GitHub (1) * main: chore: fix unit tests chore: minor refactoring and formatting chore: added docs in README and CLI. Added changelog. Updated project version. chore: added client integration tests chore: fixed unit tests chore: case integration tests fix chore: fixed unit tests chore: refactoring and improvements chore: fixed unnessary changes Addressing comments Adding new APIs in cli # Conflicts: # README.md # api_module_mapping.md
Implement All Integration Management Functions - Pt 1: Integration functions & Helpers
Summary
Part of a larger PR to implement all SOAR integration management capabilities to the SecOps SDK. This PR includes:
New SDK Modules (
src/secops/chronicle/integration/)integrations.pyintegration_instances.pymarketplace_integrations.pyNew Utility Helpers (
src/secops/chronicle/utils/)New helpers added for consistency and deduplication:
format_utils.pyformat_resource_id()— Extracts the final ID segment from a full Chronicle resource path (e.g.projects/.../instances/.../abc123→abc123). Safely passes through plain IDs.parse_json_list()— Accepts either alist[dict]or a JSON string and returns a parsed list. Used for parameter inputs (e.g.--parameters '[{"name":"p1"}]').build_patch_body()— Builds a PATCH request body andupdateMaskquery param from a list of(api_key, mask_key, value)tuples. Auto-generates the update mask from non-None fields, or accepts an explicit override.request_utils.pychronicle_request_bytes()— New helper for endpoints that return raw bytes (used bydownload_integrationanddownload_integration_dependency).New Data Models (
src/secops/chronicle/models.py)Enums:
PythonVersion—V2_7,V3_7,V3_11DiffType—COMMERCIAL,PRODUCTION,STAGINGTargetMode—PRODUCTION,STAGINGIntegrationType—RESPONSE,EXTENSIONIntegrationParamType—BOOLEAN,INT,STRING,PASSWORD,IP,URL,DOMAIN,EMAIL,VALUES_LIST, etc.ActionParamType—STRING,BOOLEAN,WFS_REPOSITORY,USER_REPOSITORY,STAGES_REPOSITORYActionType—PING,CONNECTOR,JOB, etc.ParamType— For connector parametersConnectorParamMode—REQUIRED,OPTIONAL, etc.ConnectorRuleType— Rule types for connector definitionsScheduleType—ONE_TIME,DAILY,WEEKLY,MONTHLY,ADVANCEDDayOfWeek—MONDAYthroughSUNDAYIntegrationParameterType— For integration instance parametersConnectorConnectivityStatus—CONNECTED,DISCONNECTED, etc.TransformerType— Transformer definition typesLogicalOperatorType— Logical operator definition typesDataclasses:
IntegrationParam— Integration-level parameter definitionActionParameter— Action parameter with type and validationConnectorParameter— Connector parameter with mode and rulesConnectorRule— Connector rule definitionIntegrationJobInstanceParameter— Job instance parameterDate,TimeOfDay— Date/time components for schedulingOneTimeScheduleDetails,DailyScheduleDetails,WeeklyScheduleDetails,MonthlyScheduleDetails— Schedule configurationAdvancedConfig— Advanced scheduling (cron-like)JobParameter— Job definition parameterIntegrationInstanceParameter— Integration instance parameterConnectorInstanceParameter— Connector instance parameterTransformerDefinitionParameter— Transformer parameterIntegrationLogicalOperatorParameter— Logical operator parameterCLI Commands (
src/secops/cli/commands/integration/)Added a complete
secops integrationCLI command tree with 21 subcommand modules, all registered viaintegration_client.py:secops integration integrationslist,get,create,delete,download,download-dependency,export-items,get-affected-items,get-agent,get-diff,get-dependencies,get-restricted-agents,transition,update,update-customsecops integration instanceslist,get,create,update,delete,test,get-affected-items,get-defaultsecops integration marketplacelist,get,diff,install,uninstallTests
Unit Tests - SDK Modules (
tests/chronicle/integration/)test_integrations.pytest_integration_instances.pytest_marketplace_integrations.pyUnit Tests - Utility Helpers (
tests/chronicle/utils/)test_format_utils.py-Tests forformat_resource_id,parse_json_list,build_patch_bodytest_request_utils.py- Tests forchronicle_request_bytesand updated request helpersDocumentation Updates
README.mdSDK usage examples for every new module, following the established format:
CLI.mdCLI usage documentation with bash examples for all integration subcommands, including workflow examples for revision-based safe updates.
api_module_mapping.mdChronicleClientUpdatesclient.py- All new integration module functions added asChronicleClientmethods with full docstrings__init__.py- All new functions exported in__all__and publicly importable fromsecops.chronicleAPI Version Support
All integration modules support both v1beta (default) and v1alpha via the
api_versionparameter