Skip to main content

aws_api_gateway_v2_api_mapping resource

Use the aws_api_gateway_v2_api_mapping InSpec audit resource to test the properties of a specific AWS API Gateway V2 API mapping.

For additional information, including parameters and properties, see the AWS documentation on AWS APIGatewayV2 ApiMapping.

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 mapping exists.

describe aws_api_gateway_v2_api_mapping(api_mapping_id: 'API_MAPPING_ID', domain_name: 'DOMAIN_NAME') do
  it { should exist }
end

Parameters

api_mapping_id (required)
The API mapping identifier.
domain_name (required)
The domain name.

Properties

api_id
The API identifier.
api_mapping_id
The API mapping identifier.
api_mapping_key
The API mapping key.
stage
The API stage.

Examples

Test to ensure an API ID is available

describe aws_api_gateway_v2_api_mapping(api_mapping_id: 'API_MAPPING_ID', domain_name: 'DOMAIN_NAME') do
  its('api_id') { should eq 'REST_API_ID' }
end

Test to ensure an API mapping ID is available

describe aws_api_gateway_v2_api_mapping(api_mapping_id: 'API_MAPPING_ID', domain_name: 'DOMAIN_NAME') do
  its('api_mapping_id') { should eq 'API_MAPPING_ID' }
end

Test to ensure an API mapping key is available

describe aws_api_gateway_v2_api_mapping(api_mapping_id: 'API_MAPPING_ID', domain_name: 'DOMAIN_NAME') do
  its('api_mapping_key') { should eq 'API_MAPPING_KEY' }
end

Test to ensure an API mapping stage is available

describe aws_api_gateway_v2_api_mapping(api_mapping_id: 'API_MAPPING_ID', domain_name: 'DOMAIN_NAME') do
  its('stage') { should eq 'API_STAGE_NAME' }
end

Matchers

For a full list of available matchers, see 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_v2_api_mapping(api_mapping_id: 'API_MAPPING_ID', domain_name: 'DOMAIN_NAME') do
  it { should exist }
end

Use should_not to test that the entity does not exist.

describe aws_api_gateway_v2_api_mapping(api_mapping_id: 'API_MAPPING_ID', domain_name: 'DOMAIN_NAME') do
  it { should_not exist }
end

AWS Permissions

Your Principal will need the APIGatewayv2:Client:GetApiMappingResponse action with Effect set to Allow.

Edit this page on GitHub

Thank you for your feedback!

×









Search Results