@fntio/infra-client
Version:
Self-hosted AWS access portal: credential vending, target-account trust, and grant-driven private networking as CDK stacks and constructs.
41 lines (40 loc) • 2.44 kB
TypeScript
import * as cdk from "aws-cdk-lib";
import * as apigw from "aws-cdk-lib/aws-apigateway";
import type * as dynamodb from "aws-cdk-lib/aws-dynamodb";
import * as lambda from "aws-cdk-lib/aws-lambda";
import { Construct } from "constructs";
import { AppFunction } from "../constructs/app-function";
import { ResolvedPlugin } from "./registration";
import { PluginRuntimeTables } from "./runtime";
import { AuditLogTarget } from "../audit-log";
/** What the shared authorizer reads: who (the pool, the service-user registry), whether (Access rows), and
* what (the catalog and the accounts it binds — `PluginRuntimeTables`). Read-only on every table. */
export interface PluginAuthorizerRuntime extends PluginRuntimeTables {
readonly userPoolId: string;
readonly accessTable: dynamodb.ITable;
readonly serviceUsersTable: dynamodb.ITable;
}
export interface PluginApiProps {
readonly api: apigw.RestApi;
/** The Express handler: every non-plugin /api/* path, and /api/plugins itself (discovery) plus its unknown
* sub-paths (its JSON 404), stay on it. */
readonly coreHandler: lambda.IFunction;
readonly plugins: readonly ResolvedPlugin[];
readonly runtime: PluginAuthorizerRuntime;
/** Where the authorizer records refused calls; absent = refusals are log lines only. */
readonly auditLog?: AuditLogTarget;
}
/** Plugin routes on the core REST API. Explicit resources under /api stop the root {proxy+} from covering
* /api/…, so the core keeps /api, /api/{proxy+}, ANY /api/plugins and /api/plugins/{proxy+} explicitly — created as soon as the
* feature is on, even with no plugin, so the routing change is deployed and verified on its own first.
* Each plugin's resource sets the shared REQUEST authorizer (result cache 0) as the default method option,
* so everything under /api/plugins/<id> is authorized by construction. */
export declare class PluginApi extends Construct {
/** Present when at least one plugin has routes (an unattached authorizer fails synth). */
readonly authorizer: apigw.RequestAuthorizer | undefined;
readonly authorizerFunction: AppFunction | undefined;
/** Plugin id → its methods; the catalog activation orders itself after (and, on delete, before) them. */
readonly methodsByPlugin: Map<string, cdk.aws_apigateway.Method[]>;
get methods(): apigw.Method[];
constructor(scope: Construct, id: string, props: PluginApiProps);
}