UNPKG

@pulumi/aws

Version:

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

203 lines • 9.55 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.Integration = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("../utilities"); /** * Manages an Amazon API Gateway Version 2 integration. * 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.Integration("example", { * apiId: exampleAwsApigatewayv2Api.id, * integrationType: "MOCK", * }); * ``` * * ### Lambda Integration * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * const example = new aws.lambda.Function("example", { * code: new pulumi.asset.FileArchive("example.zip"), * name: "Example", * role: exampleAwsIamRole.arn, * handler: "index.handler", * runtime: aws.lambda.Runtime.NodeJS20dX, * }); * const exampleIntegration = new aws.apigatewayv2.Integration("example", { * apiId: exampleAwsApigatewayv2Api.id, * integrationType: "AWS_PROXY", * connectionType: "INTERNET", * contentHandlingStrategy: "CONVERT_TO_TEXT", * description: "Lambda example", * integrationMethod: "POST", * integrationUri: example.invokeArn, * passthroughBehavior: "WHEN_NO_MATCH", * }); * ``` * * ### AWS Service Integration * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * const example = new aws.apigatewayv2.Integration("example", { * apiId: exampleAwsApigatewayv2Api.id, * credentialsArn: exampleAwsIamRole.arn, * description: "SQS example", * integrationType: "AWS_PROXY", * integrationSubtype: "SQS-SendMessage", * requestParameters: { * QueueUrl: "$request.header.queueUrl", * MessageBody: "$request.body.message", * }, * }); * ``` * * ### Private Integration * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * const example = new aws.apigatewayv2.Integration("example", { * apiId: exampleAwsApigatewayv2Api.id, * credentialsArn: exampleAwsIamRole.arn, * description: "Example with a load balancer", * integrationType: "HTTP_PROXY", * integrationUri: exampleAwsLbListener.arn, * integrationMethod: "ANY", * connectionType: "VPC_LINK", * connectionId: exampleAwsApigatewayv2VpcLink.id, * tlsConfig: { * serverNameToVerify: "example.com", * }, * requestParameters: { * "append:header.authforintegration": "$context.authorizer.authorizerResponse", * "overwrite:path": "staticValueForIntegration", * }, * responseParameters: [ * { * statusCode: "403", * mappings: { * "append:header.auth": "$context.authorizer.authorizerResponse", * }, * }, * { * statusCode: "200", * mappings: { * "overwrite:statuscode": "204", * }, * }, * ], * }); * ``` * * ## Import * * Using `pulumi import`, import `aws_apigatewayv2_integration` using the API identifier and integration identifier. For example: * * ```sh * $ pulumi import aws:apigatewayv2/integration:Integration example aabbccddee/1122334 * ``` * -> __Note:__ The API Gateway managed integration 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 Integration extends pulumi.CustomResource { /** * Get an existing Integration 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 Integration(name, state, Object.assign(Object.assign({}, opts), { id: id })); } /** * Returns true if the given object is an instance of Integration. 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'] === Integration.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["apiId"] = state ? state.apiId : undefined; resourceInputs["connectionId"] = state ? state.connectionId : undefined; resourceInputs["connectionType"] = state ? state.connectionType : undefined; resourceInputs["contentHandlingStrategy"] = state ? state.contentHandlingStrategy : undefined; resourceInputs["credentialsArn"] = state ? state.credentialsArn : undefined; resourceInputs["description"] = state ? state.description : undefined; resourceInputs["integrationMethod"] = state ? state.integrationMethod : undefined; resourceInputs["integrationResponseSelectionExpression"] = state ? state.integrationResponseSelectionExpression : undefined; resourceInputs["integrationSubtype"] = state ? state.integrationSubtype : undefined; resourceInputs["integrationType"] = state ? state.integrationType : undefined; resourceInputs["integrationUri"] = state ? state.integrationUri : undefined; resourceInputs["passthroughBehavior"] = state ? state.passthroughBehavior : undefined; resourceInputs["payloadFormatVersion"] = state ? state.payloadFormatVersion : undefined; resourceInputs["region"] = state ? state.region : undefined; resourceInputs["requestParameters"] = state ? state.requestParameters : undefined; resourceInputs["requestTemplates"] = state ? state.requestTemplates : undefined; resourceInputs["responseParameters"] = state ? state.responseParameters : undefined; resourceInputs["templateSelectionExpression"] = state ? state.templateSelectionExpression : undefined; resourceInputs["timeoutMilliseconds"] = state ? state.timeoutMilliseconds : undefined; resourceInputs["tlsConfig"] = state ? state.tlsConfig : undefined; } else { const args = argsOrState; if ((!args || args.apiId === undefined) && !opts.urn) { throw new Error("Missing required property 'apiId'"); } if ((!args || args.integrationType === undefined) && !opts.urn) { throw new Error("Missing required property 'integrationType'"); } resourceInputs["apiId"] = args ? args.apiId : undefined; resourceInputs["connectionId"] = args ? args.connectionId : undefined; resourceInputs["connectionType"] = args ? args.connectionType : undefined; resourceInputs["contentHandlingStrategy"] = args ? args.contentHandlingStrategy : undefined; resourceInputs["credentialsArn"] = args ? args.credentialsArn : undefined; resourceInputs["description"] = args ? args.description : undefined; resourceInputs["integrationMethod"] = args ? args.integrationMethod : undefined; resourceInputs["integrationSubtype"] = args ? args.integrationSubtype : undefined; resourceInputs["integrationType"] = args ? args.integrationType : undefined; resourceInputs["integrationUri"] = args ? args.integrationUri : undefined; resourceInputs["passthroughBehavior"] = args ? args.passthroughBehavior : undefined; resourceInputs["payloadFormatVersion"] = args ? args.payloadFormatVersion : undefined; resourceInputs["region"] = args ? args.region : undefined; resourceInputs["requestParameters"] = args ? args.requestParameters : undefined; resourceInputs["requestTemplates"] = args ? args.requestTemplates : undefined; resourceInputs["responseParameters"] = args ? args.responseParameters : undefined; resourceInputs["templateSelectionExpression"] = args ? args.templateSelectionExpression : undefined; resourceInputs["timeoutMilliseconds"] = args ? args.timeoutMilliseconds : undefined; resourceInputs["tlsConfig"] = args ? args.tlsConfig : undefined; resourceInputs["integrationResponseSelectionExpression"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(Integration.__pulumiType, name, resourceInputs, opts); } } exports.Integration = Integration; /** @internal */ Integration.__pulumiType = 'aws:apigatewayv2/integration:Integration'; //# sourceMappingURL=integration.js.map