Skip to content
Open
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .vscode/cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@
"msedge",
"msft",
"msiexec",
"msit",
"msrc",
"MSRC",
"Mykhailo",
Expand Down Expand Up @@ -261,6 +262,7 @@
"serializers",
"Seriot",
"Shringarputale",
"sovcloud",
"southafricanorth",
"southcentralus",
"southeastasia",
Expand Down
13 changes: 12 additions & 1 deletion eng/pipelines/templates/steps/cmake-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,23 @@ steps:
Get-Content $configPath
Write-Host "##vso[task.setvariable variable=CargoConfigPath]$configPath"
displayName: Configure cargo to use the azure-sdk-for-rust feed
condition: and(succeeded(), ne(variables['System.PullRequest.IsFork'], 'True'))

- task: CargoAuthenticate@0
displayName: Authenticate cargo to the azure-sdk-for-rust feed
condition: and(succeeded(), ne(variables['System.PullRequest.IsFork'], 'True'))
inputs:
configFile: $(CargoConfigPath)

- pwsh: |
$forkCmakeArgs = ''
if ('${{ parameters.ServiceDirectory }}' -eq 'core' -and
$env:SYSTEM_PULLREQUEST_ISFORK -eq 'True') {
$forkCmakeArgs = '-DDISABLE_RUST_IN_BUILD=ON'
}
Write-Host "##vso[task.setvariable variable=ForkCmakeArgs]$forkCmakeArgs"
displayName: Configure fork CMake arguments

- script: cmake --version
workingDirectory: build
displayName: cmake --version
Expand All @@ -44,7 +55,7 @@ steps:
displayName: clang --version

- script: |
${{ parameters.Env }} cmake ${{ parameters.VcpkgArgs }} ${{ parameters.GenerateArgs }} ..
${{ parameters.Env }} cmake ${{ parameters.VcpkgArgs }} ${{ parameters.GenerateArgs }} $(ForkCmakeArgs) ..
workingDirectory: build
displayName: cmake generate
env:
Expand Down
11 changes: 8 additions & 3 deletions sdk/core/azure-core-amqp/Test-Setup.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,17 @@ Push-Location -Path $WorkingDirectory
try {

$repositoryUrl = "https://github.com/Azure/azure-amqp.git"
# We would like to use the "hotfix" branch because that is current, but unfortunately it references System.Net.Security version 4.0.0
$repositoryBranch = "master"
$cloneCommand = "git clone $repositoryUrl --branch $repositoryBranch"
$repositoryCommit = "d82a86455c3459c5628bc95b25511f6e8a065598"
$cloneCommand = "git clone $repositoryUrl"

Write-Host "Cloning repository from $repositoryUrl..."
Invoke-LoggedCommand $cloneCommand
Invoke-LoggedCommand "git -C azure-amqp checkout --detach $repositoryCommit"

$clonedNuGetConfig = Join-Path $WorkingDirectory "azure-amqp/nuget.config"
$azureSdkFeed = "https://pkgs.dev.azure.com/azure-sdk/public/_packaging/azure-sdk-for-net/nuget/v3/index.json"
dotnet nuget remove source "NuGet official package source" --configfile $clonedNuGetConfig
dotnet nuget add source $azureSdkFeed --name azure-sdk-for-net --configfile $clonedNuGetConfig

Set-Location -Path "./azure-amqp/test/TestAmqpBroker"

Expand Down
4 changes: 4 additions & 0 deletions sdk/core/azure-core-amqp/src/impl/uamqp/amqp/management.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ namespace Azure { namespace Core { namespace Amqp { namespace _detail {
{
throw std::runtime_error("Management object is already open.");
}
if (context.IsCancelled())
{
return _internal::ManagementOpenStatus::Cancelled;
}

try
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,6 @@ namespace Azure { namespace Core { namespace Amqp { namespace Tests {
{
auto connection{CreateAmqpConnection()};
auto session{CreateAmqpSession(connection)};
StartServerListening();

#if ENABLE_RUST_CANCEL
{
Expand All @@ -240,7 +239,6 @@ namespace Azure { namespace Core { namespace Amqp { namespace Tests {
EXPECT_EQ(CbsOpenResult::Cancelled, openResult);
}
#endif
StopServerListening();
EndAmqpSession(session);
CloseAmqpConnection(connection);
}
Expand Down
3 changes: 3 additions & 0 deletions sdk/storage/azure-storage-files-datalake/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

### Features Added

- Added `DataLakeFileSystemClient::CreateForOneLakeWorkspace` to construct Microsoft Fabric
OneLake workspace clients from supported OneLake service endpoints. ([#7274](https://github.com/Azure/azure-sdk-for-cpp/issues/7274))

### Breaking Changes

### Bugs Fixed
Expand Down
32 changes: 32 additions & 0 deletions sdk/storage/azure-storage-files-datalake/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,38 @@ create_code_coverage(storage azure-storage-files-datalake azure-storage-test "te

if(BUILD_TESTING)
add_subdirectory(test/ut)

find_package(Python3 COMPONENTS Interpreter REQUIRED)
Comment thread
akeensoysal marked this conversation as resolved.
Outdated

add_executable(
onelake-workspace-endpoint-live-test
test/live/onelake_workspace_endpoint_live_test.cpp
)
create_per_service_target_build(storage onelake-workspace-endpoint-live-test)
if(MSVC)
target_compile_definitions(onelake-workspace-endpoint-live-test PRIVATE _CRT_SECURE_NO_WARNINGS)
endif()
set_target_properties(
onelake-workspace-endpoint-live-test
PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/test/live/$<0:>"
)
target_compile_definitions(onelake-workspace-endpoint-live-test PRIVATE _azure_BUILDING_TESTS)
target_link_libraries(
onelake-workspace-endpoint-live-test
PRIVATE azure-storage-files-datalake azure-identity
)
copy_shared_lib_binaries(
onelake-workspace-endpoint-live-test
azure-storage-files-datalake azure-storage-blobs azure-storage-common azure-identity azure-core
)
add_test(
NAME azure-storage-files-datalake.OneLakeWorkspaceEndpointHarness
COMMAND
${Python3_EXECUTABLE}
${CMAKE_CURRENT_SOURCE_DIR}/test/live/onelake_workspace_endpoint_live_test.py
$<TARGET_FILE:onelake-workspace-endpoint-live-test>
${CMAKE_CURRENT_SOURCE_DIR}/test/live/fixtures
)
endif()

if(BUILD_SAMPLES)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,31 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake {
const std::string& fileSystemName,
const DataLakeClientOptions& options = DataLakeClientOptions());

/**
* @brief Creates a client for a Microsoft Fabric OneLake workspace.
*
* @param oneLakeServiceUrl A supported shared, regional, API, or workspace-specific OneLake
* service URL used to determine the workspace endpoint.
* @param workspaceId The workspace GUID, with or without hyphens.
* @param credential The token credential used to initialize the client.
* @param options Optional parameters used to initialize the client.
* @return A client targeting the workspace-specific OneLake endpoint.
* @throw std::invalid_argument If the URL or workspace ID is invalid, the credential is null,
* or the options specify a secondary host, customer-provided key, or non-default audience.
* @remark OneLake supports a subset of Azure Data Lake Storage operations. Workspace and item
* lifecycle, access policies, ACL mutation, encryption scopes, access tiers, and other
* Fabric-managed operations remain subject to the documented OneLake API parity limitations:
* https://learn.microsoft.com/fabric/onelake/onelake-api-parity.
* @remark Caller-provided policies and transports are trusted extension points. They can
* change request destinations after client construction and are outside this factory's
* destination validation guarantee.
*/
static DataLakeFileSystemClient CreateForOneLakeWorkspace(
const std::string& oneLakeServiceUrl,
const std::string& workspaceId,
std::shared_ptr<const Core::Credentials::TokenCredential> credential,
const DataLakeClientOptions& options = DataLakeClientOptions());

/**
* @brief Shared key authentication client.
* @param fileSystemUrl The URL of the file system this client's request targets.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ endif()

add_executable(datalake-getting-started datalake_getting_started.cpp)
create_per_service_target_build_for_sample(storage datalake-getting-started)
target_link_libraries(datalake-getting-started PRIVATE azure-storage-files-datalake get-env-helper)
target_link_libraries(datalake-getting-started PRIVATE azure-storage-files-datalake azure-identity get-env-helper)
target_compile_definitions(datalake-getting-started PRIVATE _azure_BUILDING_SAMPLES)
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

#include <azure/identity.hpp>
#include <azure/storage/files/datalake.hpp>

#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <stdexcept>

Expand All @@ -24,10 +26,46 @@ std::string GetConnectionString()
throw std::runtime_error("Cannot find connection string.");
}

bool TryRunOneLakeSample()
{
const char* workspaceId = std::getenv("AZURE_ONELAKE_WORKSPACE_ID");
const char* itemId = std::getenv("AZURE_ONELAKE_ITEM_ID");
if (workspaceId == nullptr && itemId == nullptr)
{
return false;
}
if (workspaceId == nullptr || itemId == nullptr)
{
throw std::runtime_error(
"AZURE_ONELAKE_WORKSPACE_ID and AZURE_ONELAKE_ITEM_ID must both be set.");
}

const char* configuredServiceUrl = std::getenv("AZURE_ONELAKE_SERVICE_URL");
const std::string serviceUrl = configuredServiceUrl == nullptr
? "https://onelake.dfs.fabric.microsoft.com"
: configuredServiceUrl;
auto credential = std::make_shared<Azure::Identity::DefaultAzureCredential>();
auto workspaceClient
= Azure::Storage::Files::DataLake::DataLakeFileSystemClient::CreateForOneLakeWorkspace(
serviceUrl, workspaceId, credential);

// Use only OneLake-supported data operations; Fabric manages workspace and item lifecycle.
auto filesDirectoryClient = workspaceClient.GetDirectoryClient(std::string(itemId) + "/Files");
filesDirectoryClient.GetProperties();
std::cout << "Connected to the OneLake Files directory: " << filesDirectoryClient.GetUrl()
<< std::endl;
return true;
}

int main()
{
using namespace Azure::Storage::Files::DataLake;

if (TryRunOneLakeSample())
{
return 0;
}

const std::string fileSystemName = "sample-file-system";
const std::string directoryName = "sample-directory";
const std::string fileName = "sample-file";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,28 +121,9 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake {
auto response = _detail::PathClient::Create(
*m_pipeline, destinationDfsUrl, protocolLayerOptions, context);

Azure::Nullable<Blobs::TransferValidationOptions> uploadValidationOptions;
if (m_clientConfiguration.UploadValidationOptions.HasValue())
{
Blobs::TransferValidationOptions blobOptions;
blobOptions.Algorithm = m_clientConfiguration.UploadValidationOptions.Value().Algorithm;
uploadValidationOptions = blobOptions;
}

Azure::Nullable<Blobs::TransferValidationOptions> downloadValidationOptions;
if (m_clientConfiguration.DownloadValidationOptions.HasValue())
{
Blobs::TransferValidationOptions blobOptions;
blobOptions.Algorithm = m_clientConfiguration.DownloadValidationOptions.Value().Algorithm;
downloadValidationOptions = blobOptions;
}
auto renamedBlobClient = Blobs::BlobClient(
_detail::GetBlobUrlFromUrl(destinationDfsUrl),
m_pipeline,
m_clientConfiguration.CustomerProvidedKey,
Azure::Nullable<std::string>(),
std::move(uploadValidationOptions),
std::move(downloadValidationOptions));
auto renamedBlobClient = m_blobClient;
renamedBlobClient.m_blobUrl.SetPath(_internal::UrlEncodePath(destinationFileSystem));
renamedBlobClient.m_blobUrl.AppendPath(_internal::UrlEncodePath(destinationFilePath));
auto renamedFileClient = DataLakeFileClient(
std::move(destinationDfsUrl),
std::move(renamedBlobClient),
Expand Down Expand Up @@ -192,29 +173,9 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake {
auto response = _detail::PathClient::Create(
*m_pipeline, destinationDfsUrl, protocolLayerOptions, context);

Azure::Nullable<Blobs::TransferValidationOptions> uploadValidationOptions;
if (m_clientConfiguration.UploadValidationOptions.HasValue())
{
Blobs::TransferValidationOptions blobOptions;
blobOptions.Algorithm = m_clientConfiguration.UploadValidationOptions.Value().Algorithm;
uploadValidationOptions = blobOptions;
}

Azure::Nullable<Blobs::TransferValidationOptions> downloadValidationOptions;
if (m_clientConfiguration.DownloadValidationOptions.HasValue())
{
Blobs::TransferValidationOptions blobOptions;
blobOptions.Algorithm = m_clientConfiguration.DownloadValidationOptions.Value().Algorithm;
downloadValidationOptions = blobOptions;
}

auto renamedBlobClient = Blobs::BlobClient(
_detail::GetBlobUrlFromUrl(destinationDfsUrl),
m_pipeline,
m_clientConfiguration.CustomerProvidedKey,
Azure::Nullable<std::string>(),
std::move(uploadValidationOptions),
std::move(downloadValidationOptions));
auto renamedBlobClient = m_blobClient;
renamedBlobClient.m_blobUrl.SetPath(_internal::UrlEncodePath(destinationFileSystem));
renamedBlobClient.m_blobUrl.AppendPath(_internal::UrlEncodePath(destinationDirectoryPath));
auto renamedDirectoryClient = DataLakeDirectoryClient(
std::move(destinationDfsUrl),
std::move(renamedBlobClient),
Expand Down
Loading
Loading