1. Packages
  2. AWS Classic
  3. API Docs
  4. apigatewayv2
  5. RouteResponse

Try AWS Native preview for resources not in the classic version.

AWS Classic v6.32.0 published on Friday, Apr 19, 2024 by Pulumi

aws.apigatewayv2.RouteResponse

Explore with Pulumi AI

aws logo

Try AWS Native preview for resources not in the classic version.

AWS Classic v6.32.0 published on Friday, Apr 19, 2024 by Pulumi

    Manages an Amazon API Gateway Version 2 route response. More information can be found in the Amazon API Gateway Developer Guide.

    Example Usage

    Basic

    import * as pulumi from "@pulumi/pulumi";
    import * as aws from "@pulumi/aws";
    
    const example = new aws.apigatewayv2.RouteResponse("example", {
        apiId: exampleAwsApigatewayv2Api.id,
        routeId: exampleAwsApigatewayv2Route.id,
        routeResponseKey: "$default",
    });
    
    import pulumi
    import pulumi_aws as aws
    
    example = aws.apigatewayv2.RouteResponse("example",
        api_id=example_aws_apigatewayv2_api["id"],
        route_id=example_aws_apigatewayv2_route["id"],
        route_response_key="$default")
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/apigatewayv2"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := apigatewayv2.NewRouteResponse(ctx, "example", &apigatewayv2.RouteResponseArgs{
    			ApiId:            pulumi.Any(exampleAwsApigatewayv2Api.Id),
    			RouteId:          pulumi.Any(exampleAwsApigatewayv2Route.Id),
    			RouteResponseKey: pulumi.String("$default"),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Aws = Pulumi.Aws;
    
    return await Deployment.RunAsync(() => 
    {
        var example = new Aws.ApiGatewayV2.RouteResponse("example", new()
        {
            ApiId = exampleAwsApigatewayv2Api.Id,
            RouteId = exampleAwsApigatewayv2Route.Id,
            RouteResponseKey = "$default",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.aws.apigatewayv2.RouteResponse;
    import com.pulumi.aws.apigatewayv2.RouteResponseArgs;
    import java.util.List;
    import java.util.ArrayList;
    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 RouteResponse("example", RouteResponseArgs.builder()        
                .apiId(exampleAwsApigatewayv2Api.id())
                .routeId(exampleAwsApigatewayv2Route.id())
                .routeResponseKey("$default")
                .build());
    
        }
    }
    
    resources:
      example:
        type: aws:apigatewayv2:RouteResponse
        properties:
          apiId: ${exampleAwsApigatewayv2Api.id}
          routeId: ${exampleAwsApigatewayv2Route.id}
          routeResponseKey: $default
    

    Enabling Two-Way Communication

    For websocket routes that require two-way communication enabled, an aws.apigatewayv2.RouteResponse needs to be added to the route with route_response_key = "$default". More information available is available in Amazon API Gateway Developer Guide.

    You can only define the $default route response for WebSocket APIs. You can use an integration response to manipulate the response from a backend service. For more information, see Overview of integration responses.

    Create RouteResponse Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new RouteResponse(name: string, args: RouteResponseArgs, opts?: CustomResourceOptions);
    @overload
    def RouteResponse(resource_name: str,
                      args: RouteResponseArgs,
                      opts: Optional[ResourceOptions] = None)
    
    @overload
    def RouteResponse(resource_name: str,
                      opts: Optional[ResourceOptions] = None,
                      api_id: Optional[str] = None,
                      route_id: Optional[str] = None,
                      route_response_key: Optional[str] = None,
                      model_selection_expression: Optional[str] = None,
                      response_models: Optional[Mapping[str, str]] = None)
    func NewRouteResponse(ctx *Context, name string, args RouteResponseArgs, opts ...ResourceOption) (*RouteResponse, error)
    public RouteResponse(string name, RouteResponseArgs args, CustomResourceOptions? opts = null)
    public RouteResponse(String name, RouteResponseArgs args)
    public RouteResponse(String name, RouteResponseArgs args, CustomResourceOptions options)
    
    type: aws:apigatewayv2:RouteResponse
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    

    Parameters

    name string
    The unique name of the resource.
    args RouteResponseArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    resource_name str
    The unique name of the resource.
    args RouteResponseArgs
    The arguments to resource properties.
    opts ResourceOptions
    Bag of options to control resource's behavior.
    ctx Context
    Context object for the current deployment.
    name string
    The unique name of the resource.
    args RouteResponseArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args RouteResponseArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args RouteResponseArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Example

    The following reference example uses placeholder values for all input properties.

    var routeResponseResource = new Aws.ApiGatewayV2.RouteResponse("routeResponseResource", new()
    {
        ApiId = "string",
        RouteId = "string",
        RouteResponseKey = "string",
        ModelSelectionExpression = "string",
        ResponseModels = 
        {
            { "string", "string" },
        },
    });
    
    example, err := apigatewayv2.NewRouteResponse(ctx, "routeResponseResource", &apigatewayv2.RouteResponseArgs{
    	ApiId:                    pulumi.String("string"),
    	RouteId:                  pulumi.String("string"),
    	RouteResponseKey:         pulumi.String("string"),
    	ModelSelectionExpression: pulumi.String("string"),
    	ResponseModels: pulumi.StringMap{
    		"string": pulumi.String("string"),
    	},
    })
    
    var routeResponseResource = new RouteResponse("routeResponseResource", RouteResponseArgs.builder()        
        .apiId("string")
        .routeId("string")
        .routeResponseKey("string")
        .modelSelectionExpression("string")
        .responseModels(Map.of("string", "string"))
        .build());
    
    route_response_resource = aws.apigatewayv2.RouteResponse("routeResponseResource",
        api_id="string",
        route_id="string",
        route_response_key="string",
        model_selection_expression="string",
        response_models={
            "string": "string",
        })
    
    const routeResponseResource = new aws.apigatewayv2.RouteResponse("routeResponseResource", {
        apiId: "string",
        routeId: "string",
        routeResponseKey: "string",
        modelSelectionExpression: "string",
        responseModels: {
            string: "string",
        },
    });
    
    type: aws:apigatewayv2:RouteResponse
    properties:
        apiId: string
        modelSelectionExpression: string
        responseModels:
            string: string
        routeId: string
        routeResponseKey: string
    

    RouteResponse Resource Properties

    To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

    Inputs

    The RouteResponse resource accepts the following input properties:

    ApiId string
    API identifier.
    RouteId string
    Identifier of the aws.apigatewayv2.Route.
    RouteResponseKey string
    Route response key.
    ModelSelectionExpression string
    The model selection expression for the route response.
    ResponseModels Dictionary<string, string>
    Response models for the route response.
    ApiId string
    API identifier.
    RouteId string
    Identifier of the aws.apigatewayv2.Route.
    RouteResponseKey string
    Route response key.
    ModelSelectionExpression string
    The model selection expression for the route response.
    ResponseModels map[string]string
    Response models for the route response.
    apiId String
    API identifier.
    routeId String
    Identifier of the aws.apigatewayv2.Route.
    routeResponseKey String
    Route response key.
    modelSelectionExpression String
    The model selection expression for the route response.
    responseModels Map<String,String>
    Response models for the route response.
    apiId string
    API identifier.
    routeId string
    Identifier of the aws.apigatewayv2.Route.
    routeResponseKey string
    Route response key.
    modelSelectionExpression string
    The model selection expression for the route response.
    responseModels {[key: string]: string}
    Response models for the route response.
    api_id str
    API identifier.
    route_id str
    Identifier of the aws.apigatewayv2.Route.
    route_response_key str
    Route response key.
    model_selection_expression str
    The model selection expression for the route response.
    response_models Mapping[str, str]
    Response models for the route response.
    apiId String
    API identifier.
    routeId String
    Identifier of the aws.apigatewayv2.Route.
    routeResponseKey String
    Route response key.
    modelSelectionExpression String
    The model selection expression for the route response.
    responseModels Map<String>
    Response models for the route response.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the RouteResponse resource produces the following output properties:

    Id string
    The provider-assigned unique ID for this managed resource.
    Id string
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.
    id string
    The provider-assigned unique ID for this managed resource.
    id str
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.

    Look up Existing RouteResponse Resource

    Get an existing RouteResponse resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

    public static get(name: string, id: Input<ID>, state?: RouteResponseState, opts?: CustomResourceOptions): RouteResponse
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            api_id: Optional[str] = None,
            model_selection_expression: Optional[str] = None,
            response_models: Optional[Mapping[str, str]] = None,
            route_id: Optional[str] = None,
            route_response_key: Optional[str] = None) -> RouteResponse
    func GetRouteResponse(ctx *Context, name string, id IDInput, state *RouteResponseState, opts ...ResourceOption) (*RouteResponse, error)
    public static RouteResponse Get(string name, Input<string> id, RouteResponseState? state, CustomResourceOptions? opts = null)
    public static RouteResponse get(String name, Output<String> id, RouteResponseState state, CustomResourceOptions options)
    Resource lookup is not supported in YAML
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    resource_name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    The following state arguments are supported:
    ApiId string
    API identifier.
    ModelSelectionExpression string
    The model selection expression for the route response.
    ResponseModels Dictionary<string, string>
    Response models for the route response.
    RouteId string
    Identifier of the aws.apigatewayv2.Route.
    RouteResponseKey string
    Route response key.
    ApiId string
    API identifier.
    ModelSelectionExpression string
    The model selection expression for the route response.
    ResponseModels map[string]string
    Response models for the route response.
    RouteId string
    Identifier of the aws.apigatewayv2.Route.
    RouteResponseKey string
    Route response key.
    apiId String
    API identifier.
    modelSelectionExpression String
    The model selection expression for the route response.
    responseModels Map<String,String>
    Response models for the route response.
    routeId String
    Identifier of the aws.apigatewayv2.Route.
    routeResponseKey String
    Route response key.
    apiId string
    API identifier.
    modelSelectionExpression string
    The model selection expression for the route response.
    responseModels {[key: string]: string}
    Response models for the route response.
    routeId string
    Identifier of the aws.apigatewayv2.Route.
    routeResponseKey string
    Route response key.
    api_id str
    API identifier.
    model_selection_expression str
    The model selection expression for the route response.
    response_models Mapping[str, str]
    Response models for the route response.
    route_id str
    Identifier of the aws.apigatewayv2.Route.
    route_response_key str
    Route response key.
    apiId String
    API identifier.
    modelSelectionExpression String
    The model selection expression for the route response.
    responseModels Map<String>
    Response models for the route response.
    routeId String
    Identifier of the aws.apigatewayv2.Route.
    routeResponseKey String
    Route response key.

    Import

    Using pulumi import, import aws_apigatewayv2_route_response using the API identifier, route identifier and route response identifier. For example:

    $ pulumi import aws:apigatewayv2/routeResponse:RouteResponse example aabbccddee/1122334/998877
    

    To learn more about importing existing cloud resources, see Importing resources.

    Package Details

    Repository
    AWS Classic pulumi/pulumi-aws
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the aws Terraform Provider.
    aws logo

    Try AWS Native preview for resources not in the classic version.

    AWS Classic v6.32.0 published on Friday, Apr 19, 2024 by Pulumi