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

Move SigV4 config and middleware here #132

Merged
merged 2 commits into from
Mar 15, 2024
Merged

Move SigV4 config and middleware here #132

merged 2 commits into from
Mar 15, 2024

Conversation

andresmgot
Copy link
Contributor

This PR does two things:

Copy link

@itsmylife itsmylife left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@sarahzinger sarahzinger left a comment

Choose a reason for hiding this comment

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

Seems good to consolidate!

// SigV4MiddlewareName the middleware name used by SigV4Middleware.
const SigV4MiddlewareName = "sigv4"

var newSigV4Func = New
Copy link
Member

Choose a reason for hiding this comment

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

So we have one middleware calling another middleware now... https://github.com/grafana/grafana-aws-sdk/blob/main/pkg/sigv4/sigv4.go#L80-L82

Does this second middeware do anything that the first middleware doesn't do? Maybe better logging and something like that? Or is this just the format that the prometheus datasource expects?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah, this middleware is just a wrapper around the other middleware. Its goal is to do the transformation from httpclient.Options -> sigv4.Options. It could probably be refactored and only have one but it would imply changing the signature of that New method (so a breaking change).

Copy link

@mmandrus mmandrus left a comment

Choose a reason for hiding this comment

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

lgtm

@andresmgot andresmgot merged commit 1ad978d into main Mar 15, 2024
3 checks passed
@andresmgot andresmgot deleted the sigv4Middleware branch March 15, 2024 14:56
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