-
Notifications
You must be signed in to change notification settings - Fork 173
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
Refactor signing config and set a default signing config for s3 client #545
Conversation
Signed-off-by: Monthon Klongklaew <[email protected]>
40afee6
to
39f5eb7
Compare
auth_scheme.signing_region(), | ||
auth_scheme.scheme_name(), |
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.
Reason we were not keeping it optional is because when we were resolving endpoint, we were explicitly failing when we were not getting any value for any of the fields of AuthScheme. So, all these options should have some value set.
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.
That's fine if we want to fail, we can do that at resolve_for_bucket(..)
. But can't we create a signing config without resolving endpoint? Looking at the CRT function, I think what we really need are region and credentials_provider, the others are optional.
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.
Yes, we dont need other arguments in the CRT function. But, the signing config is only created after resolving the endpoint ( in s3_crt_client ). I am not sure if we need to set signing config other than making request where endpoint should be resolved.
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.
Yeah, that is a signing config at request level. We can also set it at client level which I added in this change (see s3_crt_client.rs
line 272-279), and I don't think we want to resolve the endpoint there.
@@ -32,6 +33,49 @@ impl Debug for SigningConfigInner { | |||
} | |||
} | |||
|
|||
impl SigningConfigInner { | |||
/// Create a new [SigningConfig] with default options. | |||
pub fn new(region: &str, credentials_provider: CredentialsProvider) -> Self { |
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.
Why did we create this constructor for SigningConfigInner when we were doing the same with default_init_siginig_config()
?
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.
Well, some of the configs are now optional. I think this might be easier to read.
Description of change
This PR refactors the signing config and also set a default signing config for s3 client to prepare for upcoming changes.
Does this change impact existing behavior?
No.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license and I agree to the terms of the Developer Certificate of Origin (DCO).