Try AWS Native preview for resources not in the classic version.
aws.apigateway.MethodResponse
Explore with Pulumi AI
Try AWS Native preview for resources not in the classic version.
Provides an HTTP Method Response for an API Gateway Resource.
Example Usage
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var myDemoAPI = new Aws.ApiGateway.RestApi("myDemoAPI", new()
{
Description = "This is my API for demonstration purposes",
});
var myDemoResource = new Aws.ApiGateway.Resource("myDemoResource", new()
{
RestApi = myDemoAPI.Id,
ParentId = myDemoAPI.RootResourceId,
PathPart = "mydemoresource",
});
var myDemoMethod = new Aws.ApiGateway.Method("myDemoMethod", new()
{
RestApi = myDemoAPI.Id,
ResourceId = myDemoResource.Id,
HttpMethod = "GET",
Authorization = "NONE",
});
var myDemoIntegration = new Aws.ApiGateway.Integration("myDemoIntegration", new()
{
RestApi = myDemoAPI.Id,
ResourceId = myDemoResource.Id,
HttpMethod = myDemoMethod.HttpMethod,
Type = "MOCK",
});
var response200 = new Aws.ApiGateway.MethodResponse("response200", new()
{
RestApi = myDemoAPI.Id,
ResourceId = myDemoResource.Id,
HttpMethod = myDemoMethod.HttpMethod,
StatusCode = "200",
});
});
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/apigateway"
"github.com/pulumi/pulumi/sdk/v3/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{
RestApi: myDemoAPI.ID(),
ParentId: myDemoAPI.RootResourceId,
PathPart: pulumi.String("mydemoresource"),
})
if err != nil {
return err
}
myDemoMethod, err := apigateway.NewMethod(ctx, "myDemoMethod", &apigateway.MethodArgs{
RestApi: myDemoAPI.ID(),
ResourceId: myDemoResource.ID(),
HttpMethod: pulumi.String("GET"),
Authorization: pulumi.String("NONE"),
})
if err != nil {
return err
}
_, err = apigateway.NewIntegration(ctx, "myDemoIntegration", &apigateway.IntegrationArgs{
RestApi: myDemoAPI.ID(),
ResourceId: myDemoResource.ID(),
HttpMethod: myDemoMethod.HttpMethod,
Type: pulumi.String("MOCK"),
})
if err != nil {
return err
}
_, err = apigateway.NewMethodResponse(ctx, "response200", &apigateway.MethodResponseArgs{
RestApi: myDemoAPI.ID(),
ResourceId: myDemoResource.ID(),
HttpMethod: myDemoMethod.HttpMethod,
StatusCode: pulumi.String("200"),
})
if err != nil {
return err
}
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.apigateway.RestApi;
import com.pulumi.aws.apigateway.RestApiArgs;
import com.pulumi.aws.apigateway.Resource;
import com.pulumi.aws.apigateway.ResourceArgs;
import com.pulumi.aws.apigateway.Method;
import com.pulumi.aws.apigateway.MethodArgs;
import com.pulumi.aws.apigateway.Integration;
import com.pulumi.aws.apigateway.IntegrationArgs;
import com.pulumi.aws.apigateway.MethodResponse;
import com.pulumi.aws.apigateway.MethodResponseArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var myDemoAPI = new RestApi("myDemoAPI", RestApiArgs.builder()
.description("This is my API for demonstration purposes")
.build());
var myDemoResource = new Resource("myDemoResource", ResourceArgs.builder()
.restApi(myDemoAPI.id())
.parentId(myDemoAPI.rootResourceId())
.pathPart("mydemoresource")
.build());
var myDemoMethod = new Method("myDemoMethod", MethodArgs.builder()
.restApi(myDemoAPI.id())
.resourceId(myDemoResource.id())
.httpMethod("GET")
.authorization("NONE")
.build());
var myDemoIntegration = new Integration("myDemoIntegration", IntegrationArgs.builder()
.restApi(myDemoAPI.id())
.resourceId(myDemoResource.id())
.httpMethod(myDemoMethod.httpMethod())
.type("MOCK")
.build());
var response200 = new MethodResponse("response200", MethodResponseArgs.builder()
.restApi(myDemoAPI.id())
.resourceId(myDemoResource.id())
.httpMethod(myDemoMethod.httpMethod())
.statusCode("200")
.build());
}
}
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",
rest_api=my_demo_api.id,
parent_id=my_demo_api.root_resource_id,
path_part="mydemoresource")
my_demo_method = aws.apigateway.Method("myDemoMethod",
rest_api=my_demo_api.id,
resource_id=my_demo_resource.id,
http_method="GET",
authorization="NONE")
my_demo_integration = aws.apigateway.Integration("myDemoIntegration",
rest_api=my_demo_api.id,
resource_id=my_demo_resource.id,
http_method=my_demo_method.http_method,
type="MOCK")
response200 = aws.apigateway.MethodResponse("response200",
rest_api=my_demo_api.id,
resource_id=my_demo_resource.id,
http_method=my_demo_method.http_method,
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", {
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("response200", {
restApi: myDemoAPI.id,
resourceId: myDemoResource.id,
httpMethod: myDemoMethod.httpMethod,
statusCode: "200",
});
resources:
myDemoAPI:
type: aws:apigateway:RestApi
properties:
description: This is my API for demonstration purposes
myDemoResource:
type: aws:apigateway:Resource
properties:
restApi: ${myDemoAPI.id}
parentId: ${myDemoAPI.rootResourceId}
pathPart: mydemoresource
myDemoMethod:
type: aws:apigateway:Method
properties:
restApi: ${myDemoAPI.id}
resourceId: ${myDemoResource.id}
httpMethod: GET
authorization: NONE
myDemoIntegration:
type: aws:apigateway:Integration
properties:
restApi: ${myDemoAPI.id}
resourceId: ${myDemoResource.id}
httpMethod: ${myDemoMethod.httpMethod}
type: MOCK
response200:
type: aws:apigateway:MethodResponse
properties:
restApi: ${myDemoAPI.id}
resourceId: ${myDemoResource.id}
httpMethod: ${myDemoMethod.httpMethod}
statusCode: '200'
Create MethodResponse Resource
new MethodResponse(name: string, args: MethodResponseArgs, opts?: CustomResourceOptions);
@overload
def MethodResponse(resource_name: str,
opts: Optional[ResourceOptions] = None,
http_method: Optional[str] = None,
resource_id: Optional[str] = None,
response_models: Optional[Mapping[str, str]] = None,
response_parameters: Optional[Mapping[str, bool]] = None,
rest_api: Optional[str] = None,
status_code: Optional[str] = None)
@overload
def MethodResponse(resource_name: str,
args: MethodResponseArgs,
opts: Optional[ResourceOptions] = None)
func NewMethodResponse(ctx *Context, name string, args MethodResponseArgs, opts ...ResourceOption) (*MethodResponse, error)
public MethodResponse(string name, MethodResponseArgs args, CustomResourceOptions? opts = null)
public MethodResponse(String name, MethodResponseArgs args)
public MethodResponse(String name, MethodResponseArgs args, CustomResourceOptions options)
type: aws:apigateway:MethodResponse
properties: # The arguments to resource properties.
options: # 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.
- resource_name str
- The unique name of the resource.
- args MethodResponseArgs
- The arguments to resource properties.
- opts ResourceOptions
- Bag of options to control 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.
- name String
- The unique name of the resource.
- args MethodResponseArgs
- The arguments to resource properties.
- options 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 Architecture and Concepts docs.
Inputs
The MethodResponse resource accepts the following input properties:
- Http
Method string HTTP Method (
GET
,POST
,PUT
,DELETE
,HEAD
,OPTIONS
,ANY
)- Resource
Id string API resource ID
- Rest
Api string | string ID of the associated REST API
- Status
Code string HTTP status code
- Response
Models Dictionary<string, string> Map of the API models used for the response's content type
- Response
Parameters Dictionary<string, bool> 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 headerX-Some-Header
can be provided on the response.
- Http
Method string HTTP Method (
GET
,POST
,PUT
,DELETE
,HEAD
,OPTIONS
,ANY
)- Resource
Id string API resource ID
- Rest
Api string | string ID of the associated REST API
- Status
Code string HTTP status code
- Response
Models map[string]string Map of the API models used for the response's content type
- Response
Parameters map[string]bool 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 headerX-Some-Header
can be provided on the response.
- http
Method String HTTP Method (
GET
,POST
,PUT
,DELETE
,HEAD
,OPTIONS
,ANY
)- resource
Id String API resource ID
- rest
Api String | String ID of the associated REST API
- status
Code String HTTP status code
- response
Models Map<String,String> Map of the API models used for the response's content type
- response
Parameters Map<String,Boolean> 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 headerX-Some-Header
can be provided on the response.
- http
Method string HTTP Method (
GET
,POST
,PUT
,DELETE
,HEAD
,OPTIONS
,ANY
)- resource
Id string API resource ID
- rest
Api string | RestApi ID of the associated REST API
- status
Code string HTTP status code
- response
Models {[key: string]: string} Map of the API models used for the response's content type
- response
Parameters {[key: string]: boolean} 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 headerX-Some-Header
can be provided on the response.
- http_
method str HTTP Method (
GET
,POST
,PUT
,DELETE
,HEAD
,OPTIONS
,ANY
)- resource_
id str API resource ID
- rest_
api str | str ID of the associated REST API
- status_
code str HTTP status code
- response_
models Mapping[str, str] Map of the API models used for the response's content type
- response_
parameters Mapping[str, bool] 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 headerX-Some-Header
can be provided on the response.
- http
Method String HTTP Method (
GET
,POST
,PUT
,DELETE
,HEAD
,OPTIONS
,ANY
)- resource
Id String API resource ID
- rest
Api String | ID of the associated REST API
- status
Code String HTTP status code
- response
Models Map<String> Map of the API models used for the response's content type
- response
Parameters Map<Boolean> 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 headerX-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 string
The provider-assigned unique ID for this managed resource.
- id str
The provider-assigned unique ID for this managed resource.
- id String
The provider-assigned unique ID for this managed resource.
Look up 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
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
http_method: Optional[str] = None,
resource_id: Optional[str] = None,
response_models: Optional[Mapping[str, str]] = None,
response_parameters: Optional[Mapping[str, bool]] = None,
rest_api: Optional[str] = None,
status_code: Optional[str] = None) -> MethodResponse
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)
public static MethodResponse get(String name, Output<String> id, MethodResponseState state, CustomResourceOptions options)
Resource lookup is not supported in YAML
- 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.
- 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.
- Http
Method string HTTP Method (
GET
,POST
,PUT
,DELETE
,HEAD
,OPTIONS
,ANY
)- Resource
Id string API resource ID
- Response
Models Dictionary<string, string> Map of the API models used for the response's content type
- Response
Parameters Dictionary<string, bool> 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 headerX-Some-Header
can be provided on the response.- Rest
Api string | string ID of the associated REST API
- Status
Code string HTTP status code
- Http
Method string HTTP Method (
GET
,POST
,PUT
,DELETE
,HEAD
,OPTIONS
,ANY
)- Resource
Id string API resource ID
- Response
Models map[string]string Map of the API models used for the response's content type
- Response
Parameters map[string]bool 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 headerX-Some-Header
can be provided on the response.- Rest
Api string | string ID of the associated REST API
- Status
Code string HTTP status code
- http
Method String HTTP Method (
GET
,POST
,PUT
,DELETE
,HEAD
,OPTIONS
,ANY
)- resource
Id String API resource ID
- response
Models Map<String,String> Map of the API models used for the response's content type
- response
Parameters Map<String,Boolean> 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 headerX-Some-Header
can be provided on the response.- rest
Api String | String ID of the associated REST API
- status
Code String HTTP status code
- http
Method string HTTP Method (
GET
,POST
,PUT
,DELETE
,HEAD
,OPTIONS
,ANY
)- resource
Id string API resource ID
- response
Models {[key: string]: string} Map of the API models used for the response's content type
- response
Parameters {[key: string]: boolean} 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 headerX-Some-Header
can be provided on the response.- rest
Api string | RestApi ID of the associated REST API
- status
Code string HTTP status code
- http_
method str HTTP Method (
GET
,POST
,PUT
,DELETE
,HEAD
,OPTIONS
,ANY
)- resource_
id str API resource ID
- response_
models Mapping[str, str] Map of the API models used for the response's content type
- response_
parameters Mapping[str, bool] 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 headerX-Some-Header
can be provided on the response.- rest_
api str | str ID of the associated REST API
- status_
code str HTTP status code
- http
Method String HTTP Method (
GET
,POST
,PUT
,DELETE
,HEAD
,OPTIONS
,ANY
)- resource
Id String API resource ID
- response
Models Map<String> Map of the API models used for the response's content type
- response
Parameters Map<Boolean> 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 headerX-Some-Header
can be provided on the response.- rest
Api String | ID of the associated REST API
- status
Code String HTTP status code
Import
Using pulumi import
, import aws_api_gateway_method_response
using REST-API-ID/RESOURCE-ID/HTTP-METHOD/STATUS-CODE
. For example:
$ pulumi import aws:apigateway/methodResponse:MethodResponse example 12345abcde/67890fghij/GET/200
Package Details
- Repository
- AWS Classic pulumi/pulumi-aws
- License
- Apache-2.0
- Notes
This Pulumi package is based on the
aws
Terraform Provider.
Try AWS Native preview for resources not in the classic version.