Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CHEF-5596 Magic Module docs update #223

Merged
merged 3 commits into from
Jun 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion mmv1/api/resource.rb
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,6 @@ def validate

set_variables(@parameters, :__resource)
set_variables(@properties, :__resource)

check :properties, type: Array, item_type: Api::Type, required: true unless @exclude
check :parameters, type: Array, item_type: Api::Type unless @exclude

Expand Down
36 changes: 31 additions & 5 deletions mmv1/templates/inspec/doc_template.md.erb
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,32 @@
-%>
<% autogen_exception -%>
<% resource_underscored_name = plural ? resource_name(object, product).pluralize : resource_name(object, product) -%>
---
title: About the <%= resource_underscored_name -%> resource
platform: gcp
---
+++

title = "<%= resource_underscored_name -%> Resource"
platform = "gcp"
draft = false
gh_repo = "inspec-gcp"


[menu.inspec]

title = "<%= resource_underscored_name -%>"
identifier = "inspec/resources/gcp/<%= resource_underscored_name -%> Resource"
parent = "inspec/resources/gcp"
+++

Use the `<%= resource_underscored_name -%>` InSpec audit resource to test the properties of a test a Google <%= object.name -%>.

## Installation
{{% inspec_gcp_install %}}

## Syntax
A `<%= resource_underscored_name -%>` is used to test a Google <%= object.name -%> resource

<% if beta?(object) -%>


## Beta Resource
This resource has beta fields available. To retrieve these fields, include `beta: true` in the constructor for the resource

Expand All @@ -44,13 +60,23 @@ This resource has beta fields available. To retrieve these fields, include `beta

<% end -%>

## Parameters
Properties that can be accessed from the `<%= resource_underscored_name -%>` resource:

<% if plural -%>
See <%= "[#{resource_name(object, product)}.md](#{resource_name(object, product)}.md)" -%> for more detailed information
<% object.all_user_properties.reject(&:exclude_plural).each do |prop| -%>
* `<%= "#{(prop.override_name || prop.out_name).pluralize}" -%>`: <% if prop.min_version.name == 'beta' -%><%= '(Beta only) ' -%><% end -%>an array of `<%= resource_name(object, product) -%>` <%= "#{prop.out_name}" -%>

<% end -%>
<% end -%>
## Properties
Properties that can be accessed from the `<%= resource_underscored_name -%>` resource:

<% if plural -%>
See <%= "[#{resource_name(object, product)}.md](#{resource_name(object, product)}.md)" -%> for more detailed information
<% object.all_user_properties.reject(&:exclude_plural).each do |prop| -%>
* `<%= "#{(prop.override_name || prop.out_name).pluralize}" -%>`: <% if prop.min_version.name == 'beta' -%><%= '(Beta only) ' -%><% end -%>an array of `<%= resource_name(object, product) -%>` <%= "#{prop.out_name}" -%>
* `<%= "#{(prop.override_name || prop.out_name).pluralize}" -%>`: <% if prop.min_version.name == 'beta' -%><%= '(Beta only) ' -%><% end -%>an array of `<%= resource_name(object, product) -%>` <%= "#{prop.out_name}" -%>

<% end -%>

Expand Down
Loading