Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions src/handlers/gateway/connector/create/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,43 +19,53 @@ import {
import type { CreateGatewayTargetInput } from "../../types";
import { GatewayConnectorTarget } from "../gatewayConnectorTarget";

const TARGET = "Target:";
const CONNECTOR = "Connector:";
const CREDENTIALS = "Credentials & networking:";

export const createCreateGatewayConnectorHandler = (core: Core, io: AppIO) =>
createHandler({
name: "create",
description: "create a connector-backed Gateway Target",
flags: [
flag("gateway-id", "the parent Gateway ID", z.string().optional()),
flag("name", "Connector Target name", z.string().optional()),
flag("description", "Connector Target description", z.string().optional()),
flag("gateway-id", "the parent Gateway ID", z.string().optional(), { group: TARGET }),
flag("name", "Connector Target name", z.string().optional(), { group: TARGET }),
flag("description", "Connector Target description", z.string().optional(), { group: TARGET }),
flag(
"connector-configuration",
"connector-backed Target configuration (JSON; inline, file://<path>, or - for stdin)",
z.string().optional(),
{ group: CONNECTOR },
),
flag(
"connector",
"curated connector",
z.enum(["web-search", "bedrock-knowledge-bases", "bedrock-mantle"]).optional(),
{ group: CONNECTOR },
),
flag(
"knowledge-base-id",
"Knowledge Base ID for the bedrock-knowledge-bases connector",
z.string().optional(),
{ group: CONNECTOR },
),
flag(
"credential-provider-configurations",
"one outbound credential configuration (JSON array; inline, file://<path>, or - for stdin); required with --connector-configuration and defaults to GATEWAY_IAM_ROLE with --connector",
z.string().optional(),
{ group: CREDENTIALS },
),
flag(
"metadata-configuration",
"metadata propagation (JSON; inline, file://<path>, or - for stdin)",
z.string().optional(),
{ group: CREDENTIALS },
),
flag(
"private-endpoint",
"private endpoint (JSON; inline, file://<path>, or - for stdin)",
z.string().optional(),
{ group: CREDENTIALS },
),
],
handle: async (ctx, flags) => {
Expand Down
39 changes: 31 additions & 8 deletions src/handlers/gateway/connector/update/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,49 +19,72 @@ import {
import type { GatewayTargetUpdatePatch } from "../../types";
import { GatewayConnectorTarget } from "../gatewayConnectorTarget";

const TARGET = "Target:";
const CONNECTOR = "Connector:";
const CREDENTIALS = "Credentials & networking:";
const CLEAR = "Clear (unset a field):";

export const createUpdateGatewayConnectorHandler = (core: Core, io: AppIO) =>
createHandler({
name: "update",
description: "update a connector-backed Gateway Target",
flags: [
flag("gateway-id", "the parent Gateway ID", z.string().optional()),
flag("id", "the connector-backed Gateway Target ID", z.string().optional()),
flag("name", "updated Connector Target name", z.string().optional()),
flag("description", "updated Connector Target description", z.string().optional()),
flag("gateway-id", "the parent Gateway ID", z.string().optional(), { group: TARGET }),
flag("id", "the connector-backed Gateway Target ID", z.string().optional(), {
group: TARGET,
}),
flag("name", "updated Connector Target name", z.string().optional(), { group: TARGET }),
flag("description", "updated Connector Target description", z.string().optional(), {
group: TARGET,
}),
flag(
"connector-configuration",
"complete connector-backed Target configuration (JSON; inline, file://<path>, or - for stdin)",
z.string().optional(),
{ group: CONNECTOR },
),
flag(
"connector",
"curated connector",
z.enum(["web-search", "bedrock-knowledge-bases", "bedrock-mantle"]).optional(),
{ group: CONNECTOR },
),
flag(
"knowledge-base-id",
"Knowledge Base ID for the bedrock-knowledge-bases connector",
z.string().optional(),
{ group: CONNECTOR },
),
flag(
"credential-provider-configurations",
"replacement outbound credentials (JSON array; inline, file://<path>, or - for stdin)",
z.string().optional(),
{ group: CREDENTIALS },
),
flag(
"metadata-configuration",
"replacement metadata propagation (JSON; inline, file://<path>, or - for stdin)",
z.string().optional(),
{ group: CREDENTIALS },
),
flag(
"private-endpoint",
"replacement private endpoint (JSON; inline, file://<path>, or - for stdin)",
z.string().optional(),
{ group: CREDENTIALS },
),
flag("clear-description", "remove the Connector Target description", z.boolean()),
flag("clear-credential-provider-configurations", "remove outbound credentials", z.boolean()),
flag("clear-metadata-configuration", "remove metadata propagation", z.boolean()),
flag("clear-private-endpoint", "remove private endpoint configuration", z.boolean()),
flag("clear-description", "remove the Connector Target description", z.boolean(), {
group: CLEAR,
}),
flag("clear-credential-provider-configurations", "remove outbound credentials", z.boolean(), {
group: CLEAR,
}),
flag("clear-metadata-configuration", "remove metadata propagation", z.boolean(), {
group: CLEAR,
}),
flag("clear-private-endpoint", "remove private endpoint configuration", z.boolean(), {
group: CLEAR,
}),
],
handle: async (ctx, flags) => {
if (!flags["gateway-id"]) {
Expand Down
52 changes: 35 additions & 17 deletions src/handlers/gateway/create/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,53 +12,71 @@ import type { Core } from "../../types";
import { coreOptsFromCtx, parseJsonArrayFlag, parseJsonObjectFlag, parseTags } from "../../utils";
import type { CreateGatewayInput } from "../types";

const CONFIGURATION = "Configuration:";
const PROTOCOL = "Protocol:";
const AUTHORIZER = "Authorizer:";
const POLICY_ENGINE = "Policy engine:";

export const createCreateGatewayHandler = (core: Core, io: AppIO) =>
createHandler({
name: "create",
description: "create an AgentCore Gateway",
flags: [
flag("name", "the Gateway name", z.string().optional()),
flag("role-arn", "IAM role the Gateway assumes", z.string().optional()),
flag("name", "the Gateway name", z.string().optional(), { group: CONFIGURATION }),
flag("role-arn", "IAM role the Gateway assumes", z.string().optional(), {
group: CONFIGURATION,
}),
flag("description", "Gateway description", z.string().optional(), { group: CONFIGURATION }),
flag("kms-key-arn", "KMS key ARN", z.string().optional(), { group: CONFIGURATION }),
flag("exception-level", "exception detail level: debug", z.enum(["debug"]).optional(), {
group: CONFIGURATION,
}),
flag(
"tags",
"tags as repeated key=value or a JSON object (inline, file://<path>, or - for stdin)",
z.array(z.string()).optional(),
{ group: CONFIGURATION },
),
flag("client-token", "idempotency token", z.string().optional(), { group: CONFIGURATION }),
flag(
"protocol",
"restrict Target protocols to MCP; omitted allows every Target protocol",
z.enum(["mcp"]).optional(),
{ group: PROTOCOL },
),
flag(
"authorizer-type",
"inbound authorizer: AWS_IAM, CUSTOM_JWT, NONE, or AUTHENTICATE_ONLY",
z.enum(["AWS_IAM", "CUSTOM_JWT", "NONE", "AUTHENTICATE_ONLY"]).optional(),
),
flag("description", "Gateway description", z.string().optional()),
flag(
"protocol-configuration",
"MCP protocol configuration (JSON; inline, file://<path>, or - for stdin)",
z.string().optional(),
{ group: PROTOCOL },
),
flag(
"authorizer-type",
"inbound authorizer: AWS_IAM, CUSTOM_JWT, NONE, or AUTHENTICATE_ONLY",
z.enum(["AWS_IAM", "CUSTOM_JWT", "NONE", "AUTHENTICATE_ONLY"]).optional(),
{ group: AUTHORIZER },
),
flag(
"authorizer-configuration",
"authorizer configuration (JSON; inline, file://<path>, or - for stdin)",
z.string().optional(),
{ group: AUTHORIZER },
),
flag("kms-key-arn", "KMS key ARN", z.string().optional()),
flag(
"interceptor-configurations",
"interceptor configurations (JSON array; inline, file://<path>, or - for stdin)",
z.string().optional(),
{ group: "Interceptors:" },
),
flag("policy-engine-arn", "Policy Engine ARN", z.string().optional()),
flag("policy-engine-arn", "Policy Engine ARN", z.string().optional(), {
group: POLICY_ENGINE,
}),
flag(
"policy-engine-mode",
"Policy Engine mode: log-only or enforce",
z.enum(["log-only", "enforce"]).optional(),
{ group: POLICY_ENGINE },
),
flag("exception-level", "exception detail level: debug", z.enum(["debug"]).optional()),
flag(
"tags",
"tags as repeated key=value or a JSON object (inline, file://<path>, or - for stdin)",
z.array(z.string()).optional(),
),
flag("client-token", "idempotency token", z.string().optional()),
],
handle: async (ctx, flags) => {
if (!flags.name) {
Expand Down
42 changes: 30 additions & 12 deletions src/handlers/gateway/invoke/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ import {
import { writeGatewayInvokeResponse } from "./response";
import { GatewayInvokeLaunchContextKey } from "./launchContext";

const TARGET = "Target:";
const PAYLOAD = "Payload:";
const SESSION = "Session:";

export const createInvokeGatewayHandler = (
core: Core,
io: AppIO,
Expand All @@ -27,31 +31,45 @@ export const createInvokeGatewayHandler = (
name: "invoke",
description: "invoke an AgentCore Gateway",
flags: [
flag("id", "the ID of the Gateway", gatewayIdSchema.optional()),
flag("id", "the ID of the Gateway", gatewayIdSchema.optional(), { group: TARGET }),
flag(
"path",
"the path relative to the Gateway origin",
z.string().min(1, "requires a nonempty path").optional(),
{ sensitive: true },
{ sensitive: true, group: TARGET },
),
flag("method", "the HTTP request method", z.enum(["GET", "POST", "DELETE"]).optional()),
flag("payload", "the inline payload to send", z.string().optional(), { sensitive: true }),
flag("content-type", "the payload content type", z.string().optional()),
flag("accept", "the accepted response content type", z.string().optional()),
flag("header", "an ordered application header", z.array(z.string()).optional(), {
sensitive: true,
flag("method", "the HTTP request method", z.enum(["GET", "POST", "DELETE"]).optional(), {
group: TARGET,
}),
flag("bearer-token", "the Gateway bearer token", z.string().optional(), {
flag("payload", "the inline payload to send", z.string().optional(), {
sensitive: true,
group: PAYLOAD,
}),
flag("content-type", "the payload content type", z.string().optional(), { group: PAYLOAD }),
flag("accept", "the accepted response content type", z.string().optional(), {
group: PAYLOAD,
}),
flag("session-id", "the Runtime target session ID", z.string().optional()),
flag("mcp-session-id", "the MCP session ID", z.string().optional()),
flag("mcp-protocol-version", "the MCP protocol version", z.string().optional()),
flag(
"output-file",
"the response output file",
z.string().min(1, "requires a nonempty path").optional(),
{ group: PAYLOAD },
),
flag("bearer-token", "the Gateway bearer token", z.string().optional(), {
sensitive: true,
group: "Authentication:",
}),
flag("header", "an ordered application header", z.array(z.string()).optional(), {
sensitive: true,
group: "Application headers:",
}),
flag("session-id", "the Runtime target session ID", z.string().optional(), {
group: SESSION,
}),
flag("mcp-session-id", "the MCP session ID", z.string().optional(), { group: SESSION }),
flag("mcp-protocol-version", "the MCP protocol version", z.string().optional(), {
group: SESSION,
}),
],
handle: async (ctx, flags) => {
if (flags.id === undefined) {
Expand Down
18 changes: 14 additions & 4 deletions src/handlers/gateway/target/create/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,45 +19,55 @@ import {
} from "../../../utils";
import type { CreateGatewayTargetInput } from "../../types";

const TARGET = "Target:";
const DEFINITION = "Definition:";
const CREDENTIALS = "Credentials & networking:";

export const createCreateGatewayTargetHandler = (core: Core, io: AppIO) =>
createHandler({
name: "create",
description: "create a Gateway Target",
flags: [
flag("gateway-id", "the parent Gateway ID", z.string().optional()),
flag("gateway-id", "the parent Gateway ID", z.string().optional(), { group: TARGET }),
flag(
"name",
"Target name; optional only for AgentCore Runtime Targets",
z.string().optional(),
{ group: TARGET },
),
flag("description", "Target description", z.string().optional()),
flag("endpoint", "MCP server HTTPS endpoint", z.string().optional()),
flag("description", "Target description", z.string().optional(), { group: TARGET }),
flag("endpoint", "MCP server HTTPS endpoint", z.string().optional(), { group: DEFINITION }),
flag(
"target-configuration",
"complete Target configuration (JSON; inline, file://<path>, or - for stdin)",
z.string().optional(),
{ group: DEFINITION },
),
flag(
"tool-schema",
"MCP tool schema (inline JSON, file://<path>, - for stdin, or s3:// URI)",
z.string().optional(),
{ group: DEFINITION },
),
flag(
"credential-provider-configurations",
"outbound credentials (JSON array; inline, file://<path>, or - for stdin)",
z.string().optional(),
{ group: CREDENTIALS },
),
flag(
"metadata-configuration",
"metadata propagation (JSON; inline, file://<path>, or - for stdin)",
z.string().optional(),
{ group: CREDENTIALS },
),
flag(
"private-endpoint",
"private endpoint (JSON; inline, file://<path>, or - for stdin)",
z.string().optional(),
{ group: CREDENTIALS },
),
flag("client-token", "idempotency token", z.string().optional()),
flag("client-token", "idempotency token", z.string().optional(), { group: "Idempotency:" }),
],
handle: async (ctx, flags) => {
if (!flags["gateway-id"]) {
Expand Down
Loading
Loading