Skip to content

Commit 18cb437

Browse files
committed
chore(tools/generate-docs): improve auto-generated docs tool
1 parent e623b06 commit 18cb437

File tree

2 files changed

+17
-6
lines changed

2 files changed

+17
-6
lines changed

tools/generate-docs/docs.go

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,17 @@ func execute(c *cli.Context) error { //nolint:funlen,gocyclo
5959
continue
6060
}
6161

62+
name := reg.Name
63+
description := ""
64+
if strings.HasPrefix(name, "AWS::") {
65+
description = `This is a resource that is access and controlled via the Cloud Control API, as such it's name
66+
and properties do not match the standard format for aws-nuke resources. Furthermore, the resource properties are
67+
dynamically populated and therefore cannot be documented here.`
68+
}
69+
6270
data := TemplateData{
63-
Name: reg.Name,
71+
Name: name,
72+
Description: description,
6473
Properties: docs.GeneratePropertiesMap(reg.Resource),
6574
Settings: reg.Settings,
6675
DependsOn: reg.DependsOn,
@@ -92,7 +101,7 @@ func execute(c *cli.Context) error { //nolint:funlen,gocyclo
92101
}
93102

94103
if c.Bool("write-to-disk") {
95-
filename := KebabCase(strings.ToLower(SplitCamelCase(reg.Name)))
104+
filename := KebabCase(strings.ToLower(SplitCamelCase(name)))
96105
filename = strings.Replace(filename, "io-t", "iot-", 1)
97106
filename = strings.Replace(filename, "iamsaml-", "iam-saml-", 1)
98107
filename = strings.Replace(filename, "wa-fv2-", "wafv2-", 1)

tools/generate-docs/files/resource.gomd

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,11 @@ generated: true
1414
{{ if .AlternativeResource -}}
1515
### Alternative Resource
1616

17-
!!! note - Cloud Control API - Alternative Resource
18-
This resource can also be controlled and used via Cloud Control API. Please refer to the documentation for
19-
[Cloud Control Resources](../config-cloud-control.md) for more information.
17+
!!! warning - Cloud Control API - Alternative Resource
18+
This resource conflicts with an alternative resource that can be controlled and used via Cloud Control API. If you
19+
use this alternative resource, please note that any properties listed on this page may not be valid. You will need
20+
run the tool to determine what properties are available for the alternative resource via the Cloud Control API.
21+
Please refer to the documentation for [Cloud Control Resources](../config-cloud-control.md) for more information.
2022

2123
```text
2224
{{ .AlternativeResource }}
@@ -29,7 +31,6 @@ generated: true
2931
{{ range $key, $value := .Properties }}
3032
- `{{ $key }}`: {{ if ne $value "" }}{{ $value }}{{ else }}No Description{{ end }}
3133
{{- end }}
32-
{{- end }}
3334

3435
!!! note - Using Properties
3536
Properties are what [Filters](../config-filtering.md) are written against in your configuration. You use the property
@@ -42,6 +43,7 @@ resources support properties. To write a filter against the string representatio
4243
the filter.
4344

4445
The string value is always what is used in the output of the log format when a resource is identified.
46+
{{- end }}
4547

4648
{{ if .Settings -}}
4749
## Settings

0 commit comments

Comments
 (0)