1. Packages
  2. AWS
  3. API Docs
  4. apigateway
  5. RequestValidator
AWS v6.60.0 published on Tuesday, Nov 19, 2024 by Pulumi

aws.apigateway.RequestValidator

Explore with Pulumi AI

aws logo
AWS v6.60.0 published on Tuesday, Nov 19, 2024 by Pulumi

    Manages an API Gateway Request Validator.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as aws from "@pulumi/aws";
    
    const example = new aws.apigateway.RequestValidator("example", {
        name: "example",
        restApi: exampleAwsApiGatewayRestApi.id,
        validateRequestBody: true,
        validateRequestParameters: true,
    });
    
    import pulumi
    import pulumi_aws as aws
    
    example = aws.apigateway.RequestValidator("example",
        name="example",
        rest_api=example_aws_api_gateway_rest_api["id"],
        validate_request_body=True,
        validate_request_parameters=True)
    
    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 {
    		_, err := apigateway.NewRequestValidator(ctx, "example", &apigateway.RequestValidatorArgs{
    			Name:                      pulumi.String("example"),
    			RestApi:                   pulumi.Any(exampleAwsApiGatewayRestApi.Id),
    			ValidateRequestBody:       pulumi.Bool(true),
    			ValidateRequestParameters: pulumi.Bool(true),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Aws = Pulumi.Aws;
    
    return await Deployment.RunAsync(() => 
    {
        var example = new Aws.ApiGateway.RequestValidator("example", new()
        {
            Name = "example",
            RestApi = exampleAwsApiGatewayRestApi.Id,
            ValidateRequestBody = true,
            ValidateRequestParameters = true,
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.aws.apigateway.RequestValidator;
    import com.pulumi.aws.apigateway.RequestValidatorArgs;
    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 example = new RequestValidator("example", RequestValidatorArgs.builder()
                .name("example")
                .restApi(exampleAwsApiGatewayRestApi.id())
                .validateRequestBody(true)
                .validateRequestParameters(true)
                .build());
    
        }
    }
    
    resources:
      example:
        type: aws:apigateway:RequestValidator
        properties:
          name: example
          restApi: ${exampleAwsApiGatewayRestApi.id}
          validateRequestBody: true
          validateRequestParameters: true
    

    Create RequestValidator Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new RequestValidator(name: string, args: RequestValidatorArgs, opts?: CustomResourceOptions);
    @overload
    def RequestValidator(resource_name: str,
                         args: RequestValidatorArgs,
                         opts: Optional[ResourceOptions] = None)
    
    @overload
    def RequestValidator(resource_name: str,
                         opts: Optional[ResourceOptions] = None,
                         rest_api: Optional[str] = None,
                         name: Optional[str] = None,
                         validate_request_body: Optional[bool] = None,
                         validate_request_parameters: Optional[bool] = None)
    func NewRequestValidator(ctx *Context, name string, args RequestValidatorArgs, opts ...ResourceOption) (*RequestValidator, error)
    public RequestValidator(string name, RequestValidatorArgs args, CustomResourceOptions? opts = null)
    public RequestValidator(String name, RequestValidatorArgs args)
    public RequestValidator(String name, RequestValidatorArgs args, CustomResourceOptions options)
    
    type: aws:apigateway:RequestValidator
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    

    Parameters

    name string
    The unique name of the resource.
    args RequestValidatorArgs
    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 RequestValidatorArgs
    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 RequestValidatorArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args RequestValidatorArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args RequestValidatorArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Constructor example

    The following reference example uses placeholder values for all input properties.

    var requestValidatorResource = new Aws.ApiGateway.RequestValidator("requestValidatorResource", new()
    {
        RestApi = "string",
        Name = "string",
        ValidateRequestBody = false,
        ValidateRequestParameters = false,
    });
    
    example, err := apigateway.NewRequestValidator(ctx, "requestValidatorResource", &apigateway.RequestValidatorArgs{
    	RestApi:                   pulumi.Any("string"),
    	Name:                      pulumi.String("string"),
    	ValidateRequestBody:       pulumi.Bool(false),
    	ValidateRequestParameters: pulumi.Bool(false),
    })
    
    var requestValidatorResource = new RequestValidator("requestValidatorResource", RequestValidatorArgs.builder()
        .restApi("string")
        .name("string")
        .validateRequestBody(false)
        .validateRequestParameters(false)
        .build());
    
    request_validator_resource = aws.apigateway.RequestValidator("requestValidatorResource",
        rest_api="string",
        name="string",
        validate_request_body=False,
        validate_request_parameters=False)
    
    const requestValidatorResource = new aws.apigateway.RequestValidator("requestValidatorResource", {
        restApi: "string",
        name: "string",
        validateRequestBody: false,
        validateRequestParameters: false,
    });
    
    type: aws:apigateway:RequestValidator
    properties:
        name: string
        restApi: string
        validateRequestBody: false
        validateRequestParameters: false
    

    RequestValidator Resource Properties

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

    Inputs

    In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

    The RequestValidator resource accepts the following input properties:

    RestApi string | string
    ID of the associated Rest API
    Name string
    Name of the request validator
    ValidateRequestBody bool
    Boolean whether to validate request body. Defaults to false.
    ValidateRequestParameters bool
    Boolean whether to validate request parameters. Defaults to false.
    RestApi string | string
    ID of the associated Rest API
    Name string
    Name of the request validator
    ValidateRequestBody bool
    Boolean whether to validate request body. Defaults to false.
    ValidateRequestParameters bool
    Boolean whether to validate request parameters. Defaults to false.
    restApi String | String
    ID of the associated Rest API
    name String
    Name of the request validator
    validateRequestBody Boolean
    Boolean whether to validate request body. Defaults to false.
    validateRequestParameters Boolean
    Boolean whether to validate request parameters. Defaults to false.
    restApi string | RestApi
    ID of the associated Rest API
    name string
    Name of the request validator
    validateRequestBody boolean
    Boolean whether to validate request body. Defaults to false.
    validateRequestParameters boolean
    Boolean whether to validate request parameters. Defaults to false.
    rest_api str | str
    ID of the associated Rest API
    name str
    Name of the request validator
    validate_request_body bool
    Boolean whether to validate request body. Defaults to false.
    validate_request_parameters bool
    Boolean whether to validate request parameters. Defaults to false.
    restApi String |
    ID of the associated Rest API
    name String
    Name of the request validator
    validateRequestBody Boolean
    Boolean whether to validate request body. Defaults to false.
    validateRequestParameters Boolean
    Boolean whether to validate request parameters. Defaults to false.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the RequestValidator 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 RequestValidator Resource

    Get an existing RequestValidator 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?: RequestValidatorState, opts?: CustomResourceOptions): RequestValidator
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            name: Optional[str] = None,
            rest_api: Optional[str] = None,
            validate_request_body: Optional[bool] = None,
            validate_request_parameters: Optional[bool] = None) -> RequestValidator
    func GetRequestValidator(ctx *Context, name string, id IDInput, state *RequestValidatorState, opts ...ResourceOption) (*RequestValidator, error)
    public static RequestValidator Get(string name, Input<string> id, RequestValidatorState? state, CustomResourceOptions? opts = null)
    public static RequestValidator get(String name, Output<String> id, RequestValidatorState 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.
    The following state arguments are supported:
    Name string
    Name of the request validator
    RestApi string | string
    ID of the associated Rest API
    ValidateRequestBody bool
    Boolean whether to validate request body. Defaults to false.
    ValidateRequestParameters bool
    Boolean whether to validate request parameters. Defaults to false.
    Name string
    Name of the request validator
    RestApi string | string
    ID of the associated Rest API
    ValidateRequestBody bool
    Boolean whether to validate request body. Defaults to false.
    ValidateRequestParameters bool
    Boolean whether to validate request parameters. Defaults to false.
    name String
    Name of the request validator
    restApi String | String
    ID of the associated Rest API
    validateRequestBody Boolean
    Boolean whether to validate request body. Defaults to false.
    validateRequestParameters Boolean
    Boolean whether to validate request parameters. Defaults to false.
    name string
    Name of the request validator
    restApi string | RestApi
    ID of the associated Rest API
    validateRequestBody boolean
    Boolean whether to validate request body. Defaults to false.
    validateRequestParameters boolean
    Boolean whether to validate request parameters. Defaults to false.
    name str
    Name of the request validator
    rest_api str | str
    ID of the associated Rest API
    validate_request_body bool
    Boolean whether to validate request body. Defaults to false.
    validate_request_parameters bool
    Boolean whether to validate request parameters. Defaults to false.
    name String
    Name of the request validator
    restApi String |
    ID of the associated Rest API
    validateRequestBody Boolean
    Boolean whether to validate request body. Defaults to false.
    validateRequestParameters Boolean
    Boolean whether to validate request parameters. Defaults to false.

    Import

    Using pulumi import, import aws_api_gateway_request_validator using REST-API-ID/REQUEST-VALIDATOR-ID. For example:

    $ pulumi import aws:apigateway/requestValidator:RequestValidator example 12345abcde/67890fghij
    

    To learn more about importing existing cloud resources, see Importing resources.

    Package Details

    Repository
    AWS Classic pulumi/pulumi-aws
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the aws Terraform Provider.
    aws logo
    AWS v6.60.0 published on Tuesday, Nov 19, 2024 by Pulumi