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

ENG-13394: Add Dmap Scanner library #1

Merged
merged 30 commits into from
Feb 8, 2024
Merged

ENG-13394: Add Dmap Scanner library #1

merged 30 commits into from
Feb 8, 2024

Conversation

VictorGFM
Copy link
Contributor

@VictorGFM VictorGFM commented Feb 1, 2024

Description of the change

ENG-13394: Scanner algorithm implementation

Add Dmap Scanner library implementation:

  • Add scanner Config
  • Add Scanner Manager implementation
  • Add AWS Scanner implementation
  • Add Repository model

Type of change

  • Bug fix (non-breaking change that fixes an issue).
  • New feature (non-breaking change that adds functionality).
  • Breaking change (fix or feature that would cause existing functionality to not work as expected).

Checklists

Development

  • Lint rules pass locally.
  • The code changed/added as part of this pull request has been covered with tests.
  • All tests related to the changed code pass.

Code review

  • This pull request has a descriptive title and information useful to a reviewer. There may be a screenshot or screencast attached.
  • Jira issue referenced in commit message and/or PR title.

Testing

Tested E2E using an IAM Role for the AWS Development account. Also tested with unit tests.

Copy link

@yoursnerdly yoursnerdly left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Victor. I have not looked at the code in detail but have given some ideas for high level structure - mainly to make the API extensible to other cloud types in the future without necessarily breaking the API. Please let me know what you think. Happy to discuss more in person.

scan/repository.go Outdated Show resolved Hide resolved
scan/repository.go Outdated Show resolved Hide resolved
scan/repository.go Outdated Show resolved Hide resolved
scan/repository.go Outdated Show resolved Hide resolved
scan/scanner.go Outdated Show resolved Hide resolved
scan/scanner.go Outdated Show resolved Hide resolved
scan/scanner.go Outdated Show resolved Hide resolved
scan/scanner.go Outdated Show resolved Hide resolved
scan/aws.go Outdated Show resolved Hide resolved
scan/aws.go Outdated Show resolved Hide resolved
scan/aws.go Outdated Show resolved Hide resolved
scan/repository.go Outdated Show resolved Hide resolved
scan/repository.go Outdated Show resolved Hide resolved
scan/scanner.go Outdated Show resolved Hide resolved
scan/scanner.go Outdated Show resolved Hide resolved
scan/scanner.go Outdated Show resolved Hide resolved
scan/scanner.go Outdated Show resolved Hide resolved
scan/scanner.go Outdated Show resolved Hide resolved
@VictorGFM VictorGFM marked this pull request as ready for review February 3, 2024 05:14
@VictorGFM
Copy link
Contributor Author

I still need to add descriptions to public types and interfaces, aside from that, the PR should be in a good state for re-review.

Copy link

@yoursnerdly yoursnerdly left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some more suggestions around simplifying package structure and types etc., please take a look to see if you agree.

Makefile Outdated Show resolved Hide resolved
model/repository.go Outdated Show resolved Hide resolved
scan/scan.go Outdated Show resolved Hide resolved
config/config.go Outdated Show resolved Hide resolved
scan/scan.go Outdated Show resolved Hide resolved
aws/aws.go Outdated Show resolved Hide resolved
aws/aws.go Outdated Show resolved Hide resolved
aws/aws.go Outdated Show resolved Hide resolved
aws/aws.go Outdated Show resolved Hide resolved
aws/aws.go Outdated Show resolved Hide resolved
Copy link

@yoursnerdly yoursnerdly left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM and much cleaner than before, thanks @VictorGFM

I'll also let @ccampo133 take another look and see if he has any further suggestions before the PR is approved and merged.

scan/scanner.go Show resolved Hide resolved
aws/config.go Show resolved Hide resolved
aws/scan.go Outdated Show resolved Hide resolved
aws/repository.go Outdated Show resolved Hide resolved
Copy link
Contributor

@ccampo133 ccampo133 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM @VictorGFM. Just a couple comments for your consideration, but I've still approved the PR.

aws/scanner.go Outdated Show resolved Hide resolved
aws/scanner.go Outdated Show resolved Hide resolved
Makefile Outdated Show resolved Hide resolved
err,
))
}
for _, cluster := range rdsClusters {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will rdsClusters be populated even if err is non-nil? If not, maybe we can continue when we encounter an error. Same thing for all other functions, as they follow the same pattern.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see, in this case returning earlier would just add a duplicated return block, because in practice when the rdsClusters is nil, it will skip the for loop and just return right after, which would be equivalent but with just a single return block.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, I don't have a strong opinion. I just personally prefer exiting early in an error state, but if rdsClusters will just be an empty slice then it's pretty much the same

@VictorGFM VictorGFM merged commit d4b7f84 into main Feb 8, 2024
1 check passed
@VictorGFM VictorGFM deleted the ENG-13394 branch February 8, 2024 00:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants