-
Notifications
You must be signed in to change notification settings - Fork 126
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
feat(products): Product-specific enablement and configuration. #570
Conversation
This also adds a dependency on the |
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.
I think the code looks great! However, I have never used go generics so it might be good to ask for more reviews. Thanks for the work!
Product-specific enablement and configuration operations have been added under the 'fastly/products/ package path in this module. These are intended to replace the non-specific 'GetProduct', 'EnableProduct', and 'DisableProduct' operations, which have been marked as deprecated. By adding these operations, support for products which require configuration during enablement (Next-Gen WAF), and/or support configuration after enablement (Next-Gen WAF and DDoS Protection) is now available. The operations for those products have product-specific Input and Output structures which carry the additional attributes supported by the products. In addition, the functional tests for all product enablement operations have been enhanced to more thoroughly test the operations.
0dd5e6d
to
de962ad
Compare
1. Rename internal/products to internal/productcore 2. Eliminate import aliases 3. Eliminate type parameters on structs that don't use them 4. Use pointer receivers for methods in ProductOutput interface
Applied review feedback:
The elimination of the import aliases has made the code... quite verbose. |
I never meant to take a hard line on removing all import aliases. |
I didn't interpret your comments that way, but once the mention of renaming |
Reverse order of input and output type parameters, which allows one of them to be inferred.
Reversing the order of the type parameters to follow Go practices allowed one of them to be inferred (as @cee-dub had demonstrated), which reduced the verbosity. Definitely the right change. |
Move new functional-testing support into internal/test_utils package.
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.
Only feedback here is that Go package names typically avoid using underscores, so it would be testutils
. I'm not going to block you on that!
Product-specific enablement and configuration operations have been added under the 'fastly/products/ package path in this module. These are intended to replace the non-specific 'GetProduct', 'EnableProduct', and 'DisableProduct' operations, which have been marked as deprecated.
By adding these operations, support for products which require configuration during enablement (Next-Gen WAF), and/or support configuration after enablement (Next-Gen WAF and DDoS Protection) is now available. The operations for those products have product-specific Input and Output structures which carry the additional attributes supported by the products.
In addition, the functional tests for all product enablement operations have been enhanced to more thoroughly test the operations.
Review strategy recommendations:
fastly/products
to see how product APIs and their tests are defined. Most of the files in the packages are copies of each other, except forngwaf
andddos_protection
which contain additional behavior and tests.internal/productcore
to see how the generic API operations and functional-test constructors are implemented.fastly_test_utils.go
to see how table-driven functional tests are executed (this should be used in the future to replace the existing functional test mechanisms throughout the source tree).