-
Notifications
You must be signed in to change notification settings - Fork 0
Adding the ability to filter the account list. Closes #225 #239
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
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR Overview
This pull request adds new command-line flags to filter the list of AWS accounts by including or excluding specific accounts. The key changes include:
- Adding new flags in constants and flags files.
- Registering the new flags in the initialization process.
- Implementing account filtering functions and integrating them in the profile-building logic.
Reviewed Changes
| File | Description |
|---|---|
| cmd/rootCmd.go | Added account filtering functions and integrated filtering logic |
| cmd/flags.go | Introduced new flag variables for include/exclude accounts |
| cmd/constants.go | Defined new constants for the include/exclude account flags |
| cmd/init.go | Registered the new account filtering flags with the CLI |
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
cmd/rootCmd.go
Outdated
|
|
||
| type AccountsFilter []string | ||
|
|
||
| func buildIncludedAccounts() AccountsFilter { |
Copilot
AI
Mar 6, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When includeAccounts is an empty string, strings.Split returns a slice with one empty element, which may inadvertently filter out all accounts. Consider checking if includeAccounts is empty before splitting and return a filter that includes all accounts if no value is provided.
| func buildIncludedAccounts() AccountsFilter { | |
| func buildIncludedAccounts() AccountsFilter { | |
| if includeAccounts == "" { | |
| return AccountsFilter{} | |
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR Overview
This PR adds filtering functionality for AWS accounts by introducing new include and exclude command-line flags and updating the account filtering logic accordingly. Key changes include:
- Adding new flags (includeAccounts & excludeAccounts) to the CLI.
- Introducing helper functions (buildIncludedAccounts & buildExcludedAccounts) to filter account IDs.
- Updating the README.md documentation to reflect the new flags.
Reviewed Changes
| File | Description |
|---|---|
| cmd/rootCmd.go | Added filtering logic by including buildIncludedAccounts and buildExcludedAccounts functions. |
| cmd/flags.go | Introduced new flag variables includeAccounts and excludeAccounts. |
| cmd/constants.go | Defined new flag constants for account filtering. |
| cmd/init.go | Registered the new filtering flags with the command-line interface. |
| README.md | Updated documentation to include new filtering options. |
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
This pull request introduces functionality to include or exclude specific AWS accounts using new command-line flags. The changes span multiple files to implement this feature.
New feature implementation:
cmd/constants.go: Added new flagsFlagIncludeAccountsandFlagExcludeAccountsfor including and excluding accounts.cmd/flags.go: Introduced new variablesincludeAccountsandexcludeAccountsto store comma-separated lists of accounts to include or exclude.cmd/init.go: Registered the new flagsincludeAccountsandexcludeAccountswith the command-line interface.Account filtering logic:
cmd/rootCmd.go: Added imports forstringsto handle account filtering.cmd/rootCmd.go: ImplementedbuildIncludedAccountsandbuildExcludedAccountsfunctions to create filters from the provided account lists and applied these filters in thebuildProfilesfunction to include or exclude accounts accordingly. [1] [2]