Skip to main content

aws_api_gateway_v2_model resource

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

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

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_v2_model(api_id: 'APP_ID', model_id: 'MODEL_ID') do
  it { should exist }
end

Parameters

api_id (required)
The API identifier.
model_id (required)
The model identifier.

Properties

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

Examples

Test to ensure a model ID is available

describe aws_api_gateway_v2_model(api_id: 'APP_ID', model_id: 'MODEL_ID') do
  its('model_id') { should eq 'MODEL_ID' }
end

Test to verify the model name

describe aws_api_gateway_v2_model(api_id: 'APP_ID', model_id: 'MODEL_ID') do
  its('name') { should eq 'MODEL_NAME' }
end

Test to verify the model description

describe aws_api_gateway_v2_model(api_id: 'APP_ID', model_id: 'MODEL_ID') do
  its('description') { should eq 'MODEL_DESCRIPTION' }
end

Test to verify the model content type

describe aws_api_gateway_v2_model(api_id: 'APP_ID', model_id: 'MODEL_ID') do
  its('content_type') { should eq 'application/json' }
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_model(api_id: 'APP_ID', model_id: 'MODEL_ID') do
  it { should exist }
end

not exist

Use should_not to test that the entity does not exist.

describe aws_api_gateway_v2_model(api_id: 'APP_ID', model_id: 'MODEL_ID') do
  it { should_not exist }
end

AWS Permissions

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

Edit this page on GitHub

Thank you for your feedback!

×









Search Results