feat: refactor CLI to use direct API calls#713
Conversation
eliasecchig
commented
Jan 19, 2026
- Add get_project_number() function using Resource Manager API
- Replace gcloud projects describe calls with direct API calls in cicd.py
- Add _build_api_headers() helper in register_gemini_enterprise.py
- Include User-Agent and x-goog-api-client headers in Discovery Engine API calls
- Add get_project_number() function using Resource Manager API - Replace gcloud projects describe calls with direct API calls in cicd.py - Add _build_api_headers() helper in register_gemini_enterprise.py - Include User-Agent and x-goog-api-client headers in Discovery Engine API calls
Summary of ChangesHello @eliasecchig, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request streamlines the CLI's interaction with Google Cloud by shifting from Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request is a great improvement, refactoring gcloud CLI calls to direct API requests. This enhances performance and reduces external dependencies. The new get_project_number function and _build_api_headers helper are well-implemented. However, the refactoring appears to be incomplete. The get_project_number function within agent_starter_pack/cli/commands/register_gemini_enterprise.py still relies on the gcloud command and should be updated to use the new API-based implementation from agent_starter_pack/cli/utils/gcp.py. This also means its call sites need to be updated to handle exceptions instead of a None return value. I've also added a few specific comments to improve error handling and code structure.
- Make get_user_agent and get_x_goog_api_client_header public in gcp.py - Add RESOURCE_MANAGER_API_BASE constant for API endpoint URL - Use specific exceptions (PermissionError, ValueError) in get_project_number - Update cicd.py to handle new exception types from get_project_number - Update register_gemini_enterprise.py to use public function names
* feat: refactor CLI to use direct API calls - Add get_project_number() function using Resource Manager API - Replace gcloud projects describe calls with direct API calls in cicd.py - Add _build_api_headers() helper in register_gemini_enterprise.py - Include User-Agent and x-goog-api-client headers in Discovery Engine API calls * fix: improve error handling and make API helper functions public - Make get_user_agent and get_x_goog_api_client_header public in gcp.py - Add RESOURCE_MANAGER_API_BASE constant for API endpoint URL - Use specific exceptions (PermissionError, ValueError) in get_project_number - Update cicd.py to handle new exception types from get_project_number - Update register_gemini_enterprise.py to use public function names * fix: remove extra ::: from development guide