Skip to main content

aws_api_gateway_v2_models Resource

[edit on GitHub]

Use the aws_api_gateway_v2_models InSpec audit resource to test the 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. For application/json models, this should be JSON schema draft 4 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

Test to verify the model name

describe aws_api_gateway_v2_models(api_id: 'APP_ID') do
  its('names') { should include 'MODEL_NAME' }
end

Test to verify the model description

describe aws_api_gateway_v2_models(api_id: 'APP_ID') do
  its('descriptions') { should include 'MODEL_DESCRIPTION' }
end

Test to 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 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_models(api_id: 'APP_ID') do
  it { should exist }
end

not exist

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?

×









Search Results