Skip to main content

aws_api_gateway_model Resource

Use the aws_api_gateway_model Chef InSpec audit resource to test properties of a single 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_model(rest_api_id: 'REST_API_ID', model_name: 'MODEL_NAME') do
  it { should exist }
end

Parameters

rest_api_id (required)

The ID of a REST API associated with this model.

model_name (required)

A name for the model.

Properties

id
The identifier for the model resource.
name
The name of the model. Must be an alphanumeric string.
description
The description of the model.
schema
The schema for the model. For application/json models, this should be JSON schema draft 4 model.
content_type
The content-type for the model.

Examples

Ensure an ID is available.

describe aws_api_gateway_model(rest_api_id: 'REST_API_ID', model_name: 'MODEL_NAME') do
  its('id') { should eq '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('name') { should eq '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('description') { should eq '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_type') { should eq '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_model(rest_api_id: 'REST_API_ID', model_name: 'MODEL_NAME') do
  it { should exist }
end

Use should_not to test the entity does not exist.

describe aws_api_gateway_model(rest_api_id: 'REST_API_ID', model_name: 'MODEL_NAME') do
  it { should_not exist }
end

AWS Permissions

Your Principal will need the ApiGateway:Client:Model action with Effect set to Allow.

Edit this page on GitHub

Thank you for your feedback!

×











Search Results