@fntio/infra-client
Version:
Self-hosted AWS access portal: credential vending, target-account trust, and grant-driven private networking as CDK stacks and constructs.
54 lines (53 loc) • 2.68 kB
TypeScript
import { Construct } from "constructs";
import * as iam from "aws-cdk-lib/aws-iam";
import * as lambda from "aws-cdk-lib/aws-lambda";
/** Identity of a deployed hub, from the consumer's point of view. Everything
* a cross-account stack needs derives from these — no hand-assembled ARNs. */
export interface AccessPortalHubAttributes {
readonly account: string;
readonly region: string;
/** The hub's issuer host, e.g. "issuer.acme.com". Needed for `issuerUrl`;
* omit when only the network side is consumed. */
readonly issuerDomain?: string;
/** SET-ONCE product prefix the hub was deployed with. */
readonly resourcePrefix?: string;
/** The zone + subdomain the hub's network deployed with. Needed for
* `controlUrl()`; omit when the hub has no NetworkStack. */
readonly network?: {
readonly zoneName: string;
readonly subdomain: string;
};
}
/** The hub consumers point cross-account constructs at. Every contract is a
* WELL-KNOWN NAME from `resourcePrefix`, so plain attributes answer everything. */
export interface IAccessPortalHub {
readonly account: string;
readonly region: string;
readonly resourcePrefix: string;
/** `https://<issuerDomain>` — what target-account trust derives from. */
readonly issuerUrl?: string;
/** A site's Headscale control-plane URL (`https://<site>.<subdomain>.<zone>`). */
controlUrl(siteId: string): string;
/** ONE SITE's connector minter — site selection = WHICH minter an account
* may invoke; the hub must reciprocate with grantConnectorAccount. */
connectorKeyMinter(scope: Construct, siteId: string): lambda.IFunction;
/** The hub's ACL-reconciler role — what an SG-manager/resolver IN THE HUB'S REGION trusts. */
aclReconcilerPrincipal(): iam.IPrincipal;
/** The reconciler's out-of-VPC relay role — what an SG-manager/resolver in ANY OTHER region
* trusts (the reconciler itself cannot reach that region). */
aclReconcilerRelayPrincipal(): iam.IPrincipal;
}
export declare class AccessPortalHub implements IAccessPortalHub {
/** Locate a hub by identity alone — for apps that don't contain its stacks. */
static fromAttributes(attrs: AccessPortalHubAttributes): IAccessPortalHub;
readonly account: string;
readonly region: string;
readonly resourcePrefix: string;
readonly issuerUrl?: string;
private readonly network?;
private constructor();
controlUrl(siteId: string): string;
connectorKeyMinter(scope: Construct, siteId: string): lambda.IFunction;
aclReconcilerPrincipal(): iam.IPrincipal;
aclReconcilerRelayPrincipal(): iam.IPrincipal;
}