Skip to content

Refactor policies listing to iterator pattern#90

Open
TanyaSingh369-svg wants to merge 3 commits intohashicorp:mainfrom
TanyaSingh369-svg:refactoring/iterator-pattern/policy
Open

Refactor policies listing to iterator pattern#90
TanyaSingh369-svg wants to merge 3 commits intohashicorp:mainfrom
TanyaSingh369-svg:refactoring/iterator-pattern/policy

Conversation

@TanyaSingh369-svg
Copy link

Description

Refactored policy resource listing from ModelList pattern to Iterator pattern.

Changes include:

  • Converted Policies.list() to return Iterator[Policy]
  • Removed PolicyList model and page_number from PolicyListOptions
  • Updated models/__init__.py exports
  • Updated example and unit tests to consume iterator

Testing plan

  1. Ran unit tests locally using python -m pytest -q
  2. Verified policy resource iterator behavior
  3. Confirmed all tests pass locally (396 tests)

External links

Output from tests

Including output from tests may require access to a TFE instance. Ignore this section if you have no environment to test against.

396 passed in 0.52s

Rollback Plan

If needed, this change can be reverted by restoring the previous ModelList-based implementation for policy listing.

Changes to Security Controls

No changes to security controls.

PCI review checklist

  • I have documented a clear reason for, and description of, the change I am making.

  • If applicable, I've documented a plan to revert these changes if they require more than reverting the pull request.

  • If applicable, I've documented the impact of any changes to security controls.

    Examples of changes to security controls include using new access control methods, adding or removing logging pipelines, etc.

If you have any questions, please contact your direct supervisor, GRC (#team-grc), or the PCI working group (#proj-pci-reboot). You can also find more information at PCI Compliance.

@TanyaSingh369-svg TanyaSingh369-svg requested a review from a team as a code owner February 23, 2026 04:05
@hashicorp-cla-app
Copy link

hashicorp-cla-app bot commented Feb 23, 2026

CLA assistant check
All committers have signed the CLA.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant