Skip to main content

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.

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_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: id

names
The name of the model. Must be an alphanumeric string.

Field: name

descriptions
The description of the model.

Field: description

schemas
The schema for the model. For application/json models, this should be JSON schema draft 4 model.

Field: schema

content_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

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_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.

Edit this page on GitHub

Thank you for your feedback!

×









Search Results