-
Notifications
You must be signed in to change notification settings - Fork 70
feat(gateway): add connector read commands #1922
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
351bd17
feat(gateway): add connector read commands
aidandaly24 8dc6ac6
refactor(gateway): name connector predicate module explicitly
aidandaly24 afcaac5
test(gateway): add connector golden coverage
aidandaly24 8aca33f
test(gateway): use ready connector fixture
aidandaly24 dd0fb32
test(gateway): identify read fixtures by profile
aidandaly24 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
38 changes: 38 additions & 0 deletions
38
src/handlers/gateway/__fixtures__/GetGatewayTargetCommand.5c220cde576e6df6.json
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| { | ||
| "gatewayArn": "arn:aws:bedrock-agentcore:us-east-1:685197708687:gateway/agentcore-cli-gateway-read-connector-gkzcxxkc5e", | ||
| "targetId": "Z3FQ0H8JCK", | ||
| "createdAt": { | ||
| "$date": "2026-08-05T20:20:45.351Z" | ||
| }, | ||
| "updatedAt": { | ||
| "$date": "2026-08-05T20:20:51.210Z" | ||
| }, | ||
| "status": "READY", | ||
| "name": "agentcore-cli-gateway-read-connector-openai", | ||
| "targetConfiguration": { | ||
| "inference": { | ||
| "connector": { | ||
| "source": { | ||
| "connectorId": "openai" | ||
| } | ||
| } | ||
| } | ||
| }, | ||
| "credentialProviderConfigurations": [ | ||
| { | ||
| "credentialProviderType": "API_KEY", | ||
| "credentialProvider": { | ||
| "apiKeyCredentialProvider": { | ||
| "providerArn": "arn:aws:bedrock-agentcore:us-east-1:685197708687:token-vault/default/apikeycredentialprovider/DONOTDELETEe2eOAI", | ||
| "credentialParameterName": "Authorization", | ||
| "credentialPrefix": "Bearer", | ||
| "credentialLocation": "HEADER" | ||
| } | ||
| } | ||
| } | ||
| ], | ||
| "description": "AgentCore CLI persistent READY Gateway Connector Target fixture", | ||
| "lastSynchronizedAt": { | ||
| "$date": "2026-08-05T20:20:51.000Z" | ||
| } | ||
| } |
20 changes: 20 additions & 0 deletions
20
src/handlers/gateway/__fixtures__/ListGatewayTargetsCommand.34041f83759ffb99.json
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| { | ||
| "items": [ | ||
| { | ||
| "targetId": "Z3FQ0H8JCK", | ||
| "name": "agentcore-cli-gateway-read-connector-openai", | ||
| "status": "READY", | ||
| "createdAt": { | ||
| "$date": "2026-08-05T20:20:45.351Z" | ||
| }, | ||
| "updatedAt": { | ||
| "$date": "2026-08-05T20:20:51.210Z" | ||
| }, | ||
| "description": "AgentCore CLI persistent READY Gateway Connector Target fixture", | ||
| "lastSynchronizedAt": { | ||
| "$date": "2026-08-05T20:20:51.000Z" | ||
| }, | ||
| "targetType": "CONNECTOR" | ||
| } | ||
| ] | ||
| } |
32 changes: 32 additions & 0 deletions
32
src/handlers/gateway/__fixtures__/connector-get.golden.json
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| { | ||
| "gatewayArn": "arn:aws:bedrock-agentcore:us-east-1:685197708687:gateway/agentcore-cli-gateway-read-connector-gkzcxxkc5e", | ||
| "targetId": "Z3FQ0H8JCK", | ||
| "createdAt": "2026-08-05T20:20:45.351Z", | ||
| "updatedAt": "2026-08-05T20:20:51.210Z", | ||
| "status": "READY", | ||
| "name": "agentcore-cli-gateway-read-connector-openai", | ||
| "targetConfiguration": { | ||
| "inference": { | ||
| "connector": { | ||
| "source": { | ||
| "connectorId": "openai" | ||
| } | ||
| } | ||
| } | ||
| }, | ||
| "credentialProviderConfigurations": [ | ||
| { | ||
| "credentialProviderType": "API_KEY", | ||
| "credentialProvider": { | ||
| "apiKeyCredentialProvider": { | ||
| "providerArn": "arn:aws:bedrock-agentcore:us-east-1:685197708687:token-vault/default/apikeycredentialprovider/DONOTDELETEe2eOAI", | ||
| "credentialParameterName": "Authorization", | ||
| "credentialPrefix": "Bearer", | ||
| "credentialLocation": "HEADER" | ||
| } | ||
| } | ||
| } | ||
| ], | ||
| "description": "AgentCore CLI persistent READY Gateway Connector Target fixture", | ||
| "lastSynchronizedAt": "2026-08-05T20:20:51.000Z" | ||
| } |
14 changes: 14 additions & 0 deletions
14
src/handlers/gateway/__fixtures__/connector-list.golden.json
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| { | ||
| "items": [ | ||
| { | ||
| "targetId": "Z3FQ0H8JCK", | ||
| "name": "agentcore-cli-gateway-read-connector-openai", | ||
| "status": "READY", | ||
| "createdAt": "2026-08-05T20:20:45.351Z", | ||
| "updatedAt": "2026-08-05T20:20:51.210Z", | ||
| "description": "AgentCore CLI persistent READY Gateway Connector Target fixture", | ||
| "lastSynchronizedAt": "2026-08-05T20:20:51.000Z", | ||
| "targetType": "CONNECTOR" | ||
| } | ||
| ] | ||
| } |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| import type { TargetConfiguration } from "@aws-sdk/client-bedrock-agentcore-control"; | ||
| import z from "zod"; | ||
| import { InputValidationError } from "../../../../errors"; | ||
| import { createHandler, flag } from "../../../../router"; | ||
| import { JsonRendererKey } from "../../../../tui"; | ||
| import type { Core } from "../../../types"; | ||
| import { coreOptsFromCtx } from "../../../utils"; | ||
|
|
||
| function isConnectorTarget(configuration: TargetConfiguration | undefined): boolean { | ||
| return ( | ||
| configuration?.mcp?.connector !== undefined || configuration?.inference?.connector !== undefined | ||
| ); | ||
| } | ||
|
|
||
| export const createGetGatewayConnectorHandler = (core: Core) => | ||
| createHandler({ | ||
| name: "get", | ||
| description: "get a connector configured for an AgentCore Gateway", | ||
| flags: [ | ||
| flag("gateway-id", "the ID of the Gateway", z.string().optional()), | ||
| flag("id", "the ID of the connector-backed Gateway Target", z.string().optional()), | ||
| ], | ||
| handle: async (ctx, flags) => { | ||
| if (!flags["gateway-id"]) { | ||
| throw new InputValidationError("required option '--gateway-id <gateway-id>' not specified"); | ||
| } | ||
| if (!flags.id) { | ||
| throw new InputValidationError("required option '--id <id>' not specified"); | ||
| } | ||
|
|
||
| const target = await core.gateway.getGatewayTarget( | ||
| flags["gateway-id"], | ||
| flags.id, | ||
| coreOptsFromCtx(ctx), | ||
| ); | ||
| if (!isConnectorTarget(target.targetConfiguration)) { | ||
| throw new InputValidationError(`Gateway Target "${flags.id}" is not connector-backed`); | ||
| } | ||
|
|
||
| ctx.require(JsonRendererKey).renderJson(target); | ||
| }, | ||
| }); |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| import type { AppIO } from "../../../io"; | ||
| import { Router } from "../../../router"; | ||
| import { createHelpDefault } from "../../help"; | ||
| import type { Core } from "../../types"; | ||
| import { createGetGatewayConnectorHandler } from "./get"; | ||
| import { createListGatewayConnectorsHandler } from "./list"; | ||
|
|
||
| export function createGatewayConnectorHandler(core: Core, io: AppIO): Router { | ||
| return new Router("connector", "inspect connectors configured for an AgentCore Gateway") | ||
| .default(createHelpDefault(io)) | ||
| .handler(createGetGatewayConnectorHandler(core)) | ||
| .handler(createListGatewayConnectorsHandler(core)); | ||
| } |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| import { TargetType } from "@aws-sdk/client-bedrock-agentcore-control"; | ||
| import z from "zod"; | ||
| import { InputValidationError } from "../../../../errors"; | ||
| import { createHandler, flag } from "../../../../router"; | ||
| import { JsonRendererKey } from "../../../../tui"; | ||
| import type { Core } from "../../../types"; | ||
| import { coreOptsFromCtx } from "../../../utils"; | ||
|
|
||
| export const createListGatewayConnectorsHandler = (core: Core) => | ||
| createHandler({ | ||
| name: "list", | ||
| description: "list connectors configured for an AgentCore Gateway", | ||
| flags: [ | ||
| flag("gateway-id", "the ID of the Gateway", z.string().optional()), | ||
| flag("next-token", "pagination token returned by a previous request", z.string().optional()), | ||
| flag("max-results", "maximum number of items to return", z.number().optional()), | ||
| ], | ||
| handle: async (ctx, flags) => { | ||
| if (!flags["gateway-id"]) { | ||
| throw new InputValidationError("required option '--gateway-id <gateway-id>' not specified"); | ||
| } | ||
|
|
||
| const response = await core.gateway.listGatewayTargets( | ||
| flags["gateway-id"], | ||
| flags["next-token"], | ||
| flags["max-results"], | ||
| coreOptsFromCtx(ctx), | ||
| ); | ||
|
|
||
| ctx.require(JsonRendererKey).renderJson({ | ||
| ...response, | ||
| items: response.items?.filter((target) => target.targetType === TargetType.CONNECTOR), | ||
| }); | ||
| }, | ||
| }); |
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.