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

Modify S3 endpoint regex pattern to support VPC endpoints. #206

Merged

Conversation

jcalcote
Copy link

@jcalcote jcalcote commented Jul 3, 2024

Virtual private clouds are a relatively new feature of AWS. The jclouds AWS endpoint regex was not originally designed to be able to handle VPC formatted endpoints. This new expanded regex does the trick. The change also (incidentally) allows the regex to recognize both forms of basic s3 endpoints: s3-region and s3.region.

@@ -26,7 +26,7 @@

public class AwsHostNameUtils {

private static final Pattern S3_ENDPOINT_PATTERN = Pattern.compile("^(?:.+\\.)?s3[.-]([a-z0-9-]+)$");
private static final Pattern S3_ENDPOINT_PATTERN = Pattern.compile("^(?:.+\\.)?s3[.\\-]([a-z0-9-]+)(?>\\.[a-z0-9-]+)*$");
Copy link
Member

Choose a reason for hiding this comment

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

Can you add some kind of unit test which exercises this?

Copy link
Author

Choose a reason for hiding this comment

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

Done.

@jcalcote jcalcote force-pushed the feature/master/support-aws-virtual-private-clouds branch from 01f05e2 to 022d25e Compare July 25, 2024 20:44
@jcalcote jcalcote requested a review from gaul July 25, 2024 21:53
@gaul gaul merged commit ddfb2ea into apache:master Jul 27, 2024
1 check passed
@gaul
Copy link
Member

gaul commented Jul 27, 2024

Thank you for your contribution @jcalcote!

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.

2 participants