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

chore: update docs and internal tooling #103

Merged
merged 2 commits into from
Feb 25, 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
7 changes: 7 additions & 0 deletions docs/features/enabled-regions.md
Original file line number Diff line number Diff line change
@@ -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.
7 changes: 7 additions & 0 deletions docs/features/global-filters.md
Original file line number Diff line number Diff line change
@@ -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)
4 changes: 4 additions & 0 deletions docs/features/signed-binaries.md
Original file line number Diff line number Diff line change
@@ -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.
6 changes: 3 additions & 3 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
3 changes: 3 additions & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
16 changes: 10 additions & 6 deletions tools/compare-resources/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (

var OriginalRegisterRegex = regexp.MustCompile(
`register\("(?P<resource>.*)",\s?(?P<function>\w+)(,)?(\s+mapCloudControl\("(?P<cc>.*)"\))?`)
var NewRegisterRegex = regexp.MustCompile(`resource.Registration{\s+Name:\s+(?P<name>.*),`)
var NewRegisterRegex = regexp.MustCompile(`registry.Registration{\s+Name:\s+(?P<name>.*),`)

var aliases = map[string]string{
"NetpuneSnapshot": "NeptuneSnapshot",
Expand Down Expand Up @@ -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<name>.*)"`, matches[1]))

nameMatches := NameRegex.FindStringSubmatch(string(originalFileContents))
Expand All @@ -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 {
Expand All @@ -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 {
Expand Down
3 changes: 1 addition & 2 deletions tools/migrate-resource/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down