From df8d71c8486ae727c9ece2bdd9158493ffcb19a9 Mon Sep 17 00:00:00 2001 From: Sean McCullough <44180881+seanmcc-msft@users.noreply.github.com> Date: Tue, 21 Feb 2023 18:12:18 -0600 Subject: [PATCH] STG 87 Arch Board Comments (#34331) --- .../tests/ClientBuilderExtensions.cs | 1 - .../tests/Shared/ClientBuilder.cs | 19 -------- .../tests/ClientBuilderExtensions.cs | 1 - .../tests/ClientBuilderExtensions.cs | 1 - .../tests/ClientBuilderExtensions.cs | 1 - ...ure.Storage.Files.Shares.netstandard2.0.cs | 33 +++++++++---- .../src/Generated/DirectoryRestClient.cs | 24 +++++----- .../src/Generated/FileRestClient.cs | 38 +++++++-------- .../ShareFileRequestIntent.Serialization.cs | 28 ----------- .../Models/ShareFileRequestIntent.cs | 18 ------- .../src/Generated/Models/ShareTokenIntent.cs | 48 +++++++++++++++++++ .../src/Generated/ShareRestClient.cs | 8 ++-- .../src/ShareClient.cs | 37 +++++++------- .../src/ShareClientConfiguration.cs | 10 ++-- .../src/ShareClientOptions.cs | 9 +++- .../src/ShareDirectoryClient.cs | 28 ++++------- .../src/ShareFileClient.cs | 28 ++++------- .../src/ShareServiceClient.cs | 22 +++------ .../src/autorest.md | 2 +- .../tests/ClientBuilderExtensions.cs | 12 +++-- .../tests/DirectoryClientTests.cs | 20 ++++---- .../tests/FileClientTests.cs | 48 +++++++++---------- .../tests/ShareClientTests.cs | 2 +- .../tests/QueueTestBase.cs | 1 - 24 files changed, 204 insertions(+), 235 deletions(-) delete mode 100644 sdk/storage/Azure.Storage.Files.Shares/src/Generated/Models/ShareFileRequestIntent.Serialization.cs delete mode 100644 sdk/storage/Azure.Storage.Files.Shares/src/Generated/Models/ShareFileRequestIntent.cs create mode 100644 sdk/storage/Azure.Storage.Files.Shares/src/Generated/Models/ShareTokenIntent.cs diff --git a/sdk/storage/Azure.Storage.Blobs/tests/ClientBuilderExtensions.cs b/sdk/storage/Azure.Storage.Blobs/tests/ClientBuilderExtensions.cs index 92b62db15d188..b9b484f3acf28 100644 --- a/sdk/storage/Azure.Storage.Blobs/tests/ClientBuilderExtensions.cs +++ b/sdk/storage/Azure.Storage.Blobs/tests/ClientBuilderExtensions.cs @@ -28,7 +28,6 @@ public static BlobsClientBuilder GetNewBlobsClientBuilder(TenantConfigurationBui (uri, clientOptions) => new BlobServiceClient(uri, clientOptions), (uri, sharedKeyCredential, clientOptions) => new BlobServiceClient(uri, sharedKeyCredential, clientOptions), (uri, tokenCredential, clientOptions) => new BlobServiceClient(uri, tokenCredential, clientOptions), - default, (uri, azureSasCredential, clientOptions) => new BlobServiceClient(uri, azureSasCredential, clientOptions), () => new BlobClientOptions(serviceVersion)); diff --git a/sdk/storage/Azure.Storage.Common/tests/Shared/ClientBuilder.cs b/sdk/storage/Azure.Storage.Common/tests/Shared/ClientBuilder.cs index a1017bd86fee2..9155ca33a5ed5 100644 --- a/sdk/storage/Azure.Storage.Common/tests/Shared/ClientBuilder.cs +++ b/sdk/storage/Azure.Storage.Common/tests/Shared/ClientBuilder.cs @@ -29,11 +29,6 @@ public class ClientBuilder /// public delegate TServiceClient GetServiceClientTokenCredential(Uri endpoint, TokenCredential credential, TServiceClientOptions clientOptions); - /// - /// Delegate for accessing a token credential constructor with parameter for a service client. - /// - public delegate TServiceClient GetServiceClientTokenCredentialWithParameter(Uri endpoint, TokenCredential credential, object credentialParameter, TServiceClientOptions clientOptions); - /// /// Delegate for accessing a credential-less constructor for a service client. /// @@ -60,7 +55,6 @@ public class ClientBuilder private readonly GetServiceClientStorageSharedKeyCredential _getServiceClientStorageSharedKeyCredential; private readonly GetServiceClientAzureSasCredential _getServiceClientAzureSasCredential; private readonly GetServiceClientTokenCredential _getServiceClientTokenCredential; - private readonly GetServiceClientTokenCredentialWithParameter _getServiceClientTokenCredentialWithParameter; private readonly GetServiceClient _getServiceClient; private readonly GetServiceClientOptions _getServiceClientOptions; @@ -94,7 +88,6 @@ public ClientBuilder( GetServiceClient getServiceClient, GetServiceClientStorageSharedKeyCredential getServiceClientStorageSharedKeyCredential, GetServiceClientTokenCredential getServiceClientTokenCredential, - GetServiceClientTokenCredentialWithParameter getServiceClientTokenCredentialWithParameter, GetServiceClientAzureSasCredential getServiceClientAzureSasCredential, GetServiceClientOptions getServiceClientOptions) { @@ -103,7 +96,6 @@ public ClientBuilder( _getServiceClient = getServiceClient; _getServiceClientStorageSharedKeyCredential = getServiceClientStorageSharedKeyCredential; _getServiceClientTokenCredential = getServiceClientTokenCredential; - _getServiceClientTokenCredentialWithParameter = getServiceClientTokenCredentialWithParameter; _getServiceClientAzureSasCredential = getServiceClientAzureSasCredential; _getServiceClientOptions = getServiceClientOptions; } @@ -152,17 +144,6 @@ public TServiceClient GetServiceClientFromOauthConfig( Tenants.GetOAuthCredential(config), options ?? GetOptions())); - public TServiceClient GetServiceClientFromOauthConfigWithParameter( - TenantConfiguration config, - TServiceClientOptions options = default, - object parameter = default) - => AzureCoreRecordedTestBase.InstrumentClient( - _getServiceClientTokenCredentialWithParameter( - new Uri(GetEndpoint(config)), - Tenants.GetOAuthCredential(config), - parameter, - options ?? GetOptions())); - public TServiceClientOptions GetOptions(bool parallelRange = false) { var options = _getServiceClientOptions(); diff --git a/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/ClientBuilderExtensions.cs b/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/ClientBuilderExtensions.cs index 5c8465b93491a..c58f0a0fda798 100644 --- a/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/ClientBuilderExtensions.cs +++ b/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/ClientBuilderExtensions.cs @@ -29,7 +29,6 @@ public static BlobsClientBuilder GetNewBlobsClientBuilder(TenantConfigurationBui (uri, clientOptions) => new BlobServiceClient(uri, clientOptions), (uri, sharedKeyCredential, clientOptions) => new BlobServiceClient(uri, sharedKeyCredential, clientOptions), (uri, tokenCredential, clientOptions) => new BlobServiceClient(uri, tokenCredential, clientOptions), - default, (uri, azureSasCredential, clientOptions) => new BlobServiceClient(uri, azureSasCredential, clientOptions), () => new BlobClientOptions(serviceVersion)); public static string GetNewContainerName(this BlobsClientBuilder clientBuilder) diff --git a/sdk/storage/Azure.Storage.DataMovement/tests/ClientBuilderExtensions.cs b/sdk/storage/Azure.Storage.DataMovement/tests/ClientBuilderExtensions.cs index f7d29f1e1c22a..8b93c7355543d 100644 --- a/sdk/storage/Azure.Storage.DataMovement/tests/ClientBuilderExtensions.cs +++ b/sdk/storage/Azure.Storage.DataMovement/tests/ClientBuilderExtensions.cs @@ -28,7 +28,6 @@ public static BlobsClientBuilder GetNewBlobsClientBuilder(TenantConfigurationBui (uri, clientOptions) => new BlobServiceClient(uri, clientOptions), (uri, sharedKeyCredential, clientOptions) => new BlobServiceClient(uri, sharedKeyCredential, clientOptions), (uri, tokenCredential, clientOptions) => new BlobServiceClient(uri, tokenCredential, clientOptions), - default, (uri, azureSasCredential, clientOptions) => new BlobServiceClient(uri, azureSasCredential, clientOptions), () => new BlobClientOptions(serviceVersion)); diff --git a/sdk/storage/Azure.Storage.Files.DataLake/tests/ClientBuilderExtensions.cs b/sdk/storage/Azure.Storage.Files.DataLake/tests/ClientBuilderExtensions.cs index c278868c994f3..37fcd54f8072d 100644 --- a/sdk/storage/Azure.Storage.Files.DataLake/tests/ClientBuilderExtensions.cs +++ b/sdk/storage/Azure.Storage.Files.DataLake/tests/ClientBuilderExtensions.cs @@ -30,7 +30,6 @@ public static DataLakeClientBuilder GetNewDataLakeClientBuilder(TenantConfigurat (uri, clientOptions) => new DataLakeServiceClient(uri, clientOptions), (uri, sharedKeyCredential, clientOptions) => new DataLakeServiceClient(uri, sharedKeyCredential, clientOptions), (uri, tokenCredential, clientOptions) => new DataLakeServiceClient(uri, tokenCredential, clientOptions), - default, (uri, azureSasCredential, clientOptions) => new DataLakeServiceClient(uri, azureSasCredential, clientOptions), () => new DataLakeClientOptions(serviceVersion)); diff --git a/sdk/storage/Azure.Storage.Files.Shares/api/Azure.Storage.Files.Shares.netstandard2.0.cs b/sdk/storage/Azure.Storage.Files.Shares/api/Azure.Storage.Files.Shares.netstandard2.0.cs index 2d035c34ba448..022c6333c11f7 100644 --- a/sdk/storage/Azure.Storage.Files.Shares/api/Azure.Storage.Files.Shares.netstandard2.0.cs +++ b/sdk/storage/Azure.Storage.Files.Shares/api/Azure.Storage.Files.Shares.netstandard2.0.cs @@ -6,7 +6,7 @@ protected ShareClient() { } public ShareClient(string connectionString, string shareName) { } public ShareClient(string connectionString, string shareName, Azure.Storage.Files.Shares.ShareClientOptions options) { } public ShareClient(System.Uri shareUri, Azure.AzureSasCredential credential, Azure.Storage.Files.Shares.ShareClientOptions options = null) { } - public ShareClient(System.Uri shareUri, Azure.Core.TokenCredential credential, Azure.Storage.Files.Shares.Models.ShareFileRequestIntent? fileRequestIntent = default(Azure.Storage.Files.Shares.Models.ShareFileRequestIntent?), Azure.Storage.Files.Shares.ShareClientOptions options = null) { } + public ShareClient(System.Uri shareUri, Azure.Core.TokenCredential credential, Azure.Storage.Files.Shares.ShareClientOptions options = null) { } public ShareClient(System.Uri shareUri, Azure.Storage.Files.Shares.ShareClientOptions options = null) { } public ShareClient(System.Uri shareUri, Azure.Storage.StorageSharedKeyCredential credential, Azure.Storage.Files.Shares.ShareClientOptions options = null) { } public virtual string AccountName { get { throw null; } } @@ -98,8 +98,9 @@ public ShareClient(System.Uri shareUri, Azure.Storage.StorageSharedKeyCredential public partial class ShareClientOptions : Azure.Core.ClientOptions { public ShareClientOptions(Azure.Storage.Files.Shares.ShareClientOptions.ServiceVersion version = Azure.Storage.Files.Shares.ShareClientOptions.ServiceVersion.V2021_12_02) { } + public bool? AllowSourceTrailingDot { get { throw null; } set { } } public bool? AllowTrailingDot { get { throw null; } set { } } - public bool? SourceAllowTrailingDot { get { throw null; } set { } } + public Azure.Storage.Files.Shares.Models.ShareTokenIntent? ShareTokenIntent { get { throw null; } set { } } public Azure.Storage.TransferValidationOptions TransferValidation { get { throw null; } } public Azure.Storage.Files.Shares.ShareClientOptions.ServiceVersion Version { get { throw null; } } public enum ServiceVersion @@ -128,7 +129,7 @@ protected ShareDirectoryClient() { } public ShareDirectoryClient(string connectionString, string shareName, string directoryPath) { } public ShareDirectoryClient(string connectionString, string shareName, string directoryPath, Azure.Storage.Files.Shares.ShareClientOptions options) { } public ShareDirectoryClient(System.Uri directoryUri, Azure.AzureSasCredential credential, Azure.Storage.Files.Shares.ShareClientOptions options = null) { } - public ShareDirectoryClient(System.Uri directoryUri, Azure.Core.TokenCredential credential, Azure.Storage.Files.Shares.Models.ShareFileRequestIntent? fileRequestIntent = default(Azure.Storage.Files.Shares.Models.ShareFileRequestIntent?), Azure.Storage.Files.Shares.ShareClientOptions options = null) { } + public ShareDirectoryClient(System.Uri directoryUri, Azure.Core.TokenCredential credential, Azure.Storage.Files.Shares.ShareClientOptions options = null) { } public ShareDirectoryClient(System.Uri directoryUri, Azure.Storage.Files.Shares.ShareClientOptions options = null) { } public ShareDirectoryClient(System.Uri directoryUri, Azure.Storage.StorageSharedKeyCredential credential, Azure.Storage.Files.Shares.ShareClientOptions options = null) { } public virtual string AccountName { get { throw null; } } @@ -195,7 +196,7 @@ protected ShareFileClient() { } public ShareFileClient(string connectionString, string shareName, string filePath) { } public ShareFileClient(string connectionString, string shareName, string filePath, Azure.Storage.Files.Shares.ShareClientOptions options) { } public ShareFileClient(System.Uri fileUri, Azure.AzureSasCredential credential, Azure.Storage.Files.Shares.ShareClientOptions options = null) { } - public ShareFileClient(System.Uri fileUri, Azure.Core.TokenCredential credential, Azure.Storage.Files.Shares.Models.ShareFileRequestIntent? fileRequestIntent = default(Azure.Storage.Files.Shares.Models.ShareFileRequestIntent?), Azure.Storage.Files.Shares.ShareClientOptions options = null) { } + public ShareFileClient(System.Uri fileUri, Azure.Core.TokenCredential credential, Azure.Storage.Files.Shares.ShareClientOptions options = null) { } public ShareFileClient(System.Uri fileUri, Azure.Storage.Files.Shares.ShareClientOptions options = null) { } public ShareFileClient(System.Uri fileUri, Azure.Storage.StorageSharedKeyCredential credential, Azure.Storage.Files.Shares.ShareClientOptions options = null) { } public virtual string AccountName { get { throw null; } } @@ -340,7 +341,7 @@ protected ShareServiceClient() { } public ShareServiceClient(string connectionString) { } public ShareServiceClient(string connectionString, Azure.Storage.Files.Shares.ShareClientOptions options) { } public ShareServiceClient(System.Uri serviceUri, Azure.AzureSasCredential credential, Azure.Storage.Files.Shares.ShareClientOptions options = null) { } - public ShareServiceClient(System.Uri serviceUri, Azure.Core.TokenCredential credential, Azure.Storage.Files.Shares.Models.ShareFileRequestIntent? fileRequestIntent = default(Azure.Storage.Files.Shares.Models.ShareFileRequestIntent?), Azure.Storage.Files.Shares.ShareClientOptions options = null) { } + public ShareServiceClient(System.Uri serviceUri, Azure.Core.TokenCredential credential, Azure.Storage.Files.Shares.ShareClientOptions options = null) { } public ShareServiceClient(System.Uri serviceUri, Azure.Storage.Files.Shares.ShareClientOptions options = null) { } public ShareServiceClient(System.Uri serviceUri, Azure.Storage.StorageSharedKeyCredential credential, Azure.Storage.Files.Shares.ShareClientOptions options = null) { } public virtual string AccountName { get { throw null; } } @@ -860,11 +861,6 @@ public ShareFileRequestConditions() { } public string LeaseId { get { throw null; } set { } } public override string ToString() { throw null; } } - public enum ShareFileRequestIntent - { - None = 0, - Backup = 1, - } [System.FlagsAttribute] public enum ShareFileTraits { @@ -1087,6 +1083,23 @@ internal ShareStatistics() { } public int ShareUsageBytes { get { throw null; } } public long ShareUsageInBytes { get { throw null; } } } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct ShareTokenIntent : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public ShareTokenIntent(string value) { throw null; } + public static Azure.Storage.Files.Shares.Models.ShareTokenIntent Backup { get { throw null; } } + public bool Equals(Azure.Storage.Files.Shares.Models.ShareTokenIntent other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.Storage.Files.Shares.Models.ShareTokenIntent left, Azure.Storage.Files.Shares.Models.ShareTokenIntent right) { throw null; } + public static implicit operator Azure.Storage.Files.Shares.Models.ShareTokenIntent (string value) { throw null; } + public static bool operator !=(Azure.Storage.Files.Shares.Models.ShareTokenIntent left, Azure.Storage.Files.Shares.Models.ShareTokenIntent right) { throw null; } + public override string ToString() { throw null; } + } [System.FlagsAttribute] public enum ShareTraits { diff --git a/sdk/storage/Azure.Storage.Files.Shares/src/Generated/DirectoryRestClient.cs b/sdk/storage/Azure.Storage.Files.Shares/src/Generated/DirectoryRestClient.cs index 9303ff37bebe5..40d0a8cbab77e 100644 --- a/sdk/storage/Azure.Storage.Files.Shares/src/Generated/DirectoryRestClient.cs +++ b/sdk/storage/Azure.Storage.Files.Shares/src/Generated/DirectoryRestClient.cs @@ -22,7 +22,7 @@ internal partial class DirectoryRestClient private readonly string _url; private readonly bool? _allowTrailingDot; private readonly string _version; - private readonly ShareFileRequestIntent? _fileRequestIntent; + private readonly ShareTokenIntent? _fileRequestIntent; private readonly bool? _allowSourceTrailingDot; /// The ClientDiagnostics is used to provide tracing support for the client library. @@ -37,7 +37,7 @@ internal partial class DirectoryRestClient /// Valid value is backup. /// If true, the trailing dot will not be trimmed from the source URI. /// , , or is null. - public DirectoryRestClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string url, bool? allowTrailingDot = null, string version = "2022-11-02", ShareFileRequestIntent? fileRequestIntent = null, bool? allowSourceTrailingDot = null) + public DirectoryRestClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string url, bool? allowTrailingDot = null, string version = "2022-11-02", ShareTokenIntent? fileRequestIntent = null, bool? allowSourceTrailingDot = null) { ClientDiagnostics = clientDiagnostics ?? throw new ArgumentNullException(nameof(clientDiagnostics)); _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); @@ -93,7 +93,7 @@ internal HttpMessage CreateCreateRequest(string fileAttributes, int? timeout, ID } if (_fileRequestIntent != null) { - request.Headers.Add("x-ms-file-request-intent", _fileRequestIntent.Value.ToSerialString()); + request.Headers.Add("x-ms-file-request-intent", _fileRequestIntent.Value.ToString()); } request.Headers.Add("Accept", "application/xml"); return message; @@ -183,7 +183,7 @@ internal HttpMessage CreateGetPropertiesRequest(string sharesnapshot, int? timeo request.Headers.Add("x-ms-version", _version); if (_fileRequestIntent != null) { - request.Headers.Add("x-ms-file-request-intent", _fileRequestIntent.Value.ToSerialString()); + request.Headers.Add("x-ms-file-request-intent", _fileRequestIntent.Value.ToString()); } request.Headers.Add("Accept", "application/xml"); return message; @@ -245,7 +245,7 @@ internal HttpMessage CreateDeleteRequest(int? timeout) request.Headers.Add("x-ms-version", _version); if (_fileRequestIntent != null) { - request.Headers.Add("x-ms-file-request-intent", _fileRequestIntent.Value.ToSerialString()); + request.Headers.Add("x-ms-file-request-intent", _fileRequestIntent.Value.ToString()); } request.Headers.Add("Accept", "application/xml"); return message; @@ -327,7 +327,7 @@ internal HttpMessage CreateSetPropertiesRequest(string fileAttributes, int? time } if (_fileRequestIntent != null) { - request.Headers.Add("x-ms-file-request-intent", _fileRequestIntent.Value.ToSerialString()); + request.Headers.Add("x-ms-file-request-intent", _fileRequestIntent.Value.ToString()); } request.Headers.Add("Accept", "application/xml"); return message; @@ -416,7 +416,7 @@ internal HttpMessage CreateSetMetadataRequest(int? timeout, IDictionary Only update is supported: - Update: Writes the bytes downloaded from the source url into the specified range. /// If true, the trailing dot will not be trimmed from the source URI. /// , , , or is null. - public FileRestClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string url, bool? allowTrailingDot = null, string version = "2022-11-02", ShareFileRequestIntent? fileRequestIntent = null, string fileRangeWriteFromUrl = "update", bool? allowSourceTrailingDot = null) + public FileRestClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string url, bool? allowTrailingDot = null, string version = "2022-11-02", ShareTokenIntent? fileRequestIntent = null, string fileRangeWriteFromUrl = "update", bool? allowSourceTrailingDot = null) { ClientDiagnostics = clientDiagnostics ?? throw new ArgumentNullException(nameof(clientDiagnostics)); _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); @@ -126,7 +126,7 @@ internal HttpMessage CreateCreateRequest(long fileContentLength, string fileAttr } if (_fileRequestIntent != null) { - request.Headers.Add("x-ms-file-request-intent", _fileRequestIntent.Value.ToSerialString()); + request.Headers.Add("x-ms-file-request-intent", _fileRequestIntent.Value.ToString()); } request.Headers.Add("Accept", "application/xml"); return message; @@ -230,7 +230,7 @@ internal HttpMessage CreateDownloadRequest(int? timeout, string range, bool? ran } if (_fileRequestIntent != null) { - request.Headers.Add("x-ms-file-request-intent", _fileRequestIntent.Value.ToSerialString()); + request.Headers.Add("x-ms-file-request-intent", _fileRequestIntent.Value.ToString()); } request.Headers.Add("Accept", "application/xml"); return message; @@ -311,7 +311,7 @@ internal HttpMessage CreateGetPropertiesRequest(string sharesnapshot, int? timeo } if (_fileRequestIntent != null) { - request.Headers.Add("x-ms-file-request-intent", _fileRequestIntent.Value.ToSerialString()); + request.Headers.Add("x-ms-file-request-intent", _fileRequestIntent.Value.ToString()); } request.Headers.Add("Accept", "application/xml"); return message; @@ -378,7 +378,7 @@ internal HttpMessage CreateDeleteRequest(int? timeout, ShareFileRequestCondition } if (_fileRequestIntent != null) { - request.Headers.Add("x-ms-file-request-intent", _fileRequestIntent.Value.ToSerialString()); + request.Headers.Add("x-ms-file-request-intent", _fileRequestIntent.Value.ToString()); } request.Headers.Add("Accept", "application/xml"); return message; @@ -493,7 +493,7 @@ internal HttpMessage CreateSetHttpHeadersRequest(string fileAttributes, int? tim } if (_fileRequestIntent != null) { - request.Headers.Add("x-ms-file-request-intent", _fileRequestIntent.Value.ToSerialString()); + request.Headers.Add("x-ms-file-request-intent", _fileRequestIntent.Value.ToString()); } request.Headers.Add("Accept", "application/xml"); return message; @@ -591,7 +591,7 @@ internal HttpMessage CreateSetMetadataRequest(int? timeout, IDictionary - -#nullable disable - -using System; - -namespace Azure.Storage.Files.Shares.Models -{ - internal static partial class ShareFileRequestIntentExtensions - { - public static string ToSerialString(this ShareFileRequestIntent value) => value switch - { - ShareFileRequestIntent.None => "none", - ShareFileRequestIntent.Backup => "backup", - _ => throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown ShareFileRequestIntent value.") - }; - - public static ShareFileRequestIntent ToShareFileRequestIntent(this string value) - { - if (string.Equals(value, "none", StringComparison.InvariantCultureIgnoreCase)) return ShareFileRequestIntent.None; - if (string.Equals(value, "backup", StringComparison.InvariantCultureIgnoreCase)) return ShareFileRequestIntent.Backup; - throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown ShareFileRequestIntent value."); - } - } -} diff --git a/sdk/storage/Azure.Storage.Files.Shares/src/Generated/Models/ShareFileRequestIntent.cs b/sdk/storage/Azure.Storage.Files.Shares/src/Generated/Models/ShareFileRequestIntent.cs deleted file mode 100644 index ccf846f7b1439..0000000000000 --- a/sdk/storage/Azure.Storage.Files.Shares/src/Generated/Models/ShareFileRequestIntent.cs +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -namespace Azure.Storage.Files.Shares.Models -{ - /// The ShareFileRequestIntent. - public enum ShareFileRequestIntent - { - /// none. - None, - /// backup. - Backup - } -} diff --git a/sdk/storage/Azure.Storage.Files.Shares/src/Generated/Models/ShareTokenIntent.cs b/sdk/storage/Azure.Storage.Files.Shares/src/Generated/Models/ShareTokenIntent.cs new file mode 100644 index 0000000000000..de9251c42ad9e --- /dev/null +++ b/sdk/storage/Azure.Storage.Files.Shares/src/Generated/Models/ShareTokenIntent.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.Storage.Files.Shares.Models +{ + /// The ShareTokenIntent. + public readonly partial struct ShareTokenIntent : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public ShareTokenIntent(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string BackupValue = "backup"; + + /// backup. + public static ShareTokenIntent Backup { get; } = new ShareTokenIntent(BackupValue); + /// Determines if two values are the same. + public static bool operator ==(ShareTokenIntent left, ShareTokenIntent right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ShareTokenIntent left, ShareTokenIntent right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator ShareTokenIntent(string value) => new ShareTokenIntent(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ShareTokenIntent other && Equals(other); + /// + public bool Equals(ShareTokenIntent other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/storage/Azure.Storage.Files.Shares/src/Generated/ShareRestClient.cs b/sdk/storage/Azure.Storage.Files.Shares/src/Generated/ShareRestClient.cs index c515491222a47..cd086c78a3d7f 100644 --- a/sdk/storage/Azure.Storage.Files.Shares/src/Generated/ShareRestClient.cs +++ b/sdk/storage/Azure.Storage.Files.Shares/src/Generated/ShareRestClient.cs @@ -22,7 +22,7 @@ internal partial class ShareRestClient private readonly HttpPipeline _pipeline; private readonly string _url; private readonly string _version; - private readonly ShareFileRequestIntent? _fileRequestIntent; + private readonly ShareTokenIntent? _fileRequestIntent; /// The ClientDiagnostics is used to provide tracing support for the client library. internal ClientDiagnostics ClientDiagnostics { get; } @@ -34,7 +34,7 @@ internal partial class ShareRestClient /// Specifies the version of the operation to use for this request. /// Valid value is backup. /// , , or is null. - public ShareRestClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string url, string version = "2022-11-02", ShareFileRequestIntent? fileRequestIntent = null) + public ShareRestClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string url, string version = "2022-11-02", ShareTokenIntent? fileRequestIntent = null) { ClientDiagnostics = clientDiagnostics ?? throw new ArgumentNullException(nameof(clientDiagnostics)); _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); @@ -710,7 +710,7 @@ internal HttpMessage CreateCreatePermissionRequest(SharePermission sharePermissi request.Headers.Add("x-ms-version", _version); if (_fileRequestIntent != null) { - request.Headers.Add("x-ms-file-request-intent", _fileRequestIntent.Value.ToSerialString()); + request.Headers.Add("x-ms-file-request-intent", _fileRequestIntent.Value.ToString()); } request.Headers.Add("Accept", "application/xml"); request.Headers.Add("Content-Type", "application/json"); @@ -786,7 +786,7 @@ internal HttpMessage CreateGetPermissionRequest(string filePermissionKey, int? t request.Headers.Add("x-ms-version", _version); if (_fileRequestIntent != null) { - request.Headers.Add("x-ms-file-request-intent", _fileRequestIntent.Value.ToSerialString()); + request.Headers.Add("x-ms-file-request-intent", _fileRequestIntent.Value.ToString()); } request.Headers.Add("Accept", "application/json"); return message; diff --git a/sdk/storage/Azure.Storage.Files.Shares/src/ShareClient.cs b/sdk/storage/Azure.Storage.Files.Shares/src/ShareClient.cs index 88bb1a9979174..d5341abd516c5 100644 --- a/sdk/storage/Azure.Storage.Files.Shares/src/ShareClient.cs +++ b/sdk/storage/Azure.Storage.Files.Shares/src/ShareClient.cs @@ -206,7 +206,7 @@ public ShareClient( Uri shareUri, StorageSharedKeyCredential credential, ShareClientOptions options = default) - : this(shareUri, credential.AsPolicy(), options, credential, default) + : this(shareUri, credential.AsPolicy(), options, credential) { } @@ -245,6 +245,17 @@ public ShareClient( /// /// Initializes a new instance of the /// class. + /// + /// Note that the only share-level operations that support token credential authentication are + /// , + /// , + /// , and + /// . + /// + /// This constructor also allow the construction of a that can be used to derive + /// a that has token credential authentication. + /// + /// Also note that is currently required for token authentication. /// /// /// A referencing the share that includes the @@ -253,9 +264,6 @@ public ShareClient( /// /// The token credential used to sign requests. /// - /// - /// File request intent. - /// /// /// Optional client options that define the transport pipeline /// policies for authentication, retries, etc., that are applied to @@ -264,14 +272,12 @@ public ShareClient( public ShareClient( Uri shareUri, TokenCredential credential, - ShareFileRequestIntent? fileRequestIntent = default, ShareClientOptions options = default) : this( - shareUri, - credential.AsPolicy(options), - options ?? new ShareClientOptions(), - default, - fileRequestIntent: fileRequestIntent) + shareUri: shareUri, + authentication: credential.AsPolicy(options), + options: options ?? new ShareClientOptions(), + storageSharedKeyCredential: default) { Errors.VerifyHttpsTokenAuth(shareUri); } @@ -292,9 +298,6 @@ public ShareClient( /// policies for authentication, retries, etc., that are applied to /// every request. /// - /// - /// File request intent. - /// /// /// The shared key credential used to sign requests. /// @@ -302,8 +305,7 @@ internal ShareClient( Uri shareUri, HttpPipelinePolicy authentication, ShareClientOptions options, - StorageSharedKeyCredential storageSharedKeyCredential, - ShareFileRequestIntent? fileRequestIntent) + StorageSharedKeyCredential storageSharedKeyCredential) { Argument.AssertNotNull(shareUri, nameof(shareUri)); options ??= new ShareClientOptions(); @@ -313,8 +315,7 @@ internal ShareClient( sharedKeyCredential: storageSharedKeyCredential, sasCredential: default, clientDiagnostics: new ClientDiagnostics(options), - clientOptions: options, - fileRequestIntent: fileRequestIntent); + clientOptions: options); _shareRestClient = BuildShareRestClient(shareUri); } @@ -381,7 +382,7 @@ private ShareRestClient BuildShareRestClient(Uri uri) _clientConfiguration.Pipeline, uri.AbsoluteUri, _clientConfiguration.ClientOptions.Version.ToVersionString(), - _clientConfiguration.FileRequestIntent); + _clientConfiguration.ClientOptions.ShareTokenIntent); } #endregion ctors diff --git a/sdk/storage/Azure.Storage.Files.Shares/src/ShareClientConfiguration.cs b/sdk/storage/Azure.Storage.Files.Shares/src/ShareClientConfiguration.cs index fc69bcdfd4302..baadc154fc7dd 100644 --- a/sdk/storage/Azure.Storage.Files.Shares/src/ShareClientConfiguration.cs +++ b/sdk/storage/Azure.Storage.Files.Shares/src/ShareClientConfiguration.cs @@ -13,14 +13,12 @@ internal class ShareClientConfiguration : StorageClientConfiguration public TransferValidationOptions TransferValidation { get; internal set; } - public ShareFileRequestIntent? FileRequestIntent { get; internal set; } - public ShareClientConfiguration( HttpPipeline pipeline, StorageSharedKeyCredential sharedKeyCredential, ClientDiagnostics clientDiagnostics, ShareClientOptions clientOptions) - : this(pipeline, sharedKeyCredential, default, clientDiagnostics, clientOptions, default) + : this(pipeline, sharedKeyCredential, default, clientDiagnostics, clientOptions) { } @@ -29,7 +27,7 @@ public ShareClientConfiguration( AzureSasCredential sasCredential, ClientDiagnostics clientDiagnostics, ShareClientOptions clientOptions) - : this(pipeline, default, sasCredential, clientDiagnostics, clientOptions, default) + : this(pipeline, default, sasCredential, clientDiagnostics, clientOptions) { } @@ -38,13 +36,11 @@ internal ShareClientConfiguration( StorageSharedKeyCredential sharedKeyCredential, AzureSasCredential sasCredential, ClientDiagnostics clientDiagnostics, - ShareClientOptions clientOptions, - ShareFileRequestIntent? fileRequestIntent) + ShareClientOptions clientOptions) : base(pipeline, sharedKeyCredential, sasCredential, default, clientDiagnostics) { ClientOptions = clientOptions; TransferValidation = clientOptions.TransferValidation; - FileRequestIntent = fileRequestIntent; } } } diff --git a/sdk/storage/Azure.Storage.Files.Shares/src/ShareClientOptions.cs b/sdk/storage/Azure.Storage.Files.Shares/src/ShareClientOptions.cs index 6bf42f7628d9d..d01e173c0cad3 100644 --- a/sdk/storage/Azure.Storage.Files.Shares/src/ShareClientOptions.cs +++ b/sdk/storage/Azure.Storage.Files.Shares/src/ShareClientOptions.cs @@ -2,6 +2,7 @@ // Licensed under the MIT License. using Azure.Core; +using Azure.Storage.Files.Shares.Models; namespace Azure.Storage.Files.Shares { @@ -144,7 +145,13 @@ public enum ServiceVersion /// , /// and . /// - public bool? SourceAllowTrailingDot { get; set; } + public bool? AllowSourceTrailingDot { get; set; } + + /// + /// Share Token Intent. For use with token authentication. Used to indicate the intent of the request. + /// This is currently required when using token authentication. + /// + public ShareTokenIntent? ShareTokenIntent { get; set; } /// /// Initializes a new instance of the diff --git a/sdk/storage/Azure.Storage.Files.Shares/src/ShareDirectoryClient.cs b/sdk/storage/Azure.Storage.Files.Shares/src/ShareDirectoryClient.cs index 69039d1358a48..ff5f1a2be9ab6 100644 --- a/sdk/storage/Azure.Storage.Files.Shares/src/ShareDirectoryClient.cs +++ b/sdk/storage/Azure.Storage.Files.Shares/src/ShareDirectoryClient.cs @@ -228,8 +228,7 @@ public ShareDirectoryClient( directoryUri: directoryUri, authentication: (HttpPipelinePolicy)null, options: options, - storageSharedKeyCredential: null, - fileRequestIntent: null) + storageSharedKeyCredential: null) { } @@ -258,8 +257,7 @@ public ShareDirectoryClient( directoryUri: directoryUri, authentication: credential.AsPolicy(), options: options, - storageSharedKeyCredential: credential, - fileRequestIntent: null) + storageSharedKeyCredential: credential) { } @@ -295,6 +293,8 @@ public ShareDirectoryClient( /// /// Initializes a new instance of the /// class. + /// + /// Note that is currently required for token authentication. /// /// /// A referencing the directory that includes the @@ -304,9 +304,6 @@ public ShareDirectoryClient( /// /// The token credential used to sign requests. /// - /// - /// File request intent. - /// /// /// Optional client options that define the transport pipeline /// policies for authentication, retries, etc., that are applied to @@ -315,14 +312,12 @@ public ShareDirectoryClient( public ShareDirectoryClient( Uri directoryUri, TokenCredential credential, - ShareFileRequestIntent? fileRequestIntent = default, ShareClientOptions options = default) : this( directoryUri: directoryUri, authentication: credential.AsPolicy(options), options: options ?? new ShareClientOptions(), - storageSharedKeyCredential: null, - fileRequestIntent: fileRequestIntent) + storageSharedKeyCredential: null) { Errors.VerifyHttpsTokenAuth(directoryUri); } @@ -347,15 +342,11 @@ public ShareDirectoryClient( /// /// The shared key credential used to sign requests. /// - /// - /// File request intent. - /// internal ShareDirectoryClient( Uri directoryUri, HttpPipelinePolicy authentication, ShareClientOptions options, - StorageSharedKeyCredential storageSharedKeyCredential, - ShareFileRequestIntent? fileRequestIntent) + StorageSharedKeyCredential storageSharedKeyCredential) { Argument.AssertNotNull(directoryUri, nameof(directoryUri)); options ??= new ShareClientOptions(); @@ -365,8 +356,7 @@ internal ShareDirectoryClient( sharedKeyCredential: storageSharedKeyCredential, sasCredential: default, clientDiagnostics: new ClientDiagnostics(options), - clientOptions: options, - fileRequestIntent: fileRequestIntent); + clientOptions: options); _directoryRestClient = BuildDirectoryRestClient(directoryUri); } @@ -473,9 +463,9 @@ private DirectoryRestClient BuildDirectoryRestClient(Uri uri) pipeline: _clientConfiguration.Pipeline, url: uri.AbsoluteUri, version: _clientConfiguration.ClientOptions.Version.ToVersionString(), - fileRequestIntent: _clientConfiguration.FileRequestIntent, + fileRequestIntent: _clientConfiguration.ClientOptions.ShareTokenIntent, allowTrailingDot: _clientConfiguration.ClientOptions.AllowTrailingDot, - allowSourceTrailingDot: _clientConfiguration.ClientOptions.SourceAllowTrailingDot); + allowSourceTrailingDot: _clientConfiguration.ClientOptions.AllowSourceTrailingDot); } #endregion ctors diff --git a/sdk/storage/Azure.Storage.Files.Shares/src/ShareFileClient.cs b/sdk/storage/Azure.Storage.Files.Shares/src/ShareFileClient.cs index d65fb4e53f2a5..413dc3575ac2c 100644 --- a/sdk/storage/Azure.Storage.Files.Shares/src/ShareFileClient.cs +++ b/sdk/storage/Azure.Storage.Files.Shares/src/ShareFileClient.cs @@ -238,8 +238,7 @@ public ShareFileClient( fileUri: fileUri, authentication: (HttpPipelinePolicy)null, options: options, - storageSharedKeyCredential: null, - fileRequestIntent: null) + storageSharedKeyCredential: null) { } @@ -267,8 +266,7 @@ public ShareFileClient( fileUri: fileUri, authentication: credential.AsPolicy(), options: options, - storageSharedKeyCredential: credential, - fileRequestIntent: null) + storageSharedKeyCredential: credential) { } @@ -303,6 +301,8 @@ public ShareFileClient( /// /// Initializes a new instance of the /// class. + /// + /// Note that is currently required for token authentication. /// /// /// A referencing the file that includes the @@ -312,9 +312,6 @@ public ShareFileClient( /// /// The token credential used to sign requests. /// - /// - /// File request intent. - /// /// /// Optional client options that define the transport pipeline /// policies for authentication, retries, etc., that are applied to @@ -323,14 +320,12 @@ public ShareFileClient( public ShareFileClient( Uri fileUri, TokenCredential credential, - ShareFileRequestIntent? fileRequestIntent = default, ShareClientOptions options = default) : this( fileUri: fileUri, authentication: credential.AsPolicy(options), options: options ?? new ShareClientOptions(), - storageSharedKeyCredential: null, - fileRequestIntent: fileRequestIntent) + storageSharedKeyCredential: null) { Errors.VerifyHttpsTokenAuth(fileUri); } @@ -355,15 +350,11 @@ public ShareFileClient( /// /// The shared key credential used to sign requests. /// - /// - /// File request intent. - /// internal ShareFileClient( Uri fileUri, HttpPipelinePolicy authentication, ShareClientOptions options, - StorageSharedKeyCredential storageSharedKeyCredential, - ShareFileRequestIntent? fileRequestIntent) + StorageSharedKeyCredential storageSharedKeyCredential) { Argument.AssertNotNull(fileUri, nameof(fileUri)); options ??= new ShareClientOptions(); @@ -373,8 +364,7 @@ internal ShareFileClient( sharedKeyCredential: storageSharedKeyCredential, sasCredential: null, clientDiagnostics: new ClientDiagnostics(options), - clientOptions: options, - fileRequestIntent: fileRequestIntent); + clientOptions: options); _fileRestClient = BuildFileRestClient(fileUri); } @@ -479,9 +469,9 @@ private FileRestClient BuildFileRestClient(Uri uri) pipeline: _clientConfiguration.Pipeline, url: uri.AbsoluteUri, version: _clientConfiguration.ClientOptions.Version.ToVersionString(), - fileRequestIntent: _clientConfiguration.FileRequestIntent, + fileRequestIntent: _clientConfiguration.ClientOptions.ShareTokenIntent, allowTrailingDot: _clientConfiguration.ClientOptions.AllowTrailingDot, - allowSourceTrailingDot: _clientConfiguration.ClientOptions.SourceAllowTrailingDot); + allowSourceTrailingDot: _clientConfiguration.ClientOptions.AllowSourceTrailingDot); } #endregion ctors diff --git a/sdk/storage/Azure.Storage.Files.Shares/src/ShareServiceClient.cs b/sdk/storage/Azure.Storage.Files.Shares/src/ShareServiceClient.cs index b7877e5a58c98..858d20e847ca0 100644 --- a/sdk/storage/Azure.Storage.Files.Shares/src/ShareServiceClient.cs +++ b/sdk/storage/Azure.Storage.Files.Shares/src/ShareServiceClient.cs @@ -234,6 +234,9 @@ internal ShareServiceClient( /// Note that service-level operations do not support token credential authentication. /// This constructor exists to allow the construction of a that can be used to derive /// a that has token credential authentication. + /// + /// Also note that is currently required for token authentication. + /// /// /// /// A referencing the file service. @@ -241,9 +244,6 @@ internal ShareServiceClient( /// /// The token credential used to sign requests. /// - /// - /// File request intent. - /// /// /// Optional client options that define the transport pipeline /// policies for authentication, retries, etc., that are applied to @@ -252,13 +252,11 @@ internal ShareServiceClient( public ShareServiceClient( Uri serviceUri, TokenCredential credential, - ShareFileRequestIntent? fileRequestIntent = default, ShareClientOptions options = default) : this( serviceUri: serviceUri, authentication: credential.AsPolicy(options), - options: options ?? new ShareClientOptions(), - fileRequestIntent: fileRequestIntent) + options: options ?? new ShareClientOptions()) { Errors.VerifyHttpsTokenAuth(serviceUri); } @@ -281,15 +279,11 @@ public ShareServiceClient( /// /// The shared key credential used to sign requests. /// - /// - /// File request intent. OAuth only. - /// internal ShareServiceClient( Uri serviceUri, HttpPipelinePolicy authentication, ShareClientOptions options, - StorageSharedKeyCredential storageSharedKeyCredential = default, - ShareFileRequestIntent? fileRequestIntent = default) + StorageSharedKeyCredential storageSharedKeyCredential = default) { Argument.AssertNotNull(serviceUri, nameof(serviceUri)); options ??= new ShareClientOptions(); @@ -299,8 +293,7 @@ internal ShareServiceClient( sharedKeyCredential: storageSharedKeyCredential, sasCredential: null, clientDiagnostics: new ClientDiagnostics(options), - clientOptions: options, - fileRequestIntent: fileRequestIntent); + clientOptions: options); _serviceRestClient = BuildServiceRestClient(); } @@ -336,8 +329,7 @@ internal ShareServiceClient( sharedKeyCredential: null, sasCredential: sasCredential, clientDiagnostics: new ClientDiagnostics(options), - clientOptions: options, - fileRequestIntent: null); + clientOptions: options); _serviceRestClient = BuildServiceRestClient(); } diff --git a/sdk/storage/Azure.Storage.Files.Shares/src/autorest.md b/sdk/storage/Azure.Storage.Files.Shares/src/autorest.md index cbea5f75e1550..9899b4229e25b 100644 --- a/sdk/storage/Azure.Storage.Files.Shares/src/autorest.md +++ b/sdk/storage/Azure.Storage.Files.Shares/src/autorest.md @@ -4,7 +4,7 @@ Run `dotnet build /t:GenerateCode` to generate code. ``` yaml input-file: - - https://raw.githubusercontent.com/Azure/azure-rest-api-specs/61b7e4ad91d44d3dacfcaee6c5f4cfd008022a76/specification/storage/data-plane/Microsoft.FileStorage/preview/2022-11-02/file.json + - https://raw.githubusercontent.com/seanmcc-msft/azure-rest-api-specs/97114bc1a965387eea64e1470c85b8f44590223f/specification/storage/data-plane/Microsoft.FileStorage/preview/2022-11-02/file.json generation1-convenience-client: true # https://github.com/Azure/autorest/issues/4075 skip-semantics-validation: true diff --git a/sdk/storage/Azure.Storage.Files.Shares/tests/ClientBuilderExtensions.cs b/sdk/storage/Azure.Storage.Files.Shares/tests/ClientBuilderExtensions.cs index 74aa1c1989042..d264e2bfe616b 100644 --- a/sdk/storage/Azure.Storage.Files.Shares/tests/ClientBuilderExtensions.cs +++ b/sdk/storage/Azure.Storage.Files.Shares/tests/ClientBuilderExtensions.cs @@ -26,8 +26,7 @@ public static ShareClientBuilder GetNewShareClientBuilder(TenantConfigurationBui tenants, (uri, clientOptions) => new ShareServiceClient(uri, clientOptions), (uri, sharedKeyCredential, clientOptions) => new ShareServiceClient(uri, sharedKeyCredential, clientOptions), - default, - (uri, tokenCredential, fileIntent, clientOptions) => new ShareServiceClient(uri, tokenCredential, (ShareFileRequestIntent?)fileIntent, clientOptions), + (uri, tokenCredential, clientOptions) => new ShareServiceClient(uri, tokenCredential, clientOptions), (uri, azureSasCredential, clientOptions) => new ShareServiceClient(uri, azureSasCredential, clientOptions), () => new ShareClientOptions(serviceVersion)); @@ -46,9 +45,12 @@ public static ShareServiceClient GetServiceClient_SharedKey(this ShareClientBuil => clientBuilder.GetServiceClientFromSharedKeyConfig(clientBuilder.Tenants.TestConfigDefault, options); public static ShareServiceClient GetServiceClient_OAuth( - this ShareClientBuilder clientBuilder, - ShareFileRequestIntent? fileRequestIntent = null) => - clientBuilder.GetServiceClientFromOauthConfigWithParameter(clientBuilder.Tenants.TestConfigOAuth, parameter: fileRequestIntent); + this ShareClientBuilder clientBuilder, ShareClientOptions options = default) + { + options ??= clientBuilder.GetOptions(); + options.ShareTokenIntent = ShareTokenIntent.Backup; + return clientBuilder.GetServiceClientFromOauthConfig(clientBuilder.Tenants.TestConfigOAuth, options); + } public static ShareServiceClient GetServiceClient_OAuthAccount_SharedKey(this ShareClientBuilder clientBuilder) => clientBuilder.GetServiceClientFromSharedKeyConfig(clientBuilder.Tenants.TestConfigOAuth); diff --git a/sdk/storage/Azure.Storage.Files.Shares/tests/DirectoryClientTests.cs b/sdk/storage/Azure.Storage.Files.Shares/tests/DirectoryClientTests.cs index 9c7fc4a88d01d..c484c20c32e0d 100644 --- a/sdk/storage/Azure.Storage.Files.Shares/tests/DirectoryClientTests.cs +++ b/sdk/storage/Azure.Storage.Files.Shares/tests/DirectoryClientTests.cs @@ -177,7 +177,7 @@ public async Task CreateAsync_OAuth() string shareName = GetNewShareName(); ShareServiceClient sharedKeyServiceClient = SharesClientBuilder.GetServiceClient_OAuthAccount_SharedKey(); await using DisposingShare sharedKeyShare = await GetTestShareAsync(sharedKeyServiceClient, shareName); - ShareServiceClient oauthServiceClient = SharesClientBuilder.GetServiceClient_OAuth(ShareFileRequestIntent.Backup); + ShareServiceClient oauthServiceClient = SharesClientBuilder.GetServiceClient_OAuth(); string directoryName = GetNewDirectoryName(); ShareDirectoryClient directory = InstrumentClient(oauthServiceClient.GetShareClient(shareName).GetDirectoryClient(directoryName)); @@ -619,7 +619,7 @@ public async Task DeleteAsync_OAuth() string shareName = GetNewShareName(); ShareServiceClient sharedKeyServiceClient = SharesClientBuilder.GetServiceClient_OAuthAccount_SharedKey(); await using DisposingShare sharedKeyShare = await GetTestShareAsync(sharedKeyServiceClient, shareName); - ShareServiceClient oauthServiceClient = SharesClientBuilder.GetServiceClient_OAuth(ShareFileRequestIntent.Backup); + ShareServiceClient oauthServiceClient = SharesClientBuilder.GetServiceClient_OAuth(); string directoryName = GetNewDirectoryName(); ShareDirectoryClient directory = InstrumentClient(oauthServiceClient.GetShareClient(shareName).GetDirectoryClient(directoryName)); @@ -687,7 +687,7 @@ public async Task GetPropertiesAsync_OAuth() string shareName = GetNewShareName(); ShareServiceClient sharedKeyServiceClient = SharesClientBuilder.GetServiceClient_OAuthAccount_SharedKey(); await using DisposingShare sharedKeyShare = await GetTestShareAsync(sharedKeyServiceClient, shareName); - ShareServiceClient oauthServiceClient = SharesClientBuilder.GetServiceClient_OAuth(ShareFileRequestIntent.Backup); + ShareServiceClient oauthServiceClient = SharesClientBuilder.GetServiceClient_OAuth(); string directoryName = GetNewDirectoryName(); ShareDirectoryClient directory = InstrumentClient(oauthServiceClient.GetShareClient(shareName).GetDirectoryClient(directoryName)); @@ -802,7 +802,7 @@ public async Task SetHttpHeadersAsync_OAuth() string shareName = GetNewShareName(); ShareServiceClient sharedKeyServiceClient = SharesClientBuilder.GetServiceClient_OAuthAccount_SharedKey(); await using DisposingShare sharedKeyShare = await GetTestShareAsync(sharedKeyServiceClient, shareName); - ShareServiceClient oauthServiceClient = SharesClientBuilder.GetServiceClient_OAuth(ShareFileRequestIntent.Backup); + ShareServiceClient oauthServiceClient = SharesClientBuilder.GetServiceClient_OAuth(); string directoryName = GetNewDirectoryName(); ShareDirectoryClient directory = InstrumentClient(oauthServiceClient.GetShareClient(shareName).GetDirectoryClient(directoryName)); @@ -973,7 +973,7 @@ public async Task SetMetadataAsync_OAuth() string shareName = GetNewShareName(); ShareServiceClient sharedKeyServiceClient = SharesClientBuilder.GetServiceClient_OAuthAccount_SharedKey(); await using DisposingShare sharedKeyShare = await GetTestShareAsync(sharedKeyServiceClient, shareName); - ShareServiceClient oauthServiceClient = SharesClientBuilder.GetServiceClient_OAuth(ShareFileRequestIntent.Backup); + ShareServiceClient oauthServiceClient = SharesClientBuilder.GetServiceClient_OAuth(); string directoryName = GetNewDirectoryName(); ShareDirectoryClient directory = InstrumentClient(oauthServiceClient.GetShareClient(shareName).GetDirectoryClient(directoryName)); @@ -1092,7 +1092,7 @@ public async Task ListFilesAndDirectoriesSegmentAsync_OAuth() string shareName = GetNewShareName(); ShareServiceClient sharedKeyServiceClient = SharesClientBuilder.GetServiceClient_OAuthAccount_SharedKey(); await using DisposingShare sharedKeyShare = await GetTestShareAsync(sharedKeyServiceClient, shareName); - ShareServiceClient oauthServiceClient = SharesClientBuilder.GetServiceClient_OAuth(ShareFileRequestIntent.Backup); + ShareServiceClient oauthServiceClient = SharesClientBuilder.GetServiceClient_OAuth(); string directoryName = GetNewDirectoryName(); ShareDirectoryClient directory = InstrumentClient(oauthServiceClient.GetShareClient(shareName).GetDirectoryClient(directoryName)); @@ -1344,7 +1344,7 @@ public async Task ListHandles_OAuth() string shareName = GetNewShareName(); ShareServiceClient sharedKeyServiceClient = SharesClientBuilder.GetServiceClient_OAuthAccount_SharedKey(); await using DisposingShare sharedKeyShare = await GetTestShareAsync(sharedKeyServiceClient, shareName); - ShareServiceClient oauthServiceClient = SharesClientBuilder.GetServiceClient_OAuth(ShareFileRequestIntent.Backup); + ShareServiceClient oauthServiceClient = SharesClientBuilder.GetServiceClient_OAuth(); string directoryName = GetNewDirectoryName(); ShareDirectoryClient directory = InstrumentClient(oauthServiceClient.GetShareClient(shareName).GetDirectoryClient(directoryName)); @@ -1412,7 +1412,7 @@ public async Task ForceCloseHandles_OAuth() string shareName = GetNewShareName(); ShareServiceClient sharedKeyServiceClient = SharesClientBuilder.GetServiceClient_OAuthAccount_SharedKey(); await using DisposingShare sharedKeyShare = await GetTestShareAsync(sharedKeyServiceClient, shareName); - ShareServiceClient oauthServiceClient = SharesClientBuilder.GetServiceClient_OAuth(ShareFileRequestIntent.Backup); + ShareServiceClient oauthServiceClient = SharesClientBuilder.GetServiceClient_OAuth(); string directoryName = GetNewDirectoryName(); ShareDirectoryClient directory = InstrumentClient(oauthServiceClient.GetShareClient(shareName).GetDirectoryClient(directoryName)); @@ -2247,7 +2247,7 @@ public async Task RenameAsync_TrailingDot(bool? sourceAllowTrailingDot) // Arrange ShareClientOptions options = GetOptions(); options.AllowTrailingDot = true; - options.SourceAllowTrailingDot = sourceAllowTrailingDot; + options.AllowSourceTrailingDot = sourceAllowTrailingDot; await using DisposingShare test = await SharesClientBuilder.GetTestShareAsync(options: options); string destDirectoryName = GetNewDirectoryName() + "."; ShareDirectoryClient sourceDirectory = InstrumentClient(test.Share.GetDirectoryClient(GetNewDirectoryName() + ".")); @@ -2275,7 +2275,7 @@ public async Task RenameAsync_OAuth() string shareName = GetNewShareName(); ShareServiceClient sharedKeyServiceClient = SharesClientBuilder.GetServiceClient_OAuthAccount_SharedKey(); await using DisposingShare sharedKeyShare = await GetTestShareAsync(sharedKeyServiceClient, shareName); - ShareServiceClient oauthServiceClient = SharesClientBuilder.GetServiceClient_OAuth(ShareFileRequestIntent.Backup); + ShareServiceClient oauthServiceClient = SharesClientBuilder.GetServiceClient_OAuth(); string directoryName = GetNewDirectoryName(); string destDirectoryName = GetNewDirectoryName(); diff --git a/sdk/storage/Azure.Storage.Files.Shares/tests/FileClientTests.cs b/sdk/storage/Azure.Storage.Files.Shares/tests/FileClientTests.cs index 613ae15251171..539055f263704 100644 --- a/sdk/storage/Azure.Storage.Files.Shares/tests/FileClientTests.cs +++ b/sdk/storage/Azure.Storage.Files.Shares/tests/FileClientTests.cs @@ -184,7 +184,7 @@ public async Task CreateAsync_OAuth() string shareName = GetNewShareName(); ShareServiceClient sharedKeyServiceClient = SharesClientBuilder.GetServiceClient_OAuthAccount_SharedKey(); await using DisposingShare sharedKeyShare = await GetTestShareAsync(sharedKeyServiceClient, shareName); - ShareServiceClient oauthServiceClient = SharesClientBuilder.GetServiceClient_OAuth(ShareFileRequestIntent.Backup); + ShareServiceClient oauthServiceClient = SharesClientBuilder.GetServiceClient_OAuth(); string directoryName = GetNewDirectoryName(); ShareDirectoryClient directory = InstrumentClient(oauthServiceClient.GetShareClient(shareName).GetDirectoryClient(directoryName)); @@ -696,7 +696,7 @@ public async Task SetMetadataAsync_OAuth() string shareName = GetNewShareName(); ShareServiceClient sharedKeyServiceClient = SharesClientBuilder.GetServiceClient_OAuthAccount_SharedKey(); await using DisposingShare sharedKeyShare = await GetTestShareAsync(sharedKeyServiceClient, shareName); - ShareServiceClient oauthServiceClient = SharesClientBuilder.GetServiceClient_OAuth(ShareFileRequestIntent.Backup); + ShareServiceClient oauthServiceClient = SharesClientBuilder.GetServiceClient_OAuth(); string directoryName = GetNewDirectoryName(); ShareDirectoryClient directory = InstrumentClient(oauthServiceClient.GetShareClient(shareName).GetDirectoryClient(directoryName)); @@ -824,7 +824,7 @@ public async Task GetPropertiesAsync_OAuth() string shareName = GetNewShareName(); ShareServiceClient sharedKeyServiceClient = SharesClientBuilder.GetServiceClient_OAuthAccount_SharedKey(); await using DisposingShare sharedKeyShare = await GetTestShareAsync(sharedKeyServiceClient, shareName); - ShareServiceClient oauthServiceClient = SharesClientBuilder.GetServiceClient_OAuth(ShareFileRequestIntent.Backup); + ShareServiceClient oauthServiceClient = SharesClientBuilder.GetServiceClient_OAuth(); string directoryName = GetNewDirectoryName(); ShareDirectoryClient directory = InstrumentClient(oauthServiceClient.GetShareClient(shareName).GetDirectoryClient(directoryName)); @@ -1147,7 +1147,7 @@ public async Task SetHttpHeadersAsync_OAuth() string shareName = GetNewShareName(); ShareServiceClient sharedKeyServiceClient = SharesClientBuilder.GetServiceClient_OAuthAccount_SharedKey(); await using DisposingShare sharedKeyShare = await GetTestShareAsync(sharedKeyServiceClient, shareName); - ShareServiceClient oauthServiceClient = SharesClientBuilder.GetServiceClient_OAuth(ShareFileRequestIntent.Backup); + ShareServiceClient oauthServiceClient = SharesClientBuilder.GetServiceClient_OAuth(); string directoryName = GetNewDirectoryName(); ShareDirectoryClient directory = InstrumentClient(oauthServiceClient.GetShareClient(shareName).GetDirectoryClient(directoryName)); @@ -1424,7 +1424,7 @@ public async Task DeleteAsync_OAuth() string shareName = GetNewShareName(); ShareServiceClient sharedKeyServiceClient = SharesClientBuilder.GetServiceClient_OAuthAccount_SharedKey(); await using DisposingShare sharedKeyShare = await GetTestShareAsync(sharedKeyServiceClient, shareName); - ShareServiceClient oauthServiceClient = SharesClientBuilder.GetServiceClient_OAuth(ShareFileRequestIntent.Backup); + ShareServiceClient oauthServiceClient = SharesClientBuilder.GetServiceClient_OAuth(); string directoryName = GetNewDirectoryName(); ShareDirectoryClient directory = InstrumentClient(oauthServiceClient.GetShareClient(shareName).GetDirectoryClient(directoryName)); @@ -1538,7 +1538,7 @@ public async Task StartCopyAsync_OAuth() string shareName = GetNewShareName(); ShareServiceClient sharedKeyServiceClient = SharesClientBuilder.GetServiceClient_OAuthAccount_SharedKey(); await using DisposingShare sharedKeyShare = await GetTestShareAsync(sharedKeyServiceClient, shareName); - ShareServiceClient oauthServiceClient = SharesClientBuilder.GetServiceClient_OAuth(ShareFileRequestIntent.Backup); + ShareServiceClient oauthServiceClient = SharesClientBuilder.GetServiceClient_OAuth(); string directoryName = GetNewDirectoryName(); ShareDirectoryClient directory = InstrumentClient(oauthServiceClient.GetShareClient(shareName).GetDirectoryClient(directoryName)); @@ -2042,7 +2042,7 @@ public async Task StartCopyAsync_TrailingDot(bool? sourceAllowTrailingDot) // Arrange ShareClientOptions options = GetOptions(); options.AllowTrailingDot = true; - options.SourceAllowTrailingDot = sourceAllowTrailingDot; + options.AllowSourceTrailingDot = sourceAllowTrailingDot; string sourceName = GetNewFileName() + "."; await using DisposingFile testSource = await SharesClientBuilder.GetTestFileAsync(fileName: sourceName, options: options); ShareFileClient source = testSource.File; @@ -2117,7 +2117,7 @@ public async Task AbortCopyAsync_OAuth() string shareName = GetNewShareName(); ShareServiceClient sharedKeyServiceClient = SharesClientBuilder.GetServiceClient_OAuthAccount_SharedKey(); await using DisposingShare sharedKeyShare = await GetTestShareAsync(sharedKeyServiceClient, shareName); - ShareServiceClient oauthServiceClient = SharesClientBuilder.GetServiceClient_OAuth(ShareFileRequestIntent.Backup); + ShareServiceClient oauthServiceClient = SharesClientBuilder.GetServiceClient_OAuth(); string directoryName = GetNewDirectoryName(); ShareDirectoryClient directory = InstrumentClient(oauthServiceClient.GetShareClient(shareName).GetDirectoryClient(directoryName)); @@ -2400,7 +2400,7 @@ public async Task DownloadAsync_OAuth() string shareName = GetNewShareName(); ShareServiceClient sharedKeyServiceClient = SharesClientBuilder.GetServiceClient_OAuthAccount_SharedKey(); await using DisposingShare sharedKeyShare = await GetTestShareAsync(sharedKeyServiceClient, shareName); - ShareServiceClient oauthServiceClient = SharesClientBuilder.GetServiceClient_OAuth(ShareFileRequestIntent.Backup); + ShareServiceClient oauthServiceClient = SharesClientBuilder.GetServiceClient_OAuth(); string directoryName = GetNewDirectoryName(); ShareDirectoryClient directory = InstrumentClient(oauthServiceClient.GetShareClient(shareName).GetDirectoryClient(directoryName)); @@ -2723,7 +2723,7 @@ public async Task GetRangeListAsync_OAuth() string shareName = GetNewShareName(); ShareServiceClient sharedKeyServiceClient = SharesClientBuilder.GetServiceClient_OAuthAccount_SharedKey(); await using DisposingShare sharedKeyShare = await GetTestShareAsync(sharedKeyServiceClient, shareName); - ShareServiceClient oauthServiceClient = SharesClientBuilder.GetServiceClient_OAuth(ShareFileRequestIntent.Backup); + ShareServiceClient oauthServiceClient = SharesClientBuilder.GetServiceClient_OAuth(); string directoryName = GetNewDirectoryName(); ShareDirectoryClient directory = InstrumentClient(oauthServiceClient.GetShareClient(shareName).GetDirectoryClient(directoryName)); @@ -2981,7 +2981,7 @@ public async Task GetRangeListDiffAsync_OAuth() string shareName = GetNewShareName(); ShareServiceClient sharedKeyServiceClient = SharesClientBuilder.GetServiceClient_OAuthAccount_SharedKey(); await using DisposingShare sharedKeyShare = await GetTestShareAsync(sharedKeyServiceClient, shareName); - ShareServiceClient oauthServiceClient = SharesClientBuilder.GetServiceClient_OAuth(ShareFileRequestIntent.Backup); + ShareServiceClient oauthServiceClient = SharesClientBuilder.GetServiceClient_OAuth(); string directoryName = GetNewDirectoryName(); ShareDirectoryClient directory = InstrumentClient(oauthServiceClient.GetShareClient(shareName).GetDirectoryClient(directoryName)); @@ -3219,7 +3219,7 @@ public async Task UploadRangeAsync_OAuth() var data = GetRandomBuffer(Constants.KB); await using DisposingFile test = await SharesClientBuilder.GetTestFileAsync( - SharesClientBuilder.GetServiceClient_OAuth(ShareFileRequestIntent.Backup)); + SharesClientBuilder.GetServiceClient_OAuth()); ShareFileClient file = test.File; using (var stream = new MemoryStream(data)) @@ -3479,7 +3479,7 @@ public async Task UploadAsync_OAuth() string shareName = GetNewShareName(); ShareServiceClient sharedKeyServiceClient = SharesClientBuilder.GetServiceClient_OAuthAccount_SharedKey(); await using DisposingShare sharedKeyShare = await GetTestShareAsync(sharedKeyServiceClient, shareName); - ShareServiceClient oauthServiceClient = SharesClientBuilder.GetServiceClient_OAuth(ShareFileRequestIntent.Backup); + ShareServiceClient oauthServiceClient = SharesClientBuilder.GetServiceClient_OAuth(); string directoryName = GetNewDirectoryName(); ShareDirectoryClient directory = InstrumentClient(oauthServiceClient.GetShareClient(shareName).GetDirectoryClient(directoryName)); @@ -3735,7 +3735,7 @@ public async Task ClearRangeAsync_OAuth() string shareName = GetNewShareName(); ShareServiceClient sharedKeyServiceClient = SharesClientBuilder.GetServiceClient_OAuthAccount_SharedKey(); await using DisposingShare sharedKeyShare = await GetTestShareAsync(sharedKeyServiceClient, shareName); - ShareServiceClient oauthServiceClient = SharesClientBuilder.GetServiceClient_OAuth(ShareFileRequestIntent.Backup); + ShareServiceClient oauthServiceClient = SharesClientBuilder.GetServiceClient_OAuth(); string directoryName = GetNewDirectoryName(); ShareDirectoryClient directory = InstrumentClient(oauthServiceClient.GetShareClient(shareName).GetDirectoryClient(directoryName)); @@ -4248,7 +4248,7 @@ public async Task UploadRangeFromUriAsync_TrailingDot(bool? sourceAllowTrailingD // Arrange ShareClientOptions options = GetOptions(); options.AllowTrailingDot = true; - options.SourceAllowTrailingDot = sourceAllowTrailingDot; + options.AllowSourceTrailingDot = sourceAllowTrailingDot; await using DisposingShare test = await GetTestShareAsync(options: options); ShareDirectoryClient directory = test.Share.GetDirectoryClient(GetNewDirectoryName()); await directory.CreateAsync(); @@ -4322,7 +4322,7 @@ public async Task ListHandles_OAuth() string shareName = GetNewShareName(); ShareServiceClient sharedKeyServiceClient = SharesClientBuilder.GetServiceClient_OAuthAccount_SharedKey(); await using DisposingShare sharedKeyShare = await GetTestShareAsync(sharedKeyServiceClient, shareName); - ShareServiceClient oauthServiceClient = SharesClientBuilder.GetServiceClient_OAuth(ShareFileRequestIntent.Backup); + ShareServiceClient oauthServiceClient = SharesClientBuilder.GetServiceClient_OAuth(); string directoryName = GetNewDirectoryName(); ShareDirectoryClient directory = InstrumentClient(oauthServiceClient.GetShareClient(shareName).GetDirectoryClient(directoryName)); @@ -4392,7 +4392,7 @@ public async Task ForceCloseHandles_OAuth() string shareName = GetNewShareName(); ShareServiceClient sharedKeyServiceClient = SharesClientBuilder.GetServiceClient_OAuthAccount_SharedKey(); await using DisposingShare sharedKeyShare = await GetTestShareAsync(sharedKeyServiceClient, shareName); - ShareServiceClient oauthServiceClient = SharesClientBuilder.GetServiceClient_OAuth(ShareFileRequestIntent.Backup); + ShareServiceClient oauthServiceClient = SharesClientBuilder.GetServiceClient_OAuth(); string directoryName = GetNewDirectoryName(); ShareDirectoryClient directory = InstrumentClient(oauthServiceClient.GetShareClient(shareName).GetDirectoryClient(directoryName)); @@ -4491,7 +4491,7 @@ public async Task AcquireLeaseAsync_OAuth() string shareName = GetNewShareName(); ShareServiceClient sharedKeyServiceClient = SharesClientBuilder.GetServiceClient_OAuthAccount_SharedKey(); await using DisposingShare sharedKeyShare = await GetTestShareAsync(sharedKeyServiceClient, shareName); - ShareServiceClient oauthServiceClient = SharesClientBuilder.GetServiceClient_OAuth(ShareFileRequestIntent.Backup); + ShareServiceClient oauthServiceClient = SharesClientBuilder.GetServiceClient_OAuth(); string directoryName = GetNewDirectoryName(); ShareDirectoryClient directory = InstrumentClient(oauthServiceClient.GetShareClient(shareName).GetDirectoryClient(directoryName)); @@ -4583,7 +4583,7 @@ public async Task ReleaseLeaseAsync_OAuth() string shareName = GetNewShareName(); ShareServiceClient sharedKeyServiceClient = SharesClientBuilder.GetServiceClient_OAuthAccount_SharedKey(); await using DisposingShare sharedKeyShare = await GetTestShareAsync(sharedKeyServiceClient, shareName); - ShareServiceClient oauthServiceClient = SharesClientBuilder.GetServiceClient_OAuth(ShareFileRequestIntent.Backup); + ShareServiceClient oauthServiceClient = SharesClientBuilder.GetServiceClient_OAuth(); string directoryName = GetNewDirectoryName(); ShareDirectoryClient directory = InstrumentClient(oauthServiceClient.GetShareClient(shareName).GetDirectoryClient(directoryName)); @@ -4683,7 +4683,7 @@ public async Task ChangeLeaseAsync_OAuth() string shareName = GetNewShareName(); ShareServiceClient sharedKeyServiceClient = SharesClientBuilder.GetServiceClient_OAuthAccount_SharedKey(); await using DisposingShare sharedKeyShare = await GetTestShareAsync(sharedKeyServiceClient, shareName); - ShareServiceClient oauthServiceClient = SharesClientBuilder.GetServiceClient_OAuth(ShareFileRequestIntent.Backup); + ShareServiceClient oauthServiceClient = SharesClientBuilder.GetServiceClient_OAuth(); string directoryName = GetNewDirectoryName(); ShareDirectoryClient directory = InstrumentClient(oauthServiceClient.GetShareClient(shareName).GetDirectoryClient(directoryName)); @@ -4812,7 +4812,7 @@ public async Task BreakLeaseAsync_OAuth() string shareName = GetNewShareName(); ShareServiceClient sharedKeyServiceClient = SharesClientBuilder.GetServiceClient_OAuthAccount_SharedKey(); await using DisposingShare sharedKeyShare = await GetTestShareAsync(sharedKeyServiceClient, shareName); - ShareServiceClient oauthServiceClient = SharesClientBuilder.GetServiceClient_OAuth(ShareFileRequestIntent.Backup); + ShareServiceClient oauthServiceClient = SharesClientBuilder.GetServiceClient_OAuth(); string directoryName = GetNewDirectoryName(); ShareDirectoryClient directory = InstrumentClient(oauthServiceClient.GetShareClient(shareName).GetDirectoryClient(directoryName)); @@ -4961,7 +4961,7 @@ public async Task OpenWriteAsync_OAuth() string shareName = GetNewShareName(); ShareServiceClient sharedKeyServiceClient = SharesClientBuilder.GetServiceClient_OAuthAccount_SharedKey(); await using DisposingShare sharedKeyShare = await GetTestShareAsync(sharedKeyServiceClient, shareName); - ShareServiceClient oauthServiceClient = SharesClientBuilder.GetServiceClient_OAuth(ShareFileRequestIntent.Backup); + ShareServiceClient oauthServiceClient = SharesClientBuilder.GetServiceClient_OAuth(); string directoryName = GetNewDirectoryName(); ShareDirectoryClient directory = InstrumentClient(oauthServiceClient.GetShareClient(shareName).GetDirectoryClient(directoryName)); @@ -5889,7 +5889,7 @@ public async Task RenameAsync_TrailingDot(bool? sourceAllowTrailingDot) // Arrange ShareClientOptions options = GetOptions(); options.AllowTrailingDot = true; - options.SourceAllowTrailingDot = sourceAllowTrailingDot; + options.AllowSourceTrailingDot = sourceAllowTrailingDot; await using DisposingDirectory test = await SharesClientBuilder.GetTestDirectoryAsync(options: options); string destFileName = GetNewFileName() + "."; ShareFileClient sourceFile = InstrumentClient(test.Directory.GetFileClient(GetNewFileName() + ".")); @@ -5932,7 +5932,7 @@ public async Task RenameAsync_OAuth() string shareName = GetNewShareName(); ShareServiceClient sharedKeyServiceClient = SharesClientBuilder.GetServiceClient_OAuthAccount_SharedKey(); await using DisposingShare sharedKeyShare = await GetTestShareAsync(sharedKeyServiceClient, shareName); - ShareServiceClient oauthServiceClient = SharesClientBuilder.GetServiceClient_OAuth(ShareFileRequestIntent.Backup); + ShareServiceClient oauthServiceClient = SharesClientBuilder.GetServiceClient_OAuth(); string directoryName = GetNewDirectoryName(); ShareDirectoryClient directory = InstrumentClient(oauthServiceClient.GetShareClient(shareName).GetDirectoryClient(directoryName)); diff --git a/sdk/storage/Azure.Storage.Files.Shares/tests/ShareClientTests.cs b/sdk/storage/Azure.Storage.Files.Shares/tests/ShareClientTests.cs index c3876db78fb03..be5828c92abe7 100644 --- a/sdk/storage/Azure.Storage.Files.Shares/tests/ShareClientTests.cs +++ b/sdk/storage/Azure.Storage.Files.Shares/tests/ShareClientTests.cs @@ -339,7 +339,7 @@ public async Task CreateAndGetPermissionAsync_OAuth() string shareName = GetNewShareName(); ShareServiceClient sharedKeyServiceClient = SharesClientBuilder.GetServiceClient_OAuthAccount_SharedKey(); await using DisposingShare sharedKeyShare = await GetTestShareAsync(sharedKeyServiceClient, shareName); - ShareServiceClient oauthServiceClient = SharesClientBuilder.GetServiceClient_OAuth(ShareFileRequestIntent.Backup); + ShareServiceClient oauthServiceClient = SharesClientBuilder.GetServiceClient_OAuth(); ShareClient share = oauthServiceClient.GetShareClient(shareName); // Arrange diff --git a/sdk/storage/Azure.Storage.Queues/tests/QueueTestBase.cs b/sdk/storage/Azure.Storage.Queues/tests/QueueTestBase.cs index c98f229e2284f..630c31bb02892 100644 --- a/sdk/storage/Azure.Storage.Queues/tests/QueueTestBase.cs +++ b/sdk/storage/Azure.Storage.Queues/tests/QueueTestBase.cs @@ -44,7 +44,6 @@ public QueueTestBase(bool async, RecordedTestMode? mode = null) (uri, clientOptions) => new QueueServiceClient(uri, clientOptions), (uri, sharedKeyCredential, clientOptions) => new QueueServiceClient(uri, sharedKeyCredential, clientOptions), (uri, tokenCredential, clientOptions) => new QueueServiceClient(uri, tokenCredential, clientOptions), - default, (uri, azureSasCredential, clientOptions) => new QueueServiceClient(uri, azureSasCredential, clientOptions), () => new QueueClientOptions()); }