[SVC-672] Build AWS Session in BrokerConnection#5
Merged
Conversation
lgasperin
reviewed
Jan 14, 2022
| return self._try_authenticate_scram(future) | ||
| elif self.config['sasl_mechanism'] == 'AWS_MSK_IAM': | ||
| return self._try_authenticate_aws_msk_iam(future, self.config["sasl_aws_msk_iam_session"]) | ||
| return self._try_authenticate_aws_msk_iam(future, self.config["sasl_aws_msk_iam_role_arn"]) |
There was a problem hiding this comment.
config is initialized in init, so there should be no need to pass it as a parameter.
| aws_access_key_id=credentials['AccessKeyId'], | ||
| aws_secret_access_key=credentials['SecretAccessKey'], | ||
| aws_session_token=credentials['SessionToken'], | ||
| ) |
There was a problem hiding this comment.
This should go into a separate private method or nested method, but that is a personal preference, not a requirement :)
Author
There was a problem hiding this comment.
Finally, I moved the entire Session creation logic to a private method.
lgasperin
approved these changes
Jan 14, 2022
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In this PR:
sasl_aws_msk_iam_sessionparameter was removed.sasl_aws_msk_iam_role_arnparameter was added: When this parameter has a value, the role indicated is assumed and the credentials to use to create a Session object are those provided by the assumed role.region_namewas not included in the creation of Session objects or STS clients. Also, the default session object is created without any parameter (region, aws_access_key_id, etc). We should provide these parameters as environment variables.The following Alexandria image was built including this version of the library, in case you wan't to run some tests: