Package com.pulumi.aws.apigatewayv2
Class Route
- java.lang.Object
-
- com.pulumi.resources.Resource
-
- com.pulumi.resources.CustomResource
-
- com.pulumi.aws.apigatewayv2.Route
-
public class Route extends com.pulumi.resources.CustomResourceManages an Amazon API Gateway Version 2 route. More information can be found in the [Amazon API Gateway Developer Guide](https://docs.aws.amazon.com/apigateway/latest/developerguide/welcome.html) for [WebSocket](https://docs.aws.amazon.com/apigateway/latest/developerguide/websocket-api-develop-routes.html) and [HTTP](https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-develop-routes.html) APIs. ## Example Usage ### Basic
### HTTP Proxy Integrationpackage generated_program; import com.pulumi.Context; import com.pulumi.Pulumi; import com.pulumi.core.Output; import com.pulumi.aws.apigatewayv2.Api; import com.pulumi.aws.apigatewayv2.ApiArgs; import com.pulumi.aws.apigatewayv2.Route; import com.pulumi.aws.apigatewayv2.RouteArgs; import java.util.ArrayList; import java.util.Arrays; import java.util.Map; import java.io.File; import java.nio.file.Files; import java.nio.file.Paths; public class App { public static void main(String[] args) { Pulumi.run(App::stack); } public static void stack(Context ctx) { var example = new Api("example", ApiArgs.builder() .name("example-websocket-api") .protocolType("WEBSOCKET") .routeSelectionExpression("$request.body.action") .build()); var exampleRoute = new Route("exampleRoute", RouteArgs.builder() .apiId(example.id()) .routeKey("$default") .build()); } }
## Import ### Identity Schema #### Required * `apiId` (String) API identifier. * `id` (String) Route identifier. #### Optional * `accountId` (String) AWS Account where this resource is managed. * `region` (String) Region where this resource is managed. Using `pulumi import`, import `aws.apigatewayv2.Route` using `apiId` and `id` (route identifier), delimited by a `/`. For example: ```sh $ pulumi import aws:apigatewayv2/route:Route example aabbccddee/1122334 ``` > **Note:** The API Gateway managed route created as part of [*quick_create*](https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-basic-concept.html#apigateway-definition-quick-create) cannot be imported.package generated_program; import com.pulumi.Context; import com.pulumi.Pulumi; import com.pulumi.core.Output; import com.pulumi.aws.apigatewayv2.Api; import com.pulumi.aws.apigatewayv2.ApiArgs; import com.pulumi.aws.apigatewayv2.Integration; import com.pulumi.aws.apigatewayv2.IntegrationArgs; import com.pulumi.aws.apigatewayv2.Route; import com.pulumi.aws.apigatewayv2.RouteArgs; import java.util.ArrayList; import java.util.Arrays; import java.util.Map; import java.io.File; import java.nio.file.Files; import java.nio.file.Paths; public class App { public static void main(String[] args) { Pulumi.run(App::stack); } public static void stack(Context ctx) { var example = new Api("example", ApiArgs.builder() .name("example-http-api") .protocolType("HTTP") .build()); var exampleIntegration = new Integration("exampleIntegration", IntegrationArgs.builder() .apiId(example.id()) .integrationType("HTTP_PROXY") .integrationMethod("ANY") .integrationUri("https://example.com/{proxy}") .build()); var exampleRoute = new Route("exampleRoute", RouteArgs.builder() .apiId(example.id()) .routeKey("ANY /example/{proxy+}") .target(exampleIntegration.id().applyValue(_id -> String.format("integrations/%s", _id))) .build()); } }
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description com.pulumi.core.Output<java.lang.String>apiId()com.pulumi.core.Output<java.util.Optional<java.lang.Boolean>>apiKeyRequired()com.pulumi.core.Output<java.util.Optional<java.util.List<java.lang.String>>>authorizationScopes()com.pulumi.core.Output<java.util.Optional<java.lang.String>>authorizationType()com.pulumi.core.Output<java.util.Optional<java.lang.String>>authorizerId()static Routeget(java.lang.String name, com.pulumi.core.Output<java.lang.String> id, RouteState state, com.pulumi.resources.CustomResourceOptions options)Get an existing Host resource's state with the given name, ID, and optional extra properties used to qualify the lookup.com.pulumi.core.Output<java.util.Optional<java.lang.String>>modelSelectionExpression()com.pulumi.core.Output<java.util.Optional<java.lang.String>>operationName()com.pulumi.core.Output<java.lang.String>region()com.pulumi.core.Output<java.util.Optional<java.util.Map<java.lang.String,java.lang.String>>>requestModels()com.pulumi.core.Output<java.util.Optional<java.util.List<RouteRequestParameter>>>requestParameters()com.pulumi.core.Output<java.lang.String>routeKey()com.pulumi.core.Output<java.util.Optional<java.lang.String>>routeResponseSelectionExpression()com.pulumi.core.Output<java.util.Optional<java.lang.String>>target()
-
-
-
Constructor Detail
-
Route
public Route(java.lang.String name)
- Parameters:
name- The _unique_ name of the resulting resource.
-
Route
public Route(java.lang.String name, RouteArgs args)- Parameters:
name- The _unique_ name of the resulting resource.args- The arguments to use to populate this resource's properties.
-
Route
public Route(java.lang.String name, RouteArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options)- Parameters:
name- The _unique_ name of the resulting resource.args- The arguments to use to populate this resource's properties.options- A bag of options that control this resource's behavior.
-
-
Method Detail
-
apiId
public com.pulumi.core.Output<java.lang.String> apiId()
- Returns:
- API identifier.
-
apiKeyRequired
public com.pulumi.core.Output<java.util.Optional<java.lang.Boolean>> apiKeyRequired()
- Returns:
- Whether an API key is required for the route. Defaults to `false`. Supported only for WebSocket APIs.
-
authorizationScopes
public com.pulumi.core.Output<java.util.Optional<java.util.List<java.lang.String>>> authorizationScopes()
- Returns:
- Authorization scopes supported by this route. The scopes are used with a JWT authorizer to authorize the method invocation.
-
authorizationType
public com.pulumi.core.Output<java.util.Optional<java.lang.String>> authorizationType()
- Returns:
- Authorization type for the route. For WebSocket APIs, valid values are `NONE` for open access, `AWS_IAM` for using AWS IAM permissions, and `CUSTOM` for using a Lambda authorizer. For HTTP APIs, valid values are `NONE` for open access, `JWT` for using JSON Web Tokens, `AWS_IAM` for using AWS IAM permissions, and `CUSTOM` for using a Lambda authorizer. Defaults to `NONE`.
-
authorizerId
public com.pulumi.core.Output<java.util.Optional<java.lang.String>> authorizerId()
- Returns:
- Identifier of the `aws.apigatewayv2.Authorizer` resource to be associated with this route.
-
modelSelectionExpression
public com.pulumi.core.Output<java.util.Optional<java.lang.String>> modelSelectionExpression()
- Returns:
- [Model selection expression](https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-websocket-api-selection-expressions.html#apigateway-websocket-api-model-selection-expressions) for the route. Supported only for WebSocket APIs.
-
operationName
public com.pulumi.core.Output<java.util.Optional<java.lang.String>> operationName()
- Returns:
- Operation name for the route. Must be between 1 and 64 characters in length.
-
region
public com.pulumi.core.Output<java.lang.String> region()
- Returns:
- Region where this resource will be [managed](https://docs.aws.amazon.com/general/latest/gr/rande.html#regional-endpoints). Defaults to the Region set in the provider configuration.
-
requestModels
public com.pulumi.core.Output<java.util.Optional<java.util.Map<java.lang.String,java.lang.String>>> requestModels()
- Returns:
- Request models for the route. Supported only for WebSocket APIs.
-
requestParameters
public com.pulumi.core.Output<java.util.Optional<java.util.List<RouteRequestParameter>>> requestParameters()
- Returns:
- Request parameters for the route. Supported only for WebSocket APIs. See `requestParameter` Block below.
-
routeKey
public com.pulumi.core.Output<java.lang.String> routeKey()
- Returns:
- Route key for the route. For HTTP APIs, the route key can be either `$default`, or a combination of an HTTP method and resource path, for example, `GET /pets`.
-
routeResponseSelectionExpression
public com.pulumi.core.Output<java.util.Optional<java.lang.String>> routeResponseSelectionExpression()
- Returns:
- [Route response selection expression](https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-websocket-api-selection-expressions.html#apigateway-websocket-api-route-response-selection-expressions) for the route. Supported only for WebSocket APIs.
-
target
public com.pulumi.core.Output<java.util.Optional<java.lang.String>> target()
- Returns:
- Target for the route, of the form `integrations/`*`IntegrationID`*, where *`IntegrationID`* is the identifier of an `aws.apigatewayv2.Integration` resource.
-
get
public static Route get(java.lang.String name, com.pulumi.core.Output<java.lang.String> id, @Nullable RouteState state, @Nullable com.pulumi.resources.CustomResourceOptions options)
Get an existing Host resource's state with the given name, ID, and optional extra properties used to qualify the lookup.- Parameters:
name- The _unique_ name of the resulting resource.id- The _unique_ provider ID of the resource to lookup.state-options- Optional settings to control the behavior of the CustomResource.
-
-