@pulumi/aws
Version:
A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.
140 lines • 6.33 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.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, Object.assign(Object.assign({}, 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 ? state.contentHandling : undefined;
resourceInputs["httpMethod"] = state ? state.httpMethod : undefined;
resourceInputs["region"] = state ? state.region : undefined;
resourceInputs["resourceId"] = state ? state.resourceId : undefined;
resourceInputs["responseParameters"] = state ? state.responseParameters : undefined;
resourceInputs["responseTemplates"] = state ? state.responseTemplates : undefined;
resourceInputs["restApi"] = state ? state.restApi : undefined;
resourceInputs["selectionPattern"] = state ? state.selectionPattern : undefined;
resourceInputs["statusCode"] = state ? state.statusCode : undefined;
}
else {
const args = argsOrState;
if ((!args || args.httpMethod === undefined) && !opts.urn) {
throw new Error("Missing required property 'httpMethod'");
}
if ((!args || args.resourceId === undefined) && !opts.urn) {
throw new Error("Missing required property 'resourceId'");
}
if ((!args || args.restApi === undefined) && !opts.urn) {
throw new Error("Missing required property 'restApi'");
}
if ((!args || args.statusCode === undefined) && !opts.urn) {
throw new Error("Missing required property 'statusCode'");
}
resourceInputs["contentHandling"] = args ? args.contentHandling : undefined;
resourceInputs["httpMethod"] = args ? args.httpMethod : undefined;
resourceInputs["region"] = args ? args.region : undefined;
resourceInputs["resourceId"] = args ? args.resourceId : undefined;
resourceInputs["responseParameters"] = args ? args.responseParameters : undefined;
resourceInputs["responseTemplates"] = args ? args.responseTemplates : undefined;
resourceInputs["restApi"] = args ? args.restApi : undefined;
resourceInputs["selectionPattern"] = args ? args.selectionPattern : undefined;
resourceInputs["statusCode"] = args ? args.statusCode : undefined;
}
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