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

Remove AWS SDK V1 references #52990

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

gabrielcorado
Copy link
Contributor

@gabrielcorado gabrielcorado commented Mar 12, 2025

This PR migrates most of the AWS SDK V1 references. Although this is a large PR, most changes are on tests. For reviewers, the most significant change is in Sign V4 migration (including the signer's tests and usage).

After this is merged, only a few references will be remaining:

  • lib/aws/region.go is used for discovery and configuration validation. This was left outside this PR as there is no direct conversion, so it could lead to more discussion on how to solve it.
  • Legacy V1 clients (like stsv1). Those will all be done in separate PRs, removing the clients and their references.

@gabrielcorado gabrielcorado added the no-changelog Indicates that a PR does not require a changelog entry label Mar 12, 2025
@github-actions github-actions bot requested a review from nklaassen March 12, 2025 03:38
@github-actions github-actions bot added application-access audit-log Issues related to Teleports Audit Log database-access Database access related issues and PRs size/sm labels Mar 12, 2025
Copy link
Contributor

@greedy52 greedy52 left a comment

Choose a reason for hiding this comment

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

just some ideas for the region list, maybe use go:generate or through make to fetch this:
https://raw.githubusercontent.com/boto/botocore/refs/heads/develop/botocore/data/partitions.json

e.g:

$ curl -s https://raw.githubusercontent.com/boto/botocore/refs/heads/develop/botocore/data/partitions.json | jq -r '.partitions[].regions | keys | flatten[] ' | grep -v "\-global$" | sort 
af-south-1
ap-east-1
ap-northeast-1
...

Comment on lines +90 to +91
` <Test>test</Test>`,
` <Encoding>2009-02-13T23:31:30Z</Encoding>`,
Copy link
Contributor

@greedy52 greedy52 Mar 12, 2025

Choose a reason for hiding this comment

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

what happened here? could we keep the original test?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We could, but that would require us to duplicate the definition of the struct or make the test rely on it. I've kept the test in a simpler format, given that it seems to be a generic function in the end (that marshals XML) and is not specifically attached to any AWS structure.

Copy link
Contributor

Choose a reason for hiding this comment

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

if we want to move away from sts types, i would test a more complicated example than a string, and not using AssumeRoleResponse as the xml name. I would still prefer to test some aws sdk struct though as this is part of aws utils.

alternatively we can move these helpers to the caller since your new implementation is a lot easier and there is only one caller i believe. Then we make sure proper UT cover there with the real type.

}

// MarshalXML marshals the provided root name and a map of children in XML with
// default indent (prefix "", indent " ").
func MarshalXML(rootName xml.Name, children map[string]any) ([]byte, error) {
func MarshalXML(root string, namespace string, v any) ([]byte, error) {
var buf bytes.Buffer
Copy link
Contributor

Choose a reason for hiding this comment

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

we should move MarshalXML and its unit test into aws_local_proxy_test.go since that's the only place we use it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
application-access audit-log Issues related to Teleports Audit Log database-access Database access related issues and PRs no-changelog Indicates that a PR does not require a changelog entry size/sm
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants