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

Update access controlled frontend handlers to generated code #5588

Merged
merged 1 commit into from
Jan 12, 2024

Conversation

Shaddoll
Copy link
Contributor

What changed?

  • Introduced a template to generate access controlled handlers
    Behavior changes:
  • Add auth for all admin handlers, previously there are some methods not covered
  • Remove domain tag from auth metrics of Register/Describe/Update/Deprecate APIs, because these APIs are not domain-level APIs. They are APIs for metadata.

Why?
To eliminate manual work.

How did you test it?
unit test

Potential risks

Release notes

Documentation Changes

@coveralls
Copy link

coveralls commented Jan 12, 2024

Pull Request Test Coverage Report for Build 018cff2a-bd14-4de8-b238-97c80de94d35

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.1%) to 62.441%

Totals Coverage Status
Change from base Build 018cf02e-2f0f-46c7-adac-ccab41358226: 0.1%
Covered Lines: 93016
Relevant Lines: 148966

💛 - Coveralls

@@ -19,6 +19,7 @@
// THE SOFTWARE.

//go:generate mockgen -package $GOPACKAGE -source $GOFILE -destination adminHandler_mock.go -package frontend github.com/uber/cadence/service/frontend AdminHandler
//go:generate gowrap gen -g -p . -i AdminHandler -t ./templates/accesscontrolled.tmpl -o ./access_controlled_admin_gen.go -v handler=AccessControlled
Copy link
Contributor

Choose a reason for hiding this comment

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

I propose to separate code from generated code. Could you move generated files into a subfolder?
Also, naming convention for generated files is _generated.go #5574
I don't think it is set in stone, but coverage wise, I think we should be consistent

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Originally, I put them in a separate package but realized that introduced a cyclic dependency.

Copy link
Contributor

Choose a reason for hiding this comment

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

It should be fine that generated files are in same folder but let's follow same suffix convention "_generated.go"

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 need to do another refactoring to remove the cyclic dependency.

@@ -19,6 +19,7 @@
// THE SOFTWARE.

//go:generate mockgen -package $GOPACKAGE -source $GOFILE -destination adminHandler_mock.go -package frontend github.com/uber/cadence/service/frontend AdminHandler
//go:generate gowrap gen -g -p . -i AdminHandler -t ./templates/accesscontrolled.tmpl -o ./access_controlled_admin_gen.go -v handler=AccessControlled
Copy link
Contributor

Choose a reason for hiding this comment

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

It should be fine that generated files are in same folder but let's follow same suffix convention "_generated.go"

@Shaddoll Shaddoll force-pushed the auth-wrapper branch 2 times, most recently from 5d9fc96 to 3f1f1c4 Compare January 12, 2024 18:58
@Shaddoll Shaddoll merged commit e5b3b00 into uber:master Jan 12, 2024
16 checks passed
@Shaddoll Shaddoll deleted the auth-wrapper branch January 12, 2024 20:00
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.

None yet

4 participants