Skip to content

Commit

Permalink
Fix for failing RenameAsync_SourceSasCredentialDestSasUri live tests (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
amnguye authored Jul 21, 2023
1 parent 5df0913 commit 60ad0fd
Show file tree
Hide file tree
Showing 2 changed files with 73 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,39 @@ public ShareDirectoryClient(
Errors.VerifyHttpsTokenAuth(directoryUri);
}

/// <summary>
/// Initializes a new instance of the <see cref="ShareDirectoryClient"/>
/// class.
/// </summary>
/// <param name="directoryUri">
/// A <see cref="Uri"/> referencing the directory that includes the
/// name of the account, the name of the share, and the path of the
/// directory.
/// </param>
/// <param name="diagnostics">
/// The diagnostics from the parent client.
/// </param>
/// <param name="options">
/// Optional client options that define the transport pipeline
/// policies for authentication, retries, etc., that are applied to
/// every request.
/// </param>
internal ShareDirectoryClient(
Uri directoryUri,
ClientDiagnostics diagnostics,
ShareClientOptions options)
{
Argument.AssertNotNull(directoryUri, nameof(directoryUri));
options ??= new ShareClientOptions();
_uri = directoryUri;
_clientConfiguration = new ShareClientConfiguration(
pipeline: options.Build(),
sharedKeyCredential: default,
clientDiagnostics: diagnostics,
clientOptions: options);
_directoryRestClient = BuildDirectoryRestClient(directoryUri);
}

/// <summary>
/// Initializes a new instance of the <see cref="ShareDirectoryClient"/>
/// class.
Expand Down Expand Up @@ -2559,7 +2592,8 @@ private async Task<Response<ShareDirectoryClient>> RenameInternal(
// Create the destination path with the destination SAS
destDirectoryClient = new ShareDirectoryClient(
destUriBuilder.ToUri(),
ClientConfiguration);
ClientConfiguration.ClientDiagnostics,
ClientConfiguration.ClientOptions);
}
}
else
Expand Down
40 changes: 38 additions & 2 deletions sdk/storage/Azure.Storage.Files.Shares/src/ShareFileClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,41 @@ public ShareFileClient(
Errors.VerifyHttpsTokenAuth(fileUri);
}

/// <summary>
/// Initializes a new instance of the <see cref="ShareFileClient"/>
/// class.
/// </summary>
/// <param name="fileUri">
/// A <see cref="Uri"/> referencing the file that includes the
/// name of the account, the name of the share, and the path of the
/// file.
/// </param>
/// <param name="diagnostics">
/// The diagnostics from the parent client.
/// </param>
/// <param name="options">
/// Optional client options that define the transport pipeline
/// policies for authentication, retries, etc., that are applied to
/// every request.
/// </param>
internal ShareFileClient(
Uri fileUri,
ClientDiagnostics diagnostics,
ShareClientOptions options)
{
Argument.AssertNotNull(fileUri, nameof(fileUri));
options ??= new ShareClientOptions();
_uri = fileUri;

_clientConfiguration = new ShareClientConfiguration(
pipeline: options.Build(),
sharedKeyCredential: default,
clientDiagnostics: diagnostics,
clientOptions: options);

_fileRestClient = BuildFileRestClient(fileUri);
}

/// <summary>
/// Initializes a new instance of the <see cref="ShareFileClient"/>
/// class.
Expand Down Expand Up @@ -6255,7 +6290,8 @@ private async Task<Response<ShareFileClient>> RenameInternal(
// Create the destination path with the destination SAS
destFileClient = new ShareFileClient(
destUriBuilder.ToUri(),
ClientConfiguration);
ClientConfiguration.ClientDiagnostics,
ClientConfiguration.ClientOptions);
}
}
else
Expand Down Expand Up @@ -6584,7 +6620,7 @@ public virtual Uri GenerateSasUri(ShareSasBuilder builder)
{
builder = builder ?? throw Errors.ArgumentNull(nameof(builder));

// Deep copy of builder so we don't modify the user's original DataLakeSasBuilder.
// Deep copy of builder so we don't modify the user's original ShareSasBuilder.
builder = ShareSasBuilder.DeepCopy(builder);

// Assign builder's ShareName and Path, if they are null.
Expand Down

0 comments on commit 60ad0fd

Please sign in to comment.