Skip to content

Refactor Run resource to use Iterator pattern#86

Open
NimishaShrivastava-dev wants to merge 3 commits intohashicorp:mainfrom
NimishaShrivastava-dev:Refactoring/iterator-pattern/run
Open

Refactor Run resource to use Iterator pattern#86
NimishaShrivastava-dev wants to merge 3 commits intohashicorp:mainfrom
NimishaShrivastava-dev:Refactoring/iterator-pattern/run

Conversation

@NimishaShrivastava-dev
Copy link

Summary

Converted the run resource listing methods to use the Iterator pattern instead of returning ModelList objects.

Changes

  • Updated Runs.list() to return Iterator[Run]
  • Updated Runs.list_for_organization() to return Iterator[Run]
  • Both methods now use the internal _list() helper for pagination
  • Updated examples/run.py to convert iterators to lists where needed
  • Updated unit tests to mock _list() and verify data transformation

Testing

  • All 396 tests pass
  • No breaking changes to public API
  • Models remain unchanged for backward compatibility

Related

Aligns with iterator pattern used in policy_evaluation and oauth_token resources

@NimishaShrivastava-dev NimishaShrivastava-dev requested a review from a team as a code owner February 19, 2026 08:44
@hashicorp-cla-app
Copy link

hashicorp-cla-app bot commented Feb 19, 2026

CLA assistant check
All committers have signed the CLA.

print(f"Total runs fetched: {len(run_list)}")
print()

for run in run_list.items:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Share the output results of examples/run.py file in the conversation.

value: str = Field(..., alias="value")


class RunList(BaseModel):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add back the RunList and OrganizationRunList models.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

restored these models

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.

2 participants