UNPKG

@pulumi/aws

Version:

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

140 lines 5.93 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.IntegrationResponse = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("../utilities"); /** * Provides an HTTP Method Integration Response for an API Gateway Resource. * * > **Note:** Depends on having `aws.apigateway.Integration` inside your rest api. To ensure this * you might need to add an explicit `dependsOn` for clean runs. * * ## Example Usage * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * const myDemoAPI = new aws.apigateway.RestApi("MyDemoAPI", { * name: "MyDemoAPI", * description: "This is my API for demonstration purposes", * }); * const myDemoResource = new aws.apigateway.Resource("MyDemoResource", { * restApi: myDemoAPI.id, * parentId: myDemoAPI.rootResourceId, * pathPart: "mydemoresource", * }); * const myDemoMethod = new aws.apigateway.Method("MyDemoMethod", { * restApi: myDemoAPI.id, * resourceId: myDemoResource.id, * httpMethod: "GET", * authorization: "NONE", * }); * const myDemoIntegration = new aws.apigateway.Integration("MyDemoIntegration", { * restApi: myDemoAPI.id, * resourceId: myDemoResource.id, * httpMethod: myDemoMethod.httpMethod, * type: "MOCK", * }); * const response200 = new aws.apigateway.MethodResponse("response_200", { * restApi: myDemoAPI.id, * resourceId: myDemoResource.id, * httpMethod: myDemoMethod.httpMethod, * statusCode: "200", * }); * const myDemoIntegrationResponse = new aws.apigateway.IntegrationResponse("MyDemoIntegrationResponse", { * restApi: myDemoAPI.id, * resourceId: myDemoResource.id, * httpMethod: myDemoMethod.httpMethod, * statusCode: response200.statusCode, * responseTemplates: { * "application/xml": `#set(inputRoot = input.path('')) * <?xml version=\\"1.0\\" encoding=\\"UTF-8\\"?> * <message> * inputRoot.body * </message> * `, * }, * }); * ``` * * ## Import * * Using `pulumi import`, import `aws_api_gateway_integration_response` using `REST-API-ID/RESOURCE-ID/HTTP-METHOD/STATUS-CODE`. For example: * * ```sh * $ pulumi import aws:apigateway/integrationResponse:IntegrationResponse example 12345abcde/67890fghij/GET/200 * ``` */ class IntegrationResponse extends pulumi.CustomResource { /** * Get an existing IntegrationResponse 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 IntegrationResponse(name, state, { ...opts, id: id }); } /** * Returns true if the given object is an instance of IntegrationResponse. 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'] === IntegrationResponse.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["contentHandling"] = state?.contentHandling; resourceInputs["httpMethod"] = state?.httpMethod; resourceInputs["region"] = state?.region; resourceInputs["resourceId"] = state?.resourceId; resourceInputs["responseParameters"] = state?.responseParameters; resourceInputs["responseTemplates"] = state?.responseTemplates; resourceInputs["restApi"] = state?.restApi; resourceInputs["selectionPattern"] = state?.selectionPattern; resourceInputs["statusCode"] = state?.statusCode; } else { const args = argsOrState; if (args?.httpMethod === undefined && !opts.urn) { throw new Error("Missing required property 'httpMethod'"); } if (args?.resourceId === undefined && !opts.urn) { throw new Error("Missing required property 'resourceId'"); } if (args?.restApi === undefined && !opts.urn) { throw new Error("Missing required property 'restApi'"); } if (args?.statusCode === undefined && !opts.urn) { throw new Error("Missing required property 'statusCode'"); } resourceInputs["contentHandling"] = args?.contentHandling; resourceInputs["httpMethod"] = args?.httpMethod; resourceInputs["region"] = args?.region; resourceInputs["resourceId"] = args?.resourceId; resourceInputs["responseParameters"] = args?.responseParameters; resourceInputs["responseTemplates"] = args?.responseTemplates; resourceInputs["restApi"] = args?.restApi; resourceInputs["selectionPattern"] = args?.selectionPattern; resourceInputs["statusCode"] = args?.statusCode; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(IntegrationResponse.__pulumiType, name, resourceInputs, opts); } } exports.IntegrationResponse = IntegrationResponse; /** @internal */ IntegrationResponse.__pulumiType = 'aws:apigateway/integrationResponse:IntegrationResponse'; //# sourceMappingURL=integrationResponse.js.map