Refactor(policy): convert list method to Iterator pattern#92
Open
TanyaSingh369-svg wants to merge 3 commits intohashicorp:next-0.1.3from
Open
Refactor(policy): convert list method to Iterator pattern#92TanyaSingh369-svg wants to merge 3 commits intohashicorp:next-0.1.3from
TanyaSingh369-svg wants to merge 3 commits intohashicorp:next-0.1.3from
Conversation
|
Thank you for your submission! We require that all contributors sign our Contributor License Agreement ("CLA") before we can accept the contribution. Read and sign the agreement Learn more about why HashiCorp requires a CLA and what the CLA includes Have you signed the CLA already but the status is still pending? Recheck it. |
isivaselvan
approved these changes
Feb 26, 2026
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
Refactored the Policy resource listing from the previous ModelList pattern to the Iterator pattern.
This change aligns Policy behavior with other iterator-based resources in the SDK and enables lazy pagination via the shared '_Service._list' helper.
Changes include
Output from tests
python -m pytest tests/units/test_policy.py -vv
tests/units/test_policy.py::TestPolicies::test_list_policies_validations PASSED
tests/units/test_policy.py::TestPolicies::test_list_policies_success_without_options PASSED
tests/units/test_policy.py::TestPolicies::test_create_policy_validations PASSED
tests/units/test_policy.py::TestPolicies::test_create_policy_success PASSED
tests/units/test_policy.py::TestPolicies::test_read_policy_success PASSED
tests/units/test_policy.py::TestPolicies::test_update_policy_success PASSED
tests/units/test_policy.py::TestPolicies::test_delete_policy_validations PASSED
tests/units/test_policy.py::TestPolicies::test_delete_policy_success PASSED
tests/units/test_policy.py::TestPolicies::test_upload_policy_success_with_bytes PASSED
tests/units/test_policy.py::TestPolicies::test_download_policy_success PASSED
tests/units/test_policy.py::TestPolicies::test_valid_create_options_success PASSED
=========================== 11 passed in 0.22s ===========================
Output from Example
examples/agent.py PASS
examples/agent_pool.py PASS
examples/apply.py PASS
examples/configuration_version.py PASS
examples/notification_configuration.py PASS
examples/oauth_client.py PASS
examples/oauth_token.py PASS
examples/org.py PASS
examples/organization_membership.py PASS
examples/plan.py PASS
examples/policy.py PASS
examples/policy_check.py PASS
examples/policy_evaluation.py PASS
examples/policy_set.py PASS
examples/policy_set_parameter.py PASS
examples/project.py PASS
examples/query_run.py PASS
examples/registry_module.py PASS
examples/registry_provider.py PASS
examples/registry_provider_version.py PASS
examples/reserved_tag_key.py PASS
examples/run.py PASS
examples/run_events.py PASS
examples/run_task.py PASS
examples/run_trigger.py PASS
examples/ssh_keys.py PASS
examples/state_versions.py PASS
examples/variable_sets.py PASS
examples/variables.py PASS
examples/workspace.py PASS
examples/workspace_resources.py PASS
Rollback Plan
If any regression or unexpected behavior is observed after merging this change:
No data migration, configuration changes, or external dependencies are impacted by this rollback.