@pulumi/aws
Version:
A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.
246 lines (245 loc) • 11.4 kB
TypeScript
import * as pulumi from "@pulumi/pulumi";
import { RestApi } from "./index";
/**
* Provides an HTTP Method Response for an API Gateway Resource. More information about API Gateway method responses can be found in the [Amazon API Gateway Developer Guide](https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-method-settings-method-response.html).
*
* ## Example Usage
*
* ### Basic Response
*
* ```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",
* });
* ```
*
* ### Response with Custom Header and Model
*
* ```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 myDemoResponseModel = new aws.apigateway.Model("MyDemoResponseModel", {
* restApi: myDemoAPI.id,
* name: "MyDemoResponseModel",
* description: "API response for MyDemoMethod",
* contentType: "application/json",
* schema: JSON.stringify({
* $schema: "http://json-schema.org/draft-04/schema#",
* title: "MyDemoResponse",
* type: "object",
* properties: {
* Message: {
* type: "string",
* },
* },
* }),
* });
* const response200 = new aws.apigateway.MethodResponse("response_200", {
* restApi: myDemoAPI.id,
* resourceId: myDemoResource.id,
* httpMethod: myDemoMethod.httpMethod,
* statusCode: "200",
* responseModels: {
* "application/json": "MyDemoResponseModel",
* },
* responseParameters: {
* "method.response.header.Content-Type": false,
* "method-response-header.X-My-Demo-Header": false,
* },
* });
* ```
*
* ## Import
*
* Using `pulumi import`, import `aws_api_gateway_method_response` using `REST-API-ID/RESOURCE-ID/HTTP-METHOD/STATUS-CODE`. For example:
*
* ```sh
* $ pulumi import aws:apigateway/methodResponse:MethodResponse example 12345abcde/67890fghij/GET/200
* ```
*/
export declare class MethodResponse extends pulumi.CustomResource {
/**
* Get an existing MethodResponse 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: string, id: pulumi.Input<pulumi.ID>, state?: MethodResponseState, opts?: pulumi.CustomResourceOptions): MethodResponse;
/**
* Returns true if the given object is an instance of MethodResponse. This is designed to work even
* when multiple copies of the Pulumi SDK have been loaded into the same process.
*/
static isInstance(obj: any): obj is MethodResponse;
/**
* The HTTP verb of the method resource (`GET`, `POST`, `PUT`, `DELETE`, `HEAD`, `OPTIONS`, `ANY`).
*/
readonly httpMethod: pulumi.Output<string>;
/**
* Region where this resource will be [managed](https://docs.aws.amazon.com/general/latest/gr/rande.html#regional-endpoints). Defaults to the Region set in the provider configuration.
*/
readonly region: pulumi.Output<string>;
/**
* The Resource identifier for the method resource.
*/
readonly resourceId: pulumi.Output<string>;
/**
* A map specifying the model resources used for the response's content type. Response models are represented as a key/value map, with a content type as the key and a Model name as the value.
*/
readonly responseModels: pulumi.Output<{
[key: string]: string;
} | undefined>;
/**
* A map specifying required or optional response parameters that API Gateway can send back to the caller. A key defines a method response header name and the associated value is a boolean flag indicating whether the method response parameter is required. The method response header names must match the pattern of `method.response.header.{name}`, where `name` is a valid and unique header name.
*
* The response parameter names defined here are available in the integration response to be mapped from an integration response header expressed in `integration.response.header.{name}`, a static value enclosed within a pair of single quotes (e.g., '`application/json'`), or a JSON expression from the back-end response payload in the form of `integration.response.body.{JSON-expression}`, where `JSON-expression` is a valid JSON expression without the `$` prefix.)
*/
readonly responseParameters: pulumi.Output<{
[key: string]: boolean;
} | undefined>;
/**
* The string identifier of the associated REST API.
*/
readonly restApi: pulumi.Output<string>;
/**
* The method response's status code.
*/
readonly statusCode: pulumi.Output<string>;
/**
* Create a MethodResponse resource with the given unique name, arguments, and options.
*
* @param name The _unique_ name of the resource.
* @param args The arguments to use to populate this resource's properties.
* @param opts A bag of options that control this resource's behavior.
*/
constructor(name: string, args: MethodResponseArgs, opts?: pulumi.CustomResourceOptions);
}
/**
* Input properties used for looking up and filtering MethodResponse resources.
*/
export interface MethodResponseState {
/**
* The HTTP verb of the method resource (`GET`, `POST`, `PUT`, `DELETE`, `HEAD`, `OPTIONS`, `ANY`).
*/
httpMethod?: pulumi.Input<string>;
/**
* Region where this resource will be [managed](https://docs.aws.amazon.com/general/latest/gr/rande.html#regional-endpoints). Defaults to the Region set in the provider configuration.
*/
region?: pulumi.Input<string>;
/**
* The Resource identifier for the method resource.
*/
resourceId?: pulumi.Input<string>;
/**
* A map specifying the model resources used for the response's content type. Response models are represented as a key/value map, with a content type as the key and a Model name as the value.
*/
responseModels?: pulumi.Input<{
[key: string]: pulumi.Input<string>;
}>;
/**
* A map specifying required or optional response parameters that API Gateway can send back to the caller. A key defines a method response header name and the associated value is a boolean flag indicating whether the method response parameter is required. The method response header names must match the pattern of `method.response.header.{name}`, where `name` is a valid and unique header name.
*
* The response parameter names defined here are available in the integration response to be mapped from an integration response header expressed in `integration.response.header.{name}`, a static value enclosed within a pair of single quotes (e.g., '`application/json'`), or a JSON expression from the back-end response payload in the form of `integration.response.body.{JSON-expression}`, where `JSON-expression` is a valid JSON expression without the `$` prefix.)
*/
responseParameters?: pulumi.Input<{
[key: string]: pulumi.Input<boolean>;
}>;
/**
* The string identifier of the associated REST API.
*/
restApi?: pulumi.Input<string | RestApi>;
/**
* The method response's status code.
*/
statusCode?: pulumi.Input<string>;
}
/**
* The set of arguments for constructing a MethodResponse resource.
*/
export interface MethodResponseArgs {
/**
* The HTTP verb of the method resource (`GET`, `POST`, `PUT`, `DELETE`, `HEAD`, `OPTIONS`, `ANY`).
*/
httpMethod: pulumi.Input<string>;
/**
* Region where this resource will be [managed](https://docs.aws.amazon.com/general/latest/gr/rande.html#regional-endpoints). Defaults to the Region set in the provider configuration.
*/
region?: pulumi.Input<string>;
/**
* The Resource identifier for the method resource.
*/
resourceId: pulumi.Input<string>;
/**
* A map specifying the model resources used for the response's content type. Response models are represented as a key/value map, with a content type as the key and a Model name as the value.
*/
responseModels?: pulumi.Input<{
[key: string]: pulumi.Input<string>;
}>;
/**
* A map specifying required or optional response parameters that API Gateway can send back to the caller. A key defines a method response header name and the associated value is a boolean flag indicating whether the method response parameter is required. The method response header names must match the pattern of `method.response.header.{name}`, where `name` is a valid and unique header name.
*
* The response parameter names defined here are available in the integration response to be mapped from an integration response header expressed in `integration.response.header.{name}`, a static value enclosed within a pair of single quotes (e.g., '`application/json'`), or a JSON expression from the back-end response payload in the form of `integration.response.body.{JSON-expression}`, where `JSON-expression` is a valid JSON expression without the `$` prefix.)
*/
responseParameters?: pulumi.Input<{
[key: string]: pulumi.Input<boolean>;
}>;
/**
* The string identifier of the associated REST API.
*/
restApi: pulumi.Input<string | RestApi>;
/**
* The method response's status code.
*/
statusCode: pulumi.Input<string>;
}