feat: add API Gateway route testing and discovery
This commit is contained in:
@@ -217,6 +217,34 @@ export interface ApiGatewayLambdaRoute {
|
||||
invokeUrl: string;
|
||||
}
|
||||
|
||||
export interface TestApiGatewayRouteInput {
|
||||
path: string;
|
||||
method: string;
|
||||
stage: string;
|
||||
body: string;
|
||||
headers: Record<string, string>;
|
||||
query: string;
|
||||
}
|
||||
|
||||
export interface ApiGatewayTestRouteResult {
|
||||
statusCode: number;
|
||||
headers: Record<string, string>;
|
||||
body: string;
|
||||
durationMs: number;
|
||||
}
|
||||
|
||||
export interface ApiGatewayRouteOverview {
|
||||
resourceId: string;
|
||||
path: string;
|
||||
method: string;
|
||||
functionName: string | null;
|
||||
}
|
||||
|
||||
export interface ApiGatewayRoutesResult {
|
||||
routes: ApiGatewayRouteOverview[];
|
||||
stages: string[];
|
||||
}
|
||||
|
||||
export async function createApiGatewayLambdaRoute(
|
||||
cloud: CloudProvider,
|
||||
apiId: string,
|
||||
@@ -231,6 +259,33 @@ export async function createApiGatewayLambdaRoute(
|
||||
return res.data;
|
||||
}
|
||||
|
||||
export async function listApiGatewayRoutes(
|
||||
cloud: CloudProvider,
|
||||
apiId: string,
|
||||
signal?: AbortSignal,
|
||||
): Promise<ApiGatewayRoutesResult> {
|
||||
const res = await apiClient.call<ApiGatewayRoutesResult>(
|
||||
apiEndpointKeys.clouds.resources.listApiGatewayRoutes,
|
||||
requestOptions(cloud, "apigateway", { signal }),
|
||||
{ cloud, id: apiId },
|
||||
);
|
||||
return res.data;
|
||||
}
|
||||
|
||||
export async function testApiGatewayRoute(
|
||||
cloud: CloudProvider,
|
||||
apiId: string,
|
||||
input: TestApiGatewayRouteInput,
|
||||
signal?: AbortSignal,
|
||||
): Promise<ApiGatewayTestRouteResult> {
|
||||
const res = await apiClient.call<ApiGatewayTestRouteResult, TestApiGatewayRouteInput>(
|
||||
apiEndpointKeys.clouds.resources.testApiGatewayRoute,
|
||||
requestOptions(cloud, "apigateway", { signal, body: input, timeout: INVOKE_TIMEOUT_MS }),
|
||||
{ cloud, id: apiId },
|
||||
);
|
||||
return res.data;
|
||||
}
|
||||
|
||||
export type KmsEncryptionAlgorithm =
|
||||
| "SYMMETRIC_DEFAULT"
|
||||
| "RSAES_OAEP_SHA_1"
|
||||
|
||||
Reference in New Issue
Block a user