diff --git a/sdk/storage/Azure.Storage.Files.Shares/src/ShareDirectoryClient.cs b/sdk/storage/Azure.Storage.Files.Shares/src/ShareDirectoryClient.cs index bb7f99dc0e89..c04054caad4f 100644 --- a/sdk/storage/Azure.Storage.Files.Shares/src/ShareDirectoryClient.cs +++ b/sdk/storage/Azure.Storage.Files.Shares/src/ShareDirectoryClient.cs @@ -334,6 +334,39 @@ public ShareDirectoryClient( Errors.VerifyHttpsTokenAuth(directoryUri); } + /// + /// Initializes a new instance of the + /// class. + /// + /// + /// A referencing the directory that includes the + /// name of the account, the name of the share, and the path of the + /// directory. + /// + /// + /// The diagnostics from the parent client. + /// + /// + /// Optional client options that define the transport pipeline + /// policies for authentication, retries, etc., that are applied to + /// every request. + /// + 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); + } + /// /// Initializes a new instance of the /// class. @@ -2559,7 +2592,8 @@ private async Task> RenameInternal( // Create the destination path with the destination SAS destDirectoryClient = new ShareDirectoryClient( destUriBuilder.ToUri(), - ClientConfiguration); + ClientConfiguration.ClientDiagnostics, + ClientConfiguration.ClientOptions); } } else diff --git a/sdk/storage/Azure.Storage.Files.Shares/src/ShareFileClient.cs b/sdk/storage/Azure.Storage.Files.Shares/src/ShareFileClient.cs index b671bb3763a2..bc564df197f0 100644 --- a/sdk/storage/Azure.Storage.Files.Shares/src/ShareFileClient.cs +++ b/sdk/storage/Azure.Storage.Files.Shares/src/ShareFileClient.cs @@ -342,6 +342,41 @@ public ShareFileClient( Errors.VerifyHttpsTokenAuth(fileUri); } + /// + /// Initializes a new instance of the + /// class. + /// + /// + /// A referencing the file that includes the + /// name of the account, the name of the share, and the path of the + /// file. + /// + /// + /// The diagnostics from the parent client. + /// + /// + /// Optional client options that define the transport pipeline + /// policies for authentication, retries, etc., that are applied to + /// every request. + /// + 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); + } + /// /// Initializes a new instance of the /// class. @@ -6255,7 +6290,8 @@ private async Task> RenameInternal( // Create the destination path with the destination SAS destFileClient = new ShareFileClient( destUriBuilder.ToUri(), - ClientConfiguration); + ClientConfiguration.ClientDiagnostics, + ClientConfiguration.ClientOptions); } } else @@ -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.