Response
Provides an API Gateway Gateway Response for a REST API Gateway.
Example Usage
using Pulumi;
using Aws = Pulumi.Aws;
class MyStack : Stack
{
public MyStack()
{
var main = new Aws.ApiGateway.RestApi("main", new Aws.ApiGateway.RestApiArgs
{
});
var test = new Aws.ApiGateway.Response("test", new Aws.ApiGateway.ResponseArgs
{
ResponseParameters =
{
{ "gatewayresponse.header.Authorization", "'Basic'" },
},
ResponseTemplates =
{
{ "application/json", "{'message':$context.error.messageString}" },
},
ResponseType = "UNAUTHORIZED",
RestApiId = main.Id,
StatusCode = "401",
});
}
}
package main
import (
"fmt"
"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 {
main, err := apigateway.NewRestApi(ctx, "main", nil)
if err != nil {
return err
}
_, err = apigateway.NewResponse(ctx, "test", &apigateway.ResponseArgs{
ResponseParameters: pulumi.StringMap{
"gatewayresponse.header.Authorization": pulumi.String("'Basic'"),
},
ResponseTemplates: pulumi.StringMap{
"application/json": pulumi.String(fmt.Sprintf("%v%v%v", "{'message':", "$", "context.error.messageString}")),
},
ResponseType: pulumi.String("UNAUTHORIZED"),
RestApiId: main.ID(),
StatusCode: pulumi.String("401"),
})
if err != nil {
return err
}
return nil
})
}import pulumi
import pulumi_aws as aws
main = aws.apigateway.RestApi("main")
test = aws.apigateway.Response("test",
response_parameters={
"gatewayresponse.header.Authorization": "'Basic'",
},
response_templates={
"application/json": "{'message':$context.error.messageString}",
},
response_type="UNAUTHORIZED",
rest_api_id=main.id,
status_code="401")import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const main = new aws.apigateway.RestApi("main", {});
const test = new aws.apigateway.Response("test", {
responseParameters: {
"gatewayresponse.header.Authorization": "'Basic'",
},
responseTemplates: {
"application/json": "{'message':$context.error.messageString}",
},
responseType: "UNAUTHORIZED",
restApiId: main.id,
statusCode: "401",
});Create a Response Resource
new Response(name: string, args: ResponseArgs, opts?: CustomResourceOptions);def Response(resource_name, opts=None, response_parameters=None, response_templates=None, response_type=None, rest_api_id=None, status_code=None, __props__=None);func NewResponse(ctx *Context, name string, args ResponseArgs, opts ...ResourceOption) (*Response, error)public Response(string name, ResponseArgs args, CustomResourceOptions? opts = null)- name string
- The unique name of the resource.
- args ResponseArgs
- 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 ResponseArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args ResponseArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
Response Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Programming Model docs.
Inputs
The Response resource accepts the following input properties:
- Response
Type string The response type of the associated GatewayResponse.
- Rest
Api stringId The string identifier of the associated REST API.
- Response
Parameters Dictionary<string, string> A map specifying the parameters (paths, query strings and headers) of the Gateway Response.
- Response
Templates Dictionary<string, string> A map specifying the templates used to transform the response body.
- Status
Code string The HTTP status code of the Gateway Response.
- Response
Type string The response type of the associated GatewayResponse.
- Rest
Api stringId The string identifier of the associated REST API.
- Response
Parameters map[string]string A map specifying the parameters (paths, query strings and headers) of the Gateway Response.
- Response
Templates map[string]string A map specifying the templates used to transform the response body.
- Status
Code string The HTTP status code of the Gateway Response.
- response
Type string The response type of the associated GatewayResponse.
- rest
Api stringId The string identifier of the associated REST API.
- response
Parameters {[key: string]: string} A map specifying the parameters (paths, query strings and headers) of the Gateway Response.
- response
Templates {[key: string]: string} A map specifying the templates used to transform the response body.
- status
Code string The HTTP status code of the Gateway Response.
- response_
type str The response type of the associated GatewayResponse.
- rest_
api_ strid The string identifier of the associated REST API.
- response_
parameters Dict[str, str] A map specifying the parameters (paths, query strings and headers) of the Gateway Response.
- response_
templates Dict[str, str] A map specifying the templates used to transform the response body.
- status_
code str The HTTP status code of the Gateway Response.
Outputs
All input properties are implicitly available as output properties. Additionally, the Response resource produces the following output properties:
Look up an Existing Response Resource
Get an existing Response 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?: ResponseState, opts?: CustomResourceOptions): Responsestatic get(resource_name, id, opts=None, response_parameters=None, response_templates=None, response_type=None, rest_api_id=None, status_code=None, __props__=None);func GetResponse(ctx *Context, name string, id IDInput, state *ResponseState, opts ...ResourceOption) (*Response, error)public static Response Get(string name, Input<string> id, ResponseState? 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:
- Response
Parameters Dictionary<string, string> A map specifying the parameters (paths, query strings and headers) of the Gateway Response.
- Response
Templates Dictionary<string, string> A map specifying the templates used to transform the response body.
- Response
Type string The response type of the associated GatewayResponse.
- Rest
Api stringId The string identifier of the associated REST API.
- Status
Code string The HTTP status code of the Gateway Response.
- Response
Parameters map[string]string A map specifying the parameters (paths, query strings and headers) of the Gateway Response.
- Response
Templates map[string]string A map specifying the templates used to transform the response body.
- Response
Type string The response type of the associated GatewayResponse.
- Rest
Api stringId The string identifier of the associated REST API.
- Status
Code string The HTTP status code of the Gateway Response.
- response
Parameters {[key: string]: string} A map specifying the parameters (paths, query strings and headers) of the Gateway Response.
- response
Templates {[key: string]: string} A map specifying the templates used to transform the response body.
- response
Type string The response type of the associated GatewayResponse.
- rest
Api stringId The string identifier of the associated REST API.
- status
Code string The HTTP status code of the Gateway Response.
- response_
parameters Dict[str, str] A map specifying the parameters (paths, query strings and headers) of the Gateway Response.
- response_
templates Dict[str, str] A map specifying the templates used to transform the response body.
- response_
type str The response type of the associated GatewayResponse.
- rest_
api_ strid The string identifier of the associated REST API.
- status_
code str The HTTP status code of the Gateway Response.
Package Details
- Repository
- https://github.com/pulumi/pulumi-aws
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
awsTerraform Provider.