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

Add a basic support for parsing urls from virtual private cloud #49

Merged
merged 5 commits into from
Jan 24, 2024

Conversation

Drvi
Copy link
Member

@Drvi Drvi commented Jan 24, 2024

In similar vein to JuliaServices/CloudBase.jl#35

Copy link

codecov bot commented Jan 24, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (63e4b3a) 84.32% compared to head (5fd14eb) 84.37%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #49      +/-   ##
==========================================
+ Coverage   84.32%   84.37%   +0.04%     
==========================================
  Files           7        7              
  Lines         657      659       +2     
==========================================
+ Hits          554      556       +2     
  Misses        103      103              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@nickrobinson251 nickrobinson251 left a comment

Choose a reason for hiding this comment

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

couple questions. Approved, but I'm always nervous about approving regex that don't have really extensive tests, so i'd love if there were references we could test against (maybe tests from official SDKs)?


# https://bucket.vpce-1a2b3c4d-5e6f.s3.region-code.vpce.amazonaws.com/bucket-name/key-name
# https://bucket.vpce-1a2b3c4d-5e6f.s3.region-code.vpce.amazonaws.com/bucket-name
m = match(r"^https://bucket\.vpce[^\.]+\.s3\.(?<region>[^\.]+)\.vpce\.amazonaws\.com/(?<bucket>[^/]+)(?:/(?<key>.+))?$"i, url)
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 link to docs for the schema?

Does this have to be https://bucket.vpce-... (with literal bucket) rather than https://<bucket-name-here>.vpce-...?

Copy link
Member Author

Choose a reason for hiding this comment

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

This should be a literal bucket AFAIK. I'll link the docs 👍

@@ -531,6 +531,9 @@ end
("S3://bucket-name", (true, false, nothing, "bucket-name", "", "")),
("HTtp://127.0.0.1:27181/bucket-name/key-name", (true, false, "HTtp://127.0.0.1:27181", "bucket-name", "", "key-name")),
("htTP://127.0.0.1:27181/bucket-name", (true, false, "htTP://127.0.0.1:27181", "bucket-name", "", "")),

("https://bucket.vpce-1a2b3c4d-5e6f.s3.us-west-2.vpce.amazonaws.com/bucket-name", (true, false, nothing, "bucket-name", "us-west-2", "")),
("https://bucket.vpce-1a2b3c4d-5e6f.s3.us-west-2.vpce.amazonaws.com/bucket-name/key-name", (true, false, nothing, "bucket-name", "us-west-2", "key-name")),
Copy link
Member

Choose a reason for hiding this comment

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

are there more things we should test other than these 2 happy paths?

e.g. what if the key-name has URI encoded special characters?

Are there AWS docs on what is / isn't valid?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, we use the same validation logic for all the URL styles, we apply it to the things we extract from the regex. I can add some cases that fail that validation.

@Drvi Drvi merged commit 0c8f299 into main Jan 24, 2024
7 checks passed
@Drvi Drvi deleted the td-basic-vpc branch January 24, 2024 13:44
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.

3 participants