From 75ec23e6e78a8069b9c6b5dea9eff67d0395349b Mon Sep 17 00:00:00 2001 From: Erik Kristensen Date: Sat, 24 Feb 2024 19:24:50 -0700 Subject: [PATCH] chore: update docs and internal tooling (#103) * docs: adding documentation around newer features * chore: fixing internal tools --- docs/features/enabled-regions.md | 7 +++++++ docs/features/global-filters.md | 7 +++++++ docs/features/signed-binaries.md | 4 ++++ docs/index.md | 6 +++--- mkdocs.yml | 3 +++ tools/compare-resources/main.go | 16 ++++++++++------ tools/migrate-resource/main.go | 3 +-- 7 files changed, 35 insertions(+), 11 deletions(-) create mode 100644 docs/features/enabled-regions.md create mode 100644 docs/features/global-filters.md create mode 100644 docs/features/signed-binaries.md diff --git a/docs/features/enabled-regions.md b/docs/features/enabled-regions.md new file mode 100644 index 00000000..d3365dd9 --- /dev/null +++ b/docs/features/enabled-regions.md @@ -0,0 +1,7 @@ +# Feature: All Enabled Regions + +There is a special region called `all` that can be provided to the regions block in the configuration. If `all` is +provided then the special `global` region and all regions that are enabled for the account will automatically be +included. Any other regions that are provided will be **ignored**. + +See [Full Documentation](../config.md#all-enabled-regions) for more information. \ No newline at end of file diff --git a/docs/features/global-filters.md b/docs/features/global-filters.md new file mode 100644 index 00000000..0fdde23e --- /dev/null +++ b/docs/features/global-filters.md @@ -0,0 +1,7 @@ +# Global Filters + +Global filters are filters that are applied to all resources. They are defined using a special resource name called +`__global__`. The global filters are pre-pended to all resources before any other filters for the specific resource +are applied. + +[Full Documentation](../config-filtering.md#global) \ No newline at end of file diff --git a/docs/features/signed-binaries.md b/docs/features/signed-binaries.md new file mode 100644 index 00000000..a399af0a --- /dev/null +++ b/docs/features/signed-binaries.md @@ -0,0 +1,4 @@ +# Signed Binaries + +All darwin binaries are now signed and notarized by Apple. This means that you can now run the binaries without +needing to bypass the security settings on your Mac. diff --git a/docs/index.md b/docs/index.md index 3a7e6a73..a3d108b0 100644 --- a/docs/index.md +++ b/docs/index.md @@ -9,9 +9,9 @@ resources and create a Pull Request or to create an [Issue](https://github.com/e This is not a comprehensive list, but here are some of the highlights: -* New Feature: Global Filters -* New Feature: Run Against All Enabled Regions -* New Feature: Bypass Alias Check - Allow the skip of an alias on an account +* New Feature: [Global Filters](features/global-filters.md +* New Feature: [Run Against All Enabled Regions](features/enabled-regions.md) +* New Feature: [Bypass Alias Check - Allow the skip of an alias on an account](features/bypass-alias-check.md) * Upcoming Feature: Filter Groups (**in progress**) * Breaking Change: `root` command no longer triggers the run, must use subcommand `run` (alias: `nuke`) * Completely rewrote the core of the tool as a dedicated library [libnuke](https://github.com/ekristen/libnuke) diff --git a/mkdocs.yml b/mkdocs.yml index 298ff333..ea494fc9 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -72,6 +72,9 @@ nav: - Quick Start: quick-start.md - Features: - Bypass Alias Check: features/bypass-alias-check.md + - Global Filters: features/global-filters.md + - Enabled Regions: features/enabled-regions.md + - Signed Binaries: features/signed-binaries.md - CLI: - Usage: cli-usage.md - Options: cli-options.md diff --git a/tools/compare-resources/main.go b/tools/compare-resources/main.go index dbd044c2..5a44dd77 100644 --- a/tools/compare-resources/main.go +++ b/tools/compare-resources/main.go @@ -14,7 +14,7 @@ import ( var OriginalRegisterRegex = regexp.MustCompile( `register\("(?P.*)",\s?(?P\w+)(,)?(\s+mapCloudControl\("(?P.*)"\))?`) -var NewRegisterRegex = regexp.MustCompile(`resource.Registration{\s+Name:\s+(?P.*),`) +var NewRegisterRegex = regexp.MustCompile(`registry.Registration{\s+Name:\s+(?P.*),`) var aliases = map[string]string{ "NetpuneSnapshot": "NeptuneSnapshot", @@ -99,6 +99,10 @@ func main() { //nolint:funlen,gocyclo matches := NewRegisterRegex.FindStringSubmatch(string(originalFileContents)) + if len(matches) == 0 { + continue + } + var NameRegex = regexp.MustCompile(fmt.Sprintf(`const %s = "(?P.*)"`, matches[1])) nameMatches := NameRegex.FindStringSubmatch(string(originalFileContents)) @@ -111,10 +115,10 @@ func main() { //nolint:funlen,gocyclo localResourceTypes = append(localResourceTypes, resourceType) } - fmt.Println("\naws-nuke resource count:", len(upstreamResourceTypes)) - fmt.Println("local resource count:", len(localResourceTypes)) + fmt.Println("\nrebuy-de/aws-nuke resource count:", len(upstreamResourceTypes)) + fmt.Println("ekristen/aws-nuke resource count:", len(localResourceTypes)) - fmt.Println("\nResources not in aws-nuke:") + fmt.Println("\nResources unique to ekristen/aws-nuke:") for _, resource := range localResourceTypes { found := false for _, v := range aliases { @@ -124,11 +128,11 @@ func main() { //nolint:funlen,gocyclo } if !slices.Contains(upstreamResourceTypes, resource) && !found { - fmt.Println("+>", resource) + color.New(color.Bold, color.FgGreen).Printf("%-55s\n", resource) } } - fmt.Println("\nResources not in local aws-nuke:") + fmt.Println("\nResources not in ekristen/aws-nuke:") for _, resource := range upstreamResourceTypes { _, ok := aliases[resource] if !slices.Contains(localResourceTypes, resource) && !ok { diff --git a/tools/migrate-resource/main.go b/tools/migrate-resource/main.go index b6200330..0182a1fd 100644 --- a/tools/migrate-resource/main.go +++ b/tools/migrate-resource/main.go @@ -96,8 +96,7 @@ func main() { newContents := repl.ReplaceAllString(string(originalFileContents), tpl.String()) - newContents = strings.ReplaceAll(newContents, - "github.com/rebuy-de/aws-nuke/v2/pkg/types", "github.com/ekristen/libnuke/pkg/types") + newContents = strings.ReplaceAll(newContents, "github.com/rebuy-de/aws-nuke/v2/pkg/types", "") newContents = funcMatch.ReplaceAllString(newContents, funcTpl.String()) newContents = strings.ReplaceAll(newContents, "[]Resource", "[]resource.Resource")