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 custom headers in s3 #4400

Merged
merged 5 commits into from
Oct 12, 2023
Merged

Add custom headers in s3 #4400

merged 5 commits into from
Oct 12, 2023

Conversation

bekadavis9
Copy link
Contributor

@bekadavis9 bekadavis9 commented Oct 4, 2023

Allow users to input custom headers using a new config option, vfs.s3.custom_headers.* with format config["vfs.s3.custom_headers.key_name"] = "header_value"


TYPE: FEATURE
DESC: Support custom headers on s3 requests

@shortcut-integration
Copy link

This pull request has been linked to Shortcut Story #31648: Capability to add headers to cURL requests for S3.

@bekadavis9
Copy link
Contributor Author

Functionality was validated locally, with findings here

@eric-hughes-tiledb
Copy link
Contributor

Functionality was validated locally, with findings here

We should not expect anyone to find this issue or a gist in order to be able to replicate the test. All the relevant files should be checked in somewhere, probably in a test directory of some sort.

Copy link
Member

@teo-tsirpanis teo-tsirpanis left a comment

Choose a reason for hiding this comment

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

Mostly good, thanks! Left some small comments.

tiledb/api/c_api/config/config_api_external.h Outdated Show resolved Hide resolved
tiledb/sm/filesystem/s3.cc Outdated Show resolved Hide resolved
Copy link
Member

@ihnorton ihnorton left a comment

Choose a reason for hiding this comment

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

Was there a reason to go with the subclass here rather than PutObject::SetAdditionalCustomHeaderValue discussed previously?

(also, as mentioned elsewhere: this should have a test harness; an approach was previously discussed, and outlined in the original ticket, which should take a small amount of python using the built-in HTTP server)

@ihnorton
Copy link
Member

ihnorton commented Oct 6, 2023

Also, we should specifically make sure this works for setting a custom User-Agent (additional use-case).

@eric-hughes-tiledb
Copy link
Contributor

eric-hughes-tiledb commented Oct 6, 2023

reason to go with the subclass here

It's gives a designated point of construction and makes C.41 compliance easier. Even though it's not done in the version I looked at, it provide a single place to parse and validate configuration values.

@teo-tsirpanis
Copy link
Member

Was there a reason to go with the subclass

It was my idea, after being asked offline. I hadn't noticed that PutObjectRequest derives from AmazonWebServiceRequest and there's an easier way.

One other advantage of the subclass is that the custom headers automatically apply to all kinds of S3 requests.

@ihnorton
Copy link
Member

ihnorton commented Oct 6, 2023

One other advantage of the subclass is that the custom headers automatically apply to all kinds of S3 requests.

👍 Thanks

Copy link
Contributor

@davisp davisp left a comment

Choose a reason for hiding this comment

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

Looks pretty good. Once you fix the syntax error and remove the unneeded config entry changes this will be good to go.

test/src/unit-capi-config.cc Outdated Show resolved Hide resolved
tiledb/api/c_api/config/config_api_external.h Outdated Show resolved Hide resolved
tiledb/sm/config/config.cc Outdated Show resolved Hide resolved
tiledb/sm/cpp_api/config.h Outdated Show resolved Hide resolved
tiledb/sm/filesystem/s3.h Outdated Show resolved Hide resolved
Copy link
Member

@teo-tsirpanis teo-tsirpanis left a comment

Choose a reason for hiding this comment

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

Thanks!

@teo-tsirpanis
Copy link
Member

@bekadavis9 can you update the title and description of the PR to account for the new config option and not mention curl?

Copy link
Contributor

@davisp davisp left a comment

Choose a reason for hiding this comment

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

+1

@bekadavis9 bekadavis9 changed the title Add custom curl headers in s3 Add custom headers in s3 Oct 11, 2023
@KiterLuc KiterLuc merged commit 0dc6650 into dev Oct 12, 2023
54 checks passed
@KiterLuc KiterLuc deleted the rd/curl_headers branch October 12, 2023 06:02
KiterLuc added a commit that referenced this pull request Jun 19, 2024
[SC-49141](https://app.shortcut.com/tiledb-inc/story/49141/add-support-for-custom-rest-headers-via-config)

Similar to S3 custom header support (#4400) this PR adds support for
custom headers in REST request. This allows users to set header via a
config parameter instead of the current `tildb_context_set_tag`. The
context set tag does not work in all cases because its not always
possible to use the same context, i.e SOMA and VCF python APIs can't
pass a TileDB-Py ctx to their respective C++ code.

Big thanks to @Shelnutt2 for implementing this. I added a test and
documentation.

---
TYPE: CONFIG
DESC: Add `rest.custom_headers.*` config option to set custom headers on
REST requests.

---------

Co-authored-by: Seth Shelnutt <[email protected]>
Co-authored-by: KiterLuc <[email protected]>
Co-authored-by: eric-hughes-tiledb <[email protected]>
Co-authored-by: Luc Rancourt <[email protected]>
KiterLuc added a commit that referenced this pull request Jun 19, 2024
[SC-49141](https://app.shortcut.com/tiledb-inc/story/49141/add-support-for-custom-rest-headers-via-config)

Similar to S3 custom header support (#4400) this PR adds support for
custom headers in REST request. This allows users to set header via a
config parameter instead of the current `tildb_context_set_tag`. The
context set tag does not work in all cases because its not always
possible to use the same context, i.e SOMA and VCF python APIs can't
pass a TileDB-Py ctx to their respective C++ code.

Big thanks to @Shelnutt2 for implementing this. I added a test and
documentation.

---
TYPE: CONFIG
DESC: Add `rest.custom_headers.*` config option to set custom headers on
REST requests.

---------

Co-authored-by: Seth Shelnutt <[email protected]>
Co-authored-by: KiterLuc <[email protected]>
Co-authored-by: eric-hughes-tiledb <[email protected]>
Co-authored-by: Luc Rancourt <[email protected]>
KiterLuc added a commit that referenced this pull request Jun 19, 2024
[SC-49141](https://app.shortcut.com/tiledb-inc/story/49141/add-support-for-custom-rest-headers-via-config)

Similar to S3 custom header support (#4400) this PR adds support for
custom headers in REST request. This allows users to set header via a
config parameter instead of the current `tildb_context_set_tag`. The
context set tag does not work in all cases because its not always
possible to use the same context, i.e SOMA and VCF python APIs can't
pass a TileDB-Py ctx to their respective C++ code.

Big thanks to @Shelnutt2 for implementing this. I added a test and
documentation.

---
TYPE: CONFIG
DESC: Add `rest.custom_headers.*` config option to set custom headers on
REST requests.

---------

Co-authored-by: Seth Shelnutt <[email protected]>
Co-authored-by: KiterLuc <[email protected]>
Co-authored-by: eric-hughes-tiledb <[email protected]>
Co-authored-by: Luc Rancourt <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants