Overview
Refactor remaining v1.0 legacy tools to use the modern v2.0 architecture with InsightVMClient and standardized patterns.
Legacy Files to Refactor
1. src/rapid7/api_r7_endpoints.py
- Simple constants class with endpoint strings
- Move to
src/rapid7/constants.py for better organization
- Not currently used by v2.0 code
2. src/rapid7/api_r7_isvm_sonar_add.py
- Standalone tool for creating Sonar discovery queries
- Currently uses old HTTPBasicAuth pattern directly
- Has interactive prompts
- Refactor to: Use
InsightVMClient, add API wrapper methods
3. src/rapid7/api_r7_status_codes.py
- Helper function for Sonar tool
- Integrate into refactored Sonar tool or remove if no longer needed
4. src/rapid7/tools/ directory
install_insight_agent.py
install_scan_assistant.py
- Review and refactor if needed
Refactoring Goals
- Use InsightVMClient: All tools should use the unified client
- Follow v2.0 Patterns: Inherit from BaseAPI, use proper error handling
- Improve Code Quality: Remove code duplication, add type hints
- Maintain Functionality: Ensure all existing features continue to work
- Add Documentation: Docstrings, examples, and comments
Acceptance Criteria
Priority
Medium - Important for code maintainability but not blocking other work
Overview
Refactor remaining v1.0 legacy tools to use the modern v2.0 architecture with
InsightVMClientand standardized patterns.Legacy Files to Refactor
1.
src/rapid7/api_r7_endpoints.pysrc/rapid7/constants.pyfor better organization2.
src/rapid7/api_r7_isvm_sonar_add.pyInsightVMClient, add API wrapper methods3.
src/rapid7/api_r7_status_codes.py4.
src/rapid7/tools/directoryinstall_insight_agent.pyinstall_scan_assistant.pyRefactoring Goals
Acceptance Criteria
InsightVMClientsrc/rapid7/constants.pyPriority
Medium - Important for code maintainability but not blocking other work