updated python client with kubernetes tickets model#84
Conversation
Summary of ChangesHello, 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 significantly enhances the Python client by introducing a dedicated module for managing Kubernetes tickets. It provides a robust set of data models and RPC endpoints to facilitate the creation, retrieval, bulk operations, and synchronization of Kubernetes-related tickets, thereby expanding the client's capabilities for interacting with Kubernetes insights and recommendations. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Activity
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 updates the Python client by adding new Pydantic models and an RPC handler for Kubernetes tickets. The changes are mostly additive and look good. I've provided a couple of suggestions to reduce code duplication in the new models by using inheritance, which will improve long-term maintainability.
| class CreateKubernetesTicketRequest(BaseModel): | ||
| insight_id: UUID = Field(..., title="Insight Id") | ||
| insight_alias: int = Field(..., title="Insight Alias") | ||
| cluster_id: UUID = Field(..., title="Cluster Id") | ||
| cluster_name: str = Field(..., title="Cluster Name") | ||
| account_id: str = Field(..., title="Account Id") | ||
| region: str = Field(..., title="Region") | ||
| namespace: Optional[str] = Field(None, title="Namespace") | ||
| title: str = Field(..., title="Title") | ||
| description: str = Field(..., title="Description") | ||
| target_id: str = Field(..., title="Target Id") | ||
| target_type: str = Field(..., title="Target Type") | ||
| recommendation_type: str = Field(..., title="Recommendation Type") | ||
| recommendation_details: Optional[Dict[str, Any]] = Field( | ||
| None, title="Recommendation Details" | ||
| ) | ||
| potential_savings: Optional[float] = Field(None, title="Potential Savings") | ||
| non_prorated_potential_savings: Optional[float] = Field( | ||
| None, title="Non Prorated Potential Savings" | ||
| ) | ||
| status: str = Field(..., title="Status") | ||
| unique_target_id: Optional[str] = Field(None, title="Unique Target Id") | ||
| parent_insight_id: Optional[UUID] = Field(None, title="Parent Insight Id") | ||
| ticket_status: Optional[KubernetesTicketStatus] = "TO_DO" | ||
| priority: Optional[OnelensModelsCommonsPriority] = None | ||
| provider: Provider | ||
| tenant_id: UUID = Field(..., title="Tenant Id") | ||
| created_by: Optional[UUID] = Field(None, title="Created By") |
There was a problem hiding this comment.
The CreateKubernetesTicketRequest model duplicates all fields from CreateKubernetesTicketAPIRequest and adds two more. To reduce code duplication and improve maintainability, you can make CreateKubernetesTicketRequest inherit from CreateKubernetesTicketAPIRequest.
| class CreateKubernetesTicketRequest(BaseModel): | |
| insight_id: UUID = Field(..., title="Insight Id") | |
| insight_alias: int = Field(..., title="Insight Alias") | |
| cluster_id: UUID = Field(..., title="Cluster Id") | |
| cluster_name: str = Field(..., title="Cluster Name") | |
| account_id: str = Field(..., title="Account Id") | |
| region: str = Field(..., title="Region") | |
| namespace: Optional[str] = Field(None, title="Namespace") | |
| title: str = Field(..., title="Title") | |
| description: str = Field(..., title="Description") | |
| target_id: str = Field(..., title="Target Id") | |
| target_type: str = Field(..., title="Target Type") | |
| recommendation_type: str = Field(..., title="Recommendation Type") | |
| recommendation_details: Optional[Dict[str, Any]] = Field( | |
| None, title="Recommendation Details" | |
| ) | |
| potential_savings: Optional[float] = Field(None, title="Potential Savings") | |
| non_prorated_potential_savings: Optional[float] = Field( | |
| None, title="Non Prorated Potential Savings" | |
| ) | |
| status: str = Field(..., title="Status") | |
| unique_target_id: Optional[str] = Field(None, title="Unique Target Id") | |
| parent_insight_id: Optional[UUID] = Field(None, title="Parent Insight Id") | |
| ticket_status: Optional[KubernetesTicketStatus] = "TO_DO" | |
| priority: Optional[OnelensModelsCommonsPriority] = None | |
| provider: Provider | |
| tenant_id: UUID = Field(..., title="Tenant Id") | |
| created_by: Optional[UUID] = Field(None, title="Created By") | |
| class CreateKubernetesTicketRequest(CreateKubernetesTicketAPIRequest): | |
| tenant_id: UUID = Field(..., title="Tenant Id") | |
| created_by: Optional[UUID] = Field(None, title="Created By") |
| class GetKubernetesTicketRequest(BaseModel): | ||
| tenant_id: UUID = Field(..., title="Tenant Id") | ||
| ticket_id: UUID = Field(..., title="Ticket Id") |
There was a problem hiding this comment.
The GetKubernetesTicketRequest model is identical to GetKubernetesTicketMetadataRequest. To avoid this code duplication, you can have one model inherit from the other.
| class GetKubernetesTicketRequest(BaseModel): | |
| tenant_id: UUID = Field(..., title="Tenant Id") | |
| ticket_id: UUID = Field(..., title="Ticket Id") | |
| class GetKubernetesTicketRequest(GetKubernetesTicketMetadataRequest): | |
| pass |
No description provided.