You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
retention_period, iam_auth, and final_snapshot were using the generic V3 update() method, which does a PUT to the V3 RDS endpoint and calls response.json() on the result. The ModifyRDSDBInstance API returns an empty response body, causing a JSON decode error.
Changed all three commands to use self.client.post(subscriptions/{tenant_id}/ModifyRDSDBInstance, body) directly — matching the existing pattern used by set_monitor_interval.
• Replace generic update() method with ModifyRDSDBInstance endpoint
• Fix JSON decode error in retention_period, iam_auth, final_snapshot
• Correct docstring for final_snapshot method
• Update CHANGELOG with fix details
Diagram
flowchart LR
A["RDS modify methods<br/>retention_period, iam_auth,<br/>final_snapshot"] -->|"Previously: generic<br/>update() method"| B["V3 RDS endpoint<br/>PUT request"]
B -->|"Empty response body"| C["JSON decode error"]
A -->|"Now: Direct POST"| D["ModifyRDSDBInstance<br/>endpoint"]
D -->|"Proper handling"| E["Success"]
Loading
File Changes
1. src/duplo_resource/rds.py
🐞 Bug fix +7/-4
Replace update method with ModifyRDSDBInstance endpoint
• Replaced self.update() calls with self.client.post() to ModifyRDSDBInstance endpoint in
three methods
• Extract tenant_id from self.tenant["TenantId"] for endpoint URL construction
• Fixed incorrect docstring in final_snapshot() method (was "Toggle IAM authentication")
The PR adds repeated blocks that compute tenant_id and POST to
subscriptions/{tenant_id}/ModifyRDSDBInstance across multiple RDS commands, increasing maintenance
cost and risk of inconsistent updates. This should be extracted into a shared helper to satisfy the
duplication-elimination requirement.
PR Compliance ID 4 requires extracting shared behavior into helpers instead of duplicating logic.
The modified RDS commands now repeat the same tenant_id lookup and ModifyRDSDBInstance POST
pattern in multiple places, rather than centralizing it.
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution
## Issue description
`iam_auth`, `final_snapshot`, and `retention_period` duplicate the same tenant-id resolution + `ModifyRDSDBInstance` POST logic (also already present in `set_monitor_interval`). This should be centralized in a helper method (e.g., `_modify_db_instance(body)`), and each command should call the helper.
## Issue Context
Compliance requires eliminating duplicated logic to reduce drift and ensure future endpoint/parameter changes are made once.
## Fix Focus Areas
- src/duplo_resource/rds.py[141-206]
- src/duplo_resource/rds.py[233-246]
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
2. Extra tenant lookup call 🐞➹
Description
The updated RDS commands fetch tenant_id via self.tenant["TenantId"], which forces a tenant
discovery API call even when --tenant-id is already set. This adds an avoidable request (and
potential failure point) compared to using self.tenant_id, which can resolve directly from
self.duplo.tenantid without discovery.
In the modified RDS commands, tenant_id is derived from self.tenant, and the injected tenant
property triggers tenant_svc.find() whenever _tenant is not cached. In contrast, the injected
tenant_id property uses self.duplo.tenantid directly when provided (no tenant lookup). The prior
implementation used update(), which calls self.endpoint(...), and tenant-scoped endpoint()
uses self.tenant_id (not self.tenant).
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution
## Issue description
`iam_auth`, `final_snapshot`, and `retention_period` now compute `tenant_id` using `self.tenant["TenantId"]`. For tenant-scoped resources, accessing `self.tenant` triggers `tenant_svc.find()` when `_tenant` is unset, which adds an extra network call even when the user already provided `--tenant-id`.
## Issue Context
The tenant-scope injection already provides a `tenant_id` property that can resolve directly from `self.duplo.tenantid` without a discovery call; this is also what tenant-scoped `endpoint()` uses.
## Fix Focus Areas
- src/duplo_resource/rds.py[141-206]
- src/duplo_resource/rds.py[233-248]
## Suggested change
Replace `tenant_id = self.tenant["TenantId"]` with `tenant_id = self.tenant_id` in the modified commands (and optionally align `set_monitor_interval` similarly for consistency).
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
ⓘ The new review experience is currently in Beta. Learn more
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
Describe Changes
retention_period,iam_auth, andfinal_snapshotwere using the generic V3update()method, which does a PUT to the V3 RDS endpoint and callsresponse.json()on the result. TheModifyRDSDBInstanceAPI returns an empty response body, causing a JSON decode error.Changed all three commands to use
self.client.post(subscriptions/{tenant_id}/ModifyRDSDBInstance, body)directly — matching the existing pattern used byset_monitor_interval.Link to Issues
https://app.clickup.com/t/8655600/DUPLO-41909
PR Review Checklist