Skip to content

[Refactor] Modernize legacy v1.0 tools to v2.0 architecture #56

@talltechy

Description

@talltechy

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

  1. Use InsightVMClient: All tools should use the unified client
  2. Follow v2.0 Patterns: Inherit from BaseAPI, use proper error handling
  3. Improve Code Quality: Remove code duplication, add type hints
  4. Maintain Functionality: Ensure all existing features continue to work
  5. Add Documentation: Docstrings, examples, and comments

Acceptance Criteria

  • All legacy tools refactored to use InsightVMClient
  • Code follows v2.0 architecture patterns
  • Functionality preserved (or improved)
  • Documentation updated
  • Constants moved to src/rapid7/constants.py
  • Code tested and verified working

Priority

Medium - Important for code maintainability but not blocking other work

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions