| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
There was a problem hiding this comment.
This pull request introduces helper functions get_universe_domain, get_default_mtls_endpoint, and get_api_endpoint in universe.py to handle universe domain resolution and mTLS endpoint conversion, along with corresponding unit tests. Feedback was provided to avoid using hardcoded magic numbers (-23 and -15) when slicing the host string in get_default_mtls_endpoint, suggesting dynamic calculation based on suffix lengths instead.
Sorry, something went wrong.
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
This PR refactors the generated client templates to utilize centralized endpoint routing and universe domain logic. * **Helper Relocation**: Moved `_get_default_mtls_endpoint`, `_get_api_endpoint`, and `_get_universe_domain` from generated client classes to the compatibility layer (`_compat.py`). * **Backward Compatibility**: Implemented these helpers locally in `_compat.py` to maintain compatibility with older `google-api-core` versions, laying groundwork for importing directly from `google.api_core.universe` (centralized in PR #17799) once the minimum dependency is bumped. * **Test Migration**: Moved unit tests for these routing functions from `test_%service.py.j2` to `test_compat.py.j2`. Towards: #17883
| Back | FazBrowse Home | New Git URL |
Description
This PR consolidates and centralizes all universe-related configuration helpers and routing logic into google/api_core/universe.py. This avoids polluting gapic_v1 with duplicate routing logic and keeps universe/endpoint utilities unified.
Changes: