UNPKG

@pulumi/aws

Version:

A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.

134 lines 6.01 kB
"use strict"; // *** 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.Route = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("../utilities"); /** * Manages 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 * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * const example = new aws.apigatewayv2.Api("example", { * name: "example-websocket-api", * protocolType: "WEBSOCKET", * routeSelectionExpression: "$request.body.action", * }); * const exampleRoute = new aws.apigatewayv2.Route("example", { * apiId: example.id, * routeKey: "$default", * }); * ``` * * ### HTTP Proxy Integration * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * const example = new aws.apigatewayv2.Api("example", { * name: "example-http-api", * protocolType: "HTTP", * }); * const exampleIntegration = new aws.apigatewayv2.Integration("example", { * apiId: example.id, * integrationType: "HTTP_PROXY", * integrationMethod: "ANY", * integrationUri: "https://example.com/{proxy}", * }); * const exampleRoute = new aws.apigatewayv2.Route("example", { * apiId: example.id, * routeKey: "ANY /example/{proxy+}", * target: pulumi.interpolate`integrations/${exampleIntegration.id}`, * }); * ``` * * ## Import * * Using `pulumi import`, import `aws_apigatewayv2_route` using the API identifier and route identifier. 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. */ class Route extends pulumi.CustomResource { /** * Get an existing Route 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 Route(name, state, { ...opts, id: id }); } /** * Returns true if the given object is an instance of Route. 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'] === Route.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["apiId"] = state?.apiId; resourceInputs["apiKeyRequired"] = state?.apiKeyRequired; resourceInputs["authorizationScopes"] = state?.authorizationScopes; resourceInputs["authorizationType"] = state?.authorizationType; resourceInputs["authorizerId"] = state?.authorizerId; resourceInputs["modelSelectionExpression"] = state?.modelSelectionExpression; resourceInputs["operationName"] = state?.operationName; resourceInputs["region"] = state?.region; resourceInputs["requestModels"] = state?.requestModels; resourceInputs["requestParameters"] = state?.requestParameters; resourceInputs["routeKey"] = state?.routeKey; resourceInputs["routeResponseSelectionExpression"] = state?.routeResponseSelectionExpression; resourceInputs["target"] = state?.target; } else { const args = argsOrState; if (args?.apiId === undefined && !opts.urn) { throw new Error("Missing required property 'apiId'"); } if (args?.routeKey === undefined && !opts.urn) { throw new Error("Missing required property 'routeKey'"); } resourceInputs["apiId"] = args?.apiId; resourceInputs["apiKeyRequired"] = args?.apiKeyRequired; resourceInputs["authorizationScopes"] = args?.authorizationScopes; resourceInputs["authorizationType"] = args?.authorizationType; resourceInputs["authorizerId"] = args?.authorizerId; resourceInputs["modelSelectionExpression"] = args?.modelSelectionExpression; resourceInputs["operationName"] = args?.operationName; resourceInputs["region"] = args?.region; resourceInputs["requestModels"] = args?.requestModels; resourceInputs["requestParameters"] = args?.requestParameters; resourceInputs["routeKey"] = args?.routeKey; resourceInputs["routeResponseSelectionExpression"] = args?.routeResponseSelectionExpression; resourceInputs["target"] = args?.target; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(Route.__pulumiType, name, resourceInputs, opts); } } exports.Route = Route; /** @internal */ Route.__pulumiType = 'aws:apigatewayv2/route:Route'; //# sourceMappingURL=route.js.map