Skip to main content

aws_api_gateway_request_validators Resource

Use the aws_api_gateway_request_validators Chef InSpec audit resource to the test properties of multiple AWS API Gateway request validators.

The AWS::ApiGateway::RequestValidator resource sets up basic validation rules for incoming requests to your API.

For additional information, including details on parameters and properties, see the AWS APIGateway RequestValidator documentation.

Install

This resource is available in the Chef InSpec AWS resource pack.

For information on configuring your AWS environment for Chef InSpec and creating an InSpec profile that uses the InSpec AWS resource pack, see the Chef InSpec documentation on the AWS cloud platform.

Syntax

Ensure that an API Gateway request validator exists.

describe aws_api_gateway_request_validators(rest_api_id: 'API_ID') do
  it { should exist }
end

Parameters

rest_api_id (required)

The string identifier of the associated RestApi.

Properties

id
The identifier of this RequestValidator.

Field: id

name
The name of this RequestValidator.

Field: name

validate_request_body
A Boolean flag to indicate whether to validate a request body according to the configured model schema.

Field: validate_request_body

validate_request_parameters
A Boolean flag to indicate whether to validate request parameters (true) or not (false).

Field: validate_request_parameters

Examples

Test to ensure a request validator ID is present

describe aws_api_gateway_request_validators(rest_api_id: 'API_ID') do
  its('ids') { should include 'REQUEST_ID' }
end

Test to ensure the request body is ’true'

describe aws_api_gateway_request_validators(rest_api_id: 'API_ID') do
    its('validate_request_bodies') { should include true }
end

Matchers

This InSpec audit resource has the following special matchers. For a full list of available matchers, please visit our Universal Matchers page.

The control passes if the get method returns at least one result.

exist

Use should to test that the entity exists.

describe aws_api_gateway_method(rest_api_id: 'API_ID', resource_id: 'RESOURCE_ID', http_method: 'HTTP') do
  it { should exist }
end

Use should_not to test the entity does not exist.

describe aws_api_gateway_method(rest_api_id: 'API_ID', resource_id: 'RESOURCE_ID', http_method: 'HTTP') do
  it { should_not exist }
end

be_available

Use should to check if the work_group name is available.

describe aws_api_gateway_method(rest_api_id: 'API_ID', resource_id: 'RESOURCE_ID', http_method: 'HTTP') do
  it { should be_available }
end

AWS Permissions

Your Principal will need the APIGateway:Client:RequestValidators action with Effect set to Allow.

Edit this page on GitHub

Thank you for your feedback!

×










Search Results