Skip to content

feat: add gateway client and tests#428

Open
nborges-aws wants to merge 4 commits intomainfrom
feat/gatewayClient
Open

feat: add gateway client and tests#428
nborges-aws wants to merge 4 commits intomainfrom
feat/gatewayClient

Conversation

@nborges-aws
Copy link
Copy Markdown
Contributor

Issue #, if available: Issue #390

Description of changes:

  • Add GatewayClient with __getattr__ passthrough
  • Control plane allowlisted methods (16):
    • Gateway CRUD: create_gateway, get_gateway, list_gateways, update_gateway, delete_gateway
    • Gateway target CRUD: create_gateway_target, get_gateway_target, list_gateway_targets, update_gateway_target, delete_gateway_target
    • Gateway rules: create_gateway_rule, get_gateway_rule, list_gateway_rules, update_gateway_rule, delete_gateway_rule
    • Other: synchronize_gateway_targets
  • Add *_and_wait polling methods using shared wait_until/wait_until_deleted utilities:
    • create_gateway_and_wait, update_gateway_and_wait, delete_gateway_and_wait
    • create_gateway_target_and_wait, update_gateway_target_and_wait, delete_gateway_target_and_wait
  • Add name-based lookup methods with per-page pagination and early termination:
    • get_gateway_by_name — paginates through gateways, returns full details on first match
    • get_gateway_target_by_name — paginates through targets for a given gateway, returns full details on first match
  • All *_and_wait methods accept WaitConfig for configurable polling behavior and apply convert_kwargs for snake_case support

Test Plan:

  • Unit tests (11 total, all passing):
    • Init: region, region fallback
    • Passthrough: CP forwarding, snake_case conversion, AttributeError on unknown method
    • Wait methods: create gateway, create gateway failed, create target, delete gateway
    • Name lookup: found, not found
  • Integration tests (15 total):
    • Gateway CRUD lifecycle: create+wait → get (camelCase + snake_case) → name lookup (found + not found) → list → update+wait → delete+wait
    • Target CRUD lifecycle: create+wait → get → name lookup (found + not found) → list → update+wait → delete+wait

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@nborges-aws nborges-aws requested a review from a team April 23, 2026 16:24
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 23, 2026

✅ No Breaking Changes Detected

No public API breaking changes found in this PR.

Copy link
Copy Markdown
Contributor

@Hweinstock Hweinstock left a comment

Choose a reason for hiding this comment

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

Looks good! Small qs about integ tests.

cls.region = os.environ.get("BEDROCK_TEST_REGION", "us-west-2")
cls.role_arn = os.environ.get("GATEWAY_ROLE_ARN")
if not cls.role_arn:
pytest.skip("GATEWAY_ROLE_ARN not set")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

could this lead to tests being silently skipped or would the CI action still fail?

authorizerType="NONE",
description="updated by integ test",
)
assert updated["status"] == "READY"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

should we assert that the gateway was actually updated?

)
if not response.get("nextToken"):
return None
kwargs["nextToken"] = response["nextToken"]
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Two questions:

  • why would a user pass in nextToken?
  • should we use a local variable instead to avoid mutating the parameters?



@pytest.mark.integration
class TestGatewayClient:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: could we add one more get_gateway_target_by_name

get_gateway_target returns AccessDeniedException when called with a
gateway ARN. Extract the gateway ID from the ARN for all target
_and_wait polling methods. Also add missing credentialProviderConfigurations
to the update_gateway_target integ test.
fix(gateway): use gateway ID instead of ARN for target polling
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.

3 participants