Skip to main content

aws_api_gateway_responses Resource

Use the aws_api_gateway_responses Chef InSpec audit resource to test properties of multiple AWS API Gateway gateway responses.

The AWS::ApiGateway::GatewayResponse resource creates a gateway response for your API.

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

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 a response exists.

describe aws_api_gateway_responses(rest_api_id: 'REST_API_ID') do
  it { should exist }
end

Parameters

rest_api_id (required)

The string identifier of the associated REST API.

Properties

response_type
The response type of the associated GatewayResponse.

Field: response_type

status_code
The HTTP status code for this GatewayResponse.

Field: status_code

response_parameters
Response parameters (paths, query strings and headers) of the GatewayResponse as a string-to-string map of key-value pairs.

Field: response_parameters

response_templates
Response templates of the GatewayResponse as a string-to-string map of key-value pairs.

Field: response_templates

default_response
A Boolean flag to indicate whether this GatewayResponse is the default gateway response (true ) or not (false ).

Field: default_response

Examples

Ensure a response type is DEFAULT_4XX.

describe aws_api_gateway_responses(rest_api_id: 'REST_API_ID') do
  its('response_types') { should include 'DEFAULT_4XX' }
end

Ensure a status code is 200.

describe aws_api_gateway_responses(rest_api_id: 'REST_API_ID') do
  its('status_codes') { should include '200' }
end

Matchers

For a full list of available matchers, see our Universal Matchers page.

This resource has the following special matchers.

exist

Use should to test that the entity exists.

describe aws_api_gateway_responses(rest_api_id: 'REST_API_ID') do
  it { should exist }
end

Use should_not to test the entity does not exist.

describe aws_api_gateway_responses(rest_api_id: 'REST_API_ID') do
  it { should_not exist }
end

AWS Permissions

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

Edit this page on GitHub

Thank you for your feedback!

×









Search Results