aws_api_gateway_v2_models Resource
Use the aws_api_gateway_v2_models
InSpec audit resource to test properties of multiple AWS API Gateway V2 Models.
For additional information, including parameters and properties, see the AWS documentation on AWS APIGatewayV2 Model.
Installation
This resource is available in the Chef InSpec AWS resource pack.
See the Chef InSpec documentation on cloud platforms for information on configuring your AWS environment for InSpec and creating an InSpec profile that uses the InSpec AWS resource pack.
Syntax
Ensure that the model exists.
describe aws_api_gateway_v2_models(api_id: 'APP_ID') do
it { should exist }
end
Parameters
api_id
(required)- The API identifier.
Properties
content_types
- The content-type for the model, for example, “application/json”.
Field:
content_type
descriptions
- The description of the model.
Field:
description
model_ids
- The model identifier.
Field:
model_id
names
- The name of the model. Must be alphanumeric.
Field:
name
schemas
- The schema for the model.
Field:
schema
Examples
Test to ensure a model ID is available
describe aws_api_gateway_v2_models(api_id: 'APP_ID') do
its('model_ids') { should include 'MODEL_ID' }
end
Verify the model name
describe aws_api_gateway_v2_models(api_id: 'APP_ID') do
its('names') { should include 'MODEL_NAME' }
end
Verify the model description
describe aws_api_gateway_v2_models(api_id: 'APP_ID') do
its('descriptions') { should include 'MODEL_DESCRIPTION' }
end
Verify the model content type is application/json
describe aws_api_gateway_v2_models(api_id: 'APP_ID') do
its('content_types') { should include 'application/json' }
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 controls will pass if the get
method returns at least one result.
exist
Use should
to test that the entity exists.
describe aws_api_gateway_v2_models(api_id: 'APP_ID') do
it { should exist }
end
Use should_not
to test that the entity does not exist.
describe aws_api_gateway_v2_models(api_id: 'APP_ID') do
it { should_not exist }
end
AWS Permissions
Your Principal will need the APIGatewayv2:Client:GetModelsResponse
action with Effect
set to Allow
.
Was this page helpful?