aws_api_gateway_models Resource
Use the aws_api_gateway_models Chef InSpec audit resource to test properties of the plural resource of AWS API Gateway model.
The AWS::ApiGateway::Model resource defines the structure of a request or response payload for an API method.
For additional information, including details on parameters and properties, see the AWS documentation on AWS::APIGateway::Model 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 the model exists.
describe aws_api_gateway_models(rest_api_id: 'REST_API_ID') do
it { should exist }
end
Parameters
rest_api_id(required)The ID of a REST API associated with this model.
Properties
ids- The identifier for the model resource.
Field:
idnames- The name of the model. Must be an alphanumeric string.
Field:
namedescriptions- The description of the model.
Field:
descriptionschemas- The schema for the model. For
application/jsonmodels, this should be JSON schema draft 4 model. Field:
schemacontent_types- The content-type for the model.
Field:
content_type
Examples
Ensure an ID is available.
describe aws_api_gateway_model(rest_api_id: 'REST_API_ID', model_name: 'MODEL_NAME') do
its('ids') { should include 'MODEL_ID' }
end
Ensure a name is available.
describe aws_api_gateway_model(rest_api_id: 'REST_API_ID', model_name: 'MODEL_NAME') do
its('names') { should include 'MODEL_NAME' }
end
Ensure a description is available.
describe aws_api_gateway_model(rest_api_id: 'REST_API_ID', model_name: 'MODEL_NAME') do
its('descriptions') { should include 'MODEL_DESCRIPTION' }
end
Ensure a content type is available.
describe aws_api_gateway_model(rest_api_id: 'REST_API_ID', model_name: 'MODEL_NAME') do
its('content_types') { should include 'CONTENT_TYPE' }
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_models(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_models(rest_api_id: 'REST_API_ID') do
it { should_not exist }
end
AWS Permissions
Your Principal will need the ApiGateway:Client:Models action with Effect set to Allow.