shefali163 commented on code in PR #12914: URL: https://github.com/apache/arrow/pull/12914#discussion_r867866272
########## cpp/src/arrow/filesystem/azure/azurefs.cc: ########## @@ -0,0 +1,1651 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +#include "arrow/filesystem/azure/azurefs.h" + +#include <algorithm> +#include <atomic> +#include <azure/core/credentials/credentials.hpp> +#include <azure/identity/client_secret_credential.hpp> +#include <azure/identity/managed_identity_credential.hpp> +#include <azure/storage/blobs.hpp> +#include <azure/storage/files/datalake.hpp> +#include <chrono> +#include <condition_variable> +#include <functional> +#include <memory> +#include <mutex> +#include <sstream> +#include <thread> +#include <unordered_map> +#include <utility> + +#ifdef _WIN32 +// Undefine preprocessor macros that interfere with AWS function / method names +#ifdef GetMessage +#undef GetMessage +#endif +#ifdef GetObject +#undef GetObject +#endif +#endif + +#include "arrow/util/windows_fixup.h" + +#include "arrow/buffer.h" +#include "arrow/filesystem/filesystem.h" +#include "arrow/filesystem/path_util.h" +#include "arrow/filesystem/util_internal.h" +#include "arrow/io/interfaces.h" +#include "arrow/io/memory.h" +#include "arrow/io/util_internal.h" +#include "arrow/result.h" +#include "arrow/status.h" +#include "arrow/util/async_generator.h" +#include "arrow/util/atomic_shared_ptr.h" +#include "arrow/util/checked_cast.h" +#include "arrow/util/future.h" +#include "arrow/util/key_value_metadata.h" +#include "arrow/util/logging.h" +#include "arrow/util/optional.h" +#include "arrow/util/task_group.h" +#include "arrow/util/thread_pool.h" + +namespace arrow { + +using internal::Uri; + +namespace fs { + +static const char kSep = '/'; + +// ----------------------------------------------------------------------- +// AzureOptions implementation + +AzureOptions::AzureOptions() {} + +void AzureOptions::ConfigureAnonymousCredentials(const std::string& account_name) { + account_dfs_url = "https://" + account_name + ".dfs.core.windows.net/"; + account_blob_url = "https://" + account_name + ".blob.core.windows.net/"; + credentials_kind = AzureCredentialsKind::Anonymous; +} + +void AzureOptions::ConfigureAccountKeyCredentials(const std::string& account_name, + const std::string& account_key) { + account_dfs_url = "https://" + account_name + ".dfs.core.windows.net/"; + account_blob_url = "https://" + account_name + ".blob.core.windows.net/"; + storage_credentials_provider = + std::make_shared<Azure::Storage::StorageSharedKeyCredential>(account_name, + account_key); + credentials_kind = AzureCredentialsKind::StorageCredentials; +} + +void AzureOptions::ConfigureConnectionStringCredentials( + const std::string& connection_string_uri) { + auto account_name = + Azure::Storage::_internal::ParseConnectionString(connection_string_uri).AccountName; Review Comment: No public API is available for this, Added implementation of ParseConnectionString instead. -- 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]
