Fix: Standardize URL formation for dev/staging regions across Chronicle SDK #172
+56
−48
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
Manual URL construction in several Chronicle modules was incorrectly using
client.regiondirectly (e.g.,https://dev-chronicle.googleapis.com), causing failures for dev/staging environments which should map to:dev→autopush-chronicle.sandbox.googleapis.comstaging→staging-chronicle.sandbox.googleapis.comAdditionally, dev/staging should use
usas the location in URL paths, not the region name.Solution
Standardized all manual URL formations to use:
client.base_url(APIVersion.X)for domain + API versionclient.instance_idfor the full instance pathThis ensures proper domain mapping and location handling across all regions.
Files Changed
Source Files
src/secops/chronicle/log_ingest.py-ingest_udmmethodsrc/secops/chronicle/nl_search.py-translate_nl_to_udmfunctionsrc/secops/chronicle/rule.py-test_rulefunctionsrc/secops/chronicle/gemini.py- 3 functions (create_conversation, enable_duet_ai_chat, query_gemini)src/secops/chronicle/data_export.py-_get_formatted_log_typefunctionTest Files
tests/chronicle/test_gemini.py- Updated mock fixture and assertionstests/chronicle/test_nl_search.py- Updated mock fixture and assertions