This type parameter allows you to improve type safety on the
requiredScope
field on CognitoUserPoolOrBasicAuthAuthorizerProps, by narrowing the type
to specific strings. You can then extend the ApiGateway
with this type to enforce those scopes
across the application. Remember that auth scopes must be on the format
{resource server identifier}/{scope name}
.
Example:
type AuthScopes = "external/read_users" | "internal/create_users"
export class MyProjectApiGateway extends ApiGateway<AuthScopes> {}
TypeScript will then enforce that requiredScope
is one of AuthScopes
, and provide
auto-complete.
Readonly
domainThe domain which consumers must use.
Readonly
httpThe API Gateway HTTP API. This is the main construct for API-GW.
Readonly
logAccess log group.
Readonly
nodeThe tree node.
Readonly
routesThe routes which connect the httpApi to the backend integration(s).
Allows a grantable target (role, user etc.) permission to invoke the API.
Only works when using IAM
as ApiGatewayRoute.authorization.
A grantable, like iam.Role
Returns a string representation of this construct.
Static
isChecks if x
is a construct.
Use this method instead of instanceof
to properly detect Construct
instances, even when the construct library is symlinked.
Explanation: in JavaScript, multiple copies of the constructs
library on
disk are seen as independent, completely different libraries. As a
consequence, the class Construct
in each copy of the constructs
library
is seen as a different class, and an instance of one class will not test as
instanceof
the other class. npm install
will not create installations
like this, but users may manually symlink construct libraries together or
use a monorepo tool: in those cases, multiple copies of the constructs
library can be accidentally installed, and instanceof
will behave
unpredictably. It is safest to avoid using instanceof
, and using
this type-testing method instead.
Any object
true if x
is an object created from a class which extends Construct
.
This construct tries to simplify the creation of an API Gateway for a service, by collecting most of the common setup here.
The approach followed in this construct is:
/{proxy+}
to let all sub-paths through)The route integration is one of these:
Load Balancer Security Group
Note that the load balancer used in an AlbIntegrationProps must allow outbound HTTPS traffic to its SecurityGroup. Otherwise, the VPC Link used by the API-GW can't get traffic from the ALB.
Author
Kristian Rekstad kre@capraconsulting.no
Author
Hermann Mørkrid hem@liflig.no