@pulumi/aws
Version:
A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.
101 lines • 4.83 kB
JavaScript
;
// *** WARNING: this file was generated by pulumi-language-nodejs. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
Object.defineProperty(exports, "__esModule", { value: true });
exports.RouteResponse = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* Manages an Amazon API Gateway Version 2 route response.
* More information can be found in the [Amazon API Gateway Developer Guide](https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-websocket-api.html).
*
* ## Example Usage
*
* ### Basic
*
* ```typescript
* 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",
* });
* ```
*
* ## 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 `routeResponseKey = "$default"`. More information available is available in [Amazon API Gateway Developer Guide](https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-websocket-api.html).
*
* 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](https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-websocket-api-integration-responses.html#apigateway-websocket-api-integration-response-overview).
*
* ## Import
*
* Using `pulumi import`, import `aws_apigatewayv2_route_response` using the API identifier, route identifier and route response identifier. For example:
*
* ```sh
* $ pulumi import aws:apigatewayv2/routeResponse:RouteResponse example aabbccddee/1122334/998877
* ```
*/
class RouteResponse extends pulumi.CustomResource {
/**
* Get an existing RouteResponse resource's state with the given name, ID, and optional extra
* properties used to qualify the lookup.
*
* @param name The _unique_ name of the resulting resource.
* @param id The _unique_ provider ID of the resource to lookup.
* @param state Any extra arguments used during the lookup.
* @param opts Optional settings to control the behavior of the CustomResource.
*/
static get(name, id, state, opts) {
return new RouteResponse(name, state, { ...opts, id: id });
}
/**
* Returns true if the given object is an instance of RouteResponse. This is designed to work even
* when multiple copies of the Pulumi SDK have been loaded into the same process.
*/
static isInstance(obj) {
if (obj === undefined || obj === null) {
return false;
}
return obj['__pulumiType'] === RouteResponse.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["apiId"] = state?.apiId;
resourceInputs["modelSelectionExpression"] = state?.modelSelectionExpression;
resourceInputs["region"] = state?.region;
resourceInputs["responseModels"] = state?.responseModels;
resourceInputs["routeId"] = state?.routeId;
resourceInputs["routeResponseKey"] = state?.routeResponseKey;
}
else {
const args = argsOrState;
if (args?.apiId === undefined && !opts.urn) {
throw new Error("Missing required property 'apiId'");
}
if (args?.routeId === undefined && !opts.urn) {
throw new Error("Missing required property 'routeId'");
}
if (args?.routeResponseKey === undefined && !opts.urn) {
throw new Error("Missing required property 'routeResponseKey'");
}
resourceInputs["apiId"] = args?.apiId;
resourceInputs["modelSelectionExpression"] = args?.modelSelectionExpression;
resourceInputs["region"] = args?.region;
resourceInputs["responseModels"] = args?.responseModels;
resourceInputs["routeId"] = args?.routeId;
resourceInputs["routeResponseKey"] = args?.routeResponseKey;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(RouteResponse.__pulumiType, name, resourceInputs, opts);
}
}
exports.RouteResponse = RouteResponse;
/** @internal */
RouteResponse.__pulumiType = 'aws:apigatewayv2/routeResponse:RouteResponse';
//# sourceMappingURL=routeResponse.js.map