HttpRouteKey Class
HTTP route in APIGateway is a combination of the HTTP method and the path component.
This class models that combination.
| Source | aws-apigatewayv2/lib/http/route.ts |
|---|---|
| Type last changed |
Example
ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_apigatewayv2 as apigatewayv2 } from 'aws-cdk-lib';
const httpRouteKey = apigatewayv2.HttpRouteKey.with('path', /* all optional props */ apigatewayv2.HttpMethod.ANY);
python
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_apigatewayv2 as apigatewayv2
http_route_key = apigatewayv2.HttpRouteKey.with("path", apigatewayv2.HttpMethod.ANY)
java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.services.apigatewayv2.*;
HttpRouteKey httpRouteKey = HttpRouteKey.with("path", HttpMethod.ANY);
csharp
// Install: dotnet add package Amazon.CDK.Lib
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.Apigatewayv2;
var httpRouteKey = HttpRouteKey.With("path", HttpMethod.ANY);
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"
httpRouteKey := awscdk.Aws_apigatewayv2.HttpRouteKey_With(jsii.String("path"), awscdk.Aws_apigatewayv2.HttpMethod_ANY)
Properties
DEFAULTHttpRouteKeyDEFAULTHttpRouteKeyDEFAULTHttpRouteKeyDEFAULTHttpRouteKeyDEFAULTHttpRouteKey static #The catch-all route of the API, i.e., when no other routes match.
The key to the RouteKey as recognized by APIGateway.
The method of the route.
pathmay be undefinedstringpathmay be undefinedstrpathmay be undefinedStringPathmay be undefinedstringPathmay be undefined*string #The path part of this RouteKey.
Returns undefined when RouteKey.DEFAULT is used.
Methods
with(path: string, method?: HttpMethod): HttpRouteKey // chainable@staticmethod def with(path: str, method: typing.Optional[HttpMethod] = None) -> HttpRouteKeypublic static HttpRouteKey with(String path, HttpMethod method)public static HttpRouteKey With(string path, HttpMethod? method = null)func With(Path *string, Method HttpMethod) HttpRouteKey static #Create a route key with the combination of the path and the method.
1 parameter
Parameters
methodmethodmethodmethodMethod— default is 'ANY'.