MethodResponse

Provides an HTTP Method Response for an API Gateway Resource.

Example Usage

using Pulumi;
using Aws = Pulumi.Aws;

class MyStack : Stack
{
    public MyStack()
    {
        var myDemoAPI = new Aws.ApiGateway.RestApi("myDemoAPI", new Aws.ApiGateway.RestApiArgs
        {
            Description = "This is my API for demonstration purposes",
        });
        var myDemoResource = new Aws.ApiGateway.Resource("myDemoResource", new Aws.ApiGateway.ResourceArgs
        {
            ParentId = myDemoAPI.RootResourceId,
            PathPart = "mydemoresource",
            RestApi = myDemoAPI.Id,
        });
        var myDemoMethod = new Aws.ApiGateway.Method("myDemoMethod", new Aws.ApiGateway.MethodArgs
        {
            Authorization = "NONE",
            HttpMethod = "GET",
            ResourceId = myDemoResource.Id,
            RestApi = myDemoAPI.Id,
        });
        var myDemoIntegration = new Aws.ApiGateway.Integration("myDemoIntegration", new Aws.ApiGateway.IntegrationArgs
        {
            HttpMethod = myDemoMethod.HttpMethod,
            ResourceId = myDemoResource.Id,
            RestApi = myDemoAPI.Id,
            Type = "MOCK",
        });
        var response200 = new Aws.ApiGateway.MethodResponse("response200", new Aws.ApiGateway.MethodResponseArgs
        {
            HttpMethod = myDemoMethod.HttpMethod,
            ResourceId = myDemoResource.Id,
            RestApi = myDemoAPI.Id,
            StatusCode = "200",
        });
    }

}
package main

import (
    "github.com/pulumi/pulumi-aws/sdk/v2/go/aws/apigateway"
    "github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)

func main() {
    pulumi.Run(func(ctx *pulumi.Context) error {
        myDemoAPI, err := apigateway.NewRestApi(ctx, "myDemoAPI", &apigateway.RestApiArgs{
            Description: pulumi.String("This is my API for demonstration purposes"),
        })
        if err != nil {
            return err
        }
        myDemoResource, err := apigateway.NewResource(ctx, "myDemoResource", &apigateway.ResourceArgs{
            ParentId: myDemoAPI.RootResourceId,
            PathPart: pulumi.String("mydemoresource"),
            RestApi:  myDemoAPI.ID(),
        })
        if err != nil {
            return err
        }
        myDemoMethod, err := apigateway.NewMethod(ctx, "myDemoMethod", &apigateway.MethodArgs{
            Authorization: pulumi.String("NONE"),
            HttpMethod:    pulumi.String("GET"),
            ResourceId:    myDemoResource.ID(),
            RestApi:       myDemoAPI.ID(),
        })
        if err != nil {
            return err
        }
        _, err = apigateway.NewIntegration(ctx, "myDemoIntegration", &apigateway.IntegrationArgs{
            HttpMethod: myDemoMethod.HttpMethod,
            ResourceId: myDemoResource.ID(),
            RestApi:    myDemoAPI.ID(),
            Type:       pulumi.String("MOCK"),
        })
        if err != nil {
            return err
        }
        _, err = apigateway.NewMethodResponse(ctx, "response200", &apigateway.MethodResponseArgs{
            HttpMethod: myDemoMethod.HttpMethod,
            ResourceId: myDemoResource.ID(),
            RestApi:    myDemoAPI.ID(),
            StatusCode: pulumi.String("200"),
        })
        if err != nil {
            return err
        }
        return nil
    })
}
import pulumi
import pulumi_aws as aws

my_demo_api = aws.apigateway.RestApi("myDemoAPI", description="This is my API for demonstration purposes")
my_demo_resource = aws.apigateway.Resource("myDemoResource",
    parent_id=my_demo_api.root_resource_id,
    path_part="mydemoresource",
    rest_api=my_demo_api.id)
my_demo_method = aws.apigateway.Method("myDemoMethod",
    authorization="NONE",
    http_method="GET",
    resource_id=my_demo_resource.id,
    rest_api=my_demo_api.id)
my_demo_integration = aws.apigateway.Integration("myDemoIntegration",
    http_method=my_demo_method.http_method,
    resource_id=my_demo_resource.id,
    rest_api=my_demo_api.id,
    type="MOCK")
response200 = aws.apigateway.MethodResponse("response200",
    http_method=my_demo_method.http_method,
    resource_id=my_demo_resource.id,
    rest_api=my_demo_api.id,
    status_code="200")
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const myDemoAPI = new aws.apigateway.RestApi("MyDemoAPI", {
    description: "This is my API for demonstration purposes",
});
const myDemoResource = new aws.apigateway.Resource("MyDemoResource", {
    parentId: myDemoAPI.rootResourceId,
    pathPart: "mydemoresource",
    restApi: myDemoAPI.id,
});
const myDemoMethod = new aws.apigateway.Method("MyDemoMethod", {
    authorization: "NONE",
    httpMethod: "GET",
    resourceId: myDemoResource.id,
    restApi: myDemoAPI.id,
});
const myDemoIntegration = new aws.apigateway.Integration("MyDemoIntegration", {
    httpMethod: myDemoMethod.httpMethod,
    resourceId: myDemoResource.id,
    restApi: myDemoAPI.id,
    type: "MOCK",
});
const response200 = new aws.apigateway.MethodResponse("response_200", {
    httpMethod: myDemoMethod.httpMethod,
    resourceId: myDemoResource.id,
    restApi: myDemoAPI.id,
    statusCode: "200",
});

Create a MethodResponse Resource

def MethodResponse(resource_name, opts=None, http_method=None, resource_id=None, response_models=None, response_parameters=None, rest_api=None, status_code=None, __props__=None);
name string
The unique name of the resource.
args MethodResponseArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name str
The unique name of the resource.
opts ResourceOptions
A bag of options that control this resource's behavior.
ctx Context
Context object for the current deployment.
name string
The unique name of the resource.
args MethodResponseArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args MethodResponseArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.

MethodResponse Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Programming Model docs.

Inputs

The MethodResponse resource accepts the following input properties:

HttpMethod string

The HTTP Method (GET, POST, PUT, DELETE, HEAD, OPTIONS, ANY)

ResourceId string

The API resource ID

RestApi string

The ID of the associated REST API

StatusCode string

The HTTP status code

ResponseModels Dictionary<string, string>

A map of the API models used for the response’s content type

ResponseParameters Dictionary<string, bool>

A map of response parameters that can be sent to the caller. For example: response_parameters = { "method.response.header.X-Some-Header" = true } would define that the header X-Some-Header can be provided on the response.

HttpMethod string

The HTTP Method (GET, POST, PUT, DELETE, HEAD, OPTIONS, ANY)

ResourceId string

The API resource ID

RestApi interface{}

The ID of the associated REST API

StatusCode string

The HTTP status code

ResponseModels map[string]string

A map of the API models used for the response’s content type

ResponseParameters map[string]bool

A map of response parameters that can be sent to the caller. For example: response_parameters = { "method.response.header.X-Some-Header" = true } would define that the header X-Some-Header can be provided on the response.

httpMethod string

The HTTP Method (GET, POST, PUT, DELETE, HEAD, OPTIONS, ANY)

resourceId string

The API resource ID

restApi string | RestApi

The ID of the associated REST API

statusCode string

The HTTP status code

responseModels {[key: string]: string}

A map of the API models used for the response’s content type

responseParameters {[key: string]: boolean}

A map of response parameters that can be sent to the caller. For example: response_parameters = { "method.response.header.X-Some-Header" = true } would define that the header X-Some-Header can be provided on the response.

http_method str

The HTTP Method (GET, POST, PUT, DELETE, HEAD, OPTIONS, ANY)

resource_id str

The API resource ID

rest_api string | str

The ID of the associated REST API

status_code str

The HTTP status code

response_models Dict[str, str]

A map of the API models used for the response’s content type

response_parameters Dict[str, Boolean]

A map of response parameters that can be sent to the caller. For example: response_parameters = { "method.response.header.X-Some-Header" = true } would define that the header X-Some-Header can be provided on the response.

Outputs

All input properties are implicitly available as output properties. Additionally, the MethodResponse resource produces the following output properties:

Id string
The provider-assigned unique ID for this managed resource.
Id string
The provider-assigned unique ID for this managed resource.
id string
The provider-assigned unique ID for this managed resource.
id str
The provider-assigned unique ID for this managed resource.

Look up an Existing MethodResponse Resource

Get an existing MethodResponse resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: MethodResponseState, opts?: CustomResourceOptions): MethodResponse
static get(resource_name, id, opts=None, http_method=None, resource_id=None, response_models=None, response_parameters=None, rest_api=None, status_code=None, __props__=None);
func GetMethodResponse(ctx *Context, name string, id IDInput, state *MethodResponseState, opts ...ResourceOption) (*MethodResponse, error)
public static MethodResponse Get(string name, Input<string> id, MethodResponseState? state, CustomResourceOptions? opts = null)
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.

The following state arguments are supported:

HttpMethod string

The HTTP Method (GET, POST, PUT, DELETE, HEAD, OPTIONS, ANY)

ResourceId string

The API resource ID

ResponseModels Dictionary<string, string>

A map of the API models used for the response’s content type

ResponseParameters Dictionary<string, bool>

A map of response parameters that can be sent to the caller. For example: response_parameters = { "method.response.header.X-Some-Header" = true } would define that the header X-Some-Header can be provided on the response.

RestApi string

The ID of the associated REST API

StatusCode string

The HTTP status code

HttpMethod string

The HTTP Method (GET, POST, PUT, DELETE, HEAD, OPTIONS, ANY)

ResourceId string

The API resource ID

ResponseModels map[string]string

A map of the API models used for the response’s content type

ResponseParameters map[string]bool

A map of response parameters that can be sent to the caller. For example: response_parameters = { "method.response.header.X-Some-Header" = true } would define that the header X-Some-Header can be provided on the response.

RestApi interface{}

The ID of the associated REST API

StatusCode string

The HTTP status code

httpMethod string

The HTTP Method (GET, POST, PUT, DELETE, HEAD, OPTIONS, ANY)

resourceId string

The API resource ID

responseModels {[key: string]: string}

A map of the API models used for the response’s content type

responseParameters {[key: string]: boolean}

A map of response parameters that can be sent to the caller. For example: response_parameters = { "method.response.header.X-Some-Header" = true } would define that the header X-Some-Header can be provided on the response.

restApi string | RestApi

The ID of the associated REST API

statusCode string

The HTTP status code

http_method str

The HTTP Method (GET, POST, PUT, DELETE, HEAD, OPTIONS, ANY)

resource_id str

The API resource ID

response_models Dict[str, str]

A map of the API models used for the response’s content type

response_parameters Dict[str, Boolean]

A map of response parameters that can be sent to the caller. For example: response_parameters = { "method.response.header.X-Some-Header" = true } would define that the header X-Some-Header can be provided on the response.

rest_api string | str

The ID of the associated REST API

status_code str

The HTTP status code

Package Details

Repository
https://github.com/pulumi/pulumi-aws
License
Apache-2.0
Notes
This Pulumi package is based on the aws Terraform Provider.