Open
Conversation
Contributor
✅ No Breaking Changes DetectedNo public API breaking changes found in this PR. |
Hweinstock
reviewed
Apr 23, 2026
Contributor
Hweinstock
left a comment
There was a problem hiding this comment.
Nice! I like the client. Few questions on the integ tests, but otherwise looks good.
| ) | ||
| except Exception as e: | ||
| print(f"Failed to delete policy {policy_id}: {e}") | ||
| # Wait for policy deletes to complete before deleting engines |
Contributor
There was a problem hiding this comment.
should we poll here instead of waiting?
| policyEngineId=self.engine_ids[0], | ||
| description={"optionalValue": "updated by integ test"}, | ||
| ) | ||
| assert updated["status"] == "ACTIVE" |
Contributor
There was a problem hiding this comment.
should we verify that the policy actually updated?
| cls.policy_ids = [] | ||
| sts = boto3.client("sts", region_name=cls.region) | ||
| account_id = sts.get_caller_identity()["Account"] | ||
| cls.gateway_resource_arn = f"arn:aws:bedrock-agentcore:{cls.region}:{account_id}:gateway/*" |
Contributor
There was a problem hiding this comment.
is this used anywhere?
| logger.info("Policy engine '%s' already exists, looking up...", name) | ||
| engine_id = self._find_policy_engine_by_name(name) | ||
| if not engine_id: | ||
| raise |
Contributor
There was a problem hiding this comment.
nit: if a gateway exists, but the lookup fails, the user sees a conflict exception here. Not sure how this could happen, but we might want a better error to avoid confusing customers.
|
|
||
|
|
||
| @pytest.mark.integration | ||
| class TestPolicyEngineClient: |
Contributor
There was a problem hiding this comment.
should we also test create_or_get methods?
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.
Issue #, if available: Issue #392
Description of changes:
__getattr__passthrough*_and_waitpolling methods using shared wait_until/wait_until_deleted utilities:generate_policy_asset_and_wait— starts NL→Cedar generation, polls until complete, optionally fetches generated assetsgenerate_and_create_policy— end-to-end flow: generate asset + create policy from it in one callcreate_policy_from_generation_asset— creates a policy from a specific generation assetcreate_or_get_policy_engine / create_or_get_policy— idempotent creates (handles ConflictException by finding existing resource)*_and_waitmethods accept WaitConfig for configurable polling behavior and applyconvert_kwargsfor snake_case supportTest plan:
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.