felipecrv commented on code in PR #41276:
URL: https://github.com/apache/arrow/pull/41276#discussion_r1571129208
##########
cpp/src/arrow/filesystem/azurefs.cc:
##########
@@ -381,6 +388,24 @@ AzureOptions::MakeDataLakeServiceClient() const {
return Status::Invalid("AzureOptions doesn't contain a valid auth
configuration");
}
+Result<std::string> AzureOptions::GenerateSASToken(
+ Storage::Sas::BlobSasBuilder* builder) const {
+ if (storage_shared_key_credential_) {
+ return builder->GenerateSasToken(*storage_shared_key_credential_);
+ } else {
+ // This part isn't tested. This may not work.
+ ARROW_ASSIGN_OR_RAISE(auto client, MakeBlobServiceClient());
Review Comment:
The caller already has a `BlobServiceClient`, so it's probably a good idea
to have a version of `GenerateSASToken` that takes one as parameter.
##########
cpp/src/arrow/filesystem/azurefs.cc:
##########
@@ -2868,8 +2886,19 @@ class AzureFileSystem::Impl {
if (src == dest) {
return Status::OK();
}
+ std::string sas_token;
+ {
+ Storage::Sas::BlobSasBuilder builder;
+ std::chrono::seconds available_period(60);
+ builder.ExpiresOn = std::chrono::system_clock::now() + available_period;
+ builder.BlobContainerName = src.container;
+ builder.BlobName = src.path;
+ builder.Resource = Storage::Sas::BlobSasResource::Blob;
+ builder.SetPermissions(Storage::Sas::BlobSasPermissions::Read);
+ ARROW_ASSIGN_OR_RAISE(sas_token, options_.GenerateSASToken(&builder));
+ }
+ auto src_url = GetBlobClient(src.container, src.path).GetUrl() + sas_token;
Review Comment:
What is a sas token that it can be concatenated just like this to an URL?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]