From 89cd580732438249f73723ee01e64ed8640f1e5c Mon Sep 17 00:00:00 2001 From: Isabelle <141270045+ibrandes@users.noreply.github.com> Date: Fri, 5 Apr 2024 10:57:07 -0700 Subject: [PATCH 01/17] STG94 Versions (#39551) * version updates and asset file (?) * redoing asset files pt 1 * redoing asset files pt 2 --- sdk/storage/azure-storage-blob/assets.json | 2 +- .../java/com/azure/storage/blob/BlobServiceVersion.java | 9 +++++++-- sdk/storage/azure-storage-common/ci.system.properties | 4 ++-- .../azure/storage/common/implementation/Constants.java | 4 ++-- sdk/storage/azure-storage-file-datalake/assets.json | 2 +- .../storage/file/datalake/DataLakeServiceVersion.java | 9 +++++++-- .../datalake/implementation/util/TransformUtils.java | 2 ++ sdk/storage/azure-storage-file-share/assets.json | 2 +- .../azure/storage/file/share/ShareServiceVersion.java | 9 +++++++-- .../com/azure/storage/queue/QueueServiceVersion.java | 9 +++++++-- 10 files changed, 37 insertions(+), 15 deletions(-) diff --git a/sdk/storage/azure-storage-blob/assets.json b/sdk/storage/azure-storage-blob/assets.json index 54488582adbbf..0e07aa251c6cb 100644 --- a/sdk/storage/azure-storage-blob/assets.json +++ b/sdk/storage/azure-storage-blob/assets.json @@ -2,5 +2,5 @@ "AssetsRepo": "Azure/azure-sdk-assets", "AssetsRepoPrefixPath": "java", "TagPrefix": "java/storage/azure-storage-blob", - "Tag": "java/storage/azure-storage-blob_7e4a0926e9" + "Tag": "java/storage/azure-storage-blob_38ff3444aa" } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobServiceVersion.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobServiceVersion.java index 5ae87c86d2dab..42071556d2025 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobServiceVersion.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobServiceVersion.java @@ -117,7 +117,12 @@ public enum BlobServiceVersion implements ServiceVersion { /** * Service version {@code 2024-05-04}. */ - V2024_05_04("2024-05-04"); + V2024_05_04("2024-05-04"), + + /** + * Service version {@code 2024-08-04}. + */ + V2024_08_04("2024-08-04"); private final String version; @@ -139,6 +144,6 @@ public String getVersion() { * @return the latest {@link BlobServiceVersion} */ public static BlobServiceVersion getLatest() { - return V2024_05_04; + return V2024_08_04; } } diff --git a/sdk/storage/azure-storage-common/ci.system.properties b/sdk/storage/azure-storage-common/ci.system.properties index c582bac08ccce..83ef1a7ed14de 100644 --- a/sdk/storage/azure-storage-common/ci.system.properties +++ b/sdk/storage/azure-storage-common/ci.system.properties @@ -1,2 +1,2 @@ -AZURE_LIVE_TEST_SERVICE_VERSION=V2024_05_04 -AZURE_STORAGE_SAS_SERVICE_VERSION=2024-05-04 +AZURE_LIVE_TEST_SERVICE_VERSION=V2024_08_04 +AZURE_STORAGE_SAS_SERVICE_VERSION=2024-08-04 diff --git a/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/implementation/Constants.java b/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/implementation/Constants.java index 24c7bd9f17bad..b1ac0667451a6 100644 --- a/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/implementation/Constants.java +++ b/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/implementation/Constants.java @@ -88,7 +88,7 @@ public final class Constants { public static final String PROPERTY_AZURE_STORAGE_SAS_SERVICE_VERSION = "AZURE_STORAGE_SAS_SERVICE_VERSION"; public static final String SAS_SERVICE_VERSION = Configuration.getGlobalConfiguration() - .get(PROPERTY_AZURE_STORAGE_SAS_SERVICE_VERSION, "2024-05-04"); + .get(PROPERTY_AZURE_STORAGE_SAS_SERVICE_VERSION, "2024-08-04"); private Constants() { } @@ -216,7 +216,7 @@ public static final class HeaderConstants { * @deprecated For SAS Service Version use {@link Constants#SAS_SERVICE_VERSION}. */ @Deprecated - public static final String TARGET_STORAGE_VERSION = "2024-05-04"; + public static final String TARGET_STORAGE_VERSION = "2024-08-04"; /** * Error code returned from the service. diff --git a/sdk/storage/azure-storage-file-datalake/assets.json b/sdk/storage/azure-storage-file-datalake/assets.json index c7fa4607f6e01..838392a031ec8 100644 --- a/sdk/storage/azure-storage-file-datalake/assets.json +++ b/sdk/storage/azure-storage-file-datalake/assets.json @@ -2,5 +2,5 @@ "AssetsRepo": "Azure/azure-sdk-assets", "AssetsRepoPrefixPath": "java", "TagPrefix": "java/storage/azure-storage-file-datalake", - "Tag": "java/storage/azure-storage-file-datalake_bc901016df" + "Tag": "java/storage/azure-storage-file-datalake_b6c1c0cf73" } diff --git a/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/DataLakeServiceVersion.java b/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/DataLakeServiceVersion.java index 1965e090323d9..ff620070e5832 100644 --- a/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/DataLakeServiceVersion.java +++ b/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/DataLakeServiceVersion.java @@ -117,7 +117,12 @@ public enum DataLakeServiceVersion implements ServiceVersion { /** * Service version {@code 2024-05-04}. */ - V2024_05_04("2024-05-04"); + V2024_05_04("2024-05-04"), + + /** + * Service version {@code 2024-08-04}. + */ + V2024_08_04("2024-08-04"); private final String version; @@ -139,6 +144,6 @@ public String getVersion() { * @return the latest {@link DataLakeServiceVersion} */ public static DataLakeServiceVersion getLatest() { - return V2024_05_04; + return V2024_08_04; } } diff --git a/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/implementation/util/TransformUtils.java b/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/implementation/util/TransformUtils.java index fca9b07818bfd..54e3ea3bfa3ce 100644 --- a/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/implementation/util/TransformUtils.java +++ b/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/implementation/util/TransformUtils.java @@ -56,6 +56,8 @@ public static BlobServiceVersion toBlobServiceVersion(DataLakeServiceVersion ver return BlobServiceVersion.V2024_02_04; } else if (DataLakeServiceVersion.V2024_05_04.ordinal() == version.ordinal()) { return BlobServiceVersion.V2024_05_04; + } else if (DataLakeServiceVersion.V2024_08_04.ordinal() == version.ordinal()) { + return BlobServiceVersion.V2024_08_04; } return null; diff --git a/sdk/storage/azure-storage-file-share/assets.json b/sdk/storage/azure-storage-file-share/assets.json index f13e44c89d35a..43d28c1fc7d57 100644 --- a/sdk/storage/azure-storage-file-share/assets.json +++ b/sdk/storage/azure-storage-file-share/assets.json @@ -2,5 +2,5 @@ "AssetsRepo": "Azure/azure-sdk-assets", "AssetsRepoPrefixPath": "java", "TagPrefix": "java/storage/azure-storage-file-share", - "Tag": "java/storage/azure-storage-file-share_dfe3610108" + "Tag": "java/storage/azure-storage-file-share_011cc52a61" } diff --git a/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/ShareServiceVersion.java b/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/ShareServiceVersion.java index 23f6261bc44fb..2b8115e2e4f44 100644 --- a/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/ShareServiceVersion.java +++ b/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/ShareServiceVersion.java @@ -118,7 +118,12 @@ public enum ShareServiceVersion implements ServiceVersion { /** * Service version {@code 2024-05-04}. */ - V2024_05_04("2024-05-04"); + V2024_05_04("2024-05-04"), + + /** + * Service version {@code 2024-08-04}. + */ + V2024_08_04("2024-08-04"); private final String version; @@ -140,6 +145,6 @@ public String getVersion() { * @return the latest {@link ShareServiceVersion} */ public static ShareServiceVersion getLatest() { - return V2024_05_04; + return V2024_08_04; } } diff --git a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/QueueServiceVersion.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/QueueServiceVersion.java index af7b97f964b16..66aabe6583ff6 100644 --- a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/QueueServiceVersion.java +++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/QueueServiceVersion.java @@ -117,7 +117,12 @@ public enum QueueServiceVersion implements ServiceVersion { /** * Service version {@code 2024-05-04}. */ - V2024_05_04("2024-05-04"); + V2024_05_04("2024-05-04"), + + /** + * Service version {@code 2024-08-04}. + */ + V2024_08_04("2024-08-04"); private final String version; @@ -139,6 +144,6 @@ public String getVersion() { * @return the latest {@link QueueServiceVersion} */ public static QueueServiceVersion getLatest() { - return V2024_05_04; + return V2024_08_04; } } From eaa8133a59a2f50e956464607d581add7523a786 Mon Sep 17 00:00:00 2001 From: Isabelle <141270045+ibrandes@users.noreply.github.com> Date: Wed, 10 Apr 2024 13:21:50 -0700 Subject: [PATCH 02/17] STG94 Get Account Info on Container and Blob level (#39597) * feature and tests * style --- sdk/storage/azure-storage-blob/assets.json | 2 +- .../blob/BlobContainerAsyncClient.java | 3 +- .../storage/blob/BlobServiceAsyncClient.java | 2 +- .../AzureBlobStorageImplBuilder.java | 2 +- .../blob/implementation/BlobsImpl.java | 80 ++++++++++++++++--- .../blob/implementation/ContainersImpl.java | 77 +++++++++++++++--- .../blob/implementation/ServicesImpl.java | 79 +++++++++++++++--- .../models/BlobsGetAccountInfoHeaders.java | 32 ++++++++ .../ContainersGetAccountInfoHeaders.java | 32 ++++++++ .../blob/specialized/BlobAsyncClientBase.java | 3 +- .../com/azure/storage/blob/BlobApiTests.java | 24 ++++++ .../azure/storage/blob/BlobAsyncApiTests.java | 27 +++++++ .../azure/storage/blob/ContainerApiTests.java | 24 ++++++ .../storage/blob/ContainerAsyncApiTests.java | 29 +++++++ .../azure-storage-blob/swagger/README.md | 2 +- 15 files changed, 380 insertions(+), 38 deletions(-) diff --git a/sdk/storage/azure-storage-blob/assets.json b/sdk/storage/azure-storage-blob/assets.json index 0e07aa251c6cb..ad215e3902182 100644 --- a/sdk/storage/azure-storage-blob/assets.json +++ b/sdk/storage/azure-storage-blob/assets.json @@ -2,5 +2,5 @@ "AssetsRepo": "Azure/azure-sdk-assets", "AssetsRepoPrefixPath": "java", "TagPrefix": "java/storage/azure-storage-blob", - "Tag": "java/storage/azure-storage-blob_38ff3444aa" + "Tag": "java/storage/azure-storage-blob_adf9415a55" } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobContainerAsyncClient.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobContainerAsyncClient.java index 80f428c276f56..5543c3ed1147e 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobContainerAsyncClient.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobContainerAsyncClient.java @@ -1524,7 +1524,8 @@ public Mono> getAccountInfoWithResponse() { Mono> getAccountInfoWithResponse(Context context) { context = context == null ? Context.NONE : context; - return this.azureBlobStorage.getContainers().getAccountInfoWithResponseAsync(containerName, context) + return this.azureBlobStorage.getContainers().getAccountInfoWithResponseAsync(containerName, null, + null, context) .map(rb -> { ContainersGetAccountInfoHeaders hd = rb.getDeserializedHeaders(); return new SimpleResponse<>(rb, new StorageAccountInfo(hd.getXMsSkuName(), hd.getXMsAccountKind())); diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobServiceAsyncClient.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobServiceAsyncClient.java index 3196b27e72f0a..afb0d666431ba 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobServiceAsyncClient.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobServiceAsyncClient.java @@ -1071,7 +1071,7 @@ public Mono> getAccountInfoWithResponse() { Mono> getAccountInfoWithResponse(Context context) { throwOnAnonymousAccess(); - return this.azureBlobStorage.getServices().getAccountInfoWithResponseAsync(context) + return this.azureBlobStorage.getServices().getAccountInfoWithResponseAsync(null, null, context) .map(rb -> { ServicesGetAccountInfoHeaders hd = rb.getDeserializedHeaders(); return new SimpleResponse<>(rb, new StorageAccountInfo(hd.getXMsSkuName(), hd.getXMsAccountKind(), diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/AzureBlobStorageImplBuilder.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/AzureBlobStorageImplBuilder.java index a3f4c68ffd24f..e1c3405feae06 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/AzureBlobStorageImplBuilder.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/AzureBlobStorageImplBuilder.java @@ -218,7 +218,7 @@ public AzureBlobStorageImplBuilder retryPolicy(RetryPolicy retryPolicy) { @Generated public AzureBlobStorageImpl buildClient() { HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); - String localVersion = (version != null) ? version : "2021-12-02"; + String localVersion = (version != null) ? version : "2024-08-04"; SerializerAdapter localSerializerAdapter = (serializerAdapter != null) ? serializerAdapter : JacksonAdapter.createDefaultSerializerAdapter(); AzureBlobStorageImpl client = diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/BlobsImpl.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/BlobsImpl.java index e712601c59894..f89befa5c39f2 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/BlobsImpl.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/BlobsImpl.java @@ -982,7 +982,9 @@ Mono> getAccountInfo( @PathParam("blob") String blob, @QueryParam("restype") String restype, @QueryParam("comp") String comp, + @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, + @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("Accept") String accept, Context context); @@ -995,7 +997,9 @@ Mono> getAccountInfoNoCustomHeaders( @PathParam("blob") String blob, @QueryParam("restype") String restype, @QueryParam("comp") String comp, + @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, + @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("Accept") String accept, Context context); @@ -9178,6 +9182,11 @@ public Mono> setTierNoCustomHeadersWithResponseAsync( * * @param containerName The container name. * @param blob The blob name. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws BlobStorageException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -9185,7 +9194,7 @@ public Mono> setTierNoCustomHeadersWithResponseAsync( */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono> getAccountInfoWithResponseAsync( - String containerName, String blob) { + String containerName, String blob, Integer timeout, String requestId) { final String restype = "account"; final String comp = "properties"; final String accept = "application/xml"; @@ -9197,7 +9206,9 @@ public Mono> getAccountInfoWithRe blob, restype, comp, + timeout, this.client.getVersion(), + requestId, accept, context)); } @@ -9207,6 +9218,11 @@ public Mono> getAccountInfoWithRe * * @param containerName The container name. * @param blob The blob name. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws BlobStorageException thrown if the request is rejected by server. @@ -9215,12 +9231,21 @@ public Mono> getAccountInfoWithRe */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono> getAccountInfoWithResponseAsync( - String containerName, String blob, Context context) { + String containerName, String blob, Integer timeout, String requestId, Context context) { final String restype = "account"; final String comp = "properties"; final String accept = "application/xml"; return service.getAccountInfo( - this.client.getUrl(), containerName, blob, restype, comp, this.client.getVersion(), accept, context); + this.client.getUrl(), + containerName, + blob, + restype, + comp, + timeout, + this.client.getVersion(), + requestId, + accept, + context); } /** @@ -9228,14 +9253,20 @@ public Mono> getAccountInfoWithRe * * @param containerName The container name. * @param blob The blob name. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws BlobStorageException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return A {@link Mono} that completes when a successful response is received. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getAccountInfoAsync(String containerName, String blob) { - return getAccountInfoWithResponseAsync(containerName, blob).flatMap(ignored -> Mono.empty()); + public Mono getAccountInfoAsync(String containerName, String blob, Integer timeout, String requestId) { + return getAccountInfoWithResponseAsync(containerName, blob, timeout, requestId) + .flatMap(ignored -> Mono.empty()); } /** @@ -9243,6 +9274,11 @@ public Mono getAccountInfoAsync(String containerName, String blob) { * * @param containerName The container name. * @param blob The blob name. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws BlobStorageException thrown if the request is rejected by server. @@ -9250,8 +9286,10 @@ public Mono getAccountInfoAsync(String containerName, String blob) { * @return A {@link Mono} that completes when a successful response is received. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getAccountInfoAsync(String containerName, String blob, Context context) { - return getAccountInfoWithResponseAsync(containerName, blob, context).flatMap(ignored -> Mono.empty()); + public Mono getAccountInfoAsync( + String containerName, String blob, Integer timeout, String requestId, Context context) { + return getAccountInfoWithResponseAsync(containerName, blob, timeout, requestId, context) + .flatMap(ignored -> Mono.empty()); } /** @@ -9259,13 +9297,19 @@ public Mono getAccountInfoAsync(String containerName, String blob, Context * * @param containerName The container name. * @param blob The blob name. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws BlobStorageException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getAccountInfoNoCustomHeadersWithResponseAsync(String containerName, String blob) { + public Mono> getAccountInfoNoCustomHeadersWithResponseAsync( + String containerName, String blob, Integer timeout, String requestId) { final String restype = "account"; final String comp = "properties"; final String accept = "application/xml"; @@ -9277,7 +9321,9 @@ public Mono> getAccountInfoNoCustomHeadersWithResponseAsync(Strin blob, restype, comp, + timeout, this.client.getVersion(), + requestId, accept, context)); } @@ -9287,6 +9333,11 @@ public Mono> getAccountInfoNoCustomHeadersWithResponseAsync(Strin * * @param containerName The container name. * @param blob The blob name. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws BlobStorageException thrown if the request is rejected by server. @@ -9295,12 +9346,21 @@ public Mono> getAccountInfoNoCustomHeadersWithResponseAsync(Strin */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono> getAccountInfoNoCustomHeadersWithResponseAsync( - String containerName, String blob, Context context) { + String containerName, String blob, Integer timeout, String requestId, Context context) { final String restype = "account"; final String comp = "properties"; final String accept = "application/xml"; return service.getAccountInfoNoCustomHeaders( - this.client.getUrl(), containerName, blob, restype, comp, this.client.getVersion(), accept, context); + this.client.getUrl(), + containerName, + blob, + restype, + comp, + timeout, + this.client.getVersion(), + requestId, + accept, + context); } /** diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/ContainersImpl.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/ContainersImpl.java index ddf889773dc4c..ea2cf43655226 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/ContainersImpl.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/ContainersImpl.java @@ -720,7 +720,9 @@ Mono> getAccountInfo( @PathParam("containerName") String containerName, @QueryParam("restype") String restype, @QueryParam("comp") String comp, + @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, + @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("Accept") String accept, Context context); @@ -732,7 +734,9 @@ Mono> getAccountInfoNoCustomHeaders( @PathParam("containerName") String containerName, @QueryParam("restype") String restype, @QueryParam("comp") String comp, + @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, + @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("Accept") String accept, Context context); } @@ -5817,6 +5821,11 @@ public Mono> listBlobHierarchySegmen * Returns the sku name and account kind. * * @param containerName The container name. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws BlobStorageException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -5824,7 +5833,7 @@ public Mono> listBlobHierarchySegmen */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono> getAccountInfoWithResponseAsync( - String containerName) { + String containerName, Integer timeout, String requestId) { final String restype = "account"; final String comp = "properties"; final String accept = "application/xml"; @@ -5835,7 +5844,9 @@ public Mono> getAccountInfoW containerName, restype, comp, + timeout, this.client.getVersion(), + requestId, accept, context)); } @@ -5844,6 +5855,11 @@ public Mono> getAccountInfoW * Returns the sku name and account kind. * * @param containerName The container name. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws BlobStorageException thrown if the request is rejected by server. @@ -5852,32 +5868,50 @@ public Mono> getAccountInfoW */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono> getAccountInfoWithResponseAsync( - String containerName, Context context) { + String containerName, Integer timeout, String requestId, Context context) { final String restype = "account"; final String comp = "properties"; final String accept = "application/xml"; return service.getAccountInfo( - this.client.getUrl(), containerName, restype, comp, this.client.getVersion(), accept, context); + this.client.getUrl(), + containerName, + restype, + comp, + timeout, + this.client.getVersion(), + requestId, + accept, + context); } /** * Returns the sku name and account kind. * * @param containerName The container name. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws BlobStorageException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return A {@link Mono} that completes when a successful response is received. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getAccountInfoAsync(String containerName) { - return getAccountInfoWithResponseAsync(containerName).flatMap(ignored -> Mono.empty()); + public Mono getAccountInfoAsync(String containerName, Integer timeout, String requestId) { + return getAccountInfoWithResponseAsync(containerName, timeout, requestId).flatMap(ignored -> Mono.empty()); } /** * Returns the sku name and account kind. * * @param containerName The container name. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws BlobStorageException thrown if the request is rejected by server. @@ -5885,21 +5919,28 @@ public Mono getAccountInfoAsync(String containerName) { * @return A {@link Mono} that completes when a successful response is received. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getAccountInfoAsync(String containerName, Context context) { - return getAccountInfoWithResponseAsync(containerName, context).flatMap(ignored -> Mono.empty()); + public Mono getAccountInfoAsync(String containerName, Integer timeout, String requestId, Context context) { + return getAccountInfoWithResponseAsync(containerName, timeout, requestId, context) + .flatMap(ignored -> Mono.empty()); } /** * Returns the sku name and account kind. * * @param containerName The container name. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws BlobStorageException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getAccountInfoNoCustomHeadersWithResponseAsync(String containerName) { + public Mono> getAccountInfoNoCustomHeadersWithResponseAsync( + String containerName, Integer timeout, String requestId) { final String restype = "account"; final String comp = "properties"; final String accept = "application/xml"; @@ -5910,7 +5951,9 @@ public Mono> getAccountInfoNoCustomHeadersWithResponseAsync(Strin containerName, restype, comp, + timeout, this.client.getVersion(), + requestId, accept, context)); } @@ -5919,6 +5962,11 @@ public Mono> getAccountInfoNoCustomHeadersWithResponseAsync(Strin * Returns the sku name and account kind. * * @param containerName The container name. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws BlobStorageException thrown if the request is rejected by server. @@ -5926,11 +5974,20 @@ public Mono> getAccountInfoNoCustomHeadersWithResponseAsync(Strin * @return the {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getAccountInfoNoCustomHeadersWithResponseAsync(String containerName, Context context) { + public Mono> getAccountInfoNoCustomHeadersWithResponseAsync( + String containerName, Integer timeout, String requestId, Context context) { final String restype = "account"; final String comp = "properties"; final String accept = "application/xml"; return service.getAccountInfoNoCustomHeaders( - this.client.getUrl(), containerName, restype, comp, this.client.getVersion(), accept, context); + this.client.getUrl(), + containerName, + restype, + comp, + timeout, + this.client.getVersion(), + requestId, + accept, + context); } } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/ServicesImpl.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/ServicesImpl.java index b6012bc4f5a9c..ef8abf7b6c54b 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/ServicesImpl.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/ServicesImpl.java @@ -226,7 +226,9 @@ Mono> getAccountInfo( @HostParam("url") String url, @QueryParam("restype") String restype, @QueryParam("comp") String comp, + @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, + @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("Accept") String accept, Context context); @@ -237,7 +239,9 @@ Mono> getAccountInfoNoCustomHeaders( @HostParam("url") String url, @QueryParam("restype") String restype, @QueryParam("comp") String comp, + @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, + @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("Accept") String accept, Context context); @@ -1481,24 +1485,43 @@ public Mono> getUserDelegationKeyNoCustomHeadersWith /** * Returns the sku name and account kind. * + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws BlobStorageException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the {@link ResponseBase} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getAccountInfoWithResponseAsync() { + public Mono> getAccountInfoWithResponseAsync( + Integer timeout, String requestId) { final String restype = "account"; final String comp = "properties"; final String accept = "application/xml"; return FluxUtil.withContext( context -> service.getAccountInfo( - this.client.getUrl(), restype, comp, this.client.getVersion(), accept, context)); + this.client.getUrl(), + restype, + comp, + timeout, + this.client.getVersion(), + requestId, + accept, + context)); } /** * Returns the sku name and account kind. * + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws BlobStorageException thrown if the request is rejected by server. @@ -1506,28 +1529,41 @@ public Mono> getAccountInfoWit * @return the {@link ResponseBase} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getAccountInfoWithResponseAsync(Context context) { + public Mono> getAccountInfoWithResponseAsync( + Integer timeout, String requestId, Context context) { final String restype = "account"; final String comp = "properties"; final String accept = "application/xml"; - return service.getAccountInfo(this.client.getUrl(), restype, comp, this.client.getVersion(), accept, context); + return service.getAccountInfo( + this.client.getUrl(), restype, comp, timeout, this.client.getVersion(), requestId, accept, context); } /** * Returns the sku name and account kind. * + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws BlobStorageException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return A {@link Mono} that completes when a successful response is received. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getAccountInfoAsync() { - return getAccountInfoWithResponseAsync().flatMap(ignored -> Mono.empty()); + public Mono getAccountInfoAsync(Integer timeout, String requestId) { + return getAccountInfoWithResponseAsync(timeout, requestId).flatMap(ignored -> Mono.empty()); } /** * Returns the sku name and account kind. * + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws BlobStorageException thrown if the request is rejected by server. @@ -1535,31 +1571,49 @@ public Mono getAccountInfoAsync() { * @return A {@link Mono} that completes when a successful response is received. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getAccountInfoAsync(Context context) { - return getAccountInfoWithResponseAsync(context).flatMap(ignored -> Mono.empty()); + public Mono getAccountInfoAsync(Integer timeout, String requestId, Context context) { + return getAccountInfoWithResponseAsync(timeout, requestId, context).flatMap(ignored -> Mono.empty()); } /** * Returns the sku name and account kind. * + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. + * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws BlobStorageException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getAccountInfoNoCustomHeadersWithResponseAsync() { + public Mono> getAccountInfoNoCustomHeadersWithResponseAsync(Integer timeout, String requestId) { final String restype = "account"; final String comp = "properties"; final String accept = "application/xml"; return FluxUtil.withContext( context -> service.getAccountInfoNoCustomHeaders( - this.client.getUrl(), restype, comp, this.client.getVersion(), accept, context)); + this.client.getUrl(), + restype, + comp, + timeout, + this.client.getVersion(), + requestId, + accept, + context)); } /** * Returns the sku name and account kind. * + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a + * href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting + * Timeouts for Blob Service Operations.</a>. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the + * analytics logs when storage analytics logging is enabled. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws BlobStorageException thrown if the request is rejected by server. @@ -1567,12 +1621,13 @@ public Mono> getAccountInfoNoCustomHeadersWithResponseAsync() { * @return the {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getAccountInfoNoCustomHeadersWithResponseAsync(Context context) { + public Mono> getAccountInfoNoCustomHeadersWithResponseAsync( + Integer timeout, String requestId, Context context) { final String restype = "account"; final String comp = "properties"; final String accept = "application/xml"; return service.getAccountInfoNoCustomHeaders( - this.client.getUrl(), restype, comp, this.client.getVersion(), accept, context); + this.client.getUrl(), restype, comp, timeout, this.client.getVersion(), requestId, accept, context); } /** diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/models/BlobsGetAccountInfoHeaders.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/models/BlobsGetAccountInfoHeaders.java index 0ace883aa5b21..992e8d2cb9068 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/models/BlobsGetAccountInfoHeaders.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/models/BlobsGetAccountInfoHeaders.java @@ -30,6 +30,12 @@ public final class BlobsGetAccountInfoHeaders { @JsonProperty(value = "x-ms-account-kind") private AccountKind xMsAccountKind; + /* + * The x-ms-is-hns-enabled property. + */ + @JsonProperty(value = "x-ms-is-hns-enabled") + private Boolean xMsIsHnsEnabled; + /* * The x-ms-sku-name property. */ @@ -58,6 +64,8 @@ public final class BlobsGetAccountInfoHeaders { private static final HttpHeaderName X_MS_ACCOUNT_KIND = HttpHeaderName.fromString("x-ms-account-kind"); + private static final HttpHeaderName X_MS_IS_HNS_ENABLED = HttpHeaderName.fromString("x-ms-is-hns-enabled"); + private static final HttpHeaderName X_MS_SKU_NAME = HttpHeaderName.fromString("x-ms-sku-name"); private static final HttpHeaderName X_MS_REQUEST_ID = HttpHeaderName.fromString("x-ms-request-id"); @@ -74,6 +82,10 @@ public BlobsGetAccountInfoHeaders(HttpHeaders rawHeaders) { if (xMsAccountKind != null) { this.xMsAccountKind = AccountKind.fromString(xMsAccountKind); } + String xMsIsHnsEnabled = rawHeaders.getValue(X_MS_IS_HNS_ENABLED); + if (xMsIsHnsEnabled != null) { + this.xMsIsHnsEnabled = Boolean.parseBoolean(xMsIsHnsEnabled); + } String xMsSkuName = rawHeaders.getValue(X_MS_SKU_NAME); if (xMsSkuName != null) { this.xMsSkuName = SkuName.fromString(xMsSkuName); @@ -126,6 +138,26 @@ public BlobsGetAccountInfoHeaders setXMsAccountKind(AccountKind xMsAccountKind) return this; } + /** + * Get the xMsIsHnsEnabled property: The x-ms-is-hns-enabled property. + * + * @return the xMsIsHnsEnabled value. + */ + public Boolean isXMsIsHnsEnabled() { + return this.xMsIsHnsEnabled; + } + + /** + * Set the xMsIsHnsEnabled property: The x-ms-is-hns-enabled property. + * + * @param xMsIsHnsEnabled the xMsIsHnsEnabled value to set. + * @return the BlobsGetAccountInfoHeaders object itself. + */ + public BlobsGetAccountInfoHeaders setXMsIsHnsEnabled(Boolean xMsIsHnsEnabled) { + this.xMsIsHnsEnabled = xMsIsHnsEnabled; + return this; + } + /** * Get the xMsSkuName property: The x-ms-sku-name property. * diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/models/ContainersGetAccountInfoHeaders.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/models/ContainersGetAccountInfoHeaders.java index c06145a7c9505..81e8f3c0cdbb0 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/models/ContainersGetAccountInfoHeaders.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/models/ContainersGetAccountInfoHeaders.java @@ -30,6 +30,12 @@ public final class ContainersGetAccountInfoHeaders { @JsonProperty(value = "x-ms-account-kind") private AccountKind xMsAccountKind; + /* + * The x-ms-is-hns-enabled property. + */ + @JsonProperty(value = "x-ms-is-hns-enabled") + private Boolean xMsIsHnsEnabled; + /* * The x-ms-sku-name property. */ @@ -58,6 +64,8 @@ public final class ContainersGetAccountInfoHeaders { private static final HttpHeaderName X_MS_ACCOUNT_KIND = HttpHeaderName.fromString("x-ms-account-kind"); + private static final HttpHeaderName X_MS_IS_HNS_ENABLED = HttpHeaderName.fromString("x-ms-is-hns-enabled"); + private static final HttpHeaderName X_MS_SKU_NAME = HttpHeaderName.fromString("x-ms-sku-name"); private static final HttpHeaderName X_MS_REQUEST_ID = HttpHeaderName.fromString("x-ms-request-id"); @@ -74,6 +82,10 @@ public ContainersGetAccountInfoHeaders(HttpHeaders rawHeaders) { if (xMsAccountKind != null) { this.xMsAccountKind = AccountKind.fromString(xMsAccountKind); } + String xMsIsHnsEnabled = rawHeaders.getValue(X_MS_IS_HNS_ENABLED); + if (xMsIsHnsEnabled != null) { + this.xMsIsHnsEnabled = Boolean.parseBoolean(xMsIsHnsEnabled); + } String xMsSkuName = rawHeaders.getValue(X_MS_SKU_NAME); if (xMsSkuName != null) { this.xMsSkuName = SkuName.fromString(xMsSkuName); @@ -126,6 +138,26 @@ public ContainersGetAccountInfoHeaders setXMsAccountKind(AccountKind xMsAccountK return this; } + /** + * Get the xMsIsHnsEnabled property: The x-ms-is-hns-enabled property. + * + * @return the xMsIsHnsEnabled value. + */ + public Boolean isXMsIsHnsEnabled() { + return this.xMsIsHnsEnabled; + } + + /** + * Set the xMsIsHnsEnabled property: The x-ms-is-hns-enabled property. + * + * @param xMsIsHnsEnabled the xMsIsHnsEnabled value to set. + * @return the ContainersGetAccountInfoHeaders object itself. + */ + public ContainersGetAccountInfoHeaders setXMsIsHnsEnabled(Boolean xMsIsHnsEnabled) { + this.xMsIsHnsEnabled = xMsIsHnsEnabled; + return this; + } + /** * Get the xMsSkuName property: The x-ms-sku-name property. * diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/specialized/BlobAsyncClientBase.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/specialized/BlobAsyncClientBase.java index 049137c9bcb2f..d1a3aeb3d088e 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/specialized/BlobAsyncClientBase.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/specialized/BlobAsyncClientBase.java @@ -2384,7 +2384,8 @@ public Mono> getAccountInfoWithResponse() { } Mono> getAccountInfoWithResponse(Context context) { - return this.azureBlobStorage.getBlobs().getAccountInfoWithResponseAsync(containerName, blobName, context) + return this.azureBlobStorage.getBlobs().getAccountInfoWithResponseAsync(containerName, blobName, null, + null, context) .map(rb -> { BlobsGetAccountInfoHeaders hd = rb.getDeserializedHeaders(); return new SimpleResponse<>(rb, new StorageAccountInfo(hd.getXMsSkuName(), hd.getXMsAccountKind())); diff --git a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/BlobApiTests.java b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/BlobApiTests.java index bf56756358f98..5719f7d34782f 100644 --- a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/BlobApiTests.java +++ b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/BlobApiTests.java @@ -2885,6 +2885,30 @@ public void getAccountInfoMin() { assertResponseStatusCode(bc.getAccountInfoWithResponse(null, null), 200); } + @Test + public void getAccountInfoBase() { + StorageAccountInfo info = bc.getAccountInfo(); + + assertNotNull(info.getAccountKind()); + assertNotNull(info.getSkuName()); + assertFalse(info.isHierarchicalNamespaceEnabled()); + } + + @Test + public void getAccountInfoBaseFail() { + BlobServiceClient serviceClient = instrument(new BlobServiceClientBuilder() + .endpoint(ENVIRONMENT.getPrimaryAccount().getBlobEndpoint()) + .credential(new MockTokenCredential())) + .buildClient(); + + BlobClient blobClient = serviceClient.getBlobContainerClient(generateContainerName()).getBlobClient(generateBlobName()); + + BlobStorageException e = assertThrows(BlobStorageException.class, blobClient::getAccountInfo); + assertEquals(BlobErrorCode.INVALID_AUTHENTICATION_INFO, e.getErrorCode()); + + } + + @Test public void getContainerName() { assertEquals(containerName, bc.getContainerName()); diff --git a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/BlobAsyncApiTests.java b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/BlobAsyncApiTests.java index bfc916b0707db..fd5ccabe557bb 100644 --- a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/BlobAsyncApiTests.java +++ b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/BlobAsyncApiTests.java @@ -2638,6 +2638,33 @@ public void getAccountInfoMin() { 200); } + @Test + public void getAccountInfoBase() { + StepVerifier.create(bc.getAccountInfo()) + .assertNext(r -> { + assertNotNull(r.getAccountKind()); + assertNotNull(r.getSkuName()); + assertFalse(r.isHierarchicalNamespaceEnabled()); + }) + .verifyComplete(); + } + + @Test + public void getAccountInfoBaseFail() { + BlobServiceAsyncClient serviceClient = instrument(new BlobServiceClientBuilder() + .endpoint(ENVIRONMENT.getPrimaryAccount().getBlobEndpoint()) + .credential(new MockTokenCredential())) + .buildAsyncClient(); + + BlobAsyncClient blobClient = serviceClient.getBlobContainerAsyncClient(generateContainerName()).getBlobAsyncClient(generateBlobName()); + + StepVerifier.create(blobClient.getAccountInfo()) + .verifyErrorSatisfies(r -> { + BlobStorageException e = assertInstanceOf(BlobStorageException.class, r); + assertEquals(BlobErrorCode.INVALID_AUTHENTICATION_INFO, e.getErrorCode()); + }); + } + @Test public void getContainerName() { assertEquals(containerName, bc.getContainerName()); diff --git a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/ContainerApiTests.java b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/ContainerApiTests.java index 308d0b7ab93a2..088270e5faa27 100644 --- a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/ContainerApiTests.java +++ b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/ContainerApiTests.java @@ -1896,6 +1896,30 @@ public void getAccountInfoMin() { assertResponseStatusCode(primaryBlobServiceClient.getAccountInfoWithResponse(null, null), 200); } + @Test + public void getAccountInfoBase() { + cc = primaryBlobServiceClient.getBlobContainerClient(generateContainerName()); + StorageAccountInfo info = cc.getAccountInfo(null); + + assertNotNull(info.getAccountKind()); + assertNotNull(info.getSkuName()); + assertFalse(info.isHierarchicalNamespaceEnabled()); + } + + @Test + public void getAccountInfoBaseFail() { + BlobServiceClient serviceClient = instrument(new BlobServiceClientBuilder() + .endpoint(ENVIRONMENT.getPrimaryAccount().getBlobEndpoint()) + .credential(new MockTokenCredential())) + .buildClient(); + + BlobContainerClient containerClient = serviceClient.getBlobContainerClient(generateContainerName()); + + BlobStorageException e = assertThrows(BlobStorageException.class, () -> containerClient.getAccountInfo(null)); + assertEquals(BlobErrorCode.INVALID_AUTHENTICATION_INFO, e.getErrorCode()); + + } + @Test public void getContainerName() { String containerName = generateContainerName(); diff --git a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/ContainerAsyncApiTests.java b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/ContainerAsyncApiTests.java index 6923c54c49205..95b9816720fe1 100644 --- a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/ContainerAsyncApiTests.java +++ b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/ContainerAsyncApiTests.java @@ -2011,6 +2011,35 @@ public void getAccountInfoMin() { assertAsyncResponseStatusCode(primaryBlobServiceAsyncClient.getAccountInfoWithResponse(), 200); } + @Test + public void getAccountInfoBase() { + ccAsync = primaryBlobServiceAsyncClient.getBlobContainerAsyncClient(generateContainerName()); + + StepVerifier.create(ccAsync.getAccountInfo()) + .assertNext(r -> { + assertNotNull(r.getAccountKind()); + assertNotNull(r.getSkuName()); + assertFalse(r.isHierarchicalNamespaceEnabled()); + }) + .verifyComplete(); + } + + @Test + public void getAccountInfoBaseFail() { + BlobServiceAsyncClient serviceClient = instrument(new BlobServiceClientBuilder() + .endpoint(ENVIRONMENT.getPrimaryAccount().getBlobEndpoint()) + .credential(new MockTokenCredential())) + .buildAsyncClient(); + + BlobContainerAsyncClient containerClient = serviceClient.getBlobContainerAsyncClient(generateContainerName()); + + StepVerifier.create(containerClient.getAccountInfo()) + .verifyErrorSatisfies(r -> { + BlobStorageException e = assertInstanceOf(BlobStorageException.class, r); + assertEquals(BlobErrorCode.INVALID_AUTHENTICATION_INFO, e.getErrorCode()); + }); + } + @Test public void getContainerName() { String containerName = generateContainerName(); diff --git a/sdk/storage/azure-storage-blob/swagger/README.md b/sdk/storage/azure-storage-blob/swagger/README.md index 2e670ed47dd2a..a408f56e7005d 100644 --- a/sdk/storage/azure-storage-blob/swagger/README.md +++ b/sdk/storage/azure-storage-blob/swagger/README.md @@ -16,7 +16,7 @@ autorest ### Code generation settings ``` yaml use: '@autorest/java@4.1.16' -input-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/a32d0b2423d19835246bb2ef92941503bfd5e734/specification/storage/data-plane/Microsoft.BlobStorage/preview/2021-12-02/blob.json +input-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/c13d86f8d53ee6d7a396f762f50fe02e3a5bfa07/specification/storage/data-plane/Microsoft.BlobStorage/stable/2024-08-04/blob.json java: true output-folder: ../ namespace: com.azure.storage.blob From 02c23b58afc55e5992ce844c23acef15b4570355 Mon Sep 17 00:00:00 2001 From: Isabelle <141270045+ibrandes@users.noreply.github.com> Date: Tue, 16 Apr 2024 10:16:31 -0700 Subject: [PATCH 03/17] STG94 Files OAuth - full data plane support (#39653) * swagger * tests * missed recording * link and quotaInGB description changes --- .../azure-storage-file-share/assets.json | 2 +- .../storage/file/share/ShareAsyncClient.java | 16 ++- .../azure/storage/file/share/ShareClient.java | 17 ++- .../file/share/ShareServiceAsyncClient.java | 7 +- .../file/share/ShareServiceClient.java | 7 +- .../share/implementation/ServicesImpl.java | 66 ++++++++- .../file/share/implementation/SharesImpl.java | 90 ++++++++++++ .../file/share/FileServiceApiTests.java | 73 ++++++++++ .../file/share/FileServiceAsyncApiTests.java | 75 ++++++++++ .../storage/file/share/ShareApiTests.java | 132 ++++++++++++++++-- .../file/share/ShareAsyncApiTests.java | 75 ++++++++++ .../file/share/specialized/LeaseApiTests.java | 92 ++++++++++++ .../swagger/README.md | 2 +- 13 files changed, 624 insertions(+), 30 deletions(-) diff --git a/sdk/storage/azure-storage-file-share/assets.json b/sdk/storage/azure-storage-file-share/assets.json index 43d28c1fc7d57..7ae69bae94723 100644 --- a/sdk/storage/azure-storage-file-share/assets.json +++ b/sdk/storage/azure-storage-file-share/assets.json @@ -2,5 +2,5 @@ "AssetsRepo": "Azure/azure-sdk-assets", "AssetsRepoPrefixPath": "java", "TagPrefix": "java/storage/azure-storage-file-share", - "Tag": "java/storage/azure-storage-file-share_011cc52a61" + "Tag": "java/storage/azure-storage-file-share_3222f54471" } diff --git a/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/ShareAsyncClient.java b/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/ShareAsyncClient.java index 073e035b37b80..859137892b0f3 100644 --- a/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/ShareAsyncClient.java +++ b/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/ShareAsyncClient.java @@ -319,9 +319,12 @@ public Mono create() { *

For more information, see the * Azure Docs.

* + *

For more information on updated max file share size values, see the + * Azure Docs.

+ * * @param metadata Optional metadata to associate with the share - * @param quotaInGB Optional maximum size the share is allowed to grow to in GB. This must be greater than 0 and - * less than or equal to 5120. The default value is 5120. + * @param quotaInGB Optional maximum size the share is allowed to grow to in GB. The default value is 5120. + * Refer to the Azure Docs for updated values. * @return A response containing information about the {@link ShareInfo share} and the status its creation. * @throws ShareStorageException If the share already exists with different metadata or {@code quotaInGB} is outside * the allowed range. @@ -830,7 +833,11 @@ Mono> getPropertiesWithResponse(ShareGetPropertiesOpti *

For more information, see the * Azure Docs.

* + *

For more information on updated max file share size values, see the + * Azure Docs.

+ * * @param quotaInGB Size in GB to limit the share's growth. The quota in GB must be between 1 and 5120. + * Refer to the Azure Docs for updated values. * @return The {@link ShareInfo information about the share} * @throws ShareStorageException If the share doesn't exist or {@code quotaInGB} is outside the allowed bounds * @deprecated Use {@link ShareAsyncClient#setProperties(ShareSetPropertiesOptions)} @@ -860,7 +867,10 @@ public Mono setQuota(int quotaInGB) { *

For more information, see the * Azure Docs.

* - * @param quotaInGB Size in GB to limit the share's growth. The quota in GB must be between 1 and 5120. + *

For more information on updated max file share size values, see the + * Azure Docs.

+ * + * @param quotaInGB Size in GB to limit the share's growth. The default value is 5120. Refer to the Azure Docs for updated values. * @return A response containing the {@link ShareInfo information about the share} with headers and response status * code * @throws ShareStorageException If the share doesn't exist or {@code quotaInGB} is outside the allowed bounds diff --git a/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/ShareClient.java b/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/ShareClient.java index 58c2f01bc0a81..99ee45b97657f 100644 --- a/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/ShareClient.java +++ b/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/ShareClient.java @@ -240,9 +240,12 @@ public ShareInfo create() { *

For more information, see the * Azure Docs.

* + *

For more information on updated max file share size values, see the + * Azure Docs.

+ * * @param metadata Optional metadata to associate with the share - * @param quotaInGB Optional maximum size the share is allowed to grow to in GB. This must be greater than 0 and - * less than or equal to 5120. The default value is 5120. + * @param quotaInGB Optional maximum size the share is allowed to grow to in GB. The default value is 5120. + * Refer to the Azure Docs for updated values. * @param timeout An optional timeout applied to the operation. If a response is not returned before the timeout * concludes a {@link RuntimeException} will be thrown. * @param context Additional context that is passed through the Http pipeline during the service call. @@ -666,7 +669,10 @@ public Response getPropertiesWithResponse(ShareGetPropertiesOpt *

For more information, see the * Azure Docs.

* - * @param quotaInGB Size in GB to limit the share's growth. The quota in GB must be between 1 and 5120. + *

For more information on updated max file share size values, see the + * Azure Docs.

+ * + * @param quotaInGB Size in GB to limit the share's growth. The default value is 5120. Refer to the Azure Docs for updated values. * @return The {@link ShareInfo information about the share} * @throws ShareStorageException If the share doesn't exist or {@code quotaInGB} is outside the allowed bounds * @deprecated Use {@link ShareClient#setProperties(ShareSetPropertiesOptions)} @@ -695,7 +701,10 @@ public ShareInfo setQuota(int quotaInGB) { *

For more information, see the * Azure Docs.

* - * @param quotaInGB Size in GB to limit the share's growth. The quota in GB must be between 1 and 5120. + *

For more information on updated max file share size values, see the + * Azure Docs.

+ * + * @param quotaInGB Size in GB to limit the share's growth. The default value is 5120. Refer to the Azure Docs for updated values. * @param timeout An optional timeout applied to the operation. If a response is not returned before the timeout * concludes a {@link RuntimeException} will be thrown. * @param context Additional context that is passed through the Http pipeline during the service call. diff --git a/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/ShareServiceAsyncClient.java b/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/ShareServiceAsyncClient.java index 387aa6f96e2d2..3203015d74a69 100644 --- a/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/ShareServiceAsyncClient.java +++ b/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/ShareServiceAsyncClient.java @@ -524,10 +524,13 @@ public Mono createShare(String shareName) { *

For more information, see the * Azure Docs.

* + *

For more information on updated max file share size values, see the + * Azure Docs.

+ * * @param shareName Name of the share * @param metadata Optional metadata to associate with the share - * @param quotaInGB Optional maximum size the share is allowed to grow to in GB. This must be greater than 0 and - * less than or equal to 5120. The default value is 5120. + * @param quotaInGB Optional maximum size the share is allowed to grow to in GB. + * The default value is 5120. Refer to the Azure Docs for updated values. * @return A response containing the {@link ShareAsyncClient ShareAsyncClient} and the status of creating the share. * @throws ShareStorageException If a share with the same name already exists or {@code quotaInGB} is outside the * allowed range. diff --git a/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/ShareServiceClient.java b/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/ShareServiceClient.java index 493cdc5587541..72abde2b447f7 100644 --- a/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/ShareServiceClient.java +++ b/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/ShareServiceClient.java @@ -408,10 +408,13 @@ public ShareClient createShare(String shareName) { *

For more information, see the * Azure Docs.

* + *

For more information on updated max file share size values, see the + * Azure Docs.

+ * * @param shareName Name of the share * @param metadata Optional metadata to associate with the share - * @param quotaInGB Optional maximum size the share is allowed to grow to in GB. This must be greater than 0 and - * less than or equal to 5120. The default value is 5120. + * @param quotaInGB Optional maximum size the share is allowed to grow to in GB. The default value is 5120. + * Refer to the Azure Docs for updated values. * @param timeout An optional timeout applied to the operation. If a response is not returned before the timeout * concludes a {@link RuntimeException} will be thrown. * @param context Additional context that is passed through the Http pipeline during the service call. diff --git a/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/implementation/ServicesImpl.java b/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/implementation/ServicesImpl.java index 3f079b6d79274..825374f387ef9 100644 --- a/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/implementation/ServicesImpl.java +++ b/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/implementation/ServicesImpl.java @@ -34,6 +34,7 @@ import com.azure.storage.file.share.implementation.models.ShareItemInternal; import com.azure.storage.file.share.models.ShareServiceProperties; import com.azure.storage.file.share.models.ShareStorageException; +import com.azure.storage.file.share.models.ShareTokenIntent; import java.util.List; import java.util.Objects; import java.util.stream.Collectors; @@ -73,6 +74,7 @@ Mono> setProperties( @QueryParam("comp") String comp, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, + @HeaderParam("x-ms-file-request-intent") ShareTokenIntent fileRequestIntent, @BodyParam("application/xml") ShareServiceProperties shareServiceProperties, @HeaderParam("Accept") String accept, Context context); @@ -86,6 +88,7 @@ Mono> setPropertiesNoCustomHeaders( @QueryParam("comp") String comp, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, + @HeaderParam("x-ms-file-request-intent") ShareTokenIntent fileRequestIntent, @BodyParam("application/xml") ShareServiceProperties shareServiceProperties, @HeaderParam("Accept") String accept, Context context); @@ -99,6 +102,7 @@ Mono> getProp @QueryParam("comp") String comp, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, + @HeaderParam("x-ms-file-request-intent") ShareTokenIntent fileRequestIntent, @HeaderParam("Accept") String accept, Context context); @@ -111,6 +115,7 @@ Mono> getPropertiesNoCustomHeaders( @QueryParam("comp") String comp, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, + @HeaderParam("x-ms-file-request-intent") ShareTokenIntent fileRequestIntent, @HeaderParam("Accept") String accept, Context context); @@ -126,6 +131,7 @@ Mono> listSha @QueryParam("include") String include, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, + @HeaderParam("x-ms-file-request-intent") ShareTokenIntent fileRequestIntent, @HeaderParam("Accept") String accept, Context context); @@ -141,6 +147,7 @@ Mono> listSharesSegmentNoCustomHeaders( @QueryParam("include") String include, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, + @HeaderParam("x-ms-file-request-intent") ShareTokenIntent fileRequestIntent, @HeaderParam("Accept") String accept, Context context); @@ -151,6 +158,7 @@ Mono> lis @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("url") String url, @HeaderParam("x-ms-version") String version, + @HeaderParam("x-ms-file-request-intent") ShareTokenIntent fileRequestIntent, @HeaderParam("Accept") String accept, Context context); @@ -161,6 +169,7 @@ Mono> listSharesSegmentNextNoCustomHeaders( @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("url") String url, @HeaderParam("x-ms-version") String version, + @HeaderParam("x-ms-file-request-intent") ShareTokenIntent fileRequestIntent, @HeaderParam("Accept") String accept, Context context); } @@ -192,6 +201,7 @@ public Mono> setPropertiesWithR comp, timeout, this.client.getVersion(), + this.client.getFileRequestIntent(), shareServiceProperties, accept, context)); @@ -223,6 +233,7 @@ public Mono> setPropertiesWithR comp, timeout, this.client.getVersion(), + this.client.getFileRequestIntent(), shareServiceProperties, accept, context); @@ -294,6 +305,7 @@ public Mono> setPropertiesNoCustomHeadersWithResponseAsync( comp, timeout, this.client.getVersion(), + this.client.getFileRequestIntent(), shareServiceProperties, accept, context)); @@ -325,6 +337,7 @@ public Mono> setPropertiesNoCustomHeadersWithResponseAsync( comp, timeout, this.client.getVersion(), + this.client.getFileRequestIntent(), shareServiceProperties, accept, context); @@ -358,6 +371,7 @@ public Mono> comp, timeout, this.client.getVersion(), + this.client.getFileRequestIntent(), accept, context)); } @@ -384,7 +398,14 @@ public Mono> final String comp = "properties"; final String accept = "application/xml"; return service.getProperties( - this.client.getUrl(), restype, comp, timeout, this.client.getVersion(), accept, context); + this.client.getUrl(), + restype, + comp, + timeout, + this.client.getVersion(), + this.client.getFileRequestIntent(), + accept, + context); } /** @@ -451,6 +472,7 @@ public Mono> getPropertiesNoCustomHeadersWithRe comp, timeout, this.client.getVersion(), + this.client.getFileRequestIntent(), accept, context)); } @@ -477,7 +499,14 @@ public Mono> getPropertiesNoCustomHeadersWithRe final String comp = "properties"; final String accept = "application/xml"; return service.getPropertiesNoCustomHeaders( - this.client.getUrl(), restype, comp, timeout, this.client.getVersion(), accept, context); + this.client.getUrl(), + restype, + comp, + timeout, + this.client.getVersion(), + this.client.getFileRequestIntent(), + accept, + context); } /** @@ -519,6 +548,7 @@ public Mono> listSharesSegmentSinglePageAsync( includeConverted, timeout, this.client.getVersion(), + this.client.getFileRequestIntent(), accept, context)) .map( @@ -575,6 +605,7 @@ public Mono> listSharesSegmentSinglePageAsync( includeConverted, timeout, this.client.getVersion(), + this.client.getFileRequestIntent(), accept, context) .map( @@ -687,6 +718,7 @@ public Mono> listSharesSegmentNoCustomHeadersSi includeConverted, timeout, this.client.getVersion(), + this.client.getFileRequestIntent(), accept, context)) .map( @@ -743,6 +775,7 @@ public Mono> listSharesSegmentNoCustomHeadersSi includeConverted, timeout, this.client.getVersion(), + this.client.getFileRequestIntent(), accept, context) .map( @@ -834,7 +867,12 @@ public Mono> listSharesSegmentNextSinglePageAsy return FluxUtil.withContext( context -> service.listSharesSegmentNext( - nextLink, this.client.getUrl(), this.client.getVersion(), accept, context)) + nextLink, + this.client.getUrl(), + this.client.getVersion(), + this.client.getFileRequestIntent(), + accept, + context)) .map( res -> new PagedResponseBase<>( @@ -861,7 +899,13 @@ public Mono> listSharesSegmentNextSinglePageAsy public Mono> listSharesSegmentNextSinglePageAsync( String nextLink, Context context) { final String accept = "application/xml"; - return service.listSharesSegmentNext(nextLink, this.client.getUrl(), this.client.getVersion(), accept, context) + return service.listSharesSegmentNext( + nextLink, + this.client.getUrl(), + this.client.getVersion(), + this.client.getFileRequestIntent(), + accept, + context) .map( res -> new PagedResponseBase<>( @@ -889,7 +933,12 @@ public Mono> listSharesSegmentNextNoCustomHeade return FluxUtil.withContext( context -> service.listSharesSegmentNextNoCustomHeaders( - nextLink, this.client.getUrl(), this.client.getVersion(), accept, context)) + nextLink, + this.client.getUrl(), + this.client.getVersion(), + this.client.getFileRequestIntent(), + accept, + context)) .map( res -> new PagedResponseBase<>( @@ -917,7 +966,12 @@ public Mono> listSharesSegmentNextNoCustomHeade String nextLink, Context context) { final String accept = "application/xml"; return service.listSharesSegmentNextNoCustomHeaders( - nextLink, this.client.getUrl(), this.client.getVersion(), accept, context) + nextLink, + this.client.getUrl(), + this.client.getVersion(), + this.client.getFileRequestIntent(), + accept, + context) .map( res -> new PagedResponseBase<>( diff --git a/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/implementation/SharesImpl.java b/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/implementation/SharesImpl.java index b09772a9d99e6..e5d0f315e0484 100644 --- a/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/implementation/SharesImpl.java +++ b/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/implementation/SharesImpl.java @@ -91,6 +91,7 @@ Mono> create( @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-enabled-protocols") String enabledProtocols, @HeaderParam("x-ms-root-squash") ShareRootSquash rootSquash, + @HeaderParam("x-ms-file-request-intent") ShareTokenIntent fileRequestIntent, @HeaderParam("Accept") String accept, Context context); @@ -108,6 +109,7 @@ Mono> createNoCustomHeaders( @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-enabled-protocols") String enabledProtocols, @HeaderParam("x-ms-root-squash") ShareRootSquash rootSquash, + @HeaderParam("x-ms-file-request-intent") ShareTokenIntent fileRequestIntent, @HeaderParam("Accept") String accept, Context context); @@ -122,6 +124,7 @@ Mono> getProperties( @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-lease-id") String leaseId, + @HeaderParam("x-ms-file-request-intent") ShareTokenIntent fileRequestIntent, @HeaderParam("Accept") String accept, Context context); @@ -136,6 +139,7 @@ Mono> getPropertiesNoCustomHeaders( @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-lease-id") String leaseId, + @HeaderParam("x-ms-file-request-intent") ShareTokenIntent fileRequestIntent, @HeaderParam("Accept") String accept, Context context); @@ -151,6 +155,7 @@ Mono> delete( @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-delete-snapshots") DeleteSnapshotsOptionType deleteSnapshots, @HeaderParam("x-ms-lease-id") String leaseId, + @HeaderParam("x-ms-file-request-intent") ShareTokenIntent fileRequestIntent, @HeaderParam("Accept") String accept, Context context); @@ -166,6 +171,7 @@ Mono> deleteNoCustomHeaders( @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-delete-snapshots") DeleteSnapshotsOptionType deleteSnapshots, @HeaderParam("x-ms-lease-id") String leaseId, + @HeaderParam("x-ms-file-request-intent") ShareTokenIntent fileRequestIntent, @HeaderParam("Accept") String accept, Context context); @@ -184,6 +190,7 @@ Mono> acquireLease( @HeaderParam("x-ms-version") String version, @QueryParam("sharesnapshot") String sharesnapshot, @HeaderParam("x-ms-client-request-id") String requestId, + @HeaderParam("x-ms-file-request-intent") ShareTokenIntent fileRequestIntent, @HeaderParam("Accept") String accept, Context context); @@ -202,6 +209,7 @@ Mono> acquireLeaseNoCustomHeaders( @HeaderParam("x-ms-version") String version, @QueryParam("sharesnapshot") String sharesnapshot, @HeaderParam("x-ms-client-request-id") String requestId, + @HeaderParam("x-ms-file-request-intent") ShareTokenIntent fileRequestIntent, @HeaderParam("Accept") String accept, Context context); @@ -219,6 +227,7 @@ Mono> releaseLease( @HeaderParam("x-ms-version") String version, @QueryParam("sharesnapshot") String sharesnapshot, @HeaderParam("x-ms-client-request-id") String requestId, + @HeaderParam("x-ms-file-request-intent") ShareTokenIntent fileRequestIntent, @HeaderParam("Accept") String accept, Context context); @@ -236,6 +245,7 @@ Mono> releaseLeaseNoCustomHeaders( @HeaderParam("x-ms-version") String version, @QueryParam("sharesnapshot") String sharesnapshot, @HeaderParam("x-ms-client-request-id") String requestId, + @HeaderParam("x-ms-file-request-intent") ShareTokenIntent fileRequestIntent, @HeaderParam("Accept") String accept, Context context); @@ -254,6 +264,7 @@ Mono> changeLease( @HeaderParam("x-ms-version") String version, @QueryParam("sharesnapshot") String sharesnapshot, @HeaderParam("x-ms-client-request-id") String requestId, + @HeaderParam("x-ms-file-request-intent") ShareTokenIntent fileRequestIntent, @HeaderParam("Accept") String accept, Context context); @@ -272,6 +283,7 @@ Mono> changeLeaseNoCustomHeaders( @HeaderParam("x-ms-version") String version, @QueryParam("sharesnapshot") String sharesnapshot, @HeaderParam("x-ms-client-request-id") String requestId, + @HeaderParam("x-ms-file-request-intent") ShareTokenIntent fileRequestIntent, @HeaderParam("Accept") String accept, Context context); @@ -289,6 +301,7 @@ Mono> renewLease( @HeaderParam("x-ms-version") String version, @QueryParam("sharesnapshot") String sharesnapshot, @HeaderParam("x-ms-client-request-id") String requestId, + @HeaderParam("x-ms-file-request-intent") ShareTokenIntent fileRequestIntent, @HeaderParam("Accept") String accept, Context context); @@ -306,6 +319,7 @@ Mono> renewLeaseNoCustomHeaders( @HeaderParam("x-ms-version") String version, @QueryParam("sharesnapshot") String sharesnapshot, @HeaderParam("x-ms-client-request-id") String requestId, + @HeaderParam("x-ms-file-request-intent") ShareTokenIntent fileRequestIntent, @HeaderParam("Accept") String accept, Context context); @@ -324,6 +338,7 @@ Mono> breakLease( @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("sharesnapshot") String sharesnapshot, + @HeaderParam("x-ms-file-request-intent") ShareTokenIntent fileRequestIntent, @HeaderParam("Accept") String accept, Context context); @@ -342,6 +357,7 @@ Mono> breakLeaseNoCustomHeaders( @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("sharesnapshot") String sharesnapshot, + @HeaderParam("x-ms-file-request-intent") ShareTokenIntent fileRequestIntent, @HeaderParam("Accept") String accept, Context context); @@ -356,6 +372,7 @@ Mono> createSnapshot( @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-meta-") Map metadata, @HeaderParam("x-ms-version") String version, + @HeaderParam("x-ms-file-request-intent") ShareTokenIntent fileRequestIntent, @HeaderParam("Accept") String accept, Context context); @@ -370,6 +387,7 @@ Mono> createSnapshotNoCustomHeaders( @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-meta-") Map metadata, @HeaderParam("x-ms-version") String version, + @HeaderParam("x-ms-file-request-intent") ShareTokenIntent fileRequestIntent, @HeaderParam("Accept") String accept, Context context); @@ -447,6 +465,7 @@ Mono> setProperties( @HeaderParam("x-ms-access-tier") ShareAccessTier accessTier, @HeaderParam("x-ms-lease-id") String leaseId, @HeaderParam("x-ms-root-squash") ShareRootSquash rootSquash, + @HeaderParam("x-ms-file-request-intent") ShareTokenIntent fileRequestIntent, @HeaderParam("Accept") String accept, Context context); @@ -464,6 +483,7 @@ Mono> setPropertiesNoCustomHeaders( @HeaderParam("x-ms-access-tier") ShareAccessTier accessTier, @HeaderParam("x-ms-lease-id") String leaseId, @HeaderParam("x-ms-root-squash") ShareRootSquash rootSquash, + @HeaderParam("x-ms-file-request-intent") ShareTokenIntent fileRequestIntent, @HeaderParam("Accept") String accept, Context context); @@ -479,6 +499,7 @@ Mono> setMetadata( @HeaderParam("x-ms-meta-") Map metadata, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-lease-id") String leaseId, + @HeaderParam("x-ms-file-request-intent") ShareTokenIntent fileRequestIntent, @HeaderParam("Accept") String accept, Context context); @@ -494,6 +515,7 @@ Mono> setMetadataNoCustomHeaders( @HeaderParam("x-ms-meta-") Map metadata, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-lease-id") String leaseId, + @HeaderParam("x-ms-file-request-intent") ShareTokenIntent fileRequestIntent, @HeaderParam("Accept") String accept, Context context); @@ -508,6 +530,7 @@ Mono>> ge @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-lease-id") String leaseId, + @HeaderParam("x-ms-file-request-intent") ShareTokenIntent fileRequestIntent, @HeaderParam("Accept") String accept, Context context); @@ -522,6 +545,7 @@ Mono>> getAccessPolicyNoCustomHeaders( @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-lease-id") String leaseId, + @HeaderParam("x-ms-file-request-intent") ShareTokenIntent fileRequestIntent, @HeaderParam("Accept") String accept, Context context); @@ -536,6 +560,7 @@ Mono> setAccessPolicy( @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-lease-id") String leaseId, + @HeaderParam("x-ms-file-request-intent") ShareTokenIntent fileRequestIntent, @BodyParam("application/xml") SignedIdentifiersWrapper shareAcl, @HeaderParam("Accept") String accept, Context context); @@ -551,6 +576,7 @@ Mono> setAccessPolicyNoCustomHeaders( @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-lease-id") String leaseId, + @HeaderParam("x-ms-file-request-intent") ShareTokenIntent fileRequestIntent, @BodyParam("application/xml") SignedIdentifiersWrapper shareAcl, @HeaderParam("Accept") String accept, Context context); @@ -566,6 +592,7 @@ Mono> getStatistics( @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-lease-id") String leaseId, + @HeaderParam("x-ms-file-request-intent") ShareTokenIntent fileRequestIntent, @HeaderParam("Accept") String accept, Context context); @@ -580,6 +607,7 @@ Mono> getStatisticsNoCustomHeaders( @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-lease-id") String leaseId, + @HeaderParam("x-ms-file-request-intent") ShareTokenIntent fileRequestIntent, @HeaderParam("Accept") String accept, Context context); @@ -596,6 +624,7 @@ Mono> restore( @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("x-ms-deleted-share-name") String deletedShareName, @HeaderParam("x-ms-deleted-share-version") String deletedShareVersion, + @HeaderParam("x-ms-file-request-intent") ShareTokenIntent fileRequestIntent, @HeaderParam("Accept") String accept, Context context); @@ -612,6 +641,7 @@ Mono> restoreNoCustomHeaders( @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("x-ms-deleted-share-name") String deletedShareName, @HeaderParam("x-ms-deleted-share-version") String deletedShareVersion, + @HeaderParam("x-ms-file-request-intent") ShareTokenIntent fileRequestIntent, @HeaderParam("Accept") String accept, Context context); } @@ -658,6 +688,7 @@ public Mono> createWithResponseAsync( this.client.getVersion(), enabledProtocols, rootSquash, + this.client.getFileRequestIntent(), accept, context)); } @@ -704,6 +735,7 @@ public Mono> createWithResponseAsync( this.client.getVersion(), enabledProtocols, rootSquash, + this.client.getFileRequestIntent(), accept, context); } @@ -815,6 +847,7 @@ public Mono> createNoCustomHeadersWithResponseAsync( this.client.getVersion(), enabledProtocols, rootSquash, + this.client.getFileRequestIntent(), accept, context)); } @@ -861,6 +894,7 @@ public Mono> createNoCustomHeadersWithResponseAsync( this.client.getVersion(), enabledProtocols, rootSquash, + this.client.getFileRequestIntent(), accept, context); } @@ -896,6 +930,7 @@ public Mono> getPropertiesWithRes timeout, this.client.getVersion(), leaseId, + this.client.getFileRequestIntent(), accept, context)); } @@ -930,6 +965,7 @@ public Mono> getPropertiesWithRes timeout, this.client.getVersion(), leaseId, + this.client.getFileRequestIntent(), accept, context); } @@ -1011,6 +1047,7 @@ public Mono> getPropertiesNoCustomHeadersWithResponseAsync( timeout, this.client.getVersion(), leaseId, + this.client.getFileRequestIntent(), accept, context)); } @@ -1045,6 +1082,7 @@ public Mono> getPropertiesNoCustomHeadersWithResponseAsync( timeout, this.client.getVersion(), leaseId, + this.client.getFileRequestIntent(), accept, context); } @@ -1086,6 +1124,7 @@ public Mono> deleteWithResponseAsync( this.client.getVersion(), deleteSnapshots, leaseId, + this.client.getFileRequestIntent(), accept, context)); } @@ -1127,6 +1166,7 @@ public Mono> deleteWithResponseAsync( this.client.getVersion(), deleteSnapshots, leaseId, + this.client.getFileRequestIntent(), accept, context); } @@ -1226,6 +1266,7 @@ public Mono> deleteNoCustomHeadersWithResponseAsync( this.client.getVersion(), deleteSnapshots, leaseId, + this.client.getFileRequestIntent(), accept, context)); } @@ -1267,6 +1308,7 @@ public Mono> deleteNoCustomHeadersWithResponseAsync( this.client.getVersion(), deleteSnapshots, leaseId, + this.client.getFileRequestIntent(), accept, context); } @@ -1320,6 +1362,7 @@ public Mono> acquireLeaseWithRespo this.client.getVersion(), sharesnapshot, requestId, + this.client.getFileRequestIntent(), accept, context)); } @@ -1373,6 +1416,7 @@ public Mono> acquireLeaseWithRespo this.client.getVersion(), sharesnapshot, requestId, + this.client.getFileRequestIntent(), accept, context); } @@ -1499,6 +1543,7 @@ public Mono> acquireLeaseNoCustomHeadersWithResponseAsync( this.client.getVersion(), sharesnapshot, requestId, + this.client.getFileRequestIntent(), accept, context)); } @@ -1552,6 +1597,7 @@ public Mono> acquireLeaseNoCustomHeadersWithResponseAsync( this.client.getVersion(), sharesnapshot, requestId, + this.client.getFileRequestIntent(), accept, context); } @@ -1594,6 +1640,7 @@ public Mono> releaseLeaseWithRespo this.client.getVersion(), sharesnapshot, requestId, + this.client.getFileRequestIntent(), accept, context)); } @@ -1640,6 +1687,7 @@ public Mono> releaseLeaseWithRespo this.client.getVersion(), sharesnapshot, requestId, + this.client.getFileRequestIntent(), accept, context); } @@ -1738,6 +1786,7 @@ public Mono> releaseLeaseNoCustomHeadersWithResponseAsync( this.client.getVersion(), sharesnapshot, requestId, + this.client.getFileRequestIntent(), accept, context)); } @@ -1784,6 +1833,7 @@ public Mono> releaseLeaseNoCustomHeadersWithResponseAsync( this.client.getVersion(), sharesnapshot, requestId, + this.client.getFileRequestIntent(), accept, context); } @@ -1835,6 +1885,7 @@ public Mono> changeLeaseWithRespons this.client.getVersion(), sharesnapshot, requestId, + this.client.getFileRequestIntent(), accept, context)); } @@ -1886,6 +1937,7 @@ public Mono> changeLeaseWithRespons this.client.getVersion(), sharesnapshot, requestId, + this.client.getFileRequestIntent(), accept, context); } @@ -2006,6 +2058,7 @@ public Mono> changeLeaseNoCustomHeadersWithResponseAsync( this.client.getVersion(), sharesnapshot, requestId, + this.client.getFileRequestIntent(), accept, context)); } @@ -2057,6 +2110,7 @@ public Mono> changeLeaseNoCustomHeadersWithResponseAsync( this.client.getVersion(), sharesnapshot, requestId, + this.client.getFileRequestIntent(), accept, context); } @@ -2099,6 +2153,7 @@ public Mono> renewLeaseWithResponseA this.client.getVersion(), sharesnapshot, requestId, + this.client.getFileRequestIntent(), accept, context)); } @@ -2145,6 +2200,7 @@ public Mono> renewLeaseWithResponseA this.client.getVersion(), sharesnapshot, requestId, + this.client.getFileRequestIntent(), accept, context); } @@ -2243,6 +2299,7 @@ public Mono> renewLeaseNoCustomHeadersWithResponseAsync( this.client.getVersion(), sharesnapshot, requestId, + this.client.getFileRequestIntent(), accept, context)); } @@ -2289,6 +2346,7 @@ public Mono> renewLeaseNoCustomHeadersWithResponseAsync( this.client.getVersion(), sharesnapshot, requestId, + this.client.getFileRequestIntent(), accept, context); } @@ -2343,6 +2401,7 @@ public Mono> breakLeaseWithResponseA this.client.getVersion(), requestId, sharesnapshot, + this.client.getFileRequestIntent(), accept, context)); } @@ -2397,6 +2456,7 @@ public Mono> breakLeaseWithResponseA this.client.getVersion(), requestId, sharesnapshot, + this.client.getFileRequestIntent(), accept, context); } @@ -2525,6 +2585,7 @@ public Mono> breakLeaseNoCustomHeadersWithResponseAsync( this.client.getVersion(), requestId, sharesnapshot, + this.client.getFileRequestIntent(), accept, context)); } @@ -2579,6 +2640,7 @@ public Mono> breakLeaseNoCustomHeadersWithResponseAsync( this.client.getVersion(), requestId, sharesnapshot, + this.client.getFileRequestIntent(), accept, context); } @@ -2612,6 +2674,7 @@ public Mono> createSnapshotWithR timeout, metadata, this.client.getVersion(), + this.client.getFileRequestIntent(), accept, context)); } @@ -2644,6 +2707,7 @@ public Mono> createSnapshotWithR timeout, metadata, this.client.getVersion(), + this.client.getFileRequestIntent(), accept, context); } @@ -2715,6 +2779,7 @@ public Mono> createSnapshotNoCustomHeadersWithResponseAsync( timeout, metadata, this.client.getVersion(), + this.client.getFileRequestIntent(), accept, context)); } @@ -2747,6 +2812,7 @@ public Mono> createSnapshotNoCustomHeadersWithResponseAsync( timeout, metadata, this.client.getVersion(), + this.client.getFileRequestIntent(), accept, context); } @@ -3142,6 +3208,7 @@ public Mono> setPropertiesWithRes accessTier, leaseId, rootSquash, + this.client.getFileRequestIntent(), accept, context)); } @@ -3186,6 +3253,7 @@ public Mono> setPropertiesWithRes accessTier, leaseId, rootSquash, + this.client.getFileRequestIntent(), accept, context); } @@ -3288,6 +3356,7 @@ public Mono> setPropertiesNoCustomHeadersWithResponseAsync( accessTier, leaseId, rootSquash, + this.client.getFileRequestIntent(), accept, context)); } @@ -3332,6 +3401,7 @@ public Mono> setPropertiesNoCustomHeadersWithResponseAsync( accessTier, leaseId, rootSquash, + this.client.getFileRequestIntent(), accept, context); } @@ -3367,6 +3437,7 @@ public Mono> setMetadataWithRespons metadata, this.client.getVersion(), leaseId, + this.client.getFileRequestIntent(), accept, context)); } @@ -3401,6 +3472,7 @@ public Mono> setMetadataWithRespons metadata, this.client.getVersion(), leaseId, + this.client.getFileRequestIntent(), accept, context); } @@ -3478,6 +3550,7 @@ public Mono> setMetadataNoCustomHeadersWithResponseAsync( metadata, this.client.getVersion(), leaseId, + this.client.getFileRequestIntent(), accept, context)); } @@ -3512,6 +3585,7 @@ public Mono> setMetadataNoCustomHeadersWithResponseAsync( metadata, this.client.getVersion(), leaseId, + this.client.getFileRequestIntent(), accept, context); } @@ -3546,6 +3620,7 @@ public Mono> setMetadataNoCustomHeadersWithResponseAsync( timeout, this.client.getVersion(), leaseId, + this.client.getFileRequestIntent(), accept, context)); } @@ -3579,6 +3654,7 @@ public Mono> setMetadataNoCustomHeadersWithResponseAsync( timeout, this.client.getVersion(), leaseId, + this.client.getFileRequestIntent(), accept, context); } @@ -3652,6 +3728,7 @@ public Mono>> getAccessPolicyNoCustomHeader timeout, this.client.getVersion(), leaseId, + this.client.getFileRequestIntent(), accept, context)); } @@ -3684,6 +3761,7 @@ public Mono>> getAccessPolicyNoCustomHeader timeout, this.client.getVersion(), leaseId, + this.client.getFileRequestIntent(), accept, context); } @@ -3719,6 +3797,7 @@ public Mono> setAccessPolicyWit timeout, this.client.getVersion(), leaseId, + this.client.getFileRequestIntent(), shareAclConverted, accept, context)); @@ -3754,6 +3833,7 @@ public Mono> setAccessPolicyWit timeout, this.client.getVersion(), leaseId, + this.client.getFileRequestIntent(), shareAclConverted, accept, context); @@ -3832,6 +3912,7 @@ public Mono> setAccessPolicyNoCustomHeadersWithResponseAsync( timeout, this.client.getVersion(), leaseId, + this.client.getFileRequestIntent(), shareAclConverted, accept, context)); @@ -3867,6 +3948,7 @@ public Mono> setAccessPolicyNoCustomHeadersWithResponseAsync( timeout, this.client.getVersion(), leaseId, + this.client.getFileRequestIntent(), shareAclConverted, accept, context); @@ -3901,6 +3983,7 @@ public Mono> getStatisticsW timeout, this.client.getVersion(), leaseId, + this.client.getFileRequestIntent(), accept, context)); } @@ -3933,6 +4016,7 @@ public Mono> getStatisticsW timeout, this.client.getVersion(), leaseId, + this.client.getFileRequestIntent(), accept, context); } @@ -4005,6 +4089,7 @@ public Mono> getStatisticsNoCustomHeadersWithResponseAsync( timeout, this.client.getVersion(), leaseId, + this.client.getFileRequestIntent(), accept, context)); } @@ -4037,6 +4122,7 @@ public Mono> getStatisticsNoCustomHeadersWithResponseAsync( timeout, this.client.getVersion(), leaseId, + this.client.getFileRequestIntent(), accept, context); } @@ -4075,6 +4161,7 @@ public Mono> restoreWithResponseAsync( requestId, deletedShareName, deletedShareVersion, + this.client.getFileRequestIntent(), accept, context)); } @@ -4117,6 +4204,7 @@ public Mono> restoreWithResponseAsync( requestId, deletedShareName, deletedShareVersion, + this.client.getFileRequestIntent(), accept, context); } @@ -4207,6 +4295,7 @@ public Mono> restoreNoCustomHeadersWithResponseAsync( requestId, deletedShareName, deletedShareVersion, + this.client.getFileRequestIntent(), accept, context)); } @@ -4249,6 +4338,7 @@ public Mono> restoreNoCustomHeadersWithResponseAsync( requestId, deletedShareName, deletedShareVersion, + this.client.getFileRequestIntent(), accept, context); } diff --git a/sdk/storage/azure-storage-file-share/src/test/java/com/azure/storage/file/share/FileServiceApiTests.java b/sdk/storage/azure-storage-file-share/src/test/java/com/azure/storage/file/share/FileServiceApiTests.java index f6f18b8843498..ba2fb1daec86a 100644 --- a/sdk/storage/azure-storage-file-share/src/test/java/com/azure/storage/file/share/FileServiceApiTests.java +++ b/sdk/storage/azure-storage-file-share/src/test/java/com/azure/storage/file/share/FileServiceApiTests.java @@ -21,6 +21,7 @@ import com.azure.storage.file.share.models.ShareServiceProperties; import com.azure.storage.file.share.models.ShareSmbSettings; import com.azure.storage.file.share.models.ShareStorageException; +import com.azure.storage.file.share.models.ShareTokenIntent; import com.azure.storage.file.share.models.SmbMultichannel; import com.azure.storage.file.share.options.ShareCreateOptions; import com.azure.storage.file.share.options.ShareSetPropertiesOptions; @@ -48,6 +49,7 @@ import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertInstanceOf; import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.api.Assertions.assertTrue; @@ -276,6 +278,22 @@ public void listSharesWithPremiumShare() { } } + @RequiredServiceVersion(clazz = ShareServiceVersion.class, min = "2024-08-04") + @Test + public void listSharesOAuth() { + ShareServiceClient oAuthServiceClient = getOAuthServiceClient(new ShareServiceClientBuilder() + .shareTokenIntent(ShareTokenIntent.BACKUP)); + oAuthServiceClient.createShare(shareName); + + for (ShareItem shareItem : oAuthServiceClient.listShares()) { + if (Objects.equals(shareItem.getName(), shareName)) { + assertNotNull(shareItem.getProperties().getETag()); + assertNotNull(shareItem.getProperties().getLastModified()); + } + assertNull(shareItem.getProperties().getMetadata()); + } + } + @ResourceLock("ServiceProperties") @Test public void setAndGetProperties() { @@ -356,6 +374,37 @@ private static Stream setAndGetPropertiesWithInvalidArgsSupplier() { Arguments.of(INVALID_ALLOWED_METHOD, 400, ShareErrorCode.INVALID_XML_NODE_VALUE)); } + @RequiredServiceVersion(clazz = ShareServiceVersion.class, min = "2024-08-04") + @ResourceLock("ServiceProperties") + @Test + public void setAndGetPropertiesOAuth() { + ShareServiceClient oAuthServiceClient = getOAuthServiceClient(new ShareServiceClientBuilder() + .shareTokenIntent(ShareTokenIntent.BACKUP)); + + ShareServiceProperties originalProperties = oAuthServiceClient.getProperties(); + ShareRetentionPolicy retentionPolicy = new ShareRetentionPolicy().setEnabled(true).setDays(3); + ShareMetrics metrics = new ShareMetrics().setEnabled(true).setIncludeApis(false) + .setRetentionPolicy(retentionPolicy).setVersion("1.0"); + ShareServiceProperties updatedProperties = new ShareServiceProperties().setHourMetrics(metrics) + .setMinuteMetrics(metrics).setCors(new ArrayList<>()); + + Response getPropertiesBeforeResponse = + oAuthServiceClient.getPropertiesWithResponse(null, null); + Response setPropertiesResponse = + oAuthServiceClient.setPropertiesWithResponse(updatedProperties, null, null); + Response getPropertiesAfterResponse = + oAuthServiceClient.getPropertiesWithResponse(null, null); + + FileShareTestHelper.assertResponseStatusCode(getPropertiesBeforeResponse, 200); + FileShareTestHelper.assertFileServicePropertiesAreEqual(originalProperties, + getPropertiesBeforeResponse.getValue()); + FileShareTestHelper.assertResponseStatusCode(setPropertiesResponse, 202); + FileShareTestHelper.assertResponseStatusCode(getPropertiesAfterResponse, 200); + FileShareTestHelper.assertFileServicePropertiesAreEqual(updatedProperties, + getPropertiesAfterResponse.getValue()); + + } + @RequiredServiceVersion(clazz = ShareServiceVersion.class, min = "2019-12-12") @Test public void restoreShareMin() { @@ -377,6 +426,30 @@ public void restoreShareMin() { restoredShareClient.getFileClient(fileName).exists(); } + @RequiredServiceVersion(clazz = ShareServiceVersion.class, min = "2024-08-04") + @Test + public void restoreShareOAuth() { + ShareServiceClient oAuthServiceClient = getOAuthServiceClient(new ShareServiceClientBuilder() + .shareTokenIntent(ShareTokenIntent.BACKUP)); + ShareClient shareClient = oAuthServiceClient.getShareClient(shareName); + + shareClient.create(); + String fileName = generatePathName(); + shareClient.getFileClient(fileName).create(2); + shareClient.delete(); + sleepIfRunningAgainstService(30000); + ShareItem shareItem = oAuthServiceClient.listShares( + new ListSharesOptions() + .setPrefix(shareClient.getShareName()) + .setIncludeDeleted(true), + null, Context.NONE).iterator().next(); + + ShareClient restoredShareClient = oAuthServiceClient.undeleteShare(shareItem.getName(), + shareItem.getVersion()); + + restoredShareClient.getFileClient(fileName).exists(); + } + @RequiredServiceVersion(clazz = ShareServiceVersion.class, min = "2019-12-12") @Test public void restoreShareMax() { diff --git a/sdk/storage/azure-storage-file-share/src/test/java/com/azure/storage/file/share/FileServiceAsyncApiTests.java b/sdk/storage/azure-storage-file-share/src/test/java/com/azure/storage/file/share/FileServiceAsyncApiTests.java index 0faf3f05f67ee..21806aad9db9d 100644 --- a/sdk/storage/azure-storage-file-share/src/test/java/com/azure/storage/file/share/FileServiceAsyncApiTests.java +++ b/sdk/storage/azure-storage-file-share/src/test/java/com/azure/storage/file/share/FileServiceAsyncApiTests.java @@ -15,6 +15,7 @@ import com.azure.storage.file.share.models.ShareProperties; import com.azure.storage.file.share.models.ShareRetentionPolicy; import com.azure.storage.file.share.models.ShareServiceProperties; +import com.azure.storage.file.share.models.ShareTokenIntent; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -26,6 +27,7 @@ import reactor.core.publisher.Mono; import reactor.test.StepVerifier; +import java.time.Duration; import java.util.ArrayList; import java.util.Collections; import java.util.LinkedList; @@ -204,6 +206,25 @@ public void listSharesWithPremiumShare() { } + @RequiredServiceVersion(clazz = ShareServiceVersion.class, min = "2024-08-04") + @Test + public void listSharesOAuth() { + ShareServiceAsyncClient oAuthServiceClient = getOAuthServiceAsyncClient(new ShareServiceClientBuilder() + .shareTokenIntent(ShareTokenIntent.BACKUP)); + + Flux shares = oAuthServiceClient.listShares().filter(item -> + Objects.equals(item.getName(), shareName)); + + StepVerifier.create(oAuthServiceClient.createShare(shareName).thenMany(shares)) + .assertNext(r -> { + assertNotNull(r.getProperties()); + assertNotNull(r.getProperties().getETag()); + assertNotNull(r.getProperties().getLastModified()); + }) + .verifyComplete(); + } + + @ResourceLock("ServiceProperties") @Test public void setAndGetProperties() { @@ -251,6 +272,35 @@ private static Stream setAndGetPropertiesWithInvalidArgsSupplier() { Arguments.of(INVALID_ALLOWED_METHOD, 400, ShareErrorCode.INVALID_XML_NODE_VALUE)); } + @RequiredServiceVersion(clazz = ShareServiceVersion.class, min = "2024-08-04") + @ResourceLock("ServiceProperties") + @Test + public void setAndGetPropertiesOAuth() { + ShareServiceAsyncClient oAuthServiceClient = getOAuthServiceAsyncClient(new ShareServiceClientBuilder() + .shareTokenIntent(ShareTokenIntent.BACKUP)); + + ShareServiceProperties originalProperties = oAuthServiceClient.getProperties().block(); + ShareRetentionPolicy retentionPolicy = new ShareRetentionPolicy().setEnabled(true).setDays(3); + ShareMetrics metrics = new ShareMetrics().setEnabled(true).setIncludeApis(false) + .setRetentionPolicy(retentionPolicy).setVersion("1.0"); + ShareServiceProperties updatedProperties = new ShareServiceProperties().setHourMetrics(metrics) + .setMinuteMetrics(metrics).setCors(new ArrayList<>()); + + StepVerifier.create(oAuthServiceClient.getPropertiesWithResponse()).assertNext(it -> { + FileShareTestHelper.assertResponseStatusCode(it, 200); + assertTrue(FileShareTestHelper.assertFileServicePropertiesAreEqual(originalProperties, it.getValue())); + }).verifyComplete(); + + StepVerifier.create(oAuthServiceClient.setPropertiesWithResponse(updatedProperties)) + .assertNext(it -> FileShareTestHelper.assertResponseStatusCode(it, 202)).verifyComplete(); + + StepVerifier.create(oAuthServiceClient.getPropertiesWithResponse()).assertNext(it -> { + FileShareTestHelper.assertResponseStatusCode(it, 200); + assertTrue(FileShareTestHelper.assertFileServicePropertiesAreEqual(updatedProperties, it.getValue())); + }).verifyComplete(); + + } + @RequiredServiceVersion(clazz = ShareServiceVersion.class, min = "2019-12-12") @Test public void restoreShareMin() { @@ -271,6 +321,31 @@ public void restoreShareMin() { .assertNext(Assertions::assertTrue).verifyComplete(); } + @RequiredServiceVersion(clazz = ShareServiceVersion.class, min = "2024-08-04") + @Test + public void restoreShareOAuth() { + ShareServiceAsyncClient oAuthServiceClient = getOAuthServiceAsyncClient(new ShareServiceClientBuilder() + .shareTokenIntent(ShareTokenIntent.BACKUP)); + ShareAsyncClient shareClient = oAuthServiceClient.getShareAsyncClient(generateShareName()); + + String fileName = generatePathName(); + Mono restoredShareClientMono = shareClient.create() + .then(shareClient.getFileClient(fileName).create(2)) + .then(shareClient.delete()) + .then(oAuthServiceClient.listShares( + new ListSharesOptions() + .setPrefix(shareClient.getShareName()) + .setIncludeDeleted(true)).next()) + .flatMap(r -> Mono.zip(Mono.just(r), Mono.delay(Duration.ofSeconds(30)))) + .flatMap(tuple -> { + assertNotNull(tuple.getT1()); + return oAuthServiceClient.undeleteShare(tuple.getT1().getName(), tuple.getT1().getVersion()); + }); + + StepVerifier.create(restoredShareClientMono.flatMap(it -> it.getFileClient(fileName).exists())) + .assertNext(Assertions::assertTrue).verifyComplete(); + } + @RequiredServiceVersion(clazz = ShareServiceVersion.class, min = "2019-12-12") @Test public void restoreShareMax() { diff --git a/sdk/storage/azure-storage-file-share/src/test/java/com/azure/storage/file/share/ShareApiTests.java b/sdk/storage/azure-storage-file-share/src/test/java/com/azure/storage/file/share/ShareApiTests.java index eee1cc9767e39..9e4410ca9616e 100644 --- a/sdk/storage/azure-storage-file-share/src/test/java/com/azure/storage/file/share/ShareApiTests.java +++ b/sdk/storage/azure-storage-file-share/src/test/java/com/azure/storage/file/share/ShareApiTests.java @@ -154,6 +154,18 @@ public void createShare() { 201); } + @RequiredServiceVersion(clazz = ShareServiceVersion.class, min = "2024-08-04") + @Test + public void createShareOAuth() { + ShareServiceClient oAuthServiceClient = getOAuthServiceClient(new ShareServiceClientBuilder() + .shareTokenIntent(ShareTokenIntent.BACKUP)); + ShareClient shareClient = oAuthServiceClient.getShareClient(shareName); + + FileShareTestHelper.assertResponseStatusCode(shareClient.createWithResponse(null, null, + null, null), 201); + + } + @RequiredServiceVersion(clazz = ShareServiceVersion.class, min = "2019-12-12") @ParameterizedTest @MethodSource("createShareWithArgsSupplier") @@ -342,6 +354,17 @@ public void deleteShare() { FileShareTestHelper.assertResponseStatusCode(primaryShareClient.deleteWithResponse(null, null), 202); } + @RequiredServiceVersion(clazz = ShareServiceVersion.class, min = "2024-08-04") + @Test + public void deleteShareOAuth() { + primaryShareClient.create(); + ShareServiceClient oAuthServiceClient = getOAuthServiceClient(new ShareServiceClientBuilder() + .shareTokenIntent(ShareTokenIntent.BACKUP)); + ShareClient shareClient = oAuthServiceClient.getShareClient(shareName); + + FileShareTestHelper.assertResponseStatusCode(shareClient.deleteWithResponse(null, null), 202); + } + @Test public void deleteShareDeleteSnapshotOptions() { primaryShareClient.create(); @@ -479,6 +502,21 @@ public void getProperties() { assertEquals(getPropertiesResponse.getValue().getQuota(), 1); } + @RequiredServiceVersion(clazz = ShareServiceVersion.class, min = "2024-08-04") + @Test + public void getPropertiesOAuth() { + primaryShareClient.createWithResponse(testMetadata, 1, null, null); + ShareServiceClient oAuthServiceClient = getOAuthServiceClient(new ShareServiceClientBuilder() + .shareTokenIntent(ShareTokenIntent.BACKUP)); + ShareClient shareClient = oAuthServiceClient.getShareClient(shareName); + + Response getPropertiesResponse = shareClient.getPropertiesWithResponse(null, null); + + FileShareTestHelper.assertResponseStatusCode(getPropertiesResponse, 200); + assertEquals(testMetadata, getPropertiesResponse.getValue().getMetadata()); + assertEquals(getPropertiesResponse.getValue().getQuota(), 1); + } + @RequiredServiceVersion(clazz = ShareServiceVersion.class, min = "2020-02-10") @Test public void getPropertiesLease() { @@ -505,17 +543,6 @@ public void getPropertiesError() { FileShareTestHelper.assertExceptionStatusCodeAndMessage(e, 404, ShareErrorCode.SHARE_NOT_FOUND); } - @RequiredServiceVersion(clazz = ShareServiceVersion.class, min = "2021-04-10") - @Test - public void getPropertiesOAuthError() { - primaryShareClient.create(); - ShareServiceClient oAuthServiceClient = getOAuthServiceClient(new ShareServiceClientBuilder() - .shareTokenIntent(ShareTokenIntent.BACKUP)); - ShareClient shareClient = oAuthServiceClient.getShareClient(shareName); - // only APIs supported by ShareWithtoken authentication are createPermission and getPermission - assertThrows(ShareStorageException.class, shareClient::getProperties); - } - @PlaybackOnly @ParameterizedTest @MethodSource("com.azure.storage.file.share.FileShareTestHelper#getPropertiesPremiumSupplier") @@ -570,6 +597,27 @@ public void setAccessPolicy() { assertEquals(primaryShareClient.getAccessPolicy().iterator().next().getId(), "0000"); } + @RequiredServiceVersion(clazz = ShareServiceVersion.class, min = "2024-08-04") + @Test + public void setAccessPolicyOAuth() { + primaryShareClient.create(); + ShareServiceClient oAuthServiceClient = getOAuthServiceClient(new ShareServiceClientBuilder() + .shareTokenIntent(ShareTokenIntent.BACKUP)); + ShareClient shareClient = oAuthServiceClient.getShareClient(shareName); + + ShareSignedIdentifier identifier = new ShareSignedIdentifier() + .setId("0000") + .setAccessPolicy(new ShareAccessPolicy() + .setStartsOn(testResourceNamer.now().atZoneSameInstant(ZoneId.of("UTC")).toOffsetDateTime()) + .setExpiresOn(testResourceNamer.now().atZoneSameInstant(ZoneId.of("UTC")).toOffsetDateTime() + .plusDays(1)) + .setPermissions("r")); + + List ids = Arrays.asList(identifier); + shareClient.setAccessPolicy(ids); + assertEquals(shareClient.getAccessPolicy().iterator().next().getId(), "0000"); + } + @Test public void setAccessPolicyIds() { primaryShareClient.create(); @@ -650,6 +698,34 @@ public void getAccessPolicy() { assertEquals(id.getAccessPolicy().getPermissions(), identifier.getAccessPolicy().getPermissions()); } + @RequiredServiceVersion(clazz = ShareServiceVersion.class, min = "2024-08-04") + @Test + public void getAccessPolicyOAuth() { + primaryShareClient.create(); + ShareServiceClient oAuthServiceClient = getOAuthServiceClient(new ShareServiceClientBuilder() + .shareTokenIntent(ShareTokenIntent.BACKUP)); + ShareClient shareClient = oAuthServiceClient.getShareClient(shareName); + + + ShareSignedIdentifier identifier = new ShareSignedIdentifier() + .setId("0000") + .setAccessPolicy(new ShareAccessPolicy() + .setStartsOn(testResourceNamer.now().atZoneSameInstant(ZoneId.of("UTC")).toOffsetDateTime()) + .setExpiresOn(testResourceNamer.now().atZoneSameInstant(ZoneId.of("UTC")).toOffsetDateTime() + .plusDays(1)) + .setPermissions("r")); + + List ids = Arrays.asList(identifier); + shareClient.setAccessPolicy(ids); + + ShareSignedIdentifier id = shareClient.getAccessPolicy().iterator().next(); + + assertEquals(id.getId(), identifier.getId()); + assertEquals(id.getAccessPolicy().getStartsOn(), identifier.getAccessPolicy().getStartsOn()); + assertEquals(id.getAccessPolicy().getExpiresOn(), identifier.getAccessPolicy().getExpiresOn()); + assertEquals(id.getAccessPolicy().getPermissions(), identifier.getAccessPolicy().getPermissions()); + } + @RequiredServiceVersion(clazz = ShareServiceVersion.class, min = "2020-02-10") @Test public void getAccessPolicyLease() { @@ -742,6 +818,20 @@ public void setPropertiesError() { FileShareTestHelper.assertExceptionStatusCodeAndMessage(e, 404, ShareErrorCode.SHARE_NOT_FOUND); } + @RequiredServiceVersion(clazz = ShareServiceVersion.class, min = "2024-08-04") + @Test + public void setPropertiesOAuth() { + primaryShareClient.createWithResponse(new ShareCreateOptions().setAccessTier(ShareAccessTier.HOT), null, null); + ShareServiceClient oAuthServiceClient = getOAuthServiceClient(new ShareServiceClientBuilder() + .shareTokenIntent(ShareTokenIntent.BACKUP)); + ShareClient shareClient = oAuthServiceClient.getShareClient(shareName); + + Response setAccessTierResponse = shareClient.setPropertiesWithResponse( + new ShareSetPropertiesOptions().setAccessTier(ShareAccessTier.COOL), null, null); + + FileShareTestHelper.assertResponseStatusCode(setAccessTierResponse, 200); + } + @Test public void setMetadata() { primaryShareClient.createWithResponse(testMetadata, null, null, null); @@ -757,6 +847,26 @@ public void setMetadata() { assertEquals(metadataAfterSet, getMetadataAfterResponse.getMetadata()); } + @RequiredServiceVersion(clazz = ShareServiceVersion.class, min = "2024-08-04") + @Test + public void setMetadataOAuth() { + primaryShareClient.createWithResponse(testMetadata, null, null, null); + ShareServiceClient oAuthServiceClient = getOAuthServiceClient(new ShareServiceClientBuilder() + .shareTokenIntent(ShareTokenIntent.BACKUP)); + ShareClient shareClient = oAuthServiceClient.getShareClient(shareName); + + Map metadataAfterSet = Collections.singletonMap("afterset", "value"); + + ShareProperties getMetadataBeforeResponse = shareClient.getProperties(); + Response setMetadataResponse = shareClient.setMetadataWithResponse(metadataAfterSet, null, + null); + ShareProperties getMetadataAfterResponse = shareClient.getProperties(); + + assertEquals(testMetadata, getMetadataBeforeResponse.getMetadata()); + FileShareTestHelper.assertResponseStatusCode(setMetadataResponse, 200); + assertEquals(metadataAfterSet, getMetadataAfterResponse.getMetadata()); + } + @RequiredServiceVersion(clazz = ShareServiceVersion.class, min = "2020-02-10") @Test public void setMetadataLease() { diff --git a/sdk/storage/azure-storage-file-share/src/test/java/com/azure/storage/file/share/ShareAsyncApiTests.java b/sdk/storage/azure-storage-file-share/src/test/java/com/azure/storage/file/share/ShareAsyncApiTests.java index d12878e9615dc..29c9db0d55f58 100644 --- a/sdk/storage/azure-storage-file-share/src/test/java/com/azure/storage/file/share/ShareAsyncApiTests.java +++ b/sdk/storage/azure-storage-file-share/src/test/java/com/azure/storage/file/share/ShareAsyncApiTests.java @@ -6,8 +6,10 @@ import com.azure.core.http.rest.Response; import com.azure.storage.common.StorageSharedKeyCredential; import com.azure.storage.common.test.shared.extensions.PlaybackOnly; +import com.azure.storage.common.test.shared.extensions.RequiredServiceVersion; import com.azure.storage.file.share.implementation.util.ModelHelper; import com.azure.storage.file.share.models.NtfsFileAttributes; +import com.azure.storage.file.share.models.ShareAccessTier; import com.azure.storage.file.share.models.ShareAudience; import com.azure.storage.file.share.models.ShareErrorCode; import com.azure.storage.file.share.models.ShareFileHttpHeaders; @@ -88,6 +90,18 @@ public void createShare() { .assertNext(it -> FileShareTestHelper.assertResponseStatusCode(it, 201)).verifyComplete(); } + @RequiredServiceVersion(clazz = ShareServiceVersion.class, min = "2024-08-04") + @Test + public void createShareOAuth() { + ShareServiceAsyncClient oAuthServiceClient = getOAuthServiceAsyncClient(new ShareServiceClientBuilder() + .shareTokenIntent(ShareTokenIntent.BACKUP)); + ShareAsyncClient shareClient = oAuthServiceClient.getShareAsyncClient(shareName); + + StepVerifier.create(shareClient.createWithResponse(null, (Integer) null)) + .assertNext(it -> FileShareTestHelper.assertResponseStatusCode(it, 201)) + .verifyComplete(); + } + @ParameterizedTest @MethodSource("createShareWithArgsSupplier") public void createShareWithArgs(Map metadata, Integer quota) { @@ -212,6 +226,17 @@ public void deleteShare() { .assertNext(it -> FileShareTestHelper.assertResponseStatusCode(it, 201)); } + @RequiredServiceVersion(clazz = ShareServiceVersion.class, min = "2024-08-04") + @Test + public void deleteShareOAuth() { + ShareServiceAsyncClient oAuthServiceClient = getOAuthServiceAsyncClient(new ShareServiceClientBuilder() + .shareTokenIntent(ShareTokenIntent.BACKUP)); + ShareAsyncClient shareClient = oAuthServiceClient.getShareAsyncClient(shareName); + + StepVerifier.create(primaryShareAsyncClient.create().then(shareClient.deleteWithResponse())) + .assertNext(it -> FileShareTestHelper.assertResponseStatusCode(it, 201)); + } + @Test public void deleteShareError() { StepVerifier.create(primaryShareAsyncClient.delete()) @@ -264,6 +289,22 @@ public void getProperties() { }).verifyComplete(); } + @RequiredServiceVersion(clazz = ShareServiceVersion.class, min = "2024-08-04") + @Test + public void getPropertiesOAuth() { + ShareServiceAsyncClient oAuthServiceClient = getOAuthServiceAsyncClient(new ShareServiceClientBuilder() + .shareTokenIntent(ShareTokenIntent.BACKUP)); + ShareAsyncClient shareClient = oAuthServiceClient.getShareAsyncClient(shareName); + + StepVerifier.create(primaryShareAsyncClient.createWithResponse(testMetadata, 1).then(shareClient.getPropertiesWithResponse())) + .assertNext(it -> { + FileShareTestHelper.assertResponseStatusCode(it, 200); + assertEquals(testMetadata, it.getValue().getMetadata()); + assertEquals(it.getValue().getQuota(), 1); + }) + .verifyComplete(); + } + @Test public void getPropertiesError() { StepVerifier.create(primaryShareAsyncClient.getProperties()).verifyErrorSatisfies(it -> @@ -311,6 +352,20 @@ public void setPremiumProperties() { } } + @RequiredServiceVersion(clazz = ShareServiceVersion.class, min = "2024-08-04") + @Test + public void setPropertiesOAuth() { + ShareServiceAsyncClient oAuthServiceClient = getOAuthServiceAsyncClient(new ShareServiceClientBuilder() + .shareTokenIntent(ShareTokenIntent.BACKUP)); + ShareAsyncClient shareClient = oAuthServiceClient.getShareAsyncClient(shareName); + + StepVerifier.create(primaryShareAsyncClient.createWithResponse(new ShareCreateOptions() + .setAccessTier(ShareAccessTier.HOT)) + .then(shareClient.setPropertiesWithResponse(new ShareSetPropertiesOptions().setAccessTier(ShareAccessTier.COOL)))) + .assertNext(r -> assertEquals(200, r.getStatusCode())) + .verifyComplete(); + } + @Test public void setQuota() { primaryShareAsyncClient.createWithResponse(null, 1).block(); @@ -340,6 +395,26 @@ public void setMetadata() { assertEquals(metadataAfterSet, it.getMetadata())).verifyComplete(); } + @RequiredServiceVersion(clazz = ShareServiceVersion.class, min = "2024-08-04") + @Test + public void setMetadataOAuth() { + ShareServiceAsyncClient oAuthServiceClient = getOAuthServiceAsyncClient(new ShareServiceClientBuilder() + .shareTokenIntent(ShareTokenIntent.BACKUP)); + ShareAsyncClient shareClient = oAuthServiceClient.getShareAsyncClient(shareName); + + Map metadataAfterSet = Collections.singletonMap("afterset", "value"); + StepVerifier.create(primaryShareAsyncClient.createWithResponse(testMetadata, null) + .then(shareClient.getProperties())) + .assertNext(it -> assertEquals(testMetadata, it.getMetadata())) + .verifyComplete(); + StepVerifier.create(shareClient.setMetadataWithResponse(metadataAfterSet)) + .assertNext(it -> FileShareTestHelper.assertResponseStatusCode(it, 200)) + .verifyComplete(); + StepVerifier.create(shareClient.getProperties()).assertNext(it -> + assertEquals(metadataAfterSet, it.getMetadata())) + .verifyComplete(); + } + @Test public void setMetadataError() { StepVerifier.create(primaryShareAsyncClient.setMetadata(testMetadata)).verifyErrorSatisfies(it -> diff --git a/sdk/storage/azure-storage-file-share/src/test/java/com/azure/storage/file/share/specialized/LeaseApiTests.java b/sdk/storage/azure-storage-file-share/src/test/java/com/azure/storage/file/share/specialized/LeaseApiTests.java index 8fe38164ebf2f..8709c60b5bbdb 100644 --- a/sdk/storage/azure-storage-file-share/src/test/java/com/azure/storage/file/share/specialized/LeaseApiTests.java +++ b/sdk/storage/azure-storage-file-share/src/test/java/com/azure/storage/file/share/specialized/LeaseApiTests.java @@ -274,6 +274,27 @@ public void acquireShareLease(String proposedID, int leaseTime, LeaseStateType l assertEquals(leaseDuration, properties.getLeaseDuration()); } + @RequiredServiceVersion(clazz = ShareServiceVersion.class, min = "2024-08-04") + @ParameterizedTest + @MethodSource("acquireShareLeaseSupplier") + public void acquireShareLeaseOAuth(String proposedID, int leaseTime, LeaseStateType leaseState, + LeaseDurationType leaseDuration) { + ShareServiceClient oAuthServiceClient = getOAuthServiceClient(new ShareServiceClientBuilder() + .shareTokenIntent(ShareTokenIntent.BACKUP)); + ShareClient shareClient = oAuthServiceClient.getShareClient(shareName); + + ShareLeaseClient leaseClient = createLeaseClient(shareClient, proposedID); + Response leaseResponse = leaseClient.acquireLeaseWithResponse(new ShareAcquireLeaseOptions() + .setDuration(leaseTime), null, null); + assertEquals(leaseClient.getLeaseId(), leaseResponse.getValue()); + + ShareProperties properties = shareClient.getProperties(); + assertNotNull(leaseResponse.getValue()); + validateBasicHeaders(leaseResponse.getHeaders()); + assertEquals(leaseState, properties.getLeaseState()); + assertEquals(leaseDuration, properties.getLeaseDuration()); + } + private static Stream acquireShareLeaseSupplier() { return Stream.of( Arguments.of(null, -1, LeaseStateType.LEASED, LeaseDurationType.INFINITE), @@ -350,6 +371,24 @@ public void renewShareLease() { validateBasicHeaders(renewLeaseResponse.getHeaders()); } + @RequiredServiceVersion(clazz = ShareServiceVersion.class, min = "2024-08-04") + @Test + public void renewShareLeaseOAuth() { + ShareServiceClient oAuthServiceClient = getOAuthServiceClient(new ShareServiceClientBuilder() + .shareTokenIntent(ShareTokenIntent.BACKUP)); + ShareClient shareClient = oAuthServiceClient.getShareClient(shareName); + + String leaseID = setupShareLeaseCondition(shareClient, RECEIVED_LEASE_ID); + ShareLeaseClient leaseClient = createLeaseClient(shareClient, leaseID); + + // If running in live mode wait for the lease to expire to ensure we are actually renewing it + sleepIfRunningAgainstService(16000); + Response renewLeaseResponse = leaseClient.renewLeaseWithResponse(null, null); + assertEquals(leaseClient.getLeaseId(), renewLeaseResponse.getValue()); + assertEquals(LeaseStateType.LEASED, shareClient.getProperties().getLeaseState()); + validateBasicHeaders(renewLeaseResponse.getHeaders()); + } + @RequiredServiceVersion(clazz = ShareServiceVersion.class, min = "2020-02-10") @Test public void renewShareLeaseMin() { @@ -393,6 +432,20 @@ public void releaseShareLease() { validateBasicHeaders(releaseLeaseResponse.getHeaders()); } + @RequiredServiceVersion(clazz = ShareServiceVersion.class, min = "2024-08-04") + @Test + public void releaseShareLeaseOAuth() { + ShareServiceClient oAuthServiceClient = getOAuthServiceClient(new ShareServiceClientBuilder() + .shareTokenIntent(ShareTokenIntent.BACKUP)); + ShareClient shareClient = oAuthServiceClient.getShareClient(shareName); + String leaseID = setupShareLeaseCondition(shareClient, RECEIVED_LEASE_ID); + Response releaseLeaseResponse = createLeaseClient(shareClient, leaseID) + .releaseLeaseWithResponse(null, null); + + assertEquals(LeaseStateType.AVAILABLE, shareClient.getProperties().getLeaseState()); + validateBasicHeaders(releaseLeaseResponse.getHeaders()); + } + @RequiredServiceVersion(clazz = ShareServiceVersion.class, min = "2020-02-10") @Test public void releaseShareLeaseMin() { @@ -442,6 +495,27 @@ public void breakShareLease(int leaseTime, Long breakPeriod) { } } + @RequiredServiceVersion(clazz = ShareServiceVersion.class, min = "2024-08-04") + @ParameterizedTest + @MethodSource("breakShareLeaseSupplier") + public void breakShareLeaseOAuth(int leaseTime, Long breakPeriod) { + ShareServiceClient oAuthServiceClient = getOAuthServiceClient(new ShareServiceClientBuilder() + .shareTokenIntent(ShareTokenIntent.BACKUP)); + ShareClient shareClient = oAuthServiceClient.getShareClient(shareName); + ShareLeaseClient leaseClient = createLeaseClient(shareClient, testResourceNamer.randomUuid()); + leaseClient.acquireLeaseWithResponse(new ShareAcquireLeaseOptions().setDuration(leaseTime), null, null); + + Response breakLeaseResponse = leaseClient.breakLeaseWithResponse(new ShareBreakLeaseOptions() + .setBreakPeriod(breakPeriod == null ? null : Duration.ofSeconds(breakPeriod)), null, null); + LeaseStateType state = shareClient.getProperties().getLeaseState(); + assertTrue(LeaseStateType.BROKEN == state || LeaseStateType.BREAKING == state); + validateBasicHeaders(breakLeaseResponse.getHeaders()); + if (breakPeriod != null) { + // If running in live mode wait for the lease to break so we can delete the share after the test completes + sleepIfRunningAgainstService(breakPeriod * 1000); + } + } + private static Stream breakShareLeaseSupplier() { return Stream.of(Arguments.of(-1, null), Arguments.of(-1, 20L), Arguments.of(20, 15L)); } @@ -493,6 +567,24 @@ public void changeShareLease() { validateBasicHeaders(changeLeaseResponse.getHeaders()); } + @RequiredServiceVersion(clazz = ShareServiceVersion.class, min = "2024-08-04") + @Test + public void changeShareLeaseOAuth() { + ShareServiceClient oAuthServiceClient = getOAuthServiceClient(new ShareServiceClientBuilder() + .shareTokenIntent(ShareTokenIntent.BACKUP)); + ShareClient shareClient = oAuthServiceClient.getShareClient(shareName); + + String leaseID = setupShareLeaseCondition(shareClient, RECEIVED_LEASE_ID); + ShareLeaseClient leaseClient = createLeaseClient(shareClient, leaseID); + String newLeaseId = testResourceNamer.randomUuid(); + Response changeLeaseResponse = leaseClient.changeLeaseWithResponse(newLeaseId, null, null); + assertEquals(newLeaseId, changeLeaseResponse.getValue()); + assertEquals(leaseClient.getLeaseId(), changeLeaseResponse.getValue()); + assertEquals(200, createLeaseClient(shareClient, newLeaseId).releaseLeaseWithResponse(null, null) + .getStatusCode()); + validateBasicHeaders(changeLeaseResponse.getHeaders()); + } + @RequiredServiceVersion(clazz = ShareServiceVersion.class, min = "2020-02-10") @Test public void changeShareLeaseMin() { diff --git a/sdk/storage/azure-storage-file-share/swagger/README.md b/sdk/storage/azure-storage-file-share/swagger/README.md index 83f93756a3963..a7fd7d1b614fd 100644 --- a/sdk/storage/azure-storage-file-share/swagger/README.md +++ b/sdk/storage/azure-storage-file-share/swagger/README.md @@ -16,7 +16,7 @@ autorest ### Code generation settings ``` yaml use: '@autorest/java@4.1.16' -input-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/3f9cca0301ffbb8856826d196c567d821ae190d7/specification/storage/data-plane/Microsoft.FileStorage/preview/2024-05-04/file.json +input-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/da7f1ad67a145012fcd7c4ace168e7a3ad68b120/specification/storage/data-plane/Microsoft.FileStorage/stable/2024-08-04/file.json java: true output-folder: ../ namespace: com.azure.storage.file.share From ad80150b2bc6815493f69f32791f2513ee2a8f03 Mon Sep 17 00:00:00 2001 From: Isabelle <141270045+ibrandes@users.noreply.github.com> Date: Tue, 16 Apr 2024 11:00:21 -0700 Subject: [PATCH 04/17] Revert "STG94 Files OAuth - full data plane support (#39653)" (#39738) This reverts commit 02c23b58afc55e5992ce844c23acef15b4570355. --- .../azure-storage-file-share/assets.json | 2 +- .../storage/file/share/ShareAsyncClient.java | 16 +-- .../azure/storage/file/share/ShareClient.java | 17 +-- .../file/share/ShareServiceAsyncClient.java | 7 +- .../file/share/ShareServiceClient.java | 7 +- .../share/implementation/ServicesImpl.java | 66 +-------- .../file/share/implementation/SharesImpl.java | 90 ------------ .../file/share/FileServiceApiTests.java | 73 ---------- .../file/share/FileServiceAsyncApiTests.java | 75 ---------- .../storage/file/share/ShareApiTests.java | 132 ++---------------- .../file/share/ShareAsyncApiTests.java | 75 ---------- .../file/share/specialized/LeaseApiTests.java | 92 ------------ .../swagger/README.md | 2 +- 13 files changed, 30 insertions(+), 624 deletions(-) diff --git a/sdk/storage/azure-storage-file-share/assets.json b/sdk/storage/azure-storage-file-share/assets.json index 7ae69bae94723..43d28c1fc7d57 100644 --- a/sdk/storage/azure-storage-file-share/assets.json +++ b/sdk/storage/azure-storage-file-share/assets.json @@ -2,5 +2,5 @@ "AssetsRepo": "Azure/azure-sdk-assets", "AssetsRepoPrefixPath": "java", "TagPrefix": "java/storage/azure-storage-file-share", - "Tag": "java/storage/azure-storage-file-share_3222f54471" + "Tag": "java/storage/azure-storage-file-share_011cc52a61" } diff --git a/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/ShareAsyncClient.java b/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/ShareAsyncClient.java index 859137892b0f3..073e035b37b80 100644 --- a/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/ShareAsyncClient.java +++ b/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/ShareAsyncClient.java @@ -319,12 +319,9 @@ public Mono create() { *

For more information, see the * Azure Docs.

* - *

For more information on updated max file share size values, see the - * Azure Docs.

- * * @param metadata Optional metadata to associate with the share - * @param quotaInGB Optional maximum size the share is allowed to grow to in GB. The default value is 5120. - * Refer to the Azure Docs for updated values. + * @param quotaInGB Optional maximum size the share is allowed to grow to in GB. This must be greater than 0 and + * less than or equal to 5120. The default value is 5120. * @return A response containing information about the {@link ShareInfo share} and the status its creation. * @throws ShareStorageException If the share already exists with different metadata or {@code quotaInGB} is outside * the allowed range. @@ -833,11 +830,7 @@ Mono> getPropertiesWithResponse(ShareGetPropertiesOpti *

For more information, see the * Azure Docs.

* - *

For more information on updated max file share size values, see the - * Azure Docs.

- * * @param quotaInGB Size in GB to limit the share's growth. The quota in GB must be between 1 and 5120. - * Refer to the Azure Docs for updated values. * @return The {@link ShareInfo information about the share} * @throws ShareStorageException If the share doesn't exist or {@code quotaInGB} is outside the allowed bounds * @deprecated Use {@link ShareAsyncClient#setProperties(ShareSetPropertiesOptions)} @@ -867,10 +860,7 @@ public Mono setQuota(int quotaInGB) { *

For more information, see the * Azure Docs.

* - *

For more information on updated max file share size values, see the - * Azure Docs.

- * - * @param quotaInGB Size in GB to limit the share's growth. The default value is 5120. Refer to the Azure Docs for updated values. + * @param quotaInGB Size in GB to limit the share's growth. The quota in GB must be between 1 and 5120. * @return A response containing the {@link ShareInfo information about the share} with headers and response status * code * @throws ShareStorageException If the share doesn't exist or {@code quotaInGB} is outside the allowed bounds diff --git a/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/ShareClient.java b/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/ShareClient.java index 99ee45b97657f..58c2f01bc0a81 100644 --- a/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/ShareClient.java +++ b/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/ShareClient.java @@ -240,12 +240,9 @@ public ShareInfo create() { *

For more information, see the * Azure Docs.

* - *

For more information on updated max file share size values, see the - * Azure Docs.

- * * @param metadata Optional metadata to associate with the share - * @param quotaInGB Optional maximum size the share is allowed to grow to in GB. The default value is 5120. - * Refer to the Azure Docs for updated values. + * @param quotaInGB Optional maximum size the share is allowed to grow to in GB. This must be greater than 0 and + * less than or equal to 5120. The default value is 5120. * @param timeout An optional timeout applied to the operation. If a response is not returned before the timeout * concludes a {@link RuntimeException} will be thrown. * @param context Additional context that is passed through the Http pipeline during the service call. @@ -669,10 +666,7 @@ public Response getPropertiesWithResponse(ShareGetPropertiesOpt *

For more information, see the * Azure Docs.

* - *

For more information on updated max file share size values, see the - * Azure Docs.

- * - * @param quotaInGB Size in GB to limit the share's growth. The default value is 5120. Refer to the Azure Docs for updated values. + * @param quotaInGB Size in GB to limit the share's growth. The quota in GB must be between 1 and 5120. * @return The {@link ShareInfo information about the share} * @throws ShareStorageException If the share doesn't exist or {@code quotaInGB} is outside the allowed bounds * @deprecated Use {@link ShareClient#setProperties(ShareSetPropertiesOptions)} @@ -701,10 +695,7 @@ public ShareInfo setQuota(int quotaInGB) { *

For more information, see the * Azure Docs.

* - *

For more information on updated max file share size values, see the - * Azure Docs.

- * - * @param quotaInGB Size in GB to limit the share's growth. The default value is 5120. Refer to the Azure Docs for updated values. + * @param quotaInGB Size in GB to limit the share's growth. The quota in GB must be between 1 and 5120. * @param timeout An optional timeout applied to the operation. If a response is not returned before the timeout * concludes a {@link RuntimeException} will be thrown. * @param context Additional context that is passed through the Http pipeline during the service call. diff --git a/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/ShareServiceAsyncClient.java b/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/ShareServiceAsyncClient.java index 3203015d74a69..387aa6f96e2d2 100644 --- a/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/ShareServiceAsyncClient.java +++ b/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/ShareServiceAsyncClient.java @@ -524,13 +524,10 @@ public Mono createShare(String shareName) { *

For more information, see the * Azure Docs.

* - *

For more information on updated max file share size values, see the - * Azure Docs.

- * * @param shareName Name of the share * @param metadata Optional metadata to associate with the share - * @param quotaInGB Optional maximum size the share is allowed to grow to in GB. - * The default value is 5120. Refer to the Azure Docs for updated values. + * @param quotaInGB Optional maximum size the share is allowed to grow to in GB. This must be greater than 0 and + * less than or equal to 5120. The default value is 5120. * @return A response containing the {@link ShareAsyncClient ShareAsyncClient} and the status of creating the share. * @throws ShareStorageException If a share with the same name already exists or {@code quotaInGB} is outside the * allowed range. diff --git a/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/ShareServiceClient.java b/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/ShareServiceClient.java index 72abde2b447f7..493cdc5587541 100644 --- a/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/ShareServiceClient.java +++ b/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/ShareServiceClient.java @@ -408,13 +408,10 @@ public ShareClient createShare(String shareName) { *

For more information, see the * Azure Docs.

* - *

For more information on updated max file share size values, see the - * Azure Docs.

- * * @param shareName Name of the share * @param metadata Optional metadata to associate with the share - * @param quotaInGB Optional maximum size the share is allowed to grow to in GB. The default value is 5120. - * Refer to the Azure Docs for updated values. + * @param quotaInGB Optional maximum size the share is allowed to grow to in GB. This must be greater than 0 and + * less than or equal to 5120. The default value is 5120. * @param timeout An optional timeout applied to the operation. If a response is not returned before the timeout * concludes a {@link RuntimeException} will be thrown. * @param context Additional context that is passed through the Http pipeline during the service call. diff --git a/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/implementation/ServicesImpl.java b/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/implementation/ServicesImpl.java index 825374f387ef9..3f079b6d79274 100644 --- a/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/implementation/ServicesImpl.java +++ b/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/implementation/ServicesImpl.java @@ -34,7 +34,6 @@ import com.azure.storage.file.share.implementation.models.ShareItemInternal; import com.azure.storage.file.share.models.ShareServiceProperties; import com.azure.storage.file.share.models.ShareStorageException; -import com.azure.storage.file.share.models.ShareTokenIntent; import java.util.List; import java.util.Objects; import java.util.stream.Collectors; @@ -74,7 +73,6 @@ Mono> setProperties( @QueryParam("comp") String comp, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, - @HeaderParam("x-ms-file-request-intent") ShareTokenIntent fileRequestIntent, @BodyParam("application/xml") ShareServiceProperties shareServiceProperties, @HeaderParam("Accept") String accept, Context context); @@ -88,7 +86,6 @@ Mono> setPropertiesNoCustomHeaders( @QueryParam("comp") String comp, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, - @HeaderParam("x-ms-file-request-intent") ShareTokenIntent fileRequestIntent, @BodyParam("application/xml") ShareServiceProperties shareServiceProperties, @HeaderParam("Accept") String accept, Context context); @@ -102,7 +99,6 @@ Mono> getProp @QueryParam("comp") String comp, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, - @HeaderParam("x-ms-file-request-intent") ShareTokenIntent fileRequestIntent, @HeaderParam("Accept") String accept, Context context); @@ -115,7 +111,6 @@ Mono> getPropertiesNoCustomHeaders( @QueryParam("comp") String comp, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, - @HeaderParam("x-ms-file-request-intent") ShareTokenIntent fileRequestIntent, @HeaderParam("Accept") String accept, Context context); @@ -131,7 +126,6 @@ Mono> listSha @QueryParam("include") String include, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, - @HeaderParam("x-ms-file-request-intent") ShareTokenIntent fileRequestIntent, @HeaderParam("Accept") String accept, Context context); @@ -147,7 +141,6 @@ Mono> listSharesSegmentNoCustomHeaders( @QueryParam("include") String include, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, - @HeaderParam("x-ms-file-request-intent") ShareTokenIntent fileRequestIntent, @HeaderParam("Accept") String accept, Context context); @@ -158,7 +151,6 @@ Mono> lis @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("url") String url, @HeaderParam("x-ms-version") String version, - @HeaderParam("x-ms-file-request-intent") ShareTokenIntent fileRequestIntent, @HeaderParam("Accept") String accept, Context context); @@ -169,7 +161,6 @@ Mono> listSharesSegmentNextNoCustomHeaders( @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("url") String url, @HeaderParam("x-ms-version") String version, - @HeaderParam("x-ms-file-request-intent") ShareTokenIntent fileRequestIntent, @HeaderParam("Accept") String accept, Context context); } @@ -201,7 +192,6 @@ public Mono> setPropertiesWithR comp, timeout, this.client.getVersion(), - this.client.getFileRequestIntent(), shareServiceProperties, accept, context)); @@ -233,7 +223,6 @@ public Mono> setPropertiesWithR comp, timeout, this.client.getVersion(), - this.client.getFileRequestIntent(), shareServiceProperties, accept, context); @@ -305,7 +294,6 @@ public Mono> setPropertiesNoCustomHeadersWithResponseAsync( comp, timeout, this.client.getVersion(), - this.client.getFileRequestIntent(), shareServiceProperties, accept, context)); @@ -337,7 +325,6 @@ public Mono> setPropertiesNoCustomHeadersWithResponseAsync( comp, timeout, this.client.getVersion(), - this.client.getFileRequestIntent(), shareServiceProperties, accept, context); @@ -371,7 +358,6 @@ public Mono> comp, timeout, this.client.getVersion(), - this.client.getFileRequestIntent(), accept, context)); } @@ -398,14 +384,7 @@ public Mono> final String comp = "properties"; final String accept = "application/xml"; return service.getProperties( - this.client.getUrl(), - restype, - comp, - timeout, - this.client.getVersion(), - this.client.getFileRequestIntent(), - accept, - context); + this.client.getUrl(), restype, comp, timeout, this.client.getVersion(), accept, context); } /** @@ -472,7 +451,6 @@ public Mono> getPropertiesNoCustomHeadersWithRe comp, timeout, this.client.getVersion(), - this.client.getFileRequestIntent(), accept, context)); } @@ -499,14 +477,7 @@ public Mono> getPropertiesNoCustomHeadersWithRe final String comp = "properties"; final String accept = "application/xml"; return service.getPropertiesNoCustomHeaders( - this.client.getUrl(), - restype, - comp, - timeout, - this.client.getVersion(), - this.client.getFileRequestIntent(), - accept, - context); + this.client.getUrl(), restype, comp, timeout, this.client.getVersion(), accept, context); } /** @@ -548,7 +519,6 @@ public Mono> listSharesSegmentSinglePageAsync( includeConverted, timeout, this.client.getVersion(), - this.client.getFileRequestIntent(), accept, context)) .map( @@ -605,7 +575,6 @@ public Mono> listSharesSegmentSinglePageAsync( includeConverted, timeout, this.client.getVersion(), - this.client.getFileRequestIntent(), accept, context) .map( @@ -718,7 +687,6 @@ public Mono> listSharesSegmentNoCustomHeadersSi includeConverted, timeout, this.client.getVersion(), - this.client.getFileRequestIntent(), accept, context)) .map( @@ -775,7 +743,6 @@ public Mono> listSharesSegmentNoCustomHeadersSi includeConverted, timeout, this.client.getVersion(), - this.client.getFileRequestIntent(), accept, context) .map( @@ -867,12 +834,7 @@ public Mono> listSharesSegmentNextSinglePageAsy return FluxUtil.withContext( context -> service.listSharesSegmentNext( - nextLink, - this.client.getUrl(), - this.client.getVersion(), - this.client.getFileRequestIntent(), - accept, - context)) + nextLink, this.client.getUrl(), this.client.getVersion(), accept, context)) .map( res -> new PagedResponseBase<>( @@ -899,13 +861,7 @@ public Mono> listSharesSegmentNextSinglePageAsy public Mono> listSharesSegmentNextSinglePageAsync( String nextLink, Context context) { final String accept = "application/xml"; - return service.listSharesSegmentNext( - nextLink, - this.client.getUrl(), - this.client.getVersion(), - this.client.getFileRequestIntent(), - accept, - context) + return service.listSharesSegmentNext(nextLink, this.client.getUrl(), this.client.getVersion(), accept, context) .map( res -> new PagedResponseBase<>( @@ -933,12 +889,7 @@ public Mono> listSharesSegmentNextNoCustomHeade return FluxUtil.withContext( context -> service.listSharesSegmentNextNoCustomHeaders( - nextLink, - this.client.getUrl(), - this.client.getVersion(), - this.client.getFileRequestIntent(), - accept, - context)) + nextLink, this.client.getUrl(), this.client.getVersion(), accept, context)) .map( res -> new PagedResponseBase<>( @@ -966,12 +917,7 @@ public Mono> listSharesSegmentNextNoCustomHeade String nextLink, Context context) { final String accept = "application/xml"; return service.listSharesSegmentNextNoCustomHeaders( - nextLink, - this.client.getUrl(), - this.client.getVersion(), - this.client.getFileRequestIntent(), - accept, - context) + nextLink, this.client.getUrl(), this.client.getVersion(), accept, context) .map( res -> new PagedResponseBase<>( diff --git a/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/implementation/SharesImpl.java b/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/implementation/SharesImpl.java index e5d0f315e0484..b09772a9d99e6 100644 --- a/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/implementation/SharesImpl.java +++ b/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/implementation/SharesImpl.java @@ -91,7 +91,6 @@ Mono> create( @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-enabled-protocols") String enabledProtocols, @HeaderParam("x-ms-root-squash") ShareRootSquash rootSquash, - @HeaderParam("x-ms-file-request-intent") ShareTokenIntent fileRequestIntent, @HeaderParam("Accept") String accept, Context context); @@ -109,7 +108,6 @@ Mono> createNoCustomHeaders( @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-enabled-protocols") String enabledProtocols, @HeaderParam("x-ms-root-squash") ShareRootSquash rootSquash, - @HeaderParam("x-ms-file-request-intent") ShareTokenIntent fileRequestIntent, @HeaderParam("Accept") String accept, Context context); @@ -124,7 +122,6 @@ Mono> getProperties( @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-lease-id") String leaseId, - @HeaderParam("x-ms-file-request-intent") ShareTokenIntent fileRequestIntent, @HeaderParam("Accept") String accept, Context context); @@ -139,7 +136,6 @@ Mono> getPropertiesNoCustomHeaders( @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-lease-id") String leaseId, - @HeaderParam("x-ms-file-request-intent") ShareTokenIntent fileRequestIntent, @HeaderParam("Accept") String accept, Context context); @@ -155,7 +151,6 @@ Mono> delete( @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-delete-snapshots") DeleteSnapshotsOptionType deleteSnapshots, @HeaderParam("x-ms-lease-id") String leaseId, - @HeaderParam("x-ms-file-request-intent") ShareTokenIntent fileRequestIntent, @HeaderParam("Accept") String accept, Context context); @@ -171,7 +166,6 @@ Mono> deleteNoCustomHeaders( @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-delete-snapshots") DeleteSnapshotsOptionType deleteSnapshots, @HeaderParam("x-ms-lease-id") String leaseId, - @HeaderParam("x-ms-file-request-intent") ShareTokenIntent fileRequestIntent, @HeaderParam("Accept") String accept, Context context); @@ -190,7 +184,6 @@ Mono> acquireLease( @HeaderParam("x-ms-version") String version, @QueryParam("sharesnapshot") String sharesnapshot, @HeaderParam("x-ms-client-request-id") String requestId, - @HeaderParam("x-ms-file-request-intent") ShareTokenIntent fileRequestIntent, @HeaderParam("Accept") String accept, Context context); @@ -209,7 +202,6 @@ Mono> acquireLeaseNoCustomHeaders( @HeaderParam("x-ms-version") String version, @QueryParam("sharesnapshot") String sharesnapshot, @HeaderParam("x-ms-client-request-id") String requestId, - @HeaderParam("x-ms-file-request-intent") ShareTokenIntent fileRequestIntent, @HeaderParam("Accept") String accept, Context context); @@ -227,7 +219,6 @@ Mono> releaseLease( @HeaderParam("x-ms-version") String version, @QueryParam("sharesnapshot") String sharesnapshot, @HeaderParam("x-ms-client-request-id") String requestId, - @HeaderParam("x-ms-file-request-intent") ShareTokenIntent fileRequestIntent, @HeaderParam("Accept") String accept, Context context); @@ -245,7 +236,6 @@ Mono> releaseLeaseNoCustomHeaders( @HeaderParam("x-ms-version") String version, @QueryParam("sharesnapshot") String sharesnapshot, @HeaderParam("x-ms-client-request-id") String requestId, - @HeaderParam("x-ms-file-request-intent") ShareTokenIntent fileRequestIntent, @HeaderParam("Accept") String accept, Context context); @@ -264,7 +254,6 @@ Mono> changeLease( @HeaderParam("x-ms-version") String version, @QueryParam("sharesnapshot") String sharesnapshot, @HeaderParam("x-ms-client-request-id") String requestId, - @HeaderParam("x-ms-file-request-intent") ShareTokenIntent fileRequestIntent, @HeaderParam("Accept") String accept, Context context); @@ -283,7 +272,6 @@ Mono> changeLeaseNoCustomHeaders( @HeaderParam("x-ms-version") String version, @QueryParam("sharesnapshot") String sharesnapshot, @HeaderParam("x-ms-client-request-id") String requestId, - @HeaderParam("x-ms-file-request-intent") ShareTokenIntent fileRequestIntent, @HeaderParam("Accept") String accept, Context context); @@ -301,7 +289,6 @@ Mono> renewLease( @HeaderParam("x-ms-version") String version, @QueryParam("sharesnapshot") String sharesnapshot, @HeaderParam("x-ms-client-request-id") String requestId, - @HeaderParam("x-ms-file-request-intent") ShareTokenIntent fileRequestIntent, @HeaderParam("Accept") String accept, Context context); @@ -319,7 +306,6 @@ Mono> renewLeaseNoCustomHeaders( @HeaderParam("x-ms-version") String version, @QueryParam("sharesnapshot") String sharesnapshot, @HeaderParam("x-ms-client-request-id") String requestId, - @HeaderParam("x-ms-file-request-intent") ShareTokenIntent fileRequestIntent, @HeaderParam("Accept") String accept, Context context); @@ -338,7 +324,6 @@ Mono> breakLease( @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("sharesnapshot") String sharesnapshot, - @HeaderParam("x-ms-file-request-intent") ShareTokenIntent fileRequestIntent, @HeaderParam("Accept") String accept, Context context); @@ -357,7 +342,6 @@ Mono> breakLeaseNoCustomHeaders( @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("sharesnapshot") String sharesnapshot, - @HeaderParam("x-ms-file-request-intent") ShareTokenIntent fileRequestIntent, @HeaderParam("Accept") String accept, Context context); @@ -372,7 +356,6 @@ Mono> createSnapshot( @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-meta-") Map metadata, @HeaderParam("x-ms-version") String version, - @HeaderParam("x-ms-file-request-intent") ShareTokenIntent fileRequestIntent, @HeaderParam("Accept") String accept, Context context); @@ -387,7 +370,6 @@ Mono> createSnapshotNoCustomHeaders( @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-meta-") Map metadata, @HeaderParam("x-ms-version") String version, - @HeaderParam("x-ms-file-request-intent") ShareTokenIntent fileRequestIntent, @HeaderParam("Accept") String accept, Context context); @@ -465,7 +447,6 @@ Mono> setProperties( @HeaderParam("x-ms-access-tier") ShareAccessTier accessTier, @HeaderParam("x-ms-lease-id") String leaseId, @HeaderParam("x-ms-root-squash") ShareRootSquash rootSquash, - @HeaderParam("x-ms-file-request-intent") ShareTokenIntent fileRequestIntent, @HeaderParam("Accept") String accept, Context context); @@ -483,7 +464,6 @@ Mono> setPropertiesNoCustomHeaders( @HeaderParam("x-ms-access-tier") ShareAccessTier accessTier, @HeaderParam("x-ms-lease-id") String leaseId, @HeaderParam("x-ms-root-squash") ShareRootSquash rootSquash, - @HeaderParam("x-ms-file-request-intent") ShareTokenIntent fileRequestIntent, @HeaderParam("Accept") String accept, Context context); @@ -499,7 +479,6 @@ Mono> setMetadata( @HeaderParam("x-ms-meta-") Map metadata, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-lease-id") String leaseId, - @HeaderParam("x-ms-file-request-intent") ShareTokenIntent fileRequestIntent, @HeaderParam("Accept") String accept, Context context); @@ -515,7 +494,6 @@ Mono> setMetadataNoCustomHeaders( @HeaderParam("x-ms-meta-") Map metadata, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-lease-id") String leaseId, - @HeaderParam("x-ms-file-request-intent") ShareTokenIntent fileRequestIntent, @HeaderParam("Accept") String accept, Context context); @@ -530,7 +508,6 @@ Mono>> ge @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-lease-id") String leaseId, - @HeaderParam("x-ms-file-request-intent") ShareTokenIntent fileRequestIntent, @HeaderParam("Accept") String accept, Context context); @@ -545,7 +522,6 @@ Mono>> getAccessPolicyNoCustomHeaders( @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-lease-id") String leaseId, - @HeaderParam("x-ms-file-request-intent") ShareTokenIntent fileRequestIntent, @HeaderParam("Accept") String accept, Context context); @@ -560,7 +536,6 @@ Mono> setAccessPolicy( @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-lease-id") String leaseId, - @HeaderParam("x-ms-file-request-intent") ShareTokenIntent fileRequestIntent, @BodyParam("application/xml") SignedIdentifiersWrapper shareAcl, @HeaderParam("Accept") String accept, Context context); @@ -576,7 +551,6 @@ Mono> setAccessPolicyNoCustomHeaders( @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-lease-id") String leaseId, - @HeaderParam("x-ms-file-request-intent") ShareTokenIntent fileRequestIntent, @BodyParam("application/xml") SignedIdentifiersWrapper shareAcl, @HeaderParam("Accept") String accept, Context context); @@ -592,7 +566,6 @@ Mono> getStatistics( @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-lease-id") String leaseId, - @HeaderParam("x-ms-file-request-intent") ShareTokenIntent fileRequestIntent, @HeaderParam("Accept") String accept, Context context); @@ -607,7 +580,6 @@ Mono> getStatisticsNoCustomHeaders( @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-lease-id") String leaseId, - @HeaderParam("x-ms-file-request-intent") ShareTokenIntent fileRequestIntent, @HeaderParam("Accept") String accept, Context context); @@ -624,7 +596,6 @@ Mono> restore( @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("x-ms-deleted-share-name") String deletedShareName, @HeaderParam("x-ms-deleted-share-version") String deletedShareVersion, - @HeaderParam("x-ms-file-request-intent") ShareTokenIntent fileRequestIntent, @HeaderParam("Accept") String accept, Context context); @@ -641,7 +612,6 @@ Mono> restoreNoCustomHeaders( @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("x-ms-deleted-share-name") String deletedShareName, @HeaderParam("x-ms-deleted-share-version") String deletedShareVersion, - @HeaderParam("x-ms-file-request-intent") ShareTokenIntent fileRequestIntent, @HeaderParam("Accept") String accept, Context context); } @@ -688,7 +658,6 @@ public Mono> createWithResponseAsync( this.client.getVersion(), enabledProtocols, rootSquash, - this.client.getFileRequestIntent(), accept, context)); } @@ -735,7 +704,6 @@ public Mono> createWithResponseAsync( this.client.getVersion(), enabledProtocols, rootSquash, - this.client.getFileRequestIntent(), accept, context); } @@ -847,7 +815,6 @@ public Mono> createNoCustomHeadersWithResponseAsync( this.client.getVersion(), enabledProtocols, rootSquash, - this.client.getFileRequestIntent(), accept, context)); } @@ -894,7 +861,6 @@ public Mono> createNoCustomHeadersWithResponseAsync( this.client.getVersion(), enabledProtocols, rootSquash, - this.client.getFileRequestIntent(), accept, context); } @@ -930,7 +896,6 @@ public Mono> getPropertiesWithRes timeout, this.client.getVersion(), leaseId, - this.client.getFileRequestIntent(), accept, context)); } @@ -965,7 +930,6 @@ public Mono> getPropertiesWithRes timeout, this.client.getVersion(), leaseId, - this.client.getFileRequestIntent(), accept, context); } @@ -1047,7 +1011,6 @@ public Mono> getPropertiesNoCustomHeadersWithResponseAsync( timeout, this.client.getVersion(), leaseId, - this.client.getFileRequestIntent(), accept, context)); } @@ -1082,7 +1045,6 @@ public Mono> getPropertiesNoCustomHeadersWithResponseAsync( timeout, this.client.getVersion(), leaseId, - this.client.getFileRequestIntent(), accept, context); } @@ -1124,7 +1086,6 @@ public Mono> deleteWithResponseAsync( this.client.getVersion(), deleteSnapshots, leaseId, - this.client.getFileRequestIntent(), accept, context)); } @@ -1166,7 +1127,6 @@ public Mono> deleteWithResponseAsync( this.client.getVersion(), deleteSnapshots, leaseId, - this.client.getFileRequestIntent(), accept, context); } @@ -1266,7 +1226,6 @@ public Mono> deleteNoCustomHeadersWithResponseAsync( this.client.getVersion(), deleteSnapshots, leaseId, - this.client.getFileRequestIntent(), accept, context)); } @@ -1308,7 +1267,6 @@ public Mono> deleteNoCustomHeadersWithResponseAsync( this.client.getVersion(), deleteSnapshots, leaseId, - this.client.getFileRequestIntent(), accept, context); } @@ -1362,7 +1320,6 @@ public Mono> acquireLeaseWithRespo this.client.getVersion(), sharesnapshot, requestId, - this.client.getFileRequestIntent(), accept, context)); } @@ -1416,7 +1373,6 @@ public Mono> acquireLeaseWithRespo this.client.getVersion(), sharesnapshot, requestId, - this.client.getFileRequestIntent(), accept, context); } @@ -1543,7 +1499,6 @@ public Mono> acquireLeaseNoCustomHeadersWithResponseAsync( this.client.getVersion(), sharesnapshot, requestId, - this.client.getFileRequestIntent(), accept, context)); } @@ -1597,7 +1552,6 @@ public Mono> acquireLeaseNoCustomHeadersWithResponseAsync( this.client.getVersion(), sharesnapshot, requestId, - this.client.getFileRequestIntent(), accept, context); } @@ -1640,7 +1594,6 @@ public Mono> releaseLeaseWithRespo this.client.getVersion(), sharesnapshot, requestId, - this.client.getFileRequestIntent(), accept, context)); } @@ -1687,7 +1640,6 @@ public Mono> releaseLeaseWithRespo this.client.getVersion(), sharesnapshot, requestId, - this.client.getFileRequestIntent(), accept, context); } @@ -1786,7 +1738,6 @@ public Mono> releaseLeaseNoCustomHeadersWithResponseAsync( this.client.getVersion(), sharesnapshot, requestId, - this.client.getFileRequestIntent(), accept, context)); } @@ -1833,7 +1784,6 @@ public Mono> releaseLeaseNoCustomHeadersWithResponseAsync( this.client.getVersion(), sharesnapshot, requestId, - this.client.getFileRequestIntent(), accept, context); } @@ -1885,7 +1835,6 @@ public Mono> changeLeaseWithRespons this.client.getVersion(), sharesnapshot, requestId, - this.client.getFileRequestIntent(), accept, context)); } @@ -1937,7 +1886,6 @@ public Mono> changeLeaseWithRespons this.client.getVersion(), sharesnapshot, requestId, - this.client.getFileRequestIntent(), accept, context); } @@ -2058,7 +2006,6 @@ public Mono> changeLeaseNoCustomHeadersWithResponseAsync( this.client.getVersion(), sharesnapshot, requestId, - this.client.getFileRequestIntent(), accept, context)); } @@ -2110,7 +2057,6 @@ public Mono> changeLeaseNoCustomHeadersWithResponseAsync( this.client.getVersion(), sharesnapshot, requestId, - this.client.getFileRequestIntent(), accept, context); } @@ -2153,7 +2099,6 @@ public Mono> renewLeaseWithResponseA this.client.getVersion(), sharesnapshot, requestId, - this.client.getFileRequestIntent(), accept, context)); } @@ -2200,7 +2145,6 @@ public Mono> renewLeaseWithResponseA this.client.getVersion(), sharesnapshot, requestId, - this.client.getFileRequestIntent(), accept, context); } @@ -2299,7 +2243,6 @@ public Mono> renewLeaseNoCustomHeadersWithResponseAsync( this.client.getVersion(), sharesnapshot, requestId, - this.client.getFileRequestIntent(), accept, context)); } @@ -2346,7 +2289,6 @@ public Mono> renewLeaseNoCustomHeadersWithResponseAsync( this.client.getVersion(), sharesnapshot, requestId, - this.client.getFileRequestIntent(), accept, context); } @@ -2401,7 +2343,6 @@ public Mono> breakLeaseWithResponseA this.client.getVersion(), requestId, sharesnapshot, - this.client.getFileRequestIntent(), accept, context)); } @@ -2456,7 +2397,6 @@ public Mono> breakLeaseWithResponseA this.client.getVersion(), requestId, sharesnapshot, - this.client.getFileRequestIntent(), accept, context); } @@ -2585,7 +2525,6 @@ public Mono> breakLeaseNoCustomHeadersWithResponseAsync( this.client.getVersion(), requestId, sharesnapshot, - this.client.getFileRequestIntent(), accept, context)); } @@ -2640,7 +2579,6 @@ public Mono> breakLeaseNoCustomHeadersWithResponseAsync( this.client.getVersion(), requestId, sharesnapshot, - this.client.getFileRequestIntent(), accept, context); } @@ -2674,7 +2612,6 @@ public Mono> createSnapshotWithR timeout, metadata, this.client.getVersion(), - this.client.getFileRequestIntent(), accept, context)); } @@ -2707,7 +2644,6 @@ public Mono> createSnapshotWithR timeout, metadata, this.client.getVersion(), - this.client.getFileRequestIntent(), accept, context); } @@ -2779,7 +2715,6 @@ public Mono> createSnapshotNoCustomHeadersWithResponseAsync( timeout, metadata, this.client.getVersion(), - this.client.getFileRequestIntent(), accept, context)); } @@ -2812,7 +2747,6 @@ public Mono> createSnapshotNoCustomHeadersWithResponseAsync( timeout, metadata, this.client.getVersion(), - this.client.getFileRequestIntent(), accept, context); } @@ -3208,7 +3142,6 @@ public Mono> setPropertiesWithRes accessTier, leaseId, rootSquash, - this.client.getFileRequestIntent(), accept, context)); } @@ -3253,7 +3186,6 @@ public Mono> setPropertiesWithRes accessTier, leaseId, rootSquash, - this.client.getFileRequestIntent(), accept, context); } @@ -3356,7 +3288,6 @@ public Mono> setPropertiesNoCustomHeadersWithResponseAsync( accessTier, leaseId, rootSquash, - this.client.getFileRequestIntent(), accept, context)); } @@ -3401,7 +3332,6 @@ public Mono> setPropertiesNoCustomHeadersWithResponseAsync( accessTier, leaseId, rootSquash, - this.client.getFileRequestIntent(), accept, context); } @@ -3437,7 +3367,6 @@ public Mono> setMetadataWithRespons metadata, this.client.getVersion(), leaseId, - this.client.getFileRequestIntent(), accept, context)); } @@ -3472,7 +3401,6 @@ public Mono> setMetadataWithRespons metadata, this.client.getVersion(), leaseId, - this.client.getFileRequestIntent(), accept, context); } @@ -3550,7 +3478,6 @@ public Mono> setMetadataNoCustomHeadersWithResponseAsync( metadata, this.client.getVersion(), leaseId, - this.client.getFileRequestIntent(), accept, context)); } @@ -3585,7 +3512,6 @@ public Mono> setMetadataNoCustomHeadersWithResponseAsync( metadata, this.client.getVersion(), leaseId, - this.client.getFileRequestIntent(), accept, context); } @@ -3620,7 +3546,6 @@ public Mono> setMetadataNoCustomHeadersWithResponseAsync( timeout, this.client.getVersion(), leaseId, - this.client.getFileRequestIntent(), accept, context)); } @@ -3654,7 +3579,6 @@ public Mono> setMetadataNoCustomHeadersWithResponseAsync( timeout, this.client.getVersion(), leaseId, - this.client.getFileRequestIntent(), accept, context); } @@ -3728,7 +3652,6 @@ public Mono>> getAccessPolicyNoCustomHeader timeout, this.client.getVersion(), leaseId, - this.client.getFileRequestIntent(), accept, context)); } @@ -3761,7 +3684,6 @@ public Mono>> getAccessPolicyNoCustomHeader timeout, this.client.getVersion(), leaseId, - this.client.getFileRequestIntent(), accept, context); } @@ -3797,7 +3719,6 @@ public Mono> setAccessPolicyWit timeout, this.client.getVersion(), leaseId, - this.client.getFileRequestIntent(), shareAclConverted, accept, context)); @@ -3833,7 +3754,6 @@ public Mono> setAccessPolicyWit timeout, this.client.getVersion(), leaseId, - this.client.getFileRequestIntent(), shareAclConverted, accept, context); @@ -3912,7 +3832,6 @@ public Mono> setAccessPolicyNoCustomHeadersWithResponseAsync( timeout, this.client.getVersion(), leaseId, - this.client.getFileRequestIntent(), shareAclConverted, accept, context)); @@ -3948,7 +3867,6 @@ public Mono> setAccessPolicyNoCustomHeadersWithResponseAsync( timeout, this.client.getVersion(), leaseId, - this.client.getFileRequestIntent(), shareAclConverted, accept, context); @@ -3983,7 +3901,6 @@ public Mono> getStatisticsW timeout, this.client.getVersion(), leaseId, - this.client.getFileRequestIntent(), accept, context)); } @@ -4016,7 +3933,6 @@ public Mono> getStatisticsW timeout, this.client.getVersion(), leaseId, - this.client.getFileRequestIntent(), accept, context); } @@ -4089,7 +4005,6 @@ public Mono> getStatisticsNoCustomHeadersWithResponseAsync( timeout, this.client.getVersion(), leaseId, - this.client.getFileRequestIntent(), accept, context)); } @@ -4122,7 +4037,6 @@ public Mono> getStatisticsNoCustomHeadersWithResponseAsync( timeout, this.client.getVersion(), leaseId, - this.client.getFileRequestIntent(), accept, context); } @@ -4161,7 +4075,6 @@ public Mono> restoreWithResponseAsync( requestId, deletedShareName, deletedShareVersion, - this.client.getFileRequestIntent(), accept, context)); } @@ -4204,7 +4117,6 @@ public Mono> restoreWithResponseAsync( requestId, deletedShareName, deletedShareVersion, - this.client.getFileRequestIntent(), accept, context); } @@ -4295,7 +4207,6 @@ public Mono> restoreNoCustomHeadersWithResponseAsync( requestId, deletedShareName, deletedShareVersion, - this.client.getFileRequestIntent(), accept, context)); } @@ -4338,7 +4249,6 @@ public Mono> restoreNoCustomHeadersWithResponseAsync( requestId, deletedShareName, deletedShareVersion, - this.client.getFileRequestIntent(), accept, context); } diff --git a/sdk/storage/azure-storage-file-share/src/test/java/com/azure/storage/file/share/FileServiceApiTests.java b/sdk/storage/azure-storage-file-share/src/test/java/com/azure/storage/file/share/FileServiceApiTests.java index ba2fb1daec86a..f6f18b8843498 100644 --- a/sdk/storage/azure-storage-file-share/src/test/java/com/azure/storage/file/share/FileServiceApiTests.java +++ b/sdk/storage/azure-storage-file-share/src/test/java/com/azure/storage/file/share/FileServiceApiTests.java @@ -21,7 +21,6 @@ import com.azure.storage.file.share.models.ShareServiceProperties; import com.azure.storage.file.share.models.ShareSmbSettings; import com.azure.storage.file.share.models.ShareStorageException; -import com.azure.storage.file.share.models.ShareTokenIntent; import com.azure.storage.file.share.models.SmbMultichannel; import com.azure.storage.file.share.options.ShareCreateOptions; import com.azure.storage.file.share.options.ShareSetPropertiesOptions; @@ -49,7 +48,6 @@ import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertInstanceOf; import static org.junit.jupiter.api.Assertions.assertNotNull; -import static org.junit.jupiter.api.Assertions.assertNull; import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.api.Assertions.assertTrue; @@ -278,22 +276,6 @@ public void listSharesWithPremiumShare() { } } - @RequiredServiceVersion(clazz = ShareServiceVersion.class, min = "2024-08-04") - @Test - public void listSharesOAuth() { - ShareServiceClient oAuthServiceClient = getOAuthServiceClient(new ShareServiceClientBuilder() - .shareTokenIntent(ShareTokenIntent.BACKUP)); - oAuthServiceClient.createShare(shareName); - - for (ShareItem shareItem : oAuthServiceClient.listShares()) { - if (Objects.equals(shareItem.getName(), shareName)) { - assertNotNull(shareItem.getProperties().getETag()); - assertNotNull(shareItem.getProperties().getLastModified()); - } - assertNull(shareItem.getProperties().getMetadata()); - } - } - @ResourceLock("ServiceProperties") @Test public void setAndGetProperties() { @@ -374,37 +356,6 @@ private static Stream setAndGetPropertiesWithInvalidArgsSupplier() { Arguments.of(INVALID_ALLOWED_METHOD, 400, ShareErrorCode.INVALID_XML_NODE_VALUE)); } - @RequiredServiceVersion(clazz = ShareServiceVersion.class, min = "2024-08-04") - @ResourceLock("ServiceProperties") - @Test - public void setAndGetPropertiesOAuth() { - ShareServiceClient oAuthServiceClient = getOAuthServiceClient(new ShareServiceClientBuilder() - .shareTokenIntent(ShareTokenIntent.BACKUP)); - - ShareServiceProperties originalProperties = oAuthServiceClient.getProperties(); - ShareRetentionPolicy retentionPolicy = new ShareRetentionPolicy().setEnabled(true).setDays(3); - ShareMetrics metrics = new ShareMetrics().setEnabled(true).setIncludeApis(false) - .setRetentionPolicy(retentionPolicy).setVersion("1.0"); - ShareServiceProperties updatedProperties = new ShareServiceProperties().setHourMetrics(metrics) - .setMinuteMetrics(metrics).setCors(new ArrayList<>()); - - Response getPropertiesBeforeResponse = - oAuthServiceClient.getPropertiesWithResponse(null, null); - Response setPropertiesResponse = - oAuthServiceClient.setPropertiesWithResponse(updatedProperties, null, null); - Response getPropertiesAfterResponse = - oAuthServiceClient.getPropertiesWithResponse(null, null); - - FileShareTestHelper.assertResponseStatusCode(getPropertiesBeforeResponse, 200); - FileShareTestHelper.assertFileServicePropertiesAreEqual(originalProperties, - getPropertiesBeforeResponse.getValue()); - FileShareTestHelper.assertResponseStatusCode(setPropertiesResponse, 202); - FileShareTestHelper.assertResponseStatusCode(getPropertiesAfterResponse, 200); - FileShareTestHelper.assertFileServicePropertiesAreEqual(updatedProperties, - getPropertiesAfterResponse.getValue()); - - } - @RequiredServiceVersion(clazz = ShareServiceVersion.class, min = "2019-12-12") @Test public void restoreShareMin() { @@ -426,30 +377,6 @@ public void restoreShareMin() { restoredShareClient.getFileClient(fileName).exists(); } - @RequiredServiceVersion(clazz = ShareServiceVersion.class, min = "2024-08-04") - @Test - public void restoreShareOAuth() { - ShareServiceClient oAuthServiceClient = getOAuthServiceClient(new ShareServiceClientBuilder() - .shareTokenIntent(ShareTokenIntent.BACKUP)); - ShareClient shareClient = oAuthServiceClient.getShareClient(shareName); - - shareClient.create(); - String fileName = generatePathName(); - shareClient.getFileClient(fileName).create(2); - shareClient.delete(); - sleepIfRunningAgainstService(30000); - ShareItem shareItem = oAuthServiceClient.listShares( - new ListSharesOptions() - .setPrefix(shareClient.getShareName()) - .setIncludeDeleted(true), - null, Context.NONE).iterator().next(); - - ShareClient restoredShareClient = oAuthServiceClient.undeleteShare(shareItem.getName(), - shareItem.getVersion()); - - restoredShareClient.getFileClient(fileName).exists(); - } - @RequiredServiceVersion(clazz = ShareServiceVersion.class, min = "2019-12-12") @Test public void restoreShareMax() { diff --git a/sdk/storage/azure-storage-file-share/src/test/java/com/azure/storage/file/share/FileServiceAsyncApiTests.java b/sdk/storage/azure-storage-file-share/src/test/java/com/azure/storage/file/share/FileServiceAsyncApiTests.java index 21806aad9db9d..0faf3f05f67ee 100644 --- a/sdk/storage/azure-storage-file-share/src/test/java/com/azure/storage/file/share/FileServiceAsyncApiTests.java +++ b/sdk/storage/azure-storage-file-share/src/test/java/com/azure/storage/file/share/FileServiceAsyncApiTests.java @@ -15,7 +15,6 @@ import com.azure.storage.file.share.models.ShareProperties; import com.azure.storage.file.share.models.ShareRetentionPolicy; import com.azure.storage.file.share.models.ShareServiceProperties; -import com.azure.storage.file.share.models.ShareTokenIntent; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -27,7 +26,6 @@ import reactor.core.publisher.Mono; import reactor.test.StepVerifier; -import java.time.Duration; import java.util.ArrayList; import java.util.Collections; import java.util.LinkedList; @@ -206,25 +204,6 @@ public void listSharesWithPremiumShare() { } - @RequiredServiceVersion(clazz = ShareServiceVersion.class, min = "2024-08-04") - @Test - public void listSharesOAuth() { - ShareServiceAsyncClient oAuthServiceClient = getOAuthServiceAsyncClient(new ShareServiceClientBuilder() - .shareTokenIntent(ShareTokenIntent.BACKUP)); - - Flux shares = oAuthServiceClient.listShares().filter(item -> - Objects.equals(item.getName(), shareName)); - - StepVerifier.create(oAuthServiceClient.createShare(shareName).thenMany(shares)) - .assertNext(r -> { - assertNotNull(r.getProperties()); - assertNotNull(r.getProperties().getETag()); - assertNotNull(r.getProperties().getLastModified()); - }) - .verifyComplete(); - } - - @ResourceLock("ServiceProperties") @Test public void setAndGetProperties() { @@ -272,35 +251,6 @@ private static Stream setAndGetPropertiesWithInvalidArgsSupplier() { Arguments.of(INVALID_ALLOWED_METHOD, 400, ShareErrorCode.INVALID_XML_NODE_VALUE)); } - @RequiredServiceVersion(clazz = ShareServiceVersion.class, min = "2024-08-04") - @ResourceLock("ServiceProperties") - @Test - public void setAndGetPropertiesOAuth() { - ShareServiceAsyncClient oAuthServiceClient = getOAuthServiceAsyncClient(new ShareServiceClientBuilder() - .shareTokenIntent(ShareTokenIntent.BACKUP)); - - ShareServiceProperties originalProperties = oAuthServiceClient.getProperties().block(); - ShareRetentionPolicy retentionPolicy = new ShareRetentionPolicy().setEnabled(true).setDays(3); - ShareMetrics metrics = new ShareMetrics().setEnabled(true).setIncludeApis(false) - .setRetentionPolicy(retentionPolicy).setVersion("1.0"); - ShareServiceProperties updatedProperties = new ShareServiceProperties().setHourMetrics(metrics) - .setMinuteMetrics(metrics).setCors(new ArrayList<>()); - - StepVerifier.create(oAuthServiceClient.getPropertiesWithResponse()).assertNext(it -> { - FileShareTestHelper.assertResponseStatusCode(it, 200); - assertTrue(FileShareTestHelper.assertFileServicePropertiesAreEqual(originalProperties, it.getValue())); - }).verifyComplete(); - - StepVerifier.create(oAuthServiceClient.setPropertiesWithResponse(updatedProperties)) - .assertNext(it -> FileShareTestHelper.assertResponseStatusCode(it, 202)).verifyComplete(); - - StepVerifier.create(oAuthServiceClient.getPropertiesWithResponse()).assertNext(it -> { - FileShareTestHelper.assertResponseStatusCode(it, 200); - assertTrue(FileShareTestHelper.assertFileServicePropertiesAreEqual(updatedProperties, it.getValue())); - }).verifyComplete(); - - } - @RequiredServiceVersion(clazz = ShareServiceVersion.class, min = "2019-12-12") @Test public void restoreShareMin() { @@ -321,31 +271,6 @@ public void restoreShareMin() { .assertNext(Assertions::assertTrue).verifyComplete(); } - @RequiredServiceVersion(clazz = ShareServiceVersion.class, min = "2024-08-04") - @Test - public void restoreShareOAuth() { - ShareServiceAsyncClient oAuthServiceClient = getOAuthServiceAsyncClient(new ShareServiceClientBuilder() - .shareTokenIntent(ShareTokenIntent.BACKUP)); - ShareAsyncClient shareClient = oAuthServiceClient.getShareAsyncClient(generateShareName()); - - String fileName = generatePathName(); - Mono restoredShareClientMono = shareClient.create() - .then(shareClient.getFileClient(fileName).create(2)) - .then(shareClient.delete()) - .then(oAuthServiceClient.listShares( - new ListSharesOptions() - .setPrefix(shareClient.getShareName()) - .setIncludeDeleted(true)).next()) - .flatMap(r -> Mono.zip(Mono.just(r), Mono.delay(Duration.ofSeconds(30)))) - .flatMap(tuple -> { - assertNotNull(tuple.getT1()); - return oAuthServiceClient.undeleteShare(tuple.getT1().getName(), tuple.getT1().getVersion()); - }); - - StepVerifier.create(restoredShareClientMono.flatMap(it -> it.getFileClient(fileName).exists())) - .assertNext(Assertions::assertTrue).verifyComplete(); - } - @RequiredServiceVersion(clazz = ShareServiceVersion.class, min = "2019-12-12") @Test public void restoreShareMax() { diff --git a/sdk/storage/azure-storage-file-share/src/test/java/com/azure/storage/file/share/ShareApiTests.java b/sdk/storage/azure-storage-file-share/src/test/java/com/azure/storage/file/share/ShareApiTests.java index 9e4410ca9616e..eee1cc9767e39 100644 --- a/sdk/storage/azure-storage-file-share/src/test/java/com/azure/storage/file/share/ShareApiTests.java +++ b/sdk/storage/azure-storage-file-share/src/test/java/com/azure/storage/file/share/ShareApiTests.java @@ -154,18 +154,6 @@ public void createShare() { 201); } - @RequiredServiceVersion(clazz = ShareServiceVersion.class, min = "2024-08-04") - @Test - public void createShareOAuth() { - ShareServiceClient oAuthServiceClient = getOAuthServiceClient(new ShareServiceClientBuilder() - .shareTokenIntent(ShareTokenIntent.BACKUP)); - ShareClient shareClient = oAuthServiceClient.getShareClient(shareName); - - FileShareTestHelper.assertResponseStatusCode(shareClient.createWithResponse(null, null, - null, null), 201); - - } - @RequiredServiceVersion(clazz = ShareServiceVersion.class, min = "2019-12-12") @ParameterizedTest @MethodSource("createShareWithArgsSupplier") @@ -354,17 +342,6 @@ public void deleteShare() { FileShareTestHelper.assertResponseStatusCode(primaryShareClient.deleteWithResponse(null, null), 202); } - @RequiredServiceVersion(clazz = ShareServiceVersion.class, min = "2024-08-04") - @Test - public void deleteShareOAuth() { - primaryShareClient.create(); - ShareServiceClient oAuthServiceClient = getOAuthServiceClient(new ShareServiceClientBuilder() - .shareTokenIntent(ShareTokenIntent.BACKUP)); - ShareClient shareClient = oAuthServiceClient.getShareClient(shareName); - - FileShareTestHelper.assertResponseStatusCode(shareClient.deleteWithResponse(null, null), 202); - } - @Test public void deleteShareDeleteSnapshotOptions() { primaryShareClient.create(); @@ -502,21 +479,6 @@ public void getProperties() { assertEquals(getPropertiesResponse.getValue().getQuota(), 1); } - @RequiredServiceVersion(clazz = ShareServiceVersion.class, min = "2024-08-04") - @Test - public void getPropertiesOAuth() { - primaryShareClient.createWithResponse(testMetadata, 1, null, null); - ShareServiceClient oAuthServiceClient = getOAuthServiceClient(new ShareServiceClientBuilder() - .shareTokenIntent(ShareTokenIntent.BACKUP)); - ShareClient shareClient = oAuthServiceClient.getShareClient(shareName); - - Response getPropertiesResponse = shareClient.getPropertiesWithResponse(null, null); - - FileShareTestHelper.assertResponseStatusCode(getPropertiesResponse, 200); - assertEquals(testMetadata, getPropertiesResponse.getValue().getMetadata()); - assertEquals(getPropertiesResponse.getValue().getQuota(), 1); - } - @RequiredServiceVersion(clazz = ShareServiceVersion.class, min = "2020-02-10") @Test public void getPropertiesLease() { @@ -543,6 +505,17 @@ public void getPropertiesError() { FileShareTestHelper.assertExceptionStatusCodeAndMessage(e, 404, ShareErrorCode.SHARE_NOT_FOUND); } + @RequiredServiceVersion(clazz = ShareServiceVersion.class, min = "2021-04-10") + @Test + public void getPropertiesOAuthError() { + primaryShareClient.create(); + ShareServiceClient oAuthServiceClient = getOAuthServiceClient(new ShareServiceClientBuilder() + .shareTokenIntent(ShareTokenIntent.BACKUP)); + ShareClient shareClient = oAuthServiceClient.getShareClient(shareName); + // only APIs supported by ShareWithtoken authentication are createPermission and getPermission + assertThrows(ShareStorageException.class, shareClient::getProperties); + } + @PlaybackOnly @ParameterizedTest @MethodSource("com.azure.storage.file.share.FileShareTestHelper#getPropertiesPremiumSupplier") @@ -597,27 +570,6 @@ public void setAccessPolicy() { assertEquals(primaryShareClient.getAccessPolicy().iterator().next().getId(), "0000"); } - @RequiredServiceVersion(clazz = ShareServiceVersion.class, min = "2024-08-04") - @Test - public void setAccessPolicyOAuth() { - primaryShareClient.create(); - ShareServiceClient oAuthServiceClient = getOAuthServiceClient(new ShareServiceClientBuilder() - .shareTokenIntent(ShareTokenIntent.BACKUP)); - ShareClient shareClient = oAuthServiceClient.getShareClient(shareName); - - ShareSignedIdentifier identifier = new ShareSignedIdentifier() - .setId("0000") - .setAccessPolicy(new ShareAccessPolicy() - .setStartsOn(testResourceNamer.now().atZoneSameInstant(ZoneId.of("UTC")).toOffsetDateTime()) - .setExpiresOn(testResourceNamer.now().atZoneSameInstant(ZoneId.of("UTC")).toOffsetDateTime() - .plusDays(1)) - .setPermissions("r")); - - List ids = Arrays.asList(identifier); - shareClient.setAccessPolicy(ids); - assertEquals(shareClient.getAccessPolicy().iterator().next().getId(), "0000"); - } - @Test public void setAccessPolicyIds() { primaryShareClient.create(); @@ -698,34 +650,6 @@ public void getAccessPolicy() { assertEquals(id.getAccessPolicy().getPermissions(), identifier.getAccessPolicy().getPermissions()); } - @RequiredServiceVersion(clazz = ShareServiceVersion.class, min = "2024-08-04") - @Test - public void getAccessPolicyOAuth() { - primaryShareClient.create(); - ShareServiceClient oAuthServiceClient = getOAuthServiceClient(new ShareServiceClientBuilder() - .shareTokenIntent(ShareTokenIntent.BACKUP)); - ShareClient shareClient = oAuthServiceClient.getShareClient(shareName); - - - ShareSignedIdentifier identifier = new ShareSignedIdentifier() - .setId("0000") - .setAccessPolicy(new ShareAccessPolicy() - .setStartsOn(testResourceNamer.now().atZoneSameInstant(ZoneId.of("UTC")).toOffsetDateTime()) - .setExpiresOn(testResourceNamer.now().atZoneSameInstant(ZoneId.of("UTC")).toOffsetDateTime() - .plusDays(1)) - .setPermissions("r")); - - List ids = Arrays.asList(identifier); - shareClient.setAccessPolicy(ids); - - ShareSignedIdentifier id = shareClient.getAccessPolicy().iterator().next(); - - assertEquals(id.getId(), identifier.getId()); - assertEquals(id.getAccessPolicy().getStartsOn(), identifier.getAccessPolicy().getStartsOn()); - assertEquals(id.getAccessPolicy().getExpiresOn(), identifier.getAccessPolicy().getExpiresOn()); - assertEquals(id.getAccessPolicy().getPermissions(), identifier.getAccessPolicy().getPermissions()); - } - @RequiredServiceVersion(clazz = ShareServiceVersion.class, min = "2020-02-10") @Test public void getAccessPolicyLease() { @@ -818,20 +742,6 @@ public void setPropertiesError() { FileShareTestHelper.assertExceptionStatusCodeAndMessage(e, 404, ShareErrorCode.SHARE_NOT_FOUND); } - @RequiredServiceVersion(clazz = ShareServiceVersion.class, min = "2024-08-04") - @Test - public void setPropertiesOAuth() { - primaryShareClient.createWithResponse(new ShareCreateOptions().setAccessTier(ShareAccessTier.HOT), null, null); - ShareServiceClient oAuthServiceClient = getOAuthServiceClient(new ShareServiceClientBuilder() - .shareTokenIntent(ShareTokenIntent.BACKUP)); - ShareClient shareClient = oAuthServiceClient.getShareClient(shareName); - - Response setAccessTierResponse = shareClient.setPropertiesWithResponse( - new ShareSetPropertiesOptions().setAccessTier(ShareAccessTier.COOL), null, null); - - FileShareTestHelper.assertResponseStatusCode(setAccessTierResponse, 200); - } - @Test public void setMetadata() { primaryShareClient.createWithResponse(testMetadata, null, null, null); @@ -847,26 +757,6 @@ public void setMetadata() { assertEquals(metadataAfterSet, getMetadataAfterResponse.getMetadata()); } - @RequiredServiceVersion(clazz = ShareServiceVersion.class, min = "2024-08-04") - @Test - public void setMetadataOAuth() { - primaryShareClient.createWithResponse(testMetadata, null, null, null); - ShareServiceClient oAuthServiceClient = getOAuthServiceClient(new ShareServiceClientBuilder() - .shareTokenIntent(ShareTokenIntent.BACKUP)); - ShareClient shareClient = oAuthServiceClient.getShareClient(shareName); - - Map metadataAfterSet = Collections.singletonMap("afterset", "value"); - - ShareProperties getMetadataBeforeResponse = shareClient.getProperties(); - Response setMetadataResponse = shareClient.setMetadataWithResponse(metadataAfterSet, null, - null); - ShareProperties getMetadataAfterResponse = shareClient.getProperties(); - - assertEquals(testMetadata, getMetadataBeforeResponse.getMetadata()); - FileShareTestHelper.assertResponseStatusCode(setMetadataResponse, 200); - assertEquals(metadataAfterSet, getMetadataAfterResponse.getMetadata()); - } - @RequiredServiceVersion(clazz = ShareServiceVersion.class, min = "2020-02-10") @Test public void setMetadataLease() { diff --git a/sdk/storage/azure-storage-file-share/src/test/java/com/azure/storage/file/share/ShareAsyncApiTests.java b/sdk/storage/azure-storage-file-share/src/test/java/com/azure/storage/file/share/ShareAsyncApiTests.java index 29c9db0d55f58..d12878e9615dc 100644 --- a/sdk/storage/azure-storage-file-share/src/test/java/com/azure/storage/file/share/ShareAsyncApiTests.java +++ b/sdk/storage/azure-storage-file-share/src/test/java/com/azure/storage/file/share/ShareAsyncApiTests.java @@ -6,10 +6,8 @@ import com.azure.core.http.rest.Response; import com.azure.storage.common.StorageSharedKeyCredential; import com.azure.storage.common.test.shared.extensions.PlaybackOnly; -import com.azure.storage.common.test.shared.extensions.RequiredServiceVersion; import com.azure.storage.file.share.implementation.util.ModelHelper; import com.azure.storage.file.share.models.NtfsFileAttributes; -import com.azure.storage.file.share.models.ShareAccessTier; import com.azure.storage.file.share.models.ShareAudience; import com.azure.storage.file.share.models.ShareErrorCode; import com.azure.storage.file.share.models.ShareFileHttpHeaders; @@ -90,18 +88,6 @@ public void createShare() { .assertNext(it -> FileShareTestHelper.assertResponseStatusCode(it, 201)).verifyComplete(); } - @RequiredServiceVersion(clazz = ShareServiceVersion.class, min = "2024-08-04") - @Test - public void createShareOAuth() { - ShareServiceAsyncClient oAuthServiceClient = getOAuthServiceAsyncClient(new ShareServiceClientBuilder() - .shareTokenIntent(ShareTokenIntent.BACKUP)); - ShareAsyncClient shareClient = oAuthServiceClient.getShareAsyncClient(shareName); - - StepVerifier.create(shareClient.createWithResponse(null, (Integer) null)) - .assertNext(it -> FileShareTestHelper.assertResponseStatusCode(it, 201)) - .verifyComplete(); - } - @ParameterizedTest @MethodSource("createShareWithArgsSupplier") public void createShareWithArgs(Map metadata, Integer quota) { @@ -226,17 +212,6 @@ public void deleteShare() { .assertNext(it -> FileShareTestHelper.assertResponseStatusCode(it, 201)); } - @RequiredServiceVersion(clazz = ShareServiceVersion.class, min = "2024-08-04") - @Test - public void deleteShareOAuth() { - ShareServiceAsyncClient oAuthServiceClient = getOAuthServiceAsyncClient(new ShareServiceClientBuilder() - .shareTokenIntent(ShareTokenIntent.BACKUP)); - ShareAsyncClient shareClient = oAuthServiceClient.getShareAsyncClient(shareName); - - StepVerifier.create(primaryShareAsyncClient.create().then(shareClient.deleteWithResponse())) - .assertNext(it -> FileShareTestHelper.assertResponseStatusCode(it, 201)); - } - @Test public void deleteShareError() { StepVerifier.create(primaryShareAsyncClient.delete()) @@ -289,22 +264,6 @@ public void getProperties() { }).verifyComplete(); } - @RequiredServiceVersion(clazz = ShareServiceVersion.class, min = "2024-08-04") - @Test - public void getPropertiesOAuth() { - ShareServiceAsyncClient oAuthServiceClient = getOAuthServiceAsyncClient(new ShareServiceClientBuilder() - .shareTokenIntent(ShareTokenIntent.BACKUP)); - ShareAsyncClient shareClient = oAuthServiceClient.getShareAsyncClient(shareName); - - StepVerifier.create(primaryShareAsyncClient.createWithResponse(testMetadata, 1).then(shareClient.getPropertiesWithResponse())) - .assertNext(it -> { - FileShareTestHelper.assertResponseStatusCode(it, 200); - assertEquals(testMetadata, it.getValue().getMetadata()); - assertEquals(it.getValue().getQuota(), 1); - }) - .verifyComplete(); - } - @Test public void getPropertiesError() { StepVerifier.create(primaryShareAsyncClient.getProperties()).verifyErrorSatisfies(it -> @@ -352,20 +311,6 @@ public void setPremiumProperties() { } } - @RequiredServiceVersion(clazz = ShareServiceVersion.class, min = "2024-08-04") - @Test - public void setPropertiesOAuth() { - ShareServiceAsyncClient oAuthServiceClient = getOAuthServiceAsyncClient(new ShareServiceClientBuilder() - .shareTokenIntent(ShareTokenIntent.BACKUP)); - ShareAsyncClient shareClient = oAuthServiceClient.getShareAsyncClient(shareName); - - StepVerifier.create(primaryShareAsyncClient.createWithResponse(new ShareCreateOptions() - .setAccessTier(ShareAccessTier.HOT)) - .then(shareClient.setPropertiesWithResponse(new ShareSetPropertiesOptions().setAccessTier(ShareAccessTier.COOL)))) - .assertNext(r -> assertEquals(200, r.getStatusCode())) - .verifyComplete(); - } - @Test public void setQuota() { primaryShareAsyncClient.createWithResponse(null, 1).block(); @@ -395,26 +340,6 @@ public void setMetadata() { assertEquals(metadataAfterSet, it.getMetadata())).verifyComplete(); } - @RequiredServiceVersion(clazz = ShareServiceVersion.class, min = "2024-08-04") - @Test - public void setMetadataOAuth() { - ShareServiceAsyncClient oAuthServiceClient = getOAuthServiceAsyncClient(new ShareServiceClientBuilder() - .shareTokenIntent(ShareTokenIntent.BACKUP)); - ShareAsyncClient shareClient = oAuthServiceClient.getShareAsyncClient(shareName); - - Map metadataAfterSet = Collections.singletonMap("afterset", "value"); - StepVerifier.create(primaryShareAsyncClient.createWithResponse(testMetadata, null) - .then(shareClient.getProperties())) - .assertNext(it -> assertEquals(testMetadata, it.getMetadata())) - .verifyComplete(); - StepVerifier.create(shareClient.setMetadataWithResponse(metadataAfterSet)) - .assertNext(it -> FileShareTestHelper.assertResponseStatusCode(it, 200)) - .verifyComplete(); - StepVerifier.create(shareClient.getProperties()).assertNext(it -> - assertEquals(metadataAfterSet, it.getMetadata())) - .verifyComplete(); - } - @Test public void setMetadataError() { StepVerifier.create(primaryShareAsyncClient.setMetadata(testMetadata)).verifyErrorSatisfies(it -> diff --git a/sdk/storage/azure-storage-file-share/src/test/java/com/azure/storage/file/share/specialized/LeaseApiTests.java b/sdk/storage/azure-storage-file-share/src/test/java/com/azure/storage/file/share/specialized/LeaseApiTests.java index 8709c60b5bbdb..8fe38164ebf2f 100644 --- a/sdk/storage/azure-storage-file-share/src/test/java/com/azure/storage/file/share/specialized/LeaseApiTests.java +++ b/sdk/storage/azure-storage-file-share/src/test/java/com/azure/storage/file/share/specialized/LeaseApiTests.java @@ -274,27 +274,6 @@ public void acquireShareLease(String proposedID, int leaseTime, LeaseStateType l assertEquals(leaseDuration, properties.getLeaseDuration()); } - @RequiredServiceVersion(clazz = ShareServiceVersion.class, min = "2024-08-04") - @ParameterizedTest - @MethodSource("acquireShareLeaseSupplier") - public void acquireShareLeaseOAuth(String proposedID, int leaseTime, LeaseStateType leaseState, - LeaseDurationType leaseDuration) { - ShareServiceClient oAuthServiceClient = getOAuthServiceClient(new ShareServiceClientBuilder() - .shareTokenIntent(ShareTokenIntent.BACKUP)); - ShareClient shareClient = oAuthServiceClient.getShareClient(shareName); - - ShareLeaseClient leaseClient = createLeaseClient(shareClient, proposedID); - Response leaseResponse = leaseClient.acquireLeaseWithResponse(new ShareAcquireLeaseOptions() - .setDuration(leaseTime), null, null); - assertEquals(leaseClient.getLeaseId(), leaseResponse.getValue()); - - ShareProperties properties = shareClient.getProperties(); - assertNotNull(leaseResponse.getValue()); - validateBasicHeaders(leaseResponse.getHeaders()); - assertEquals(leaseState, properties.getLeaseState()); - assertEquals(leaseDuration, properties.getLeaseDuration()); - } - private static Stream acquireShareLeaseSupplier() { return Stream.of( Arguments.of(null, -1, LeaseStateType.LEASED, LeaseDurationType.INFINITE), @@ -371,24 +350,6 @@ public void renewShareLease() { validateBasicHeaders(renewLeaseResponse.getHeaders()); } - @RequiredServiceVersion(clazz = ShareServiceVersion.class, min = "2024-08-04") - @Test - public void renewShareLeaseOAuth() { - ShareServiceClient oAuthServiceClient = getOAuthServiceClient(new ShareServiceClientBuilder() - .shareTokenIntent(ShareTokenIntent.BACKUP)); - ShareClient shareClient = oAuthServiceClient.getShareClient(shareName); - - String leaseID = setupShareLeaseCondition(shareClient, RECEIVED_LEASE_ID); - ShareLeaseClient leaseClient = createLeaseClient(shareClient, leaseID); - - // If running in live mode wait for the lease to expire to ensure we are actually renewing it - sleepIfRunningAgainstService(16000); - Response renewLeaseResponse = leaseClient.renewLeaseWithResponse(null, null); - assertEquals(leaseClient.getLeaseId(), renewLeaseResponse.getValue()); - assertEquals(LeaseStateType.LEASED, shareClient.getProperties().getLeaseState()); - validateBasicHeaders(renewLeaseResponse.getHeaders()); - } - @RequiredServiceVersion(clazz = ShareServiceVersion.class, min = "2020-02-10") @Test public void renewShareLeaseMin() { @@ -432,20 +393,6 @@ public void releaseShareLease() { validateBasicHeaders(releaseLeaseResponse.getHeaders()); } - @RequiredServiceVersion(clazz = ShareServiceVersion.class, min = "2024-08-04") - @Test - public void releaseShareLeaseOAuth() { - ShareServiceClient oAuthServiceClient = getOAuthServiceClient(new ShareServiceClientBuilder() - .shareTokenIntent(ShareTokenIntent.BACKUP)); - ShareClient shareClient = oAuthServiceClient.getShareClient(shareName); - String leaseID = setupShareLeaseCondition(shareClient, RECEIVED_LEASE_ID); - Response releaseLeaseResponse = createLeaseClient(shareClient, leaseID) - .releaseLeaseWithResponse(null, null); - - assertEquals(LeaseStateType.AVAILABLE, shareClient.getProperties().getLeaseState()); - validateBasicHeaders(releaseLeaseResponse.getHeaders()); - } - @RequiredServiceVersion(clazz = ShareServiceVersion.class, min = "2020-02-10") @Test public void releaseShareLeaseMin() { @@ -495,27 +442,6 @@ public void breakShareLease(int leaseTime, Long breakPeriod) { } } - @RequiredServiceVersion(clazz = ShareServiceVersion.class, min = "2024-08-04") - @ParameterizedTest - @MethodSource("breakShareLeaseSupplier") - public void breakShareLeaseOAuth(int leaseTime, Long breakPeriod) { - ShareServiceClient oAuthServiceClient = getOAuthServiceClient(new ShareServiceClientBuilder() - .shareTokenIntent(ShareTokenIntent.BACKUP)); - ShareClient shareClient = oAuthServiceClient.getShareClient(shareName); - ShareLeaseClient leaseClient = createLeaseClient(shareClient, testResourceNamer.randomUuid()); - leaseClient.acquireLeaseWithResponse(new ShareAcquireLeaseOptions().setDuration(leaseTime), null, null); - - Response breakLeaseResponse = leaseClient.breakLeaseWithResponse(new ShareBreakLeaseOptions() - .setBreakPeriod(breakPeriod == null ? null : Duration.ofSeconds(breakPeriod)), null, null); - LeaseStateType state = shareClient.getProperties().getLeaseState(); - assertTrue(LeaseStateType.BROKEN == state || LeaseStateType.BREAKING == state); - validateBasicHeaders(breakLeaseResponse.getHeaders()); - if (breakPeriod != null) { - // If running in live mode wait for the lease to break so we can delete the share after the test completes - sleepIfRunningAgainstService(breakPeriod * 1000); - } - } - private static Stream breakShareLeaseSupplier() { return Stream.of(Arguments.of(-1, null), Arguments.of(-1, 20L), Arguments.of(20, 15L)); } @@ -567,24 +493,6 @@ public void changeShareLease() { validateBasicHeaders(changeLeaseResponse.getHeaders()); } - @RequiredServiceVersion(clazz = ShareServiceVersion.class, min = "2024-08-04") - @Test - public void changeShareLeaseOAuth() { - ShareServiceClient oAuthServiceClient = getOAuthServiceClient(new ShareServiceClientBuilder() - .shareTokenIntent(ShareTokenIntent.BACKUP)); - ShareClient shareClient = oAuthServiceClient.getShareClient(shareName); - - String leaseID = setupShareLeaseCondition(shareClient, RECEIVED_LEASE_ID); - ShareLeaseClient leaseClient = createLeaseClient(shareClient, leaseID); - String newLeaseId = testResourceNamer.randomUuid(); - Response changeLeaseResponse = leaseClient.changeLeaseWithResponse(newLeaseId, null, null); - assertEquals(newLeaseId, changeLeaseResponse.getValue()); - assertEquals(leaseClient.getLeaseId(), changeLeaseResponse.getValue()); - assertEquals(200, createLeaseClient(shareClient, newLeaseId).releaseLeaseWithResponse(null, null) - .getStatusCode()); - validateBasicHeaders(changeLeaseResponse.getHeaders()); - } - @RequiredServiceVersion(clazz = ShareServiceVersion.class, min = "2020-02-10") @Test public void changeShareLeaseMin() { diff --git a/sdk/storage/azure-storage-file-share/swagger/README.md b/sdk/storage/azure-storage-file-share/swagger/README.md index a7fd7d1b614fd..83f93756a3963 100644 --- a/sdk/storage/azure-storage-file-share/swagger/README.md +++ b/sdk/storage/azure-storage-file-share/swagger/README.md @@ -16,7 +16,7 @@ autorest ### Code generation settings ``` yaml use: '@autorest/java@4.1.16' -input-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/da7f1ad67a145012fcd7c4ace168e7a3ad68b120/specification/storage/data-plane/Microsoft.FileStorage/stable/2024-08-04/file.json +input-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/3f9cca0301ffbb8856826d196c567d821ae190d7/specification/storage/data-plane/Microsoft.FileStorage/preview/2024-05-04/file.json java: true output-folder: ../ namespace: com.azure.storage.file.share From c40ac4bc13babf2be7dd1eadf0e94dc5f1c16cfc Mon Sep 17 00:00:00 2001 From: Isabelle <141270045+ibrandes@users.noreply.github.com> Date: Thu, 18 Apr 2024 12:29:10 -0700 Subject: [PATCH 05/17] STG94 Authorization Error Detail (#39655) * tests and recordings * style --- .../azure-storage-file-share/assets.json | 2 +- .../implementation/models/StorageError.java | 26 +++++++++++++++++++ .../storage/file/share/ShareApiTests.java | 14 ++++++++++ .../file/share/ShareAsyncApiTests.java | 18 +++++++++++++ .../swagger/README.md | 2 +- 5 files changed, 60 insertions(+), 2 deletions(-) diff --git a/sdk/storage/azure-storage-file-share/assets.json b/sdk/storage/azure-storage-file-share/assets.json index 43d28c1fc7d57..b6148d2b7230c 100644 --- a/sdk/storage/azure-storage-file-share/assets.json +++ b/sdk/storage/azure-storage-file-share/assets.json @@ -2,5 +2,5 @@ "AssetsRepo": "Azure/azure-sdk-assets", "AssetsRepoPrefixPath": "java", "TagPrefix": "java/storage/azure-storage-file-share", - "Tag": "java/storage/azure-storage-file-share_011cc52a61" + "Tag": "java/storage/azure-storage-file-share_5a1b3f763c" } diff --git a/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/implementation/models/StorageError.java b/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/implementation/models/StorageError.java index a4a620cca7e7a..964157d1ce5b7 100644 --- a/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/implementation/models/StorageError.java +++ b/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/implementation/models/StorageError.java @@ -18,6 +18,12 @@ public final class StorageError { @JsonProperty(value = "Message") private String message; + /* + * The AuthenticationErrorDetail property. + */ + @JsonProperty(value = "AuthenticationErrorDetail") + private String authenticationErrorDetail; + /** Creates an instance of StorageError class. */ public StorageError() {} @@ -40,4 +46,24 @@ public StorageError setMessage(String message) { this.message = message; return this; } + + /** + * Get the authenticationErrorDetail property: The AuthenticationErrorDetail property. + * + * @return the authenticationErrorDetail value. + */ + public String getAuthenticationErrorDetail() { + return this.authenticationErrorDetail; + } + + /** + * Set the authenticationErrorDetail property: The AuthenticationErrorDetail property. + * + * @param authenticationErrorDetail the authenticationErrorDetail value to set. + * @return the StorageError object itself. + */ + public StorageError setAuthenticationErrorDetail(String authenticationErrorDetail) { + this.authenticationErrorDetail = authenticationErrorDetail; + return this; + } } diff --git a/sdk/storage/azure-storage-file-share/src/test/java/com/azure/storage/file/share/ShareApiTests.java b/sdk/storage/azure-storage-file-share/src/test/java/com/azure/storage/file/share/ShareApiTests.java index eee1cc9767e39..fb61238922eb1 100644 --- a/sdk/storage/azure-storage-file-share/src/test/java/com/azure/storage/file/share/ShareApiTests.java +++ b/sdk/storage/azure-storage-file-share/src/test/java/com/azure/storage/file/share/ShareApiTests.java @@ -154,6 +154,20 @@ public void createShare() { 201); } + @RequiredServiceVersion(clazz = ShareServiceVersion.class, min = "2024-08-04") + @Test + public void createShareSasError() { + ShareServiceClient unauthorizedServiceClient = fileServiceBuilderHelper() + .sasToken("sig=dummyToken") + .buildClient(); + + ShareClient share = unauthorizedServiceClient.getShareClient(generateShareName()); + + ShareStorageException e = assertThrows(ShareStorageException.class, share::create); + assertEquals(ShareErrorCode.AUTHENTICATION_FAILED, e.getErrorCode()); + assertTrue(e.getServiceMessage().contains("AuthenticationErrorDetail")); + } + @RequiredServiceVersion(clazz = ShareServiceVersion.class, min = "2019-12-12") @ParameterizedTest @MethodSource("createShareWithArgsSupplier") diff --git a/sdk/storage/azure-storage-file-share/src/test/java/com/azure/storage/file/share/ShareAsyncApiTests.java b/sdk/storage/azure-storage-file-share/src/test/java/com/azure/storage/file/share/ShareAsyncApiTests.java index d12878e9615dc..66722521a7b42 100644 --- a/sdk/storage/azure-storage-file-share/src/test/java/com/azure/storage/file/share/ShareAsyncApiTests.java +++ b/sdk/storage/azure-storage-file-share/src/test/java/com/azure/storage/file/share/ShareAsyncApiTests.java @@ -6,6 +6,7 @@ import com.azure.core.http.rest.Response; import com.azure.storage.common.StorageSharedKeyCredential; import com.azure.storage.common.test.shared.extensions.PlaybackOnly; +import com.azure.storage.common.test.shared.extensions.RequiredServiceVersion; import com.azure.storage.file.share.implementation.util.ModelHelper; import com.azure.storage.file.share.models.NtfsFileAttributes; import com.azure.storage.file.share.models.ShareAudience; @@ -88,6 +89,23 @@ public void createShare() { .assertNext(it -> FileShareTestHelper.assertResponseStatusCode(it, 201)).verifyComplete(); } + @RequiredServiceVersion(clazz = ShareServiceVersion.class, min = "2024-08-04") + @Test + public void createShareSasError() { + ShareServiceAsyncClient unauthorizedServiceClient = fileServiceBuilderHelper() + .sasToken("sig=dummyToken") + .buildAsyncClient(); + + ShareAsyncClient share = unauthorizedServiceClient.getShareAsyncClient(generateShareName()); + + StepVerifier.create(share.create()) + .verifyErrorSatisfies(r -> { + ShareStorageException e = assertInstanceOf(ShareStorageException.class, r); + assertEquals(ShareErrorCode.AUTHENTICATION_FAILED, e.getErrorCode()); + assertTrue(e.getServiceMessage().contains("AuthenticationErrorDetail")); + }); + } + @ParameterizedTest @MethodSource("createShareWithArgsSupplier") public void createShareWithArgs(Map metadata, Integer quota) { diff --git a/sdk/storage/azure-storage-file-share/swagger/README.md b/sdk/storage/azure-storage-file-share/swagger/README.md index 83f93756a3963..57de2ba899b66 100644 --- a/sdk/storage/azure-storage-file-share/swagger/README.md +++ b/sdk/storage/azure-storage-file-share/swagger/README.md @@ -16,7 +16,7 @@ autorest ### Code generation settings ``` yaml use: '@autorest/java@4.1.16' -input-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/3f9cca0301ffbb8856826d196c567d821ae190d7/specification/storage/data-plane/Microsoft.FileStorage/preview/2024-05-04/file.json +input-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/12e0ceead6d4611abdd617d2bbc5c9068e4c772a/specification/storage/data-plane/Microsoft.FileStorage/stable/2024-08-04/file.json java: true output-folder: ../ namespace: com.azure.storage.file.share From a46fdd6b2a24e79cf212f4d31f40b566de587732 Mon Sep 17 00:00:00 2001 From: Isabelle <141270045+ibrandes@users.noreply.github.com> Date: Mon, 22 Apr 2024 11:34:43 -0700 Subject: [PATCH 06/17] Stg94 Snapshot management support via REST for NFS shares (#39739) * Stg93 Snapshot management support via REST for NFS shares (Cleaned) (#38845) * swagger and hookup * everything * style * removing preprod from test environment suffix * adding better descriptions * renaming * re-recording * updating required service version for tests --- .../storage/file/share/ShareAsyncClient.java | 9 +- .../file/share/implementation/SharesImpl.java | 91 +++++++++++++++++-- .../models/SharePropertiesInternal.java | 27 ++++++ .../models/SharesGetPropertiesHeaders.java | 38 ++++++++ .../implementation/util/ModelHelper.java | 1 + .../file/share/models/ShareProperties.java | 34 +++++++ .../share/options/ShareCreateOptions.java | 26 ++++++ .../options/ShareSetPropertiesOptions.java | 28 ++++++ .../file/share/FileServiceApiTests.java | 19 ++++ .../file/share/FileServiceAsyncApiTests.java | 24 +++++ .../storage/file/share/ShareApiTests.java | 52 +++++++++++ .../file/share/ShareAsyncApiTests.java | 61 +++++++++++++ .../swagger/README.md | 2 +- 13 files changed, 398 insertions(+), 14 deletions(-) diff --git a/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/ShareAsyncClient.java b/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/ShareAsyncClient.java index 073e035b37b80..ec0e8787b4d6e 100644 --- a/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/ShareAsyncClient.java +++ b/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/ShareAsyncClient.java @@ -375,7 +375,8 @@ Mono> createWithResponse(ShareCreateOptions options, Context enabledProtocol = "".equals(enabledProtocol) ? null : enabledProtocol; return azureFileStorageClient.getShares() .createWithResponseAsync(shareName, null, options.getMetadata(), options.getQuotaInGb(), - options.getAccessTier(), enabledProtocol, options.getRootSquash(), context) + options.getAccessTier(), enabledProtocol, options.getRootSquash(), + options.isSnapshotVirtualDirectoryAccessEnabled(), context) .map(this::mapToShareInfoResponse); } @@ -933,7 +934,8 @@ Mono> setPropertiesWithResponse(ShareSetPropertiesOptions op ? new ShareRequestConditions() : options.getRequestConditions(); context = context == null ? Context.NONE : context; return azureFileStorageClient.getShares().setPropertiesWithResponseAsync(shareName, null, - options.getQuotaInGb(), options.getAccessTier(), requestConditions.getLeaseId(), options.getRootSquash(), context) + options.getQuotaInGb(), options.getAccessTier(), requestConditions.getLeaseId(), options.getRootSquash(), + options.isSnapshotVirtualDirectoryAccessEnabled(), context) .map(this::mapToShareInfoResponse); } @@ -2308,7 +2310,8 @@ private Response mapGetPropertiesResponse( .setAccessTierChangeTime(headers.getXMsAccessTierChangeTime()) .setAccessTierTransitionState(headers.getXMsAccessTierTransitionState()) .setProtocols(ModelHelper.parseShareProtocols(headers.getXMsEnabledProtocols())) - .setRootSquash(headers.getXMsRootSquash()); + .setRootSquash(headers.getXMsRootSquash()) + .setEnableSnapshotVirtualDirectoryAccess(headers.isXMsEnableSnapshotVirtualDirectoryAccess()); return new SimpleResponse<>(response, shareProperties); } diff --git a/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/implementation/SharesImpl.java b/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/implementation/SharesImpl.java index b09772a9d99e6..5e82406f9064c 100644 --- a/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/implementation/SharesImpl.java +++ b/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/implementation/SharesImpl.java @@ -91,6 +91,8 @@ Mono> create( @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-enabled-protocols") String enabledProtocols, @HeaderParam("x-ms-root-squash") ShareRootSquash rootSquash, + @HeaderParam("x-ms-enable-snapshot-virtual-directory-access") + Boolean enableSnapshotVirtualDirectoryAccess, @HeaderParam("Accept") String accept, Context context); @@ -108,6 +110,8 @@ Mono> createNoCustomHeaders( @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-enabled-protocols") String enabledProtocols, @HeaderParam("x-ms-root-squash") ShareRootSquash rootSquash, + @HeaderParam("x-ms-enable-snapshot-virtual-directory-access") + Boolean enableSnapshotVirtualDirectoryAccess, @HeaderParam("Accept") String accept, Context context); @@ -447,6 +451,8 @@ Mono> setProperties( @HeaderParam("x-ms-access-tier") ShareAccessTier accessTier, @HeaderParam("x-ms-lease-id") String leaseId, @HeaderParam("x-ms-root-squash") ShareRootSquash rootSquash, + @HeaderParam("x-ms-enable-snapshot-virtual-directory-access") + Boolean enableSnapshotVirtualDirectoryAccess, @HeaderParam("Accept") String accept, Context context); @@ -464,6 +470,8 @@ Mono> setPropertiesNoCustomHeaders( @HeaderParam("x-ms-access-tier") ShareAccessTier accessTier, @HeaderParam("x-ms-lease-id") String leaseId, @HeaderParam("x-ms-root-squash") ShareRootSquash rootSquash, + @HeaderParam("x-ms-enable-snapshot-virtual-directory-access") + Boolean enableSnapshotVirtualDirectoryAccess, @HeaderParam("Accept") String accept, Context context); @@ -629,6 +637,7 @@ Mono> restoreNoCustomHeaders( * @param accessTier Specifies the access tier of the share. * @param enabledProtocols Protocols to enable on the share. * @param rootSquash Root squash to set on the share. Only valid for NFS shares. + * @param enableSnapshotVirtualDirectoryAccess The enableSnapshotVirtualDirectoryAccess parameter. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ShareStorageException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -642,7 +651,8 @@ public Mono> createWithResponseAsync( Integer quota, ShareAccessTier accessTier, String enabledProtocols, - ShareRootSquash rootSquash) { + ShareRootSquash rootSquash, + Boolean enableSnapshotVirtualDirectoryAccess) { final String restype = "share"; final String accept = "application/xml"; return FluxUtil.withContext( @@ -658,6 +668,7 @@ public Mono> createWithResponseAsync( this.client.getVersion(), enabledProtocols, rootSquash, + enableSnapshotVirtualDirectoryAccess, accept, context)); } @@ -675,6 +686,7 @@ public Mono> createWithResponseAsync( * @param accessTier Specifies the access tier of the share. * @param enabledProtocols Protocols to enable on the share. * @param rootSquash Root squash to set on the share. Only valid for NFS shares. + * @param enableSnapshotVirtualDirectoryAccess The enableSnapshotVirtualDirectoryAccess parameter. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ShareStorageException thrown if the request is rejected by server. @@ -690,6 +702,7 @@ public Mono> createWithResponseAsync( ShareAccessTier accessTier, String enabledProtocols, ShareRootSquash rootSquash, + Boolean enableSnapshotVirtualDirectoryAccess, Context context) { final String restype = "share"; final String accept = "application/xml"; @@ -704,6 +717,7 @@ public Mono> createWithResponseAsync( this.client.getVersion(), enabledProtocols, rootSquash, + enableSnapshotVirtualDirectoryAccess, accept, context); } @@ -721,6 +735,7 @@ public Mono> createWithResponseAsync( * @param accessTier Specifies the access tier of the share. * @param enabledProtocols Protocols to enable on the share. * @param rootSquash Root squash to set on the share. Only valid for NFS shares. + * @param enableSnapshotVirtualDirectoryAccess The enableSnapshotVirtualDirectoryAccess parameter. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ShareStorageException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -734,8 +749,17 @@ public Mono createAsync( Integer quota, ShareAccessTier accessTier, String enabledProtocols, - ShareRootSquash rootSquash) { - return createWithResponseAsync(shareName, timeout, metadata, quota, accessTier, enabledProtocols, rootSquash) + ShareRootSquash rootSquash, + Boolean enableSnapshotVirtualDirectoryAccess) { + return createWithResponseAsync( + shareName, + timeout, + metadata, + quota, + accessTier, + enabledProtocols, + rootSquash, + enableSnapshotVirtualDirectoryAccess) .flatMap(ignored -> Mono.empty()); } @@ -752,6 +776,7 @@ public Mono createAsync( * @param accessTier Specifies the access tier of the share. * @param enabledProtocols Protocols to enable on the share. * @param rootSquash Root squash to set on the share. Only valid for NFS shares. + * @param enableSnapshotVirtualDirectoryAccess The enableSnapshotVirtualDirectoryAccess parameter. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ShareStorageException thrown if the request is rejected by server. @@ -767,9 +792,18 @@ public Mono createAsync( ShareAccessTier accessTier, String enabledProtocols, ShareRootSquash rootSquash, + Boolean enableSnapshotVirtualDirectoryAccess, Context context) { return createWithResponseAsync( - shareName, timeout, metadata, quota, accessTier, enabledProtocols, rootSquash, context) + shareName, + timeout, + metadata, + quota, + accessTier, + enabledProtocols, + rootSquash, + enableSnapshotVirtualDirectoryAccess, + context) .flatMap(ignored -> Mono.empty()); } @@ -786,6 +820,7 @@ public Mono createAsync( * @param accessTier Specifies the access tier of the share. * @param enabledProtocols Protocols to enable on the share. * @param rootSquash Root squash to set on the share. Only valid for NFS shares. + * @param enableSnapshotVirtualDirectoryAccess The enableSnapshotVirtualDirectoryAccess parameter. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ShareStorageException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -799,7 +834,8 @@ public Mono> createNoCustomHeadersWithResponseAsync( Integer quota, ShareAccessTier accessTier, String enabledProtocols, - ShareRootSquash rootSquash) { + ShareRootSquash rootSquash, + Boolean enableSnapshotVirtualDirectoryAccess) { final String restype = "share"; final String accept = "application/xml"; return FluxUtil.withContext( @@ -815,6 +851,7 @@ public Mono> createNoCustomHeadersWithResponseAsync( this.client.getVersion(), enabledProtocols, rootSquash, + enableSnapshotVirtualDirectoryAccess, accept, context)); } @@ -832,6 +869,7 @@ public Mono> createNoCustomHeadersWithResponseAsync( * @param accessTier Specifies the access tier of the share. * @param enabledProtocols Protocols to enable on the share. * @param rootSquash Root squash to set on the share. Only valid for NFS shares. + * @param enableSnapshotVirtualDirectoryAccess The enableSnapshotVirtualDirectoryAccess parameter. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ShareStorageException thrown if the request is rejected by server. @@ -847,6 +885,7 @@ public Mono> createNoCustomHeadersWithResponseAsync( ShareAccessTier accessTier, String enabledProtocols, ShareRootSquash rootSquash, + Boolean enableSnapshotVirtualDirectoryAccess, Context context) { final String restype = "share"; final String accept = "application/xml"; @@ -861,6 +900,7 @@ public Mono> createNoCustomHeadersWithResponseAsync( this.client.getVersion(), enabledProtocols, rootSquash, + enableSnapshotVirtualDirectoryAccess, accept, context); } @@ -3113,6 +3153,7 @@ public Mono> getPermissionNoCustomHeadersWithResponseA * @param accessTier Specifies the access tier of the share. * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. * @param rootSquash Root squash to set on the share. Only valid for NFS shares. + * @param enableSnapshotVirtualDirectoryAccess The enableSnapshotVirtualDirectoryAccess parameter. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ShareStorageException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -3125,7 +3166,8 @@ public Mono> setPropertiesWithRes Integer quota, ShareAccessTier accessTier, String leaseId, - ShareRootSquash rootSquash) { + ShareRootSquash rootSquash, + Boolean enableSnapshotVirtualDirectoryAccess) { final String restype = "share"; final String comp = "properties"; final String accept = "application/xml"; @@ -3142,6 +3184,7 @@ public Mono> setPropertiesWithRes accessTier, leaseId, rootSquash, + enableSnapshotVirtualDirectoryAccess, accept, context)); } @@ -3157,6 +3200,7 @@ public Mono> setPropertiesWithRes * @param accessTier Specifies the access tier of the share. * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. * @param rootSquash Root squash to set on the share. Only valid for NFS shares. + * @param enableSnapshotVirtualDirectoryAccess The enableSnapshotVirtualDirectoryAccess parameter. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ShareStorageException thrown if the request is rejected by server. @@ -3171,6 +3215,7 @@ public Mono> setPropertiesWithRes ShareAccessTier accessTier, String leaseId, ShareRootSquash rootSquash, + Boolean enableSnapshotVirtualDirectoryAccess, Context context) { final String restype = "share"; final String comp = "properties"; @@ -3186,6 +3231,7 @@ public Mono> setPropertiesWithRes accessTier, leaseId, rootSquash, + enableSnapshotVirtualDirectoryAccess, accept, context); } @@ -3201,6 +3247,7 @@ public Mono> setPropertiesWithRes * @param accessTier Specifies the access tier of the share. * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. * @param rootSquash Root squash to set on the share. Only valid for NFS shares. + * @param enableSnapshotVirtualDirectoryAccess The enableSnapshotVirtualDirectoryAccess parameter. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ShareStorageException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -3213,8 +3260,16 @@ public Mono setPropertiesAsync( Integer quota, ShareAccessTier accessTier, String leaseId, - ShareRootSquash rootSquash) { - return setPropertiesWithResponseAsync(shareName, timeout, quota, accessTier, leaseId, rootSquash) + ShareRootSquash rootSquash, + Boolean enableSnapshotVirtualDirectoryAccess) { + return setPropertiesWithResponseAsync( + shareName, + timeout, + quota, + accessTier, + leaseId, + rootSquash, + enableSnapshotVirtualDirectoryAccess) .flatMap(ignored -> Mono.empty()); } @@ -3229,6 +3284,7 @@ public Mono setPropertiesAsync( * @param accessTier Specifies the access tier of the share. * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. * @param rootSquash Root squash to set on the share. Only valid for NFS shares. + * @param enableSnapshotVirtualDirectoryAccess The enableSnapshotVirtualDirectoryAccess parameter. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ShareStorageException thrown if the request is rejected by server. @@ -3243,8 +3299,17 @@ public Mono setPropertiesAsync( ShareAccessTier accessTier, String leaseId, ShareRootSquash rootSquash, + Boolean enableSnapshotVirtualDirectoryAccess, Context context) { - return setPropertiesWithResponseAsync(shareName, timeout, quota, accessTier, leaseId, rootSquash, context) + return setPropertiesWithResponseAsync( + shareName, + timeout, + quota, + accessTier, + leaseId, + rootSquash, + enableSnapshotVirtualDirectoryAccess, + context) .flatMap(ignored -> Mono.empty()); } @@ -3259,6 +3324,7 @@ public Mono setPropertiesAsync( * @param accessTier Specifies the access tier of the share. * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. * @param rootSquash Root squash to set on the share. Only valid for NFS shares. + * @param enableSnapshotVirtualDirectoryAccess The enableSnapshotVirtualDirectoryAccess parameter. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ShareStorageException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -3271,7 +3337,8 @@ public Mono> setPropertiesNoCustomHeadersWithResponseAsync( Integer quota, ShareAccessTier accessTier, String leaseId, - ShareRootSquash rootSquash) { + ShareRootSquash rootSquash, + Boolean enableSnapshotVirtualDirectoryAccess) { final String restype = "share"; final String comp = "properties"; final String accept = "application/xml"; @@ -3288,6 +3355,7 @@ public Mono> setPropertiesNoCustomHeadersWithResponseAsync( accessTier, leaseId, rootSquash, + enableSnapshotVirtualDirectoryAccess, accept, context)); } @@ -3303,6 +3371,7 @@ public Mono> setPropertiesNoCustomHeadersWithResponseAsync( * @param accessTier Specifies the access tier of the share. * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. * @param rootSquash Root squash to set on the share. Only valid for NFS shares. + * @param enableSnapshotVirtualDirectoryAccess The enableSnapshotVirtualDirectoryAccess parameter. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ShareStorageException thrown if the request is rejected by server. @@ -3317,6 +3386,7 @@ public Mono> setPropertiesNoCustomHeadersWithResponseAsync( ShareAccessTier accessTier, String leaseId, ShareRootSquash rootSquash, + Boolean enableSnapshotVirtualDirectoryAccess, Context context) { final String restype = "share"; final String comp = "properties"; @@ -3332,6 +3402,7 @@ public Mono> setPropertiesNoCustomHeadersWithResponseAsync( accessTier, leaseId, rootSquash, + enableSnapshotVirtualDirectoryAccess, accept, context); } diff --git a/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/implementation/models/SharePropertiesInternal.java b/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/implementation/models/SharePropertiesInternal.java index c006dded9dab4..a5a2b46858138 100644 --- a/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/implementation/models/SharePropertiesInternal.java +++ b/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/implementation/models/SharePropertiesInternal.java @@ -127,6 +127,12 @@ public final class SharePropertiesInternal { @JsonProperty(value = "RootSquash") private ShareRootSquash rootSquash; + /* + * The EnableSnapshotVirtualDirectoryAccess property. + */ + @JsonProperty(value = "EnableSnapshotVirtualDirectoryAccess") + private Boolean enableSnapshotVirtualDirectoryAccess; + /* * Dictionary of */ @@ -526,6 +532,27 @@ public SharePropertiesInternal setRootSquash(ShareRootSquash rootSquash) { return this; } + /** + * Get the enableSnapshotVirtualDirectoryAccess property: The EnableSnapshotVirtualDirectoryAccess property. + * + * @return the enableSnapshotVirtualDirectoryAccess value. + */ + public Boolean isEnableSnapshotVirtualDirectoryAccess() { + return this.enableSnapshotVirtualDirectoryAccess; + } + + /** + * Set the enableSnapshotVirtualDirectoryAccess property: The EnableSnapshotVirtualDirectoryAccess property. + * + * @param enableSnapshotVirtualDirectoryAccess the enableSnapshotVirtualDirectoryAccess value to set. + * @return the SharePropertiesInternal object itself. + */ + public SharePropertiesInternal setEnableSnapshotVirtualDirectoryAccess( + Boolean enableSnapshotVirtualDirectoryAccess) { + this.enableSnapshotVirtualDirectoryAccess = enableSnapshotVirtualDirectoryAccess; + return this; + } + /** * Get the metadata property: Dictionary of <string>. * diff --git a/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/implementation/models/SharesGetPropertiesHeaders.java b/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/implementation/models/SharesGetPropertiesHeaders.java index 40bdd22eb36d6..9d016da2308e6 100644 --- a/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/implementation/models/SharesGetPropertiesHeaders.java +++ b/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/implementation/models/SharesGetPropertiesHeaders.java @@ -66,6 +66,12 @@ public final class SharesGetPropertiesHeaders { @JsonProperty(value = "x-ms-access-tier-change-time") private DateTimeRfc1123 xMsAccessTierChangeTime; + /* + * The x-ms-enable-snapshot-virtual-directory-access property. + */ + @JsonProperty(value = "x-ms-enable-snapshot-virtual-directory-access") + private Boolean xMsEnableSnapshotVirtualDirectoryAccess; + /* * The x-ms-meta- property. */ @@ -158,6 +164,9 @@ public final class SharesGetPropertiesHeaders { private static final HttpHeaderName X_MS_ACCESS_TIER_CHANGE_TIME = HttpHeaderName.fromString("x-ms-access-tier-change-time"); + private static final HttpHeaderName X_MS_ENABLE_SNAPSHOT_VIRTUAL_DIRECTORY_ACCESS = + HttpHeaderName.fromString("x-ms-enable-snapshot-virtual-directory-access"); + private static final HttpHeaderName X_MS_SHARE_PROVISIONED_INGRESS_MBPS = HttpHeaderName.fromString("x-ms-share-provisioned-ingress-mbps"); @@ -215,6 +224,12 @@ public SharesGetPropertiesHeaders(HttpHeaders rawHeaders) { if (xMsAccessTierChangeTime != null) { this.xMsAccessTierChangeTime = new DateTimeRfc1123(xMsAccessTierChangeTime); } + String xMsEnableSnapshotVirtualDirectoryAccess = + rawHeaders.getValue(X_MS_ENABLE_SNAPSHOT_VIRTUAL_DIRECTORY_ACCESS); + if (xMsEnableSnapshotVirtualDirectoryAccess != null) { + this.xMsEnableSnapshotVirtualDirectoryAccess = + Boolean.parseBoolean(xMsEnableSnapshotVirtualDirectoryAccess); + } String date = rawHeaders.getValue(HttpHeaderName.DATE); if (date != null) { this.date = new DateTimeRfc1123(date); @@ -415,6 +430,29 @@ public SharesGetPropertiesHeaders setXMsAccessTierChangeTime(OffsetDateTime xMsA return this; } + /** + * Get the xMsEnableSnapshotVirtualDirectoryAccess property: The x-ms-enable-snapshot-virtual-directory-access + * property. + * + * @return the xMsEnableSnapshotVirtualDirectoryAccess value. + */ + public Boolean isXMsEnableSnapshotVirtualDirectoryAccess() { + return this.xMsEnableSnapshotVirtualDirectoryAccess; + } + + /** + * Set the xMsEnableSnapshotVirtualDirectoryAccess property: The x-ms-enable-snapshot-virtual-directory-access + * property. + * + * @param xMsEnableSnapshotVirtualDirectoryAccess the xMsEnableSnapshotVirtualDirectoryAccess value to set. + * @return the SharesGetPropertiesHeaders object itself. + */ + public SharesGetPropertiesHeaders setXMsEnableSnapshotVirtualDirectoryAccess( + Boolean xMsEnableSnapshotVirtualDirectoryAccess) { + this.xMsEnableSnapshotVirtualDirectoryAccess = xMsEnableSnapshotVirtualDirectoryAccess; + return this; + } + /** * Get the xMsMeta property: The x-ms-meta- property. * diff --git a/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/implementation/util/ModelHelper.java b/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/implementation/util/ModelHelper.java index f30ffd5806696..c043479facd43 100644 --- a/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/implementation/util/ModelHelper.java +++ b/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/implementation/util/ModelHelper.java @@ -147,6 +147,7 @@ public static ShareProperties populateShareProperties(SharePropertiesInternal sh properties.setRootSquash(sharePropertiesInternal.getRootSquash()); properties.setMetadata(sharePropertiesInternal.getMetadata()); properties.setProvisionedBandwidthMiBps(sharePropertiesInternal.getProvisionedBandwidthMiBps()); + properties.setEnableSnapshotVirtualDirectoryAccess(sharePropertiesInternal.isEnableSnapshotVirtualDirectoryAccess()); return properties; } diff --git a/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/models/ShareProperties.java b/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/models/ShareProperties.java index e2fdf97ecf1be..dc2caf89b83cb 100644 --- a/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/models/ShareProperties.java +++ b/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/models/ShareProperties.java @@ -131,6 +131,12 @@ public final class ShareProperties { */ private Integer provisionedBandwidthMiBps; + /* + * The EnableSnapshotVirtualDirectoryAccess property. + */ + @JsonProperty(value = "EnableSnapshotVirtualDirectoryAccess") + private Boolean enableSnapshotVirtualDirectoryAccess; + /** * Get the lastModified property: The lastModified property. * @@ -568,4 +574,32 @@ public ShareProperties setMetadata(Map metadata) { this.metadata = metadata; return this; } + + /** + * Get the enableSnapshotVirtualDirectoryAccess property: + * Optional. Supported in version 2023-08-03 and above. + * Specifies whether the snapshot virtual directory should be accessible at the root of share mount point when NFS is enabled. + * If not specified, the default is true. + * + * @return the enableSnapshotVirtualDirectoryAccess value. + */ + public Boolean isEnableSnapshotVirtualDirectoryAccess() { + return this.enableSnapshotVirtualDirectoryAccess; + } + + /** + * Set the enableSnapshotVirtualDirectoryAccess property: + * Optional. Supported in version 2023-08-03 and above. + * Specifies whether the snapshot virtual directory should be accessible at the root of share mount point when NFS is enabled. + * If not specified, the default is true. + * + * @param enableSnapshotVirtualDirectoryAccess the enableSnapshotVirtualDirectoryAccess value to set. + * @return the ShareProperties object itself. + */ + public ShareProperties setEnableSnapshotVirtualDirectoryAccess( + Boolean enableSnapshotVirtualDirectoryAccess) { + this.enableSnapshotVirtualDirectoryAccess = enableSnapshotVirtualDirectoryAccess; + return this; + } + } diff --git a/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/options/ShareCreateOptions.java b/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/options/ShareCreateOptions.java index 4d5e803601303..86719011fe6ca 100644 --- a/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/options/ShareCreateOptions.java +++ b/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/options/ShareCreateOptions.java @@ -21,6 +21,7 @@ public class ShareCreateOptions { private ShareAccessTier accessTier; private ShareProtocols protocols; private ShareRootSquash rootSquash; + private Boolean enableSnapshotVirtualDirectoryAccess; /** * @return Size in GB to limit the share's growth. @@ -102,4 +103,29 @@ public ShareCreateOptions setRootSquash(ShareRootSquash rootSquash) { this.rootSquash = rootSquash; return this; } + + /** + * Get the enableSnapshotVirtualDirectoryAccess property: The EnableSnapshotVirtualDirectoryAccess property. + * Optional. Supported in version 2023-08-03 and above. + * Specifies whether the snapshot virtual directory should be accessible at the root of share mount point when NFS is enabled. + * If not specified, the default is true. + * @return the enableSnapshotVirtualDirectoryAccess value. + */ + public Boolean isSnapshotVirtualDirectoryAccessEnabled() { + return enableSnapshotVirtualDirectoryAccess; + } + + /** + * Set the enableSnapshotVirtualDirectoryAccess property: + * Optional. Supported in version 2023-08-03 and above. + * Specifies whether the snapshot virtual directory should be accessible at the root of share mount point when NFS is enabled. + * If not specified, the default is true. + * @param snapshotVirtualDirectoryAccessEnabled the enableSnapshotVirtualDirectoryAccess value to set. + * @return the ShareCreateOptions object itself. + */ + public ShareCreateOptions setSnapshotVirtualDirectoryAccessEnabled( + Boolean snapshotVirtualDirectoryAccessEnabled) { + this.enableSnapshotVirtualDirectoryAccess = snapshotVirtualDirectoryAccessEnabled; + return this; + } } diff --git a/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/options/ShareSetPropertiesOptions.java b/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/options/ShareSetPropertiesOptions.java index 7086bd21aa319..fb5d3b7f67ebc 100644 --- a/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/options/ShareSetPropertiesOptions.java +++ b/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/options/ShareSetPropertiesOptions.java @@ -18,6 +18,7 @@ public class ShareSetPropertiesOptions { private ShareAccessTier accessTier; private ShareRootSquash rootSquash; private ShareRequestConditions requestConditions; + private Boolean enableSnapshotVirtualDirectoryAccess; /** * @return {@link ShareAccessTier} @@ -82,4 +83,31 @@ public ShareSetPropertiesOptions setRequestConditions(ShareRequestConditions req this.requestConditions = requestConditions; return this; } + + /** + * Get the enableSnapshotVirtualDirectoryAccess property: The EnableSnapshotVirtualDirectoryAccess property. + * Optional. Supported in version 2023-08-03 and above. + * Specifies whether the snapshot virtual directory should be accessible at the root of share mount point when NFS is enabled. + * If not specified, the default is true. + * + * @return the enableSnapshotVirtualDirectoryAccess value. + */ + public Boolean isSnapshotVirtualDirectoryAccessEnabled() { + return enableSnapshotVirtualDirectoryAccess; + } + + /** + * Set the enableSnapshotVirtualDirectoryAccess property: The EnableSnapshotVirtualDirectoryAccess property. + * Optional. Supported in version 2023-08-03 and above. + * Specifies whether the snapshot virtual directory should be accessible at the root of share mount point when NFS is enabled. + * If not specified, the default is true. + * + * @param snapshotVirtualDirectoryAccessEnabled the enableSnapshotVirtualDirectoryAccess value to set. + * @return the ShareSetPropertiesOptions object itself. + */ + public ShareSetPropertiesOptions setSnapshotVirtualDirectoryAccessEnabled( + Boolean snapshotVirtualDirectoryAccessEnabled) { + this.enableSnapshotVirtualDirectoryAccess = snapshotVirtualDirectoryAccessEnabled; + return this; + } } diff --git a/sdk/storage/azure-storage-file-share/src/test/java/com/azure/storage/file/share/FileServiceApiTests.java b/sdk/storage/azure-storage-file-share/src/test/java/com/azure/storage/file/share/FileServiceApiTests.java index f6f18b8843498..4ec0d3ab8afcb 100644 --- a/sdk/storage/azure-storage-file-share/src/test/java/com/azure/storage/file/share/FileServiceApiTests.java +++ b/sdk/storage/azure-storage-file-share/src/test/java/com/azure/storage/file/share/FileServiceApiTests.java @@ -7,8 +7,10 @@ import com.azure.core.http.rest.Response; import com.azure.core.util.Context; import com.azure.storage.common.StorageSharedKeyCredential; +import com.azure.storage.common.implementation.Constants; import com.azure.storage.common.test.shared.extensions.PlaybackOnly; import com.azure.storage.common.test.shared.extensions.RequiredServiceVersion; +import com.azure.storage.file.share.implementation.util.ModelHelper; import com.azure.storage.file.share.models.ListSharesOptions; import com.azure.storage.file.share.models.ShareAccessTier; import com.azure.storage.file.share.models.ShareCorsRule; @@ -17,6 +19,7 @@ import com.azure.storage.file.share.models.ShareMetrics; import com.azure.storage.file.share.models.ShareProperties; import com.azure.storage.file.share.models.ShareProtocolSettings; +import com.azure.storage.file.share.models.ShareProtocols; import com.azure.storage.file.share.models.ShareRetentionPolicy; import com.azure.storage.file.share.models.ShareServiceProperties; import com.azure.storage.file.share.models.ShareSmbSettings; @@ -415,4 +418,20 @@ public void perCallPolicy() { Response response = serviceClient.getPropertiesWithResponse(null, null); assertEquals(response.getHeaders().getValue(X_MS_VERSION), "2017-11-09"); } + + @RequiredServiceVersion(clazz = ShareServiceVersion.class, min = "2024-08-04") + @Test + public void listSharesEnableSnapshotVirtualDirectoryAccess() { + ShareCreateOptions options = new ShareCreateOptions(); + ShareProtocols protocols = ModelHelper.parseShareProtocols(Constants.HeaderConstants.NFS_PROTOCOL); + options.setProtocols(protocols); + options.setSnapshotVirtualDirectoryAccessEnabled(true); + + ShareClient shareClient = primaryFileServiceClient.getShareClient(generateShareName()); + shareClient.createWithResponse(options, null, null); + + ShareItem share = primaryFileServiceClient.listShares().iterator().next(); + assertEquals(protocols.toString(), share.getProperties().getProtocols().toString()); + assertTrue(share.getProperties().isEnableSnapshotVirtualDirectoryAccess()); + } } diff --git a/sdk/storage/azure-storage-file-share/src/test/java/com/azure/storage/file/share/FileServiceAsyncApiTests.java b/sdk/storage/azure-storage-file-share/src/test/java/com/azure/storage/file/share/FileServiceAsyncApiTests.java index 0faf3f05f67ee..c75f3cb39fdc5 100644 --- a/sdk/storage/azure-storage-file-share/src/test/java/com/azure/storage/file/share/FileServiceAsyncApiTests.java +++ b/sdk/storage/azure-storage-file-share/src/test/java/com/azure/storage/file/share/FileServiceAsyncApiTests.java @@ -6,15 +6,19 @@ import com.azure.core.http.rest.Response; import com.azure.core.util.Context; import com.azure.storage.common.StorageSharedKeyCredential; +import com.azure.storage.common.implementation.Constants; import com.azure.storage.common.test.shared.extensions.RequiredServiceVersion; +import com.azure.storage.file.share.implementation.util.ModelHelper; import com.azure.storage.file.share.models.ListSharesOptions; import com.azure.storage.file.share.models.ShareCorsRule; import com.azure.storage.file.share.models.ShareErrorCode; import com.azure.storage.file.share.models.ShareItem; import com.azure.storage.file.share.models.ShareMetrics; import com.azure.storage.file.share.models.ShareProperties; +import com.azure.storage.file.share.models.ShareProtocols; import com.azure.storage.file.share.models.ShareRetentionPolicy; import com.azure.storage.file.share.models.ShareServiceProperties; +import com.azure.storage.file.share.options.ShareCreateOptions; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -300,4 +304,24 @@ public void restoreShareError() { .verifyErrorSatisfies(it -> FileShareTestHelper.assertExceptionStatusCodeAndMessage(it, 404, ShareErrorCode.SHARE_NOT_FOUND)); } + + @RequiredServiceVersion(clazz = ShareServiceVersion.class, min = "2024-08-04") + @Test + public void listSharesEnableSnapshotVirtualDirectoryAccess() { + ShareCreateOptions options = new ShareCreateOptions(); + ShareProtocols protocols = ModelHelper.parseShareProtocols(Constants.HeaderConstants.NFS_PROTOCOL); + options.setProtocols(protocols); + options.setSnapshotVirtualDirectoryAccessEnabled(true); + + ShareAsyncClient shareClient = primaryFileServiceAsyncClient.getShareAsyncClient(generateShareName()); + shareClient.createWithResponse(options).block(); + + StepVerifier.create(primaryFileServiceAsyncClient.listShares()) + .assertNext(r -> { + ShareProperties properties = r.getProperties(); + assertEquals(protocols.toString(), properties.getProtocols().toString()); + assertTrue(properties.isEnableSnapshotVirtualDirectoryAccess()); + }) + .verifyComplete(); + } } diff --git a/sdk/storage/azure-storage-file-share/src/test/java/com/azure/storage/file/share/ShareApiTests.java b/sdk/storage/azure-storage-file-share/src/test/java/com/azure/storage/file/share/ShareApiTests.java index fb61238922eb1..9c8d326da3973 100644 --- a/sdk/storage/azure-storage-file-share/src/test/java/com/azure/storage/file/share/ShareApiTests.java +++ b/sdk/storage/azure-storage-file-share/src/test/java/com/azure/storage/file/share/ShareApiTests.java @@ -1253,4 +1253,56 @@ public void audienceFromString() { String infoPermission = aadShareClient.createPermission(permission); assertNotNull(infoPermission); } + + @RequiredServiceVersion(clazz = ShareServiceVersion.class, min = "2024-05-04") + @ParameterizedTest + @MethodSource("createEnableSnapshotVirtualDirectoryAccessSupplier") + public void createEnableSnapshotVirtualDirectoryAccess(Boolean enableSnapshotVirtualDirectoryAccess) { + ShareCreateOptions options = new ShareCreateOptions(); + ShareProtocols protocols = ModelHelper.parseShareProtocols(Constants.HeaderConstants.NFS_PROTOCOL); + options.setProtocols(protocols); + options.setSnapshotVirtualDirectoryAccessEnabled(enableSnapshotVirtualDirectoryAccess); + + primaryShareClient.createWithResponse(options, null, null); + + ShareProperties response = primaryShareClient.getProperties(); + assertEquals(protocols.toString(), response.getProtocols().toString()); + if (enableSnapshotVirtualDirectoryAccess == null || enableSnapshotVirtualDirectoryAccess) { + assertTrue(response.isEnableSnapshotVirtualDirectoryAccess()); + } else { + assertFalse(response.isEnableSnapshotVirtualDirectoryAccess()); + } + } + + private static Stream createEnableSnapshotVirtualDirectoryAccessSupplier() { + return Stream.of( + Arguments.of(true), + Arguments.of(false), + Arguments.of((Boolean) null)); + } + + @RequiredServiceVersion(clazz = ShareServiceVersion.class, min = "2024-08-04") + @ParameterizedTest + @MethodSource("createEnableSnapshotVirtualDirectoryAccessSupplier") + public void setPropertiesEnableSnapshotVirtualDirectoryAccess(Boolean enableSnapshotVirtualDirectoryAccess) { + ShareCreateOptions options = new ShareCreateOptions(); + ShareProtocols protocols = ModelHelper.parseShareProtocols(Constants.HeaderConstants.NFS_PROTOCOL); + options.setProtocols(protocols); + + primaryShareClient.createWithResponse(options, null, null); + + ShareSetPropertiesOptions setPropertiesOptions = new ShareSetPropertiesOptions(); + setPropertiesOptions.setSnapshotVirtualDirectoryAccessEnabled(enableSnapshotVirtualDirectoryAccess); + setPropertiesOptions.setAccessTier(ShareAccessTier.TRANSACTION_OPTIMIZED); + + primaryShareClient.setProperties(setPropertiesOptions); + + ShareProperties response = primaryShareClient.getProperties(); + assertEquals(protocols.toString(), response.getProtocols().toString()); + if (enableSnapshotVirtualDirectoryAccess == null || enableSnapshotVirtualDirectoryAccess) { + assertTrue(response.isEnableSnapshotVirtualDirectoryAccess()); + } else { + assertFalse(response.isEnableSnapshotVirtualDirectoryAccess()); + } + } } diff --git a/sdk/storage/azure-storage-file-share/src/test/java/com/azure/storage/file/share/ShareAsyncApiTests.java b/sdk/storage/azure-storage-file-share/src/test/java/com/azure/storage/file/share/ShareAsyncApiTests.java index 66722521a7b42..602ff6bfeaaf4 100644 --- a/sdk/storage/azure-storage-file-share/src/test/java/com/azure/storage/file/share/ShareAsyncApiTests.java +++ b/sdk/storage/azure-storage-file-share/src/test/java/com/azure/storage/file/share/ShareAsyncApiTests.java @@ -5,10 +5,12 @@ import com.azure.core.http.rest.Response; import com.azure.storage.common.StorageSharedKeyCredential; +import com.azure.storage.common.implementation.Constants; import com.azure.storage.common.test.shared.extensions.PlaybackOnly; import com.azure.storage.common.test.shared.extensions.RequiredServiceVersion; import com.azure.storage.file.share.implementation.util.ModelHelper; import com.azure.storage.file.share.models.NtfsFileAttributes; +import com.azure.storage.file.share.models.ShareAccessTier; import com.azure.storage.file.share.models.ShareAudience; import com.azure.storage.file.share.models.ShareErrorCode; import com.azure.storage.file.share.models.ShareFileHttpHeaders; @@ -813,4 +815,63 @@ public void audienceFromString() { .assertNext(r -> assertNotNull(r)) .verifyComplete(); } + + @RequiredServiceVersion(clazz = ShareServiceVersion.class, min = "2024-05-04") + @ParameterizedTest + @MethodSource("createEnableSnapshotVirtualDirectoryAccessSupplier") + public void createEnableSnapshotVirtualDirectoryAccess(Boolean enableSnapshotVirtualDirectoryAccess) { + ShareCreateOptions options = new ShareCreateOptions(); + ShareProtocols protocols = ModelHelper.parseShareProtocols(Constants.HeaderConstants.NFS_PROTOCOL); + options.setProtocols(protocols); + options.setSnapshotVirtualDirectoryAccessEnabled(enableSnapshotVirtualDirectoryAccess); + + primaryShareAsyncClient.createWithResponse(options).block(); + + StepVerifier.create(primaryShareAsyncClient.getProperties()) + .assertNext(r -> { + assertEquals(protocols.toString(), r.getProtocols().toString()); + if (enableSnapshotVirtualDirectoryAccess == null || enableSnapshotVirtualDirectoryAccess) { + assertTrue(r.isEnableSnapshotVirtualDirectoryAccess()); + } else { + assertFalse(r.isEnableSnapshotVirtualDirectoryAccess()); + } + }) + .verifyComplete(); + } + + private static Stream createEnableSnapshotVirtualDirectoryAccessSupplier() { + return Stream.of( + Arguments.of(true), + Arguments.of(false), + Arguments.of((Boolean) null)); + } + + @RequiredServiceVersion(clazz = ShareServiceVersion.class, min = "2024-08-04") + @ParameterizedTest + @MethodSource("createEnableSnapshotVirtualDirectoryAccessSupplier") + public void setPropertiesEnableSnapshotVirtualDirectoryAccess(Boolean enableSnapshotVirtualDirectoryAccess) { + ShareCreateOptions options = new ShareCreateOptions(); + ShareProtocols protocols = ModelHelper.parseShareProtocols(Constants.HeaderConstants.NFS_PROTOCOL); + options.setProtocols(protocols); + + primaryShareAsyncClient.createWithResponse(options).block(); + + ShareSetPropertiesOptions setPropertiesOptions = new ShareSetPropertiesOptions(); + setPropertiesOptions.setSnapshotVirtualDirectoryAccessEnabled(enableSnapshotVirtualDirectoryAccess); + setPropertiesOptions.setAccessTier(ShareAccessTier.TRANSACTION_OPTIMIZED); + + primaryShareAsyncClient.setProperties(setPropertiesOptions).block(); + + StepVerifier.create(primaryShareAsyncClient.getProperties()) + .assertNext(r -> { + assertEquals(protocols.toString(), r.getProtocols().toString()); + if (enableSnapshotVirtualDirectoryAccess == null || enableSnapshotVirtualDirectoryAccess) { + assertTrue(r.isEnableSnapshotVirtualDirectoryAccess()); + } else { + assertFalse(r.isEnableSnapshotVirtualDirectoryAccess()); + } + }) + .verifyComplete(); + } + } diff --git a/sdk/storage/azure-storage-file-share/swagger/README.md b/sdk/storage/azure-storage-file-share/swagger/README.md index 57de2ba899b66..2be198ed51ad9 100644 --- a/sdk/storage/azure-storage-file-share/swagger/README.md +++ b/sdk/storage/azure-storage-file-share/swagger/README.md @@ -16,7 +16,7 @@ autorest ### Code generation settings ``` yaml use: '@autorest/java@4.1.16' -input-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/12e0ceead6d4611abdd617d2bbc5c9068e4c772a/specification/storage/data-plane/Microsoft.FileStorage/stable/2024-08-04/file.json +input-file: https://raw.githubusercontent.com/seanmcc-msft/azure-rest-api-specs/bbb7986063b2d5f3e248d3c57c8664ad5625e5b1/specification/storage/data-plane/Microsoft.FileStorage/stable/2024-08-04/file.json java: true output-folder: ../ namespace: com.azure.storage.file.share From 7c1b34ffef58ced95fb780e73cc2627230c166c3 Mon Sep 17 00:00:00 2001 From: Isabelle <141270045+ibrandes@users.noreply.github.com> Date: Thu, 25 Apr 2024 11:21:37 -0700 Subject: [PATCH 07/17] STG94 Error Code For Copy Blob (#39795) * everything * resolving conflicts * style * style * changes to retry policy * adding back generated changes from other feature * retry changes and client changes * recording changes * swagger changes * retry constant change and appendblob test troubleshooting * creating new test copies * re-recording whole appendblob files * cleanup --- sdk/storage/azure-storage-blob/assets.json | 2 +- .../implementation/models/StorageError.java | 78 +++++++++++++++++++ .../blob/specialized/AppendBlobApiTests.java | 13 ++++ .../specialized/AppendBlobAsyncApiTests.java | 14 ++++ .../blob/specialized/BlobBaseApiTests.java | 12 +++ .../specialized/BlobBaseAsyncApiTests.java | 16 ++++ .../blob/specialized/BlockBlobApiTests.java | 26 +++++++ .../specialized/BlockBlobAsyncApiTests.java | 30 +++++++ .../blob/specialized/PageBlobApiTests.java | 15 ++++ .../specialized/PageBlobAsyncApiTests.java | 16 ++++ .../azure-storage-blob/swagger/README.md | 2 +- .../common/policy/RequestRetryPolicy.java | 21 +++-- .../common/policy/RequestRetryPolicyTest.java | 13 +++- .../azure-storage-file-share/assets.json | 2 +- .../implementation/models/StorageError.java | 78 +++++++++++++++++++ .../storage/file/share/FileApiTests.java | 30 +++++++ .../storage/file/share/FileAsyncApiTests.java | 52 ++++++++++--- .../swagger/README.md | 2 +- 18 files changed, 402 insertions(+), 20 deletions(-) diff --git a/sdk/storage/azure-storage-blob/assets.json b/sdk/storage/azure-storage-blob/assets.json index ad215e3902182..ca424b0bc56c0 100644 --- a/sdk/storage/azure-storage-blob/assets.json +++ b/sdk/storage/azure-storage-blob/assets.json @@ -2,5 +2,5 @@ "AssetsRepo": "Azure/azure-sdk-assets", "AssetsRepoPrefixPath": "java", "TagPrefix": "java/storage/azure-storage-blob", - "Tag": "java/storage/azure-storage-blob_adf9415a55" + "Tag": "java/storage/azure-storage-blob_38641eb87d" } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/models/StorageError.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/models/StorageError.java index 3f4f75388fa10..397028f1be1ae 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/models/StorageError.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/models/StorageError.java @@ -18,6 +18,24 @@ public final class StorageError { @JsonProperty(value = "Message") private String message; + /* + * The CopySourceStatusCode property. + */ + @JsonProperty(value = "CopySourceStatusCode") + private Long copySourceStatusCode; + + /* + * The CopySourceErrorCode property. + */ + @JsonProperty(value = "CopySourceErrorCode") + private String copySourceErrorCode; + + /* + * The CopySourceErrorMessage property. + */ + @JsonProperty(value = "CopySourceErrorMessage") + private String copySourceErrorMessage; + /** Creates an instance of StorageError class. */ public StorageError() {} @@ -40,4 +58,64 @@ public StorageError setMessage(String message) { this.message = message; return this; } + + /** + * Get the copySourceStatusCode property: The CopySourceStatusCode property. + * + * @return the copySourceStatusCode value. + */ + public Long getCopySourceStatusCode() { + return this.copySourceStatusCode; + } + + /** + * Set the copySourceStatusCode property: The CopySourceStatusCode property. + * + * @param copySourceStatusCode the copySourceStatusCode value to set. + * @return the StorageError object itself. + */ + public StorageError setCopySourceStatusCode(Long copySourceStatusCode) { + this.copySourceStatusCode = copySourceStatusCode; + return this; + } + + /** + * Get the copySourceErrorCode property: The CopySourceErrorCode property. + * + * @return the copySourceErrorCode value. + */ + public String getCopySourceErrorCode() { + return this.copySourceErrorCode; + } + + /** + * Set the copySourceErrorCode property: The CopySourceErrorCode property. + * + * @param copySourceErrorCode the copySourceErrorCode value to set. + * @return the StorageError object itself. + */ + public StorageError setCopySourceErrorCode(String copySourceErrorCode) { + this.copySourceErrorCode = copySourceErrorCode; + return this; + } + + /** + * Get the copySourceErrorMessage property: The CopySourceErrorMessage property. + * + * @return the copySourceErrorMessage value. + */ + public String getCopySourceErrorMessage() { + return this.copySourceErrorMessage; + } + + /** + * Set the copySourceErrorMessage property: The CopySourceErrorMessage property. + * + * @param copySourceErrorMessage the copySourceErrorMessage value to set. + * @return the StorageError object itself. + */ + public StorageError setCopySourceErrorMessage(String copySourceErrorMessage) { + this.copySourceErrorMessage = copySourceErrorMessage; + return this; + } } diff --git a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/specialized/AppendBlobApiTests.java b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/specialized/AppendBlobApiTests.java index 59376401de1f2..85203874d6837 100644 --- a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/specialized/AppendBlobApiTests.java +++ b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/specialized/AppendBlobApiTests.java @@ -530,6 +530,19 @@ public void appendBlockFromURLMin() { validateBasicHeaders(response.getHeaders()); } + @RequiredServiceVersion(clazz = BlobServiceVersion.class, min = "2024-08-04") + @Test + public void appendBlockFromURLSourceErrorAndStatusCodeNewTest() { + AppendBlobClient destBlob = cc.getBlobClient(generateBlobName()).getAppendBlobClient(); + destBlob.createIfNotExists(); + + BlobStorageException e = assertThrows(BlobStorageException.class, () -> destBlob.appendBlockFromUrl(bc.getBlobUrl(), new BlobRange(0, (long) PageBlobClient.PAGE_BYTES))); + + assertTrue(e.getStatusCode() == 409); + assertTrue(e.getServiceMessage().contains("PublicAccessNotPermitted")); + assertTrue(e.getServiceMessage().contains("Public access is not permitted on this storage account.")); + } + @Test public void appendBlockFromURLRange() { byte[] data = getRandomByteArray(4 * 1024); diff --git a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/specialized/AppendBlobAsyncApiTests.java b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/specialized/AppendBlobAsyncApiTests.java index e612940a2d55a..379dd795898a7 100644 --- a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/specialized/AppendBlobAsyncApiTests.java +++ b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/specialized/AppendBlobAsyncApiTests.java @@ -558,6 +558,20 @@ public void appendBlockFromURLMin() { .verifyComplete(); } + @RequiredServiceVersion(clazz = BlobServiceVersion.class, min = "2024-08-04") + @Test + public void appendBlockFromURLSourceErrorAndStatusCodeNewTest() { + AppendBlobAsyncClient destBlob = ccAsync.getBlobAsyncClient(generateBlobName()).getAppendBlobAsyncClient(); + + StepVerifier.create(destBlob.createIfNotExists().then(destBlob.appendBlockFromUrl(bc.getBlobUrl(), new BlobRange(0, (long) PageBlobClient.PAGE_BYTES)))) + .verifyErrorSatisfies(r -> { + BlobStorageException e = assertInstanceOf(BlobStorageException.class, r); + assertTrue(e.getStatusCode() == 409); + assertTrue(e.getServiceMessage().contains("PublicAccessNotPermitted")); + assertTrue(e.getServiceMessage().contains("Public access is not permitted on this storage account.")); + }); + } + @Test public void appendBlockFromURLRange() { byte[] data = getRandomByteArray(4 * 1024); diff --git a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/specialized/BlobBaseApiTests.java b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/specialized/BlobBaseApiTests.java index 1ee8e9b9df1aa..9de37d1f93b65 100644 --- a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/specialized/BlobBaseApiTests.java +++ b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/specialized/BlobBaseApiTests.java @@ -812,6 +812,18 @@ public void queryACFail(OffsetDateTime modified, OffsetDateTime unmodified, Stri () -> bc.queryWithResponse(optionsOs, null, null)); } + @RequiredServiceVersion(clazz = BlobServiceVersion.class, min = "2024-08-04") + @Test + public void copyFromURLSourceErrorAndStatusCode() { + BlockBlobClient destBlob = cc.getBlobClient(generateBlobName()).getBlockBlobClient(); + + BlobStorageException e = assertThrows(BlobStorageException.class, () -> destBlob.copyFromUrl(bc.getBlobUrl())); + + assertTrue(e.getStatusCode() == 409); + assertTrue(e.getServiceMessage().contains("PublicAccessNotPermitted")); + assertTrue(e.getServiceMessage().contains("Public access is not permitted on this storage account.")); + } + static class MockProgressConsumer implements Consumer { List progressList; diff --git a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/specialized/BlobBaseAsyncApiTests.java b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/specialized/BlobBaseAsyncApiTests.java index 3d4ba056cb0d2..79ab6cb0f9045 100644 --- a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/specialized/BlobBaseAsyncApiTests.java +++ b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/specialized/BlobBaseAsyncApiTests.java @@ -47,6 +47,7 @@ import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertInstanceOf; import static org.junit.jupiter.api.Assertions.assertTrue; public class BlobBaseAsyncApiTests extends BlobTestBase { @@ -584,6 +585,21 @@ public void queryACFail(OffsetDateTime modified, OffsetDateTime unmodified, Stri .verifyError(BlobStorageException.class); } + @RequiredServiceVersion(clazz = BlobServiceVersion.class, min = "2024-08-04") + @Test + public void copyFromURLSourceErrorAndStatusCode() { + BlockBlobAsyncClient destBlob = ccAsync.getBlobAsyncClient(generateBlobName()).getBlockBlobAsyncClient(); + + StepVerifier.create(destBlob.copyFromUrl(bc.getBlobUrl())) + .verifyErrorSatisfies(r -> { + BlobStorageException e = assertInstanceOf(BlobStorageException.class, r); + assertTrue(e.getStatusCode() == 409); + assertTrue(e.getServiceMessage().contains("PublicAccessNotPermitted")); + assertTrue(e.getServiceMessage().contains("Public access is not permitted on this storage account.")); + }); + } + + static class MockProgressConsumer implements Consumer { List progressList; diff --git a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/specialized/BlockBlobApiTests.java b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/specialized/BlockBlobApiTests.java index 934ca026a1760..163345d783441 100644 --- a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/specialized/BlockBlobApiTests.java +++ b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/specialized/BlockBlobApiTests.java @@ -376,6 +376,20 @@ public void stageBlockFromUrl() { assertEquals(ByteBuffer.wrap(outputStream.toByteArray()), DATA.getDefaultData()); } + @RequiredServiceVersion(clazz = BlobServiceVersion.class, min = "2024-08-04") + @Test + public void stageBlockFromUrlSourceErrorAndStatusCode() { + BlockBlobClient destBlob = cc.getBlobClient(generateBlobName()).getBlockBlobClient(); + + String blockID = getBlockID(); + + BlobStorageException e = assertThrows(BlobStorageException.class, () -> destBlob.stageBlockFromUrl(blockID, blockBlobClient.getBlobUrl(), new BlobRange(0, (long) PageBlobClient.PAGE_BYTES))); + + assertTrue(e.getStatusCode() == 409); + assertTrue(e.getServiceMessage().contains("PublicAccessNotPermitted")); + assertTrue(e.getServiceMessage().contains("Public access is not permitted on this storage account.")); + } + @Test public void stageBlockFromUrlMin() { BlockBlobClient bu2 = cc.getBlobClient(generateBlobName()).getBlockBlobClient(); @@ -1485,6 +1499,18 @@ public void uploadFromUrlMin() { TestUtils.assertArraysEqual(DATA.getDefaultBytes(), os.toByteArray()); } + @RequiredServiceVersion(clazz = BlobServiceVersion.class, min = "2024-08-04") + @Test + public void uploadFromUrlSourceErrorAndStatusCode() { + BlockBlobClient destBlob = cc.getBlobClient(generateBlobName()).getBlockBlobClient(); + + BlobStorageException e = assertThrows(BlobStorageException.class, () -> destBlob.uploadFromUrl(blockBlobClient.getBlobUrl())); + + assertTrue(e.getStatusCode() == 409); + assertTrue(e.getServiceMessage().contains("PublicAccessNotPermitted")); + assertTrue(e.getServiceMessage().contains("Public access is not permitted on this storage account.")); + } + @RequiredServiceVersion(clazz = BlobServiceVersion.class, min = "2020-04-08") @Test public void uploadFromUrlOverwrite() { diff --git a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/specialized/BlockBlobAsyncApiTests.java b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/specialized/BlockBlobAsyncApiTests.java index e28a755f3f125..4ccf6834d1f60 100644 --- a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/specialized/BlockBlobAsyncApiTests.java +++ b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/specialized/BlockBlobAsyncApiTests.java @@ -422,6 +422,22 @@ public void stageBlockFromUrl() { .verifyComplete(); } + @RequiredServiceVersion(clazz = BlobServiceVersion.class, min = "2024-08-04") + @Test + public void stageBlockFromUrlSourceErrorAndStatusCode() { + BlockBlobAsyncClient destBlob = ccAsync.getBlobAsyncClient(generateBlobName()).getBlockBlobAsyncClient(); + + String blockID = getBlockID(); + + StepVerifier.create(destBlob.stageBlockFromUrl(blockID, blockBlobAsyncClient.getBlobUrl(), new BlobRange(0, (long) PageBlobClient.PAGE_BYTES))) + .verifyErrorSatisfies(r -> { + BlobStorageException e = assertInstanceOf(BlobStorageException.class, r); + assertTrue(e.getStatusCode() == 409); + assertTrue(e.getServiceMessage().contains("PublicAccessNotPermitted")); + assertTrue(e.getServiceMessage().contains("Public access is not permitted on this storage account.")); + }); + } + @Test public void stageBlockFromUrlMin() { BlockBlobAsyncClient bu2 = ccAsync.getBlobAsyncClient(generateBlobName()).getBlockBlobAsyncClient(); @@ -2353,6 +2369,20 @@ public void uploadFromUrlMin() { .verifyComplete(); } + @RequiredServiceVersion(clazz = BlobServiceVersion.class, min = "2024-08-04") + @Test + public void uploadFromUrlSourceErrorAndStatusCode() { + BlockBlobAsyncClient destBlob = ccAsync.getBlobAsyncClient(generateBlobName()).getBlockBlobAsyncClient(); + + StepVerifier.create(destBlob.uploadFromUrl(blockBlobAsyncClient.getBlobUrl())) + .verifyErrorSatisfies(r -> { + BlobStorageException e = assertInstanceOf(BlobStorageException.class, r); + assertTrue(e.getStatusCode() == 409); + assertTrue(e.getServiceMessage().contains("PublicAccessNotPermitted")); + assertTrue(e.getServiceMessage().contains("Public access is not permitted on this storage account.")); + }); + } + @RequiredServiceVersion(clazz = BlobServiceVersion.class, min = "2020-04-08") @Test public void uploadFromUrlOverwrite() { diff --git a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/specialized/PageBlobApiTests.java b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/specialized/PageBlobApiTests.java index 15fc318bfb9b4..881c16ab7f8dc 100644 --- a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/specialized/PageBlobApiTests.java +++ b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/specialized/PageBlobApiTests.java @@ -537,6 +537,21 @@ public void uploadPageFromURLMin() { assertTrue(validateBasicHeaders(response.getHeaders())); } + @RequiredServiceVersion(clazz = BlobServiceVersion.class, min = "2024-08-04") + @Test + public void uploadPageFromURLSourceErrorAndStatusCode() { + PageBlobClient destBlob = cc.getBlobClient(generateBlobName()).getPageBlobClient(); + + destBlob.createIfNotExists(Constants.KB); + PageRange pageRange = new PageRange().setStart(0).setEnd(PageBlobClient.PAGE_BYTES - 1); + + BlobStorageException e = assertThrows(BlobStorageException.class, () -> destBlob.uploadPagesFromUrl(pageRange, bc.getBlobUrl(), null)); + + assertTrue(e.getStatusCode() == 409); + assertTrue(e.getServiceMessage().contains("PublicAccessNotPermitted")); + assertTrue(e.getServiceMessage().contains("Public access is not permitted on this storage account.")); + } + @Test public void uploadPageFromURLRange() { byte[] data = getRandomByteArray(PageBlobClient.PAGE_BYTES * 4); diff --git a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/specialized/PageBlobAsyncApiTests.java b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/specialized/PageBlobAsyncApiTests.java index 9a95edb8e14a3..2ca3029a475ba 100644 --- a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/specialized/PageBlobAsyncApiTests.java +++ b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/specialized/PageBlobAsyncApiTests.java @@ -547,6 +547,22 @@ public void uploadPageFromURLMin() { .verifyComplete(); } + @RequiredServiceVersion(clazz = BlobServiceVersion.class, min = "2024-08-04") + @Test + public void uploadPageFromURLSourceErrorAndStatusCode() { + PageBlobAsyncClient destBlob = ccAsync.getBlobAsyncClient(generateBlobName()).getPageBlobAsyncClient(); + + PageRange pageRange = new PageRange().setStart(0).setEnd(PageBlobClient.PAGE_BYTES - 1); + + StepVerifier.create(destBlob.createIfNotExists(Constants.KB).then(destBlob.uploadPagesFromUrl(pageRange, bc.getBlobUrl(), null))) + .verifyErrorSatisfies(r -> { + BlobStorageException e = assertInstanceOf(BlobStorageException.class, r); + assertTrue(e.getStatusCode() == 409); + assertTrue(e.getServiceMessage().contains("PublicAccessNotPermitted")); + assertTrue(e.getServiceMessage().contains("Public access is not permitted on this storage account.")); + }); + } + @Test public void uploadPageFromURLRange() { byte[] data = getRandomByteArray(PageBlobClient.PAGE_BYTES * 4); diff --git a/sdk/storage/azure-storage-blob/swagger/README.md b/sdk/storage/azure-storage-blob/swagger/README.md index a408f56e7005d..73ff2a71122ba 100644 --- a/sdk/storage/azure-storage-blob/swagger/README.md +++ b/sdk/storage/azure-storage-blob/swagger/README.md @@ -16,7 +16,7 @@ autorest ### Code generation settings ``` yaml use: '@autorest/java@4.1.16' -input-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/c13d86f8d53ee6d7a396f762f50fe02e3a5bfa07/specification/storage/data-plane/Microsoft.BlobStorage/stable/2024-08-04/blob.json +input-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/ccefad16baad361096d997888ef8ff8503118fac/specification/storage/data-plane/Microsoft.BlobStorage/stable/2024-08-04/blob.json java: true output-folder: ../ namespace: com.azure.storage.blob diff --git a/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/policy/RequestRetryPolicy.java b/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/policy/RequestRetryPolicy.java index 79230e1ebf07d..693c863e0bb73 100644 --- a/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/policy/RequestRetryPolicy.java +++ b/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/policy/RequestRetryPolicy.java @@ -4,6 +4,7 @@ package com.azure.storage.common.policy; +import com.azure.core.http.HttpHeaderName; import com.azure.core.http.HttpMethod; import com.azure.core.http.HttpPipelineCallContext; import com.azure.core.http.HttpPipelineNextPolicy; @@ -39,6 +40,7 @@ public final class RequestRetryPolicy implements HttpPipelinePolicy { private static final ClientLogger LOGGER = new ClientLogger(RequestRetryPolicy.class); private final RequestRetryOptions requestRetryOptions; + private static final HttpHeaderName X_MS_COPY_SOURCE_ERROR_CODE = HttpHeaderName.fromString("x-ms-copy-source-error-code"); /** * Constructs the policy using the retry options. @@ -151,7 +153,7 @@ private Mono attemptAsync(HttpPipelineCallContext context, HttpPip boolean newConsiderSecondary = considerSecondary; int statusCode = response.getStatusCode(); - boolean retry = shouldStatusCodeBeRetried(statusCode, tryingPrimary); + boolean retry = shouldResponseBeRetried(statusCode, tryingPrimary, response); if (!tryingPrimary && statusCode == 404) { newConsiderSecondary = false; } @@ -266,7 +268,7 @@ private HttpResponse attemptSync(final HttpPipelineCallContext context, HttpPipe boolean newConsiderSecondary = considerSecondary; int statusCode = response.getStatusCode(); - boolean retry = shouldStatusCodeBeRetried(statusCode, tryingPrimary); + boolean retry = shouldResponseBeRetried(statusCode, tryingPrimary, response); if (!tryingPrimary && statusCode == 404) { newConsiderSecondary = false; } @@ -377,14 +379,23 @@ static ExceptionRetryStatus shouldErrorBeRetried(Throwable error, int attempt, i return new ExceptionRetryStatus(false, unwrappedThrowable); } - static boolean shouldStatusCodeBeRetried(int statusCode, boolean isPrimary) { + static boolean shouldResponseBeRetried(int statusCode, boolean isPrimary, HttpResponse response) { /* * Retry the request if the server had an error (500), was unavailable (503), or requested a backoff (429), * or if the secondary was being tried and the resources didn't exist there (404). Only the secondary can retry * if the resource wasn't found as there may be a delay in replication from the primary. */ - return (statusCode == 429 || statusCode == 500 || statusCode == 503) - || (!isPrimary && statusCode == 404); + boolean headerRetry = false; + boolean statusCodeRetry = (statusCode == 429 || statusCode == 500 || statusCode == 503) || (!isPrimary && statusCode == 404); + if (response != null && response.getHeaders() != null) { + String headerValue = response.getHeaders().getValue(X_MS_COPY_SOURCE_ERROR_CODE); + if (headerValue != null) { + headerRetry = ("429".equals(headerValue) || "500".equals(headerValue) || "503".equals(headerValue)) + || (!isPrimary && "404".equals(headerValue)); + } + + } + return statusCodeRetry || headerRetry; } static final class ExceptionRetryStatus { diff --git a/sdk/storage/azure-storage-common/src/test/java/com/azure/storage/common/policy/RequestRetryPolicyTest.java b/sdk/storage/azure-storage-common/src/test/java/com/azure/storage/common/policy/RequestRetryPolicyTest.java index 1d2197e2677c2..0ae71287a7993 100644 --- a/sdk/storage/azure-storage-common/src/test/java/com/azure/storage/common/policy/RequestRetryPolicyTest.java +++ b/sdk/storage/azure-storage-common/src/test/java/com/azure/storage/common/policy/RequestRetryPolicyTest.java @@ -3,6 +3,7 @@ package com.azure.storage.common.policy; +import com.azure.core.http.HttpHeaderName; import com.azure.core.http.HttpHeaders; import com.azure.core.http.HttpMethod; import com.azure.core.http.HttpPipeline; @@ -250,7 +251,17 @@ public void retryPolicyRetriesExceptions(Throwable throwable, boolean shouldBeRe @ParameterizedTest @MethodSource("retryPolicyRetriesStatusCodeSupplier") public void retryPolicyRetriesStatusCode(int statusCode, boolean isPrimary, boolean shouldBeRetried) { - assertEquals(shouldBeRetried, RequestRetryPolicy.shouldStatusCodeBeRetried(statusCode, isPrimary)); + assertEquals(shouldBeRetried, RequestRetryPolicy.shouldResponseBeRetried(statusCode, isPrimary, null)); + } + + @ParameterizedTest + @MethodSource("retryPolicyRetriesStatusCodeSupplier") + public void retryPolicyRetriesResponse(int statusCode, boolean isPrimary, boolean shouldBeRetried) { + MockHttpResponse response = new MockHttpResponse(null, 404, + new HttpHeaders().set(HttpHeaderName.fromString("x-ms-copy-source-error-code"), "" + statusCode)); + + assertEquals(shouldBeRetried, RequestRetryPolicy.shouldResponseBeRetried(0, isPrimary, response)); + } private static Mono sendRequest(HttpPipeline pipeline) { diff --git a/sdk/storage/azure-storage-file-share/assets.json b/sdk/storage/azure-storage-file-share/assets.json index b6148d2b7230c..32b43ca6269c3 100644 --- a/sdk/storage/azure-storage-file-share/assets.json +++ b/sdk/storage/azure-storage-file-share/assets.json @@ -2,5 +2,5 @@ "AssetsRepo": "Azure/azure-sdk-assets", "AssetsRepoPrefixPath": "java", "TagPrefix": "java/storage/azure-storage-file-share", - "Tag": "java/storage/azure-storage-file-share_5a1b3f763c" + "Tag": "java/storage/azure-storage-file-share_d57444c858" } diff --git a/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/implementation/models/StorageError.java b/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/implementation/models/StorageError.java index 964157d1ce5b7..fa8df2d374c83 100644 --- a/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/implementation/models/StorageError.java +++ b/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/implementation/models/StorageError.java @@ -18,6 +18,24 @@ public final class StorageError { @JsonProperty(value = "Message") private String message; + /* + * The CopySourceStatusCode property. + */ + @JsonProperty(value = "CopySourceStatusCode") + private Long copySourceStatusCode; + + /* + * The CopySourceErrorCode property. + */ + @JsonProperty(value = "CopySourceErrorCode") + private String copySourceErrorCode; + + /* + * The CopySourceErrorMessage property. + */ + @JsonProperty(value = "CopySourceErrorMessage") + private String copySourceErrorMessage; + /* * The AuthenticationErrorDetail property. */ @@ -47,6 +65,66 @@ public StorageError setMessage(String message) { return this; } + /** + * Get the copySourceStatusCode property: The CopySourceStatusCode property. + * + * @return the copySourceStatusCode value. + */ + public Long getCopySourceStatusCode() { + return this.copySourceStatusCode; + } + + /** + * Set the copySourceStatusCode property: The CopySourceStatusCode property. + * + * @param copySourceStatusCode the copySourceStatusCode value to set. + * @return the StorageError object itself. + */ + public StorageError setCopySourceStatusCode(Long copySourceStatusCode) { + this.copySourceStatusCode = copySourceStatusCode; + return this; + } + + /** + * Get the copySourceErrorCode property: The CopySourceErrorCode property. + * + * @return the copySourceErrorCode value. + */ + public String getCopySourceErrorCode() { + return this.copySourceErrorCode; + } + + /** + * Set the copySourceErrorCode property: The CopySourceErrorCode property. + * + * @param copySourceErrorCode the copySourceErrorCode value to set. + * @return the StorageError object itself. + */ + public StorageError setCopySourceErrorCode(String copySourceErrorCode) { + this.copySourceErrorCode = copySourceErrorCode; + return this; + } + + /** + * Get the copySourceErrorMessage property: The CopySourceErrorMessage property. + * + * @return the copySourceErrorMessage value. + */ + public String getCopySourceErrorMessage() { + return this.copySourceErrorMessage; + } + + /** + * Set the copySourceErrorMessage property: The CopySourceErrorMessage property. + * + * @param copySourceErrorMessage the copySourceErrorMessage value to set. + * @return the StorageError object itself. + */ + public StorageError setCopySourceErrorMessage(String copySourceErrorMessage) { + this.copySourceErrorMessage = copySourceErrorMessage; + return this; + } + /** * Get the authenticationErrorDetail property: The AuthenticationErrorDetail property. * diff --git a/sdk/storage/azure-storage-file-share/src/test/java/com/azure/storage/file/share/FileApiTests.java b/sdk/storage/azure-storage-file-share/src/test/java/com/azure/storage/file/share/FileApiTests.java index 382cdf324f595..f1f5d5ebc1186 100644 --- a/sdk/storage/azure-storage-file-share/src/test/java/com/azure/storage/file/share/FileApiTests.java +++ b/sdk/storage/azure-storage-file-share/src/test/java/com/azure/storage/file/share/FileApiTests.java @@ -1070,6 +1070,21 @@ public void uploadRangeFromURL(String pathSuffix) { } } + @RequiredServiceVersion(clazz = ShareServiceVersion.class, min = "2024-08-04") + @Test + public void uploadRangeFromURLSourceErrorAndStatusCode() { + primaryFileClient.create(1024); + ShareFileClient destinationClient = shareClient.getFileClient(generatePathName()); + destinationClient.create(1024); + + ShareStorageException e = assertThrows(ShareStorageException.class, + () -> destinationClient.uploadRangeFromUrl(5, 0, 0, primaryFileClient.getFileUrl())); + + assertTrue(e.getStatusCode() == 401); + assertTrue(e.getServiceMessage().contains("NoAuthenticationInformation")); + assertTrue(e.getServiceMessage().contains("Server failed to authenticate the request. Please refer to the information in the www-authenticate header.")); + } + @RequiredServiceVersion(clazz = ShareServiceVersion.class, min = "2021-04-10") @Test public void uploadRangeFromURLOAuth() { @@ -1316,6 +1331,21 @@ public void startCopyError() { FileShareTestHelper.assertExceptionStatusCodeAndMessage(e, 400, ShareErrorCode.INVALID_HEADER_VALUE); } + @RequiredServiceVersion(clazz = ShareServiceVersion.class, min = "2024-08-04") + @Test + public void startCopySourceErrorAndStatusCode() { + primaryFileClient.create(1024); + + ShareStorageException e = assertThrows(ShareStorageException.class, () -> { + SyncPoller poller = primaryFileClient.beginCopy("https://error.file.core.windows.net/garbage", testMetadata, null); + poller.waitForCompletion(); + }); + + assertTrue(e.getStatusCode() == 400); + assertTrue(e.getServiceMessage().contains("InvalidUri")); + assertTrue(e.getServiceMessage().contains("The requested URI does not represent any resource on the server.")); + } + @ParameterizedTest @MethodSource("com.azure.storage.file.share.FileShareTestHelper#startCopyArgumentsSupplier") public void startCopyWithOptions(boolean setFilePermissionKey, boolean setFilePermission, boolean ignoreReadOnly, diff --git a/sdk/storage/azure-storage-file-share/src/test/java/com/azure/storage/file/share/FileAsyncApiTests.java b/sdk/storage/azure-storage-file-share/src/test/java/com/azure/storage/file/share/FileAsyncApiTests.java index b374c62f688bc..f261406670681 100644 --- a/sdk/storage/azure-storage-file-share/src/test/java/com/azure/storage/file/share/FileAsyncApiTests.java +++ b/sdk/storage/azure-storage-file-share/src/test/java/com/azure/storage/file/share/FileAsyncApiTests.java @@ -76,7 +76,7 @@ public class FileAsyncApiTests extends FileShareTestBase { private ShareFileAsyncClient primaryFileAsyncClient; - private ShareClient shareClient; + private ShareAsyncClient shareAsyncClient; private String shareName; private String filePath; private static Map testMetadata; @@ -88,8 +88,8 @@ public class FileAsyncApiTests extends FileShareTestBase { public void setup() { shareName = generateShareName(); filePath = generatePathName(); - shareClient = shareBuilderHelper(shareName).buildClient(); - shareClient.create(); + shareAsyncClient = shareBuilderHelper(shareName).buildAsyncClient(); + shareAsyncClient.create().block(); primaryFileAsyncClient = fileBuilderHelper(shareName, filePath).buildFileAsyncClient(); testMetadata = Collections.singletonMap("testmetadata", "value"); httpHeaders = new ShareFileHttpHeaders().setContentLanguage("en") @@ -120,7 +120,7 @@ public void createFileError() { @Test public void createFileWithArgsFpk() { - String filePermissionKey = shareClient.createPermission(FILE_PERMISSION); + String filePermissionKey = shareAsyncClient.createPermission(FILE_PERMISSION).block(); smbProperties.setFileCreationTime(testResourceNamer.now()) .setFileLastWriteTime(testResourceNamer.now()) .setFilePermissionKey(filePermissionKey); @@ -608,6 +608,21 @@ public void uploadRangeFromURL() { }).verifyComplete(); } + @RequiredServiceVersion(clazz = ShareServiceVersion.class, min = "2024-08-04") + @Test + public void uploadRangeFromURLSourceErrorAndStatusCode() { + ShareFileAsyncClient destinationClient = shareAsyncClient.getFileClient(generatePathName()); + + StepVerifier.create(primaryFileAsyncClient.create(1024).then(destinationClient.create(1024)) + .then(destinationClient.uploadRangeFromUrl(5, 0, 0, primaryFileAsyncClient.getFileUrl()))) + .verifyErrorSatisfies(r -> { + ShareStorageException e = assertInstanceOf(ShareStorageException.class, r); + assertTrue(e.getStatusCode() == 401); + assertTrue(e.getServiceMessage().contains("NoAuthenticationInformation")); + assertTrue(e.getServiceMessage().contains("Server failed to authenticate the request. Please refer to the information in the www-authenticate header.")); + }); + } + @RequiredServiceVersion(clazz = ShareServiceVersion.class, min = "2021-04-10") @Test public void uploadRangeFromURLOAuth() { @@ -747,7 +762,7 @@ public void startCopyWithArgs(boolean setFilePermissionKey, boolean setFilePermi boolean setArchiveAttribute, PermissionCopyModeType permissionType) { primaryFileAsyncClient.create(1024).block(); String sourceURL = primaryFileAsyncClient.getFileUrl(); - String filePermissionKey = shareClient.createPermission(FILE_PERMISSION); + String filePermissionKey = shareAsyncClient.createPermission(FILE_PERMISSION).block(); // We recreate file properties for each test since we need to store the times for the test with // testResourceNamer.now() smbProperties.setFileCreationTime(testResourceNamer.now()) @@ -778,6 +793,23 @@ public void startCopyError() { .verify(Duration.ofMinutes(1)); } + @RequiredServiceVersion(clazz = ShareServiceVersion.class, min = "2024-08-04") + @Test + public void startCopySourceErrorAndStatusCode() { + primaryFileAsyncClient.create(1024); + + PollerFlux poller = setPlaybackPollerFluxPollInterval( + primaryFileAsyncClient.beginCopy("https://error.file.core.windows.net/garbage", new ShareFileCopyOptions(), null)); + + StepVerifier.create(primaryFileAsyncClient.create(1024).thenMany(poller)) + .verifyErrorSatisfies(r -> { + ShareStorageException e = assertInstanceOf(ShareStorageException.class, r); + assertTrue(e.getStatusCode() == 400); + assertTrue(e.getServiceMessage().contains("InvalidUri")); + assertTrue(e.getServiceMessage().contains("The requested URI does not represent any resource on the server.")); + }); + } + @Disabled("There is a race condition in Poller where it misses the first observed event if there is a gap " + "between the time subscribed and the time we start observing events.") @Test @@ -819,7 +851,7 @@ public void startCopyWithOptions(boolean setFilePermissionKey, boolean setFilePe boolean setArchiveAttribute, PermissionCopyModeType permissionType) { primaryFileAsyncClient.create(1024).block(); String sourceURL = primaryFileAsyncClient.getFileUrl(); - String filePermissionKey = shareClient.createPermission(FILE_PERMISSION); + String filePermissionKey = shareAsyncClient.createPermission(FILE_PERMISSION).block(); // We recreate file properties for each test since we need to store the times for the test with // testResourceNamer.now() smbProperties.setFileCreationTime(testResourceNamer.now()) @@ -920,7 +952,7 @@ public void startCopyWithOptionsChangeTime() { public void startCopyWithOptionsCopySmbFilePropertiesPermissionKey() { primaryFileAsyncClient.create(1024).block(); String sourceURL = primaryFileAsyncClient.getFileUrl(); - String filePermissionKey = shareClient.createPermission(FILE_PERMISSION); + String filePermissionKey = shareAsyncClient.createPermission(FILE_PERMISSION).block(); EnumSet ntfs = EnumSet.of(NtfsFileAttributes.READ_ONLY, NtfsFileAttributes.ARCHIVE); // We recreate file properties for each test since we need to store the times for the test with // testResourceNamer.now() @@ -1187,7 +1219,7 @@ public void getPropertiesError() { @Test public void setHttpHeadersFpk() { primaryFileAsyncClient.createWithResponse(1024, null, null, null, null).block(); - String filePermissionKey = shareClient.createPermission(FILE_PERMISSION); + String filePermissionKey = shareAsyncClient.createPermission(FILE_PERMISSION).block(); smbProperties.setFileCreationTime(testResourceNamer.now()) .setFileLastWriteTime(testResourceNamer.now()) .setFilePermissionKey(filePermissionKey); @@ -1540,7 +1572,7 @@ public void storageAccountAudience() { ShareServiceAsyncClient oAuthServiceClient = getOAuthServiceAsyncClient(new ShareServiceClientBuilder() .shareTokenIntent(ShareTokenIntent.BACKUP) - .audience(ShareAudience.createShareServiceAccountAudience(shareClient.getAccountName()))); + .audience(ShareAudience.createShareServiceAccountAudience(shareAsyncClient.getAccountName()))); ShareFileAsyncClient aadFileClient = oAuthServiceClient.getShareAsyncClient(shareName).getFileClient(fileName); @@ -1570,7 +1602,7 @@ public void audienceError() { @Test public void audienceFromString() { - String url = String.format("https://%s.file.core.windows.net/", shareClient.getAccountName()); + String url = String.format("https://%s.file.core.windows.net/", shareAsyncClient.getAccountName()); ShareAudience audience = ShareAudience.fromString(url); String fileName = generatePathName(); diff --git a/sdk/storage/azure-storage-file-share/swagger/README.md b/sdk/storage/azure-storage-file-share/swagger/README.md index 2be198ed51ad9..d33eae4e11e5b 100644 --- a/sdk/storage/azure-storage-file-share/swagger/README.md +++ b/sdk/storage/azure-storage-file-share/swagger/README.md @@ -16,7 +16,7 @@ autorest ### Code generation settings ``` yaml use: '@autorest/java@4.1.16' -input-file: https://raw.githubusercontent.com/seanmcc-msft/azure-rest-api-specs/bbb7986063b2d5f3e248d3c57c8664ad5625e5b1/specification/storage/data-plane/Microsoft.FileStorage/stable/2024-08-04/file.json +input-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/ccefad16baad361096d997888ef8ff8503118fac/specification/storage/data-plane/Microsoft.FileStorage/stable/2024-08-04/file.json java: true output-folder: ../ namespace: com.azure.storage.file.share From b72f27fd0898365c22ba31e44c344a36acefa46e Mon Sep 17 00:00:00 2001 From: Isabelle Date: Mon, 13 May 2024 15:02:08 -0700 Subject: [PATCH 08/17] fixing sharesimpl --- .../file/share/implementation/SharesImpl.java | 454 +++++------------- .../models/SharePropertiesInternal.java | 81 ++-- 2 files changed, 149 insertions(+), 386 deletions(-) diff --git a/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/implementation/SharesImpl.java b/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/implementation/SharesImpl.java index 9752be4903947..74e4e633249a6 100644 --- a/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/implementation/SharesImpl.java +++ b/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/implementation/SharesImpl.java @@ -81,46 +81,32 @@ public final class SharesImpl { * The interface defining all the services for AzureFileStorageShares to be used by the proxy service to perform * REST calls. */ - @Host("{url}") //todo + @Host("{url}") @ServiceInterface(name = "AzureFileStorageShar") public interface SharesService { @Put("/{shareName}") @ExpectedResponses({ 201 }) @UnexpectedResponseExceptionType(ShareStorageException.class) - Mono> create( - @HostParam("url") String url, - @PathParam("shareName") String shareName, - @QueryParam("restype") String restype, - @QueryParam("timeout") Integer timeout, - @HeaderParam("x-ms-meta-") Map metadata, - @HeaderParam("x-ms-share-quota") Integer quota, - @HeaderParam("x-ms-access-tier") ShareAccessTier accessTier, - @HeaderParam("x-ms-version") String version, - @HeaderParam("x-ms-enabled-protocols") String enabledProtocols, - @HeaderParam("x-ms-root-squash") ShareRootSquash rootSquash, - @HeaderParam("x-ms-enable-snapshot-virtual-directory-access") - Boolean enableSnapshotVirtualDirectoryAccess, - @HeaderParam("Accept") String accept, - Context context); - - @Put("/{shareName}") //todo + Mono> create(@HostParam("url") String url, + @PathParam("shareName") String shareName, @QueryParam("restype") String restype, + @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-meta-") Map metadata, + @HeaderParam("x-ms-share-quota") Integer quota, @HeaderParam("x-ms-access-tier") ShareAccessTier accessTier, + @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-enabled-protocols") String enabledProtocols, + @HeaderParam("x-ms-root-squash") ShareRootSquash rootSquash, + @HeaderParam("x-ms-enable-snapshot-virtual-directory-access") Boolean enableSnapshotVirtualDirectoryAccess, + @HeaderParam("Accept") String accept, Context context); + + @Put("/{shareName}") @ExpectedResponses({ 201 }) @UnexpectedResponseExceptionType(ShareStorageException.class) - Mono> createNoCustomHeaders( - @HostParam("url") String url, - @PathParam("shareName") String shareName, - @QueryParam("restype") String restype, - @QueryParam("timeout") Integer timeout, - @HeaderParam("x-ms-meta-") Map metadata, - @HeaderParam("x-ms-share-quota") Integer quota, - @HeaderParam("x-ms-access-tier") ShareAccessTier accessTier, - @HeaderParam("x-ms-version") String version, - @HeaderParam("x-ms-enabled-protocols") String enabledProtocols, - @HeaderParam("x-ms-root-squash") ShareRootSquash rootSquash, - @HeaderParam("x-ms-enable-snapshot-virtual-directory-access") - Boolean enableSnapshotVirtualDirectoryAccess, - @HeaderParam("Accept") String accept, - Context context); + Mono> createNoCustomHeaders(@HostParam("url") String url, + @PathParam("shareName") String shareName, @QueryParam("restype") String restype, + @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-meta-") Map metadata, + @HeaderParam("x-ms-share-quota") Integer quota, @HeaderParam("x-ms-access-tier") ShareAccessTier accessTier, + @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-enabled-protocols") String enabledProtocols, + @HeaderParam("x-ms-root-squash") ShareRootSquash rootSquash, + @HeaderParam("x-ms-enable-snapshot-virtual-directory-access") Boolean enableSnapshotVirtualDirectoryAccess, + @HeaderParam("Accept") String accept, Context context); @Put("/{shareName}") @ExpectedResponses({ 201 }) @@ -532,55 +518,36 @@ Mono> getPermission(@H @Get("/{shareName}") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ShareStorageException.class) - Mono> getPermissionNoCustomHeaders( - @HostParam("url") String url, - @PathParam("shareName") String shareName, - @QueryParam("restype") String restype, - @QueryParam("comp") String comp, - @HeaderParam("x-ms-file-permission-key") String filePermissionKey, - @QueryParam("timeout") Integer timeout, - @HeaderParam("x-ms-version") String version, - @HeaderParam("x-ms-file-request-intent") ShareTokenIntent fileRequestIntent, - @HeaderParam("Accept") String accept, - Context context); + Mono> getPermissionNoCustomHeaders(@HostParam("url") String url, + @PathParam("shareName") String shareName, @QueryParam("restype") String restype, + @QueryParam("comp") String comp, @HeaderParam("x-ms-file-permission-key") String filePermissionKey, + @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, + @HeaderParam("x-ms-file-request-intent") ShareTokenIntent fileRequestIntent, + @HeaderParam("Accept") String accept, Context context); @Put("/{shareName}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ShareStorageException.class) - Mono> setProperties( - @HostParam("url") String url, - @PathParam("shareName") String shareName, - @QueryParam("restype") String restype, - @QueryParam("comp") String comp, - @QueryParam("timeout") Integer timeout, - @HeaderParam("x-ms-version") String version, - @HeaderParam("x-ms-share-quota") Integer quota, - @HeaderParam("x-ms-access-tier") ShareAccessTier accessTier, - @HeaderParam("x-ms-lease-id") String leaseId, - @HeaderParam("x-ms-root-squash") ShareRootSquash rootSquash, - @HeaderParam("x-ms-enable-snapshot-virtual-directory-access") - Boolean enableSnapshotVirtualDirectoryAccess, - @HeaderParam("Accept") String accept, - Context context); + Mono> setProperties(@HostParam("url") String url, + @PathParam("shareName") String shareName, @QueryParam("restype") String restype, + @QueryParam("comp") String comp, @QueryParam("timeout") Integer timeout, + @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-share-quota") Integer quota, + @HeaderParam("x-ms-access-tier") ShareAccessTier accessTier, @HeaderParam("x-ms-lease-id") String leaseId, + @HeaderParam("x-ms-root-squash") ShareRootSquash rootSquash, + @HeaderParam("x-ms-enable-snapshot-virtual-directory-access") Boolean enableSnapshotVirtualDirectoryAccess, + @HeaderParam("Accept") String accept, Context context); @Put("/{shareName}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ShareStorageException.class) - Mono> setPropertiesNoCustomHeaders( - @HostParam("url") String url, - @PathParam("shareName") String shareName, - @QueryParam("restype") String restype, - @QueryParam("comp") String comp, - @QueryParam("timeout") Integer timeout, - @HeaderParam("x-ms-version") String version, - @HeaderParam("x-ms-share-quota") Integer quota, - @HeaderParam("x-ms-access-tier") ShareAccessTier accessTier, - @HeaderParam("x-ms-lease-id") String leaseId, - @HeaderParam("x-ms-root-squash") ShareRootSquash rootSquash, - @HeaderParam("x-ms-enable-snapshot-virtual-directory-access") - Boolean enableSnapshotVirtualDirectoryAccess, - @HeaderParam("Accept") String accept, - Context context); + Mono> setPropertiesNoCustomHeaders(@HostParam("url") String url, + @PathParam("shareName") String shareName, @QueryParam("restype") String restype, + @QueryParam("comp") String comp, @QueryParam("timeout") Integer timeout, + @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-share-quota") Integer quota, + @HeaderParam("x-ms-access-tier") ShareAccessTier accessTier, @HeaderParam("x-ms-lease-id") String leaseId, + @HeaderParam("x-ms-root-squash") ShareRootSquash rootSquash, + @HeaderParam("x-ms-enable-snapshot-virtual-directory-access") Boolean enableSnapshotVirtualDirectoryAccess, + @HeaderParam("Accept") String accept, Context context); @Get("/{shareName}") @ExpectedResponses({ 200 }) @@ -858,34 +825,15 @@ Response restoreNoCustomHeadersSync(@HostParam("url") String url, * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the {@link ResponseBase} on successful completion of {@link Mono}. */ - @ServiceMethod(returns = ReturnType.SINGLE) //todo - public Mono> createWithResponseAsync( - String shareName, - Integer timeout, - Map metadata, - Integer quota, - ShareAccessTier accessTier, - String enabledProtocols, - ShareRootSquash rootSquash, - Boolean enableSnapshotVirtualDirectoryAccess) { + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> createWithResponseAsync(String shareName, Integer timeout, + Map metadata, Integer quota, ShareAccessTier accessTier, String enabledProtocols, + ShareRootSquash rootSquash, Boolean enableSnapshotVirtualDirectoryAccess) { final String restype = "share"; final String accept = "application/xml"; - return FluxUtil.withContext( - context -> - service.create( - this.client.getUrl(), - shareName, - restype, - timeout, - metadata, - quota, - accessTier, - this.client.getVersion(), - enabledProtocols, - rootSquash, - enableSnapshotVirtualDirectoryAccess, - accept, - context)); + return FluxUtil.withContext(context -> service.create(this.client.getUrl(), shareName, restype, timeout, + metadata, quota, accessTier, this.client.getVersion(), enabledProtocols, rootSquash, + enableSnapshotVirtualDirectoryAccess, accept, context)); } /** @@ -908,33 +856,15 @@ public Mono> createWithResponseAsync( * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the {@link ResponseBase} on successful completion of {@link Mono}. */ - @ServiceMethod(returns = ReturnType.SINGLE)//todo - public Mono> createWithResponseAsync( - String shareName, - Integer timeout, - Map metadata, - Integer quota, - ShareAccessTier accessTier, - String enabledProtocols, - ShareRootSquash rootSquash, - Boolean enableSnapshotVirtualDirectoryAccess, - Context context) { + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> createWithResponseAsync(String shareName, Integer timeout, + Map metadata, Integer quota, ShareAccessTier accessTier, String enabledProtocols, + ShareRootSquash rootSquash, Boolean enableSnapshotVirtualDirectoryAccess, Context context) { final String restype = "share"; final String accept = "application/xml"; - return service.create( - this.client.getUrl(), - shareName, - restype, - timeout, - metadata, - quota, - accessTier, - this.client.getVersion(), - enabledProtocols, - rootSquash, - enableSnapshotVirtualDirectoryAccess, - accept, - context); + return service.create(this.client.getUrl(), shareName, restype, timeout, metadata, quota, accessTier, + this.client.getVersion(), enabledProtocols, rootSquash, enableSnapshotVirtualDirectoryAccess, accept, + context); } /** @@ -957,25 +887,11 @@ public Mono> createWithResponseAsync( * @return A {@link Mono} that completes when a successful response is received. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono createAsync( - String shareName, - Integer timeout, - Map metadata, - Integer quota, - ShareAccessTier accessTier, - String enabledProtocols, - ShareRootSquash rootSquash, - Boolean enableSnapshotVirtualDirectoryAccess) { - return createWithResponseAsync( - shareName, - timeout, - metadata, - quota, - accessTier, - enabledProtocols, - rootSquash, - enableSnapshotVirtualDirectoryAccess) - .flatMap(ignored -> Mono.empty()); + public Mono createAsync(String shareName, Integer timeout, Map metadata, Integer quota, + ShareAccessTier accessTier, String enabledProtocols, ShareRootSquash rootSquash, + Boolean enableSnapshotVirtualDirectoryAccess) { + return createWithResponseAsync(shareName, timeout, metadata, quota, accessTier, enabledProtocols, rootSquash, + enableSnapshotVirtualDirectoryAccess).flatMap(ignored -> Mono.empty()); } /** @@ -998,28 +914,12 @@ public Mono createAsync( * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return A {@link Mono} that completes when a successful response is received. */ - @ServiceMethod(returns = ReturnType.SINGLE)//todo - public Mono createAsync( - String shareName, - Integer timeout, - Map metadata, - Integer quota, - ShareAccessTier accessTier, - String enabledProtocols, - ShareRootSquash rootSquash, - Boolean enableSnapshotVirtualDirectoryAccess, - Context context) { - return createWithResponseAsync( - shareName, - timeout, - metadata, - quota, - accessTier, - enabledProtocols, - rootSquash, - enableSnapshotVirtualDirectoryAccess, - context) - .flatMap(ignored -> Mono.empty()); + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono createAsync(String shareName, Integer timeout, Map metadata, Integer quota, + ShareAccessTier accessTier, String enabledProtocols, ShareRootSquash rootSquash, + Boolean enableSnapshotVirtualDirectoryAccess, Context context) { + return createWithResponseAsync(shareName, timeout, metadata, quota, accessTier, enabledProtocols, rootSquash, + enableSnapshotVirtualDirectoryAccess, context).flatMap(ignored -> Mono.empty()); } /** @@ -1042,33 +942,14 @@ public Mono createAsync( * @return the {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> createNoCustomHeadersWithResponseAsync( - String shareName, - Integer timeout, - Map metadata, - Integer quota, - ShareAccessTier accessTier, - String enabledProtocols, - ShareRootSquash rootSquash, - Boolean enableSnapshotVirtualDirectoryAccess) { + public Mono> createNoCustomHeadersWithResponseAsync(String shareName, Integer timeout, + Map metadata, Integer quota, ShareAccessTier accessTier, String enabledProtocols, + ShareRootSquash rootSquash, Boolean enableSnapshotVirtualDirectoryAccess) { final String restype = "share"; final String accept = "application/xml"; - return FluxUtil.withContext( - context -> - service.createNoCustomHeaders( - this.client.getUrl(), - shareName, - restype, - timeout, - metadata, - quota, - accessTier, - this.client.getVersion(), - enabledProtocols, - rootSquash, - enableSnapshotVirtualDirectoryAccess, - accept, - context)); + return FluxUtil.withContext(context -> service.createNoCustomHeaders(this.client.getUrl(), shareName, restype, + timeout, metadata, quota, accessTier, this.client.getVersion(), enabledProtocols, rootSquash, + enableSnapshotVirtualDirectoryAccess, accept, context)); } /** @@ -1092,32 +973,14 @@ public Mono> createNoCustomHeadersWithResponseAsync( * @return the {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> createNoCustomHeadersWithResponseAsync( - String shareName, - Integer timeout, - Map metadata, - Integer quota, - ShareAccessTier accessTier, - String enabledProtocols, - ShareRootSquash rootSquash, - Boolean enableSnapshotVirtualDirectoryAccess, - Context context) { + public Mono> createNoCustomHeadersWithResponseAsync(String shareName, Integer timeout, + Map metadata, Integer quota, ShareAccessTier accessTier, String enabledProtocols, + ShareRootSquash rootSquash, Boolean enableSnapshotVirtualDirectoryAccess, Context context) { final String restype = "share"; final String accept = "application/xml"; - return service.createNoCustomHeaders( - this.client.getUrl(), - shareName, - restype, - timeout, - metadata, - quota, - accessTier, - this.client.getVersion(), - enabledProtocols, - rootSquash, - enableSnapshotVirtualDirectoryAccess, - accept, - context); + return service.createNoCustomHeaders(this.client.getUrl(), shareName, restype, timeout, metadata, quota, + accessTier, this.client.getVersion(), enabledProtocols, rootSquash, enableSnapshotVirtualDirectoryAccess, + accept, context); } /** @@ -3665,33 +3528,15 @@ public Response getPermissionNoCustomHeadersWithResponse(String * @return the {@link ResponseBase} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> setPropertiesWithResponseAsync( - String shareName, - Integer timeout, - Integer quota, - ShareAccessTier accessTier, - String leaseId, - ShareRootSquash rootSquash, - Boolean enableSnapshotVirtualDirectoryAccess) { + public Mono> setPropertiesWithResponseAsync(String shareName, + Integer timeout, Integer quota, ShareAccessTier accessTier, String leaseId, ShareRootSquash rootSquash, + Boolean enableSnapshotVirtualDirectoryAccess) { final String restype = "share"; final String comp = "properties"; final String accept = "application/xml"; - return FluxUtil.withContext( - context -> - service.setProperties( - this.client.getUrl(), - shareName, - restype, - comp, - timeout, - this.client.getVersion(), - quota, - accessTier, - leaseId, - rootSquash, - enableSnapshotVirtualDirectoryAccess, - accept, - context)); + return FluxUtil.withContext(context -> service.setProperties(this.client.getUrl(), shareName, restype, comp, + timeout, this.client.getVersion(), quota, accessTier, leaseId, rootSquash, + enableSnapshotVirtualDirectoryAccess, accept, context)); } /** @@ -3713,32 +3558,14 @@ public Mono> setPropertiesWithRes * @return the {@link ResponseBase} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> setPropertiesWithResponseAsync( - String shareName, - Integer timeout, - Integer quota, - ShareAccessTier accessTier, - String leaseId, - ShareRootSquash rootSquash, - Boolean enableSnapshotVirtualDirectoryAccess, - Context context) { + public Mono> setPropertiesWithResponseAsync(String shareName, + Integer timeout, Integer quota, ShareAccessTier accessTier, String leaseId, ShareRootSquash rootSquash, + Boolean enableSnapshotVirtualDirectoryAccess, Context context) { final String restype = "share"; final String comp = "properties"; final String accept = "application/xml"; - return service.setProperties( - this.client.getUrl(), - shareName, - restype, - comp, - timeout, - this.client.getVersion(), - quota, - accessTier, - leaseId, - rootSquash, - enableSnapshotVirtualDirectoryAccess, - accept, - context); + return service.setProperties(this.client.getUrl(), shareName, restype, comp, timeout, this.client.getVersion(), + quota, accessTier, leaseId, rootSquash, enableSnapshotVirtualDirectoryAccess, accept, context); } /** @@ -3759,23 +3586,10 @@ public Mono> setPropertiesWithRes * @return A {@link Mono} that completes when a successful response is received. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono setPropertiesAsync( - String shareName, - Integer timeout, - Integer quota, - ShareAccessTier accessTier, - String leaseId, - ShareRootSquash rootSquash, - Boolean enableSnapshotVirtualDirectoryAccess) { - return setPropertiesWithResponseAsync( - shareName, - timeout, - quota, - accessTier, - leaseId, - rootSquash, - enableSnapshotVirtualDirectoryAccess) - .flatMap(ignored -> Mono.empty()); + public Mono setPropertiesAsync(String shareName, Integer timeout, Integer quota, ShareAccessTier accessTier, + String leaseId, ShareRootSquash rootSquash, Boolean enableSnapshotVirtualDirectoryAccess) { + return setPropertiesWithResponseAsync(shareName, timeout, quota, accessTier, leaseId, rootSquash, + enableSnapshotVirtualDirectoryAccess).flatMap(ignored -> Mono.empty()); } /** @@ -3797,25 +3611,10 @@ public Mono setPropertiesAsync( * @return A {@link Mono} that completes when a successful response is received. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono setPropertiesAsync( - String shareName, - Integer timeout, - Integer quota, - ShareAccessTier accessTier, - String leaseId, - ShareRootSquash rootSquash, - Boolean enableSnapshotVirtualDirectoryAccess, - Context context) { - return setPropertiesWithResponseAsync( - shareName, - timeout, - quota, - accessTier, - leaseId, - rootSquash, - enableSnapshotVirtualDirectoryAccess, - context) - .flatMap(ignored -> Mono.empty()); + public Mono setPropertiesAsync(String shareName, Integer timeout, Integer quota, ShareAccessTier accessTier, + String leaseId, ShareRootSquash rootSquash, Boolean enableSnapshotVirtualDirectoryAccess, Context context) { + return setPropertiesWithResponseAsync(shareName, timeout, quota, accessTier, leaseId, rootSquash, + enableSnapshotVirtualDirectoryAccess, context).flatMap(ignored -> Mono.empty()); } /** @@ -3836,33 +3635,15 @@ public Mono setPropertiesAsync( * @return the {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> setPropertiesNoCustomHeadersWithResponseAsync( - String shareName, - Integer timeout, - Integer quota, - ShareAccessTier accessTier, - String leaseId, - ShareRootSquash rootSquash, - Boolean enableSnapshotVirtualDirectoryAccess) { + public Mono> setPropertiesNoCustomHeadersWithResponseAsync(String shareName, Integer timeout, + Integer quota, ShareAccessTier accessTier, String leaseId, ShareRootSquash rootSquash, + Boolean enableSnapshotVirtualDirectoryAccess) { final String restype = "share"; final String comp = "properties"; final String accept = "application/xml"; - return FluxUtil.withContext( - context -> - service.setPropertiesNoCustomHeaders( - this.client.getUrl(), - shareName, - restype, - comp, - timeout, - this.client.getVersion(), - quota, - accessTier, - leaseId, - rootSquash, - enableSnapshotVirtualDirectoryAccess, - accept, - context)); + return FluxUtil.withContext(context -> service.setPropertiesNoCustomHeaders(this.client.getUrl(), shareName, + restype, comp, timeout, this.client.getVersion(), quota, accessTier, leaseId, rootSquash, + enableSnapshotVirtualDirectoryAccess, accept, context)); } /** @@ -3884,32 +3665,15 @@ public Mono> setPropertiesNoCustomHeadersWithResponseAsync( * @return the {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> setPropertiesNoCustomHeadersWithResponseAsync( - String shareName, - Integer timeout, - Integer quota, - ShareAccessTier accessTier, - String leaseId, - ShareRootSquash rootSquash, - Boolean enableSnapshotVirtualDirectoryAccess, - Context context) { + public Mono> setPropertiesNoCustomHeadersWithResponseAsync(String shareName, Integer timeout, + Integer quota, ShareAccessTier accessTier, String leaseId, ShareRootSquash rootSquash, + Boolean enableSnapshotVirtualDirectoryAccess, Context context) { final String restype = "share"; final String comp = "properties"; final String accept = "application/xml"; - return service.setPropertiesNoCustomHeaders( - this.client.getUrl(), - shareName, - restype, - comp, - timeout, - this.client.getVersion(), - quota, - accessTier, - leaseId, - rootSquash, - enableSnapshotVirtualDirectoryAccess, - accept, - context); + return service.setPropertiesNoCustomHeaders(this.client.getUrl(), shareName, restype, comp, timeout, + this.client.getVersion(), quota, accessTier, leaseId, rootSquash, enableSnapshotVirtualDirectoryAccess, + accept, context); } /** diff --git a/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/implementation/models/SharePropertiesInternal.java b/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/implementation/models/SharePropertiesInternal.java index cd136f34127a9..35c0cbd10b0ed 100644 --- a/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/implementation/models/SharePropertiesInternal.java +++ b/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/implementation/models/SharePropertiesInternal.java @@ -120,7 +120,6 @@ public final class SharePropertiesInternal implements XmlSerializable getMetadata() { @@ -556,7 +555,7 @@ public Map getMetadata() { /** * Set the metadata property: Dictionary of <string>. - * + * * @param metadata the metadata value to set. * @return the SharePropertiesInternal object itself. */ @@ -606,7 +605,7 @@ public XmlWriter toXml(XmlWriter xmlWriter, String rootElementName) throws XMLSt /** * Reads an instance of SharePropertiesInternal from the XmlReader. - * + * * @param xmlReader The XmlReader being read. * @return An instance of SharePropertiesInternal if the XmlReader was pointing to an instance of it, or null if it * was pointing to XML null. @@ -619,7 +618,7 @@ public static SharePropertiesInternal fromXml(XmlReader xmlReader) throws XMLStr /** * Reads an instance of SharePropertiesInternal from the XmlReader. - * + * * @param xmlReader The XmlReader being read. * @param rootElementName Optional root element name to override the default defined by the model. Used to support * cases where the model can deserialize from different root element names. From 14b9a94b46885f34c60e2e28639d9619cdacfbb8 Mon Sep 17 00:00:00 2001 From: Isabelle <141270045+ibrandes@users.noreply.github.com> Date: Wed, 29 May 2024 15:03:46 -0700 Subject: [PATCH 09/17] STG94 Bearer Challenge Implementation (#39934) * bearer challenge implementation * making tests live only * style * queue changes and adding support for blobs * style * datalake implementation * blob recording * fileshare implementation pt1 * removing fileshare implementation * style * wip * file swagger changes and making nfs share work again * resolving some comments * adding comment and changing the parsing to how tables does it --- sdk/storage/azure-storage-blob/assets.json | 2 +- .../implementation/util/BuilderHelper.java | 4 +- .../com/azure/storage/blob/BlobApiTests.java | 15 +- .../azure/storage/blob/BlobAsyncApiTests.java | 20 +- .../azure/storage/blob/ContainerApiTests.java | 18 +- .../storage/blob/ContainerAsyncApiTests.java | 21 +- .../azure/storage/blob/ServiceApiTests.java | 19 +- .../storage/blob/ServiceAsyncApiTests.java | 22 +- .../blob/specialized/AppendBlobApiTests.java | 18 +- .../specialized/AppendBlobAsyncApiTests.java | 23 +- .../blob/specialized/BlockBlobApiTests.java | 17 +- .../specialized/BlockBlobAsyncApiTests.java | 22 +- .../blob/specialized/PageBlobApiTests.java | 18 +- .../specialized/PageBlobAsyncApiTests.java | 23 +- ...arerTokenChallengeAuthorizationPolicy.java | 120 ++++++ .../azure-storage-file-datalake/assets.json | 2 +- .../implementation/util/BuilderHelper.java | 4 +- .../file/datalake/DirectoryApiTests.java | 11 +- .../file/datalake/DirectoryAsyncApiTests.java | 14 +- .../storage/file/datalake/FileApiTest.java | 10 +- .../file/datalake/FileAsyncApiTests.java | 13 +- .../file/datalake/FileSystemApiTests.java | 12 +- .../datalake/FileSystemAsyncApiTests.java | 15 +- .../file/datalake/ServiceApiTests.java | 12 +- .../file/datalake/ServiceAsyncApiTests.java | 16 +- .../azure/storage/file/share/ShareClient.java | 6 +- .../share/implementation/DirectoriesImpl.java | 42 +- .../file/share/implementation/FilesImpl.java | 4 +- .../share/implementation/ServicesImpl.java | 56 ++- .../file/share/implementation/SharesImpl.java | 405 +++++++++--------- .../models/CopyFileSmbInfo.java | 78 +--- .../DestinationLeaseAccessConditions.java | 47 +- .../implementation/models/FileProperty.java | 4 +- .../models/SharePermission.java | 3 + .../models/SharePropertiesInternal.java | 93 ++-- .../models/ShareSignedIdentifierWrapper.java | 5 +- .../implementation/models/ShareStats.java | 3 +- .../models/SharesGetPropertiesHeaders.java | 114 ++--- .../models/SourceLeaseAccessConditions.java | 40 +- .../implementation/models/StorageError.java | 43 +- .../implementation/util/ModelHelper.java | 3 +- .../file/share/models/ShareCorsRule.java | 16 +- .../share/models/ShareFileHttpHeaders.java | 63 +-- .../file/share/models/ShareProperties.java | 4 +- .../share/models/ShareRetentionPolicy.java | 14 +- .../SourceModifiedAccessConditions.java | 44 +- .../file/share/FileServiceApiTests.java | 2 +- .../file/share/FileServiceAsyncApiTests.java | 3 +- .../storage/file/share/ShareApiTests.java | 8 +- .../file/share/ShareAsyncApiTests.java | 8 +- .../swagger/README.md | 4 +- sdk/storage/azure-storage-queue/assets.json | 2 +- .../implementation/util/BuilderHelper.java | 4 +- .../azure/storage/queue/QueueApiTests.java | 13 +- .../storage/queue/QueueAsyncApiTests.java | 17 +- .../storage/queue/QueueServiceApiTests.java | 12 +- .../queue/QueueServiceAsyncApiTests.java | 16 +- 57 files changed, 828 insertions(+), 819 deletions(-) create mode 100644 sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/policy/StorageBearerTokenChallengeAuthorizationPolicy.java diff --git a/sdk/storage/azure-storage-blob/assets.json b/sdk/storage/azure-storage-blob/assets.json index 16ac84f0df6a3..b3fc915e5e0b2 100644 --- a/sdk/storage/azure-storage-blob/assets.json +++ b/sdk/storage/azure-storage-blob/assets.json @@ -2,5 +2,5 @@ "AssetsRepo": "Azure/azure-sdk-assets", "AssetsRepoPrefixPath": "java", "TagPrefix": "java/storage/azure-storage-blob", - "Tag": "java/storage/azure-storage-blob_aacdd6d63e" + "Tag": "java/storage/azure-storage-blob_e9a4d152f3" } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/util/BuilderHelper.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/util/BuilderHelper.java index dc7166614bb5d..cf76dc72f4d5c 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/util/BuilderHelper.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/util/BuilderHelper.java @@ -13,7 +13,6 @@ import com.azure.core.http.policy.AddHeadersFromContextPolicy; import com.azure.core.http.policy.AddHeadersPolicy; import com.azure.core.http.policy.AzureSasCredentialPolicy; -import com.azure.core.http.policy.BearerTokenAuthenticationPolicy; import com.azure.core.http.policy.HttpLogOptions; import com.azure.core.http.policy.HttpLoggingPolicy; import com.azure.core.http.policy.HttpPipelinePolicy; @@ -38,6 +37,7 @@ import com.azure.storage.common.policy.RequestRetryOptions; import com.azure.storage.common.policy.ResponseValidationPolicyBuilder; import com.azure.storage.common.policy.ScrubEtagPolicy; +import com.azure.storage.common.policy.StorageBearerTokenChallengeAuthorizationPolicy; import com.azure.storage.common.policy.StorageSharedKeyCredentialPolicy; import java.net.MalformedURLException; @@ -123,7 +123,7 @@ public static HttpPipeline buildPipeline( String scope = audience != null ? ((audience.toString().endsWith("/") ? audience + ".default" : audience + "/.default")) : Constants.STORAGE_SCOPE; - credentialPolicy = new BearerTokenAuthenticationPolicy(tokenCredential, scope); + credentialPolicy = new StorageBearerTokenChallengeAuthorizationPolicy(tokenCredential, scope); } else if (azureSasCredential != null) { credentialPolicy = new AzureSasCredentialPolicy(azureSasCredential, false); } else if (sasToken != null) { diff --git a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/BlobApiTests.java b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/BlobApiTests.java index 5719f7d34782f..1bb75c462819b 100644 --- a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/BlobApiTests.java +++ b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/BlobApiTests.java @@ -3072,15 +3072,18 @@ public void storageAccountAudience() { assertTrue(aadBlob.exists()); } + @RequiredServiceVersion(clazz = BlobServiceVersion.class, min = "2024-08-04") + @LiveOnly @Test - public void audienceError() { - BlobClient aadBlob = instrument(new BlobClientBuilder().endpoint(bc.getBlobUrl()) - .credential(new MockTokenCredential()) - .audience(BlobAudience.createBlobServiceAccountAudience("badAudience"))) + /* This test tests if the bearer challenge is working properly. A bad audience is passed in, the service returns + the default audience, and the request gets retried with this default audience, making the call function as expected. + */ + public void audienceErrorBearerChallengeRetry() { + BlobClient aadBlob = getBlobClientBuilderWithTokenCredential(bc.getBlobUrl()) + .audience(BlobAudience.createBlobServiceAccountAudience("badAudience")) .buildClient(); - BlobStorageException e = assertThrows(BlobStorageException.class, aadBlob::exists); - assertTrue(e.getErrorCode() == BlobErrorCode.INVALID_AUTHENTICATION_INFO); + assertNotNull(aadBlob.getProperties()); } @Test diff --git a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/BlobAsyncApiTests.java b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/BlobAsyncApiTests.java index fd5ccabe557bb..84242a456bfe8 100644 --- a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/BlobAsyncApiTests.java +++ b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/BlobAsyncApiTests.java @@ -2821,18 +2821,20 @@ public void storageAccountAudience() { .verifyComplete(); } + @RequiredServiceVersion(clazz = BlobServiceVersion.class, min = "2024-08-04") + @LiveOnly @Test - public void audienceError() { - BlobAsyncClient aadBlob = instrument(new BlobClientBuilder().endpoint(bc.getBlobUrl()) - .credential(new MockTokenCredential()) - .audience(BlobAudience.createBlobServiceAccountAudience("badAudience"))) + /* This test tests if the bearer challenge is working properly. A bad audience is passed in, the service returns + the default audience, and the request gets retried with this default audience, making the call function as expected. + */ + public void audienceErrorBearerChallengeRetry() { + BlobAsyncClient aadBlob = getBlobClientBuilderWithTokenCredential(bc.getBlobUrl()) + .audience(BlobAudience.createBlobServiceAccountAudience("badAudience")) .buildAsyncClient(); - StepVerifier.create(aadBlob.exists()) - .verifyErrorSatisfies(r -> { - BlobStorageException e = assertInstanceOf(BlobStorageException.class, r); - assertTrue(e.getErrorCode() == BlobErrorCode.INVALID_AUTHENTICATION_INFO); - }); + StepVerifier.create(aadBlob.getProperties()) + .assertNext(r -> assertNotNull(r)) + .verifyComplete(); } @Test diff --git a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/ContainerApiTests.java b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/ContainerApiTests.java index 088270e5faa27..f58a1e4ece3d8 100644 --- a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/ContainerApiTests.java +++ b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/ContainerApiTests.java @@ -45,6 +45,7 @@ import com.azure.storage.common.Utility; import com.azure.storage.common.implementation.Constants; import com.azure.storage.common.test.shared.TestHttpClientType; +import com.azure.storage.common.test.shared.extensions.LiveOnly; import com.azure.storage.common.test.shared.extensions.PlaybackOnly; import com.azure.storage.common.test.shared.extensions.RequiredServiceVersion; import org.junit.jupiter.api.BeforeEach; @@ -1978,15 +1979,18 @@ public void storageAccountAudience() { assertTrue(aadContainer.exists()); } + @RequiredServiceVersion(clazz = BlobServiceVersion.class, min = "2024-08-04") + @LiveOnly @Test - public void audienceError() { - BlobContainerClient aadContainer = getContainerClientBuilder(cc.getBlobContainerUrl()) - .credential(new MockTokenCredential()) - .audience(BlobAudience.createBlobServiceAccountAudience("badAudience")) - .buildClient(); + /* This test tests if the bearer challenge is working properly. A bad audience is passed in, the service returns + the default audience, and the request gets retried with this default audience, making the call function as expected. + */ + public void audienceErrorBearerChallengeRetry() { + BlobContainerClient aadContainer = getContainerClientBuilderWithTokenCredential(cc.getBlobContainerUrl()) + .audience(BlobAudience.createBlobServiceAccountAudience("badAudience")) + .buildClient(); - BlobStorageException e = assertThrows(BlobStorageException.class, () -> aadContainer.exists()); - assertTrue(e.getErrorCode() == BlobErrorCode.INVALID_AUTHENTICATION_INFO); + assertNotNull(aadContainer.getProperties()); } @Test diff --git a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/ContainerAsyncApiTests.java b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/ContainerAsyncApiTests.java index 95b9816720fe1..bc56b852797c8 100644 --- a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/ContainerAsyncApiTests.java +++ b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/ContainerAsyncApiTests.java @@ -41,6 +41,7 @@ import com.azure.storage.blob.specialized.PageBlobAsyncClient; import com.azure.storage.common.implementation.Constants; import com.azure.storage.common.test.shared.TestHttpClientType; +import com.azure.storage.common.test.shared.extensions.LiveOnly; import com.azure.storage.common.test.shared.extensions.PlaybackOnly; import com.azure.storage.common.test.shared.extensions.RequiredServiceVersion; import org.junit.jupiter.api.BeforeEach; @@ -2101,18 +2102,20 @@ public void storageAccountAudience() { .expectNext(true); } + @RequiredServiceVersion(clazz = BlobServiceVersion.class, min = "2024-08-04") + @LiveOnly @Test - public void audienceError() { - BlobContainerAsyncClient aadContainer = getContainerClientBuilder(ccAsync.getBlobContainerUrl()) - .credential(new MockTokenCredential()) - .audience(BlobAudience.createBlobServiceAccountAudience("badAudience")) - .buildAsyncClient(); + /* This test tests if the bearer challenge is working properly. A bad audience is passed in, the service returns + the default audience, and the request gets retried with this default audience, making the call function as expected. + */ + public void audienceErrorBearerChallengeRetry() { + BlobContainerAsyncClient aadContainer = getContainerClientBuilderWithTokenCredential(ccAsync.getBlobContainerUrl()) + .audience(BlobAudience.createBlobServiceAccountAudience("badAudience")) + .buildAsyncClient(); StepVerifier.create(aadContainer.exists()) - .verifyErrorSatisfies(r -> { - BlobStorageException e = assertInstanceOf(BlobStorageException.class, r); - assertTrue(e.getErrorCode() == BlobErrorCode.INVALID_AUTHENTICATION_INFO); - }); + .assertNext(r -> assertNotNull(r)) + .verifyComplete(); } @Test diff --git a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/ServiceApiTests.java b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/ServiceApiTests.java index 013b7c066c98a..a2eca961da1c1 100644 --- a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/ServiceApiTests.java +++ b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/ServiceApiTests.java @@ -8,7 +8,6 @@ import com.azure.core.http.rest.PagedIterable; import com.azure.core.http.rest.PagedResponse; import com.azure.core.http.rest.Response; -import com.azure.core.test.utils.MockTokenCredential; import com.azure.core.util.Context; import com.azure.core.util.paging.ContinuablePage; import com.azure.identity.DefaultAzureCredentialBuilder; @@ -1141,16 +1140,18 @@ public void storageAccountAudience() { assertNotNull(aadService.getProperties()); } + @RequiredServiceVersion(clazz = BlobServiceVersion.class, min = "2024-08-04") + @LiveOnly @Test - public void audienceError() { - BlobServiceClient aadService = instrument(new BlobServiceClientBuilder() - .endpoint(cc.getBlobContainerUrl()) - .credential(new MockTokenCredential()) - .audience(BlobAudience.createBlobServiceAccountAudience("badAudience"))) - .buildClient(); + /* This test tests if the bearer challenge is working properly. A bad audience is passed in, the service returns + the default audience, and the request gets retried with this default audience, making the call function as expected. + */ + public void audienceErrorBearerChallengeRetry() { + BlobServiceClient aadService = getServiceClientBuilderWithTokenCredential(cc.getBlobContainerUrl()) + .audience(BlobAudience.createBlobServiceAccountAudience("badAudience")) + .buildClient(); - BlobStorageException e = assertThrows(BlobStorageException.class, () -> aadService.getProperties()); - assertTrue(e.getErrorCode() == BlobErrorCode.INVALID_AUTHENTICATION_INFO); + assertNotNull(aadService.getProperties()); } @Test diff --git a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/ServiceAsyncApiTests.java b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/ServiceAsyncApiTests.java index d4fd89589f128..840219785db51 100644 --- a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/ServiceAsyncApiTests.java +++ b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/ServiceAsyncApiTests.java @@ -7,7 +7,6 @@ import com.azure.core.http.rest.PagedResponse; import com.azure.core.http.rest.Response; import com.azure.core.test.TestMode; -import com.azure.core.test.utils.MockTokenCredential; import com.azure.core.util.Context; import com.azure.core.util.paging.ContinuablePage; import com.azure.identity.DefaultAzureCredentialBuilder; @@ -1204,19 +1203,20 @@ public void storageAccountAudience() { .verifyComplete(); } + @RequiredServiceVersion(clazz = BlobServiceVersion.class, min = "2024-08-04") + @LiveOnly @Test - public void audienceError() { - BlobServiceAsyncClient aadService = instrument(new BlobServiceClientBuilder() - .endpoint(ccAsync.getBlobContainerUrl()) - .credential(new MockTokenCredential()) - .audience(BlobAudience.createBlobServiceAccountAudience("badAudience"))) - .buildAsyncClient(); + /* This test tests if the bearer challenge is working properly. A bad audience is passed in, the service returns + the default audience, and the request gets retried with this default audience, making the call function as expected. + */ + public void audienceErrorBearerChallengeRetry() { + BlobServiceAsyncClient aadService = getServiceClientBuilderWithTokenCredential(ccAsync.getBlobContainerUrl()) + .audience(BlobAudience.createBlobServiceAccountAudience("badAudience")) + .buildAsyncClient(); StepVerifier.create(aadService.getProperties()) - .verifyErrorSatisfies(r -> { - BlobStorageException e = assertInstanceOf(BlobStorageException.class, r); - assertTrue(e.getErrorCode() == BlobErrorCode.INVALID_AUTHENTICATION_INFO); - }); + .assertNext(r -> assertNotNull(r)) + .verifyComplete(); } @Test diff --git a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/specialized/AppendBlobApiTests.java b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/specialized/AppendBlobApiTests.java index 85203874d6837..c767dc7828047 100644 --- a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/specialized/AppendBlobApiTests.java +++ b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/specialized/AppendBlobApiTests.java @@ -5,7 +5,6 @@ import com.azure.core.exception.UnexpectedLengthException; import com.azure.core.http.rest.Response; -import com.azure.core.test.utils.MockTokenCredential; import com.azure.core.test.utils.TestUtils; import com.azure.core.util.Context; import com.azure.storage.blob.BlobServiceVersion; @@ -25,6 +24,7 @@ import com.azure.storage.blob.sas.BlobContainerSasPermission; import com.azure.storage.blob.sas.BlobServiceSasSignatureValues; import com.azure.storage.common.implementation.Constants; +import com.azure.storage.common.test.shared.extensions.LiveOnly; import com.azure.storage.common.test.shared.extensions.RequiredServiceVersion; import com.azure.storage.common.test.shared.policy.TransientFailureInjectingHttpPipelinePolicy; import org.junit.jupiter.api.BeforeEach; @@ -851,16 +851,18 @@ public void storageAccountAudience() { assertTrue(aadBlob.exists()); } + @RequiredServiceVersion(clazz = BlobServiceVersion.class, min = "2024-08-04") + @LiveOnly @Test - public void audienceError() { - AppendBlobClient aadBlob = instrument(new SpecializedBlobClientBuilder() - .endpoint(bc.getBlobUrl()) - .credential(new MockTokenCredential()) - .audience(BlobAudience.createBlobServiceAccountAudience("badAudience"))) + /* This test tests if the bearer challenge is working properly. A bad audience is passed in, the service returns + the default audience, and the request gets retried with this default audience, making the call function as expected. + */ + public void audienceErrorBearerChallengeRetry() { + AppendBlobClient aadBlob = getSpecializedBuilderWithTokenCredential(bc.getBlobUrl()) + .audience(BlobAudience.createBlobServiceAccountAudience("badAudience")) .buildAppendBlobClient(); - BlobStorageException e = assertThrows(BlobStorageException.class, () -> aadBlob.exists()); - assertTrue(e.getErrorCode() == BlobErrorCode.INVALID_AUTHENTICATION_INFO); + assertNotNull(aadBlob.getProperties()); } @Test diff --git a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/specialized/AppendBlobAsyncApiTests.java b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/specialized/AppendBlobAsyncApiTests.java index 379dd795898a7..ab46ea9799da7 100644 --- a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/specialized/AppendBlobAsyncApiTests.java +++ b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/specialized/AppendBlobAsyncApiTests.java @@ -4,7 +4,6 @@ package com.azure.storage.blob.specialized; import com.azure.core.exception.UnexpectedLengthException; -import com.azure.core.test.utils.MockTokenCredential; import com.azure.core.test.utils.TestUtils; import com.azure.core.util.FluxUtil; import com.azure.storage.blob.BlobServiceVersion; @@ -22,6 +21,7 @@ import com.azure.storage.blob.sas.BlobSasPermission; import com.azure.storage.blob.sas.BlobServiceSasSignatureValues; import com.azure.storage.common.implementation.Constants; +import com.azure.storage.common.test.shared.extensions.LiveOnly; import com.azure.storage.common.test.shared.extensions.RequiredServiceVersion; import com.azure.storage.common.test.shared.policy.TransientFailureInjectingHttpPipelinePolicy; import org.junit.jupiter.api.BeforeEach; @@ -904,19 +904,20 @@ public void storageAccountAudience() { .verifyComplete(); } + @RequiredServiceVersion(clazz = BlobServiceVersion.class, min = "2024-08-04") + @LiveOnly @Test - public void audienceError() { - AppendBlobAsyncClient aadBlob = instrument(new SpecializedBlobClientBuilder() - .endpoint(bc.getBlobUrl()) - .credential(new MockTokenCredential()) - .audience(BlobAudience.createBlobServiceAccountAudience("badAudience"))) + /* This test tests if the bearer challenge is working properly. A bad audience is passed in, the service returns + the default audience, and the request gets retried with this default audience, making the call function as expected. + */ + public void audienceErrorBearerChallengeRetry() { + AppendBlobAsyncClient aadBlob = getSpecializedBuilderWithTokenCredential(bc.getBlobUrl()) + .audience(BlobAudience.createBlobServiceAccountAudience("badAudience")) .buildAppendBlobAsyncClient(); - StepVerifier.create(aadBlob.exists()) - .verifyErrorSatisfies(r -> { - BlobStorageException e = assertInstanceOf(BlobStorageException.class, r); - assertTrue(e.getErrorCode() == BlobErrorCode.INVALID_AUTHENTICATION_INFO); - }); + StepVerifier.create(aadBlob.getProperties()) + .assertNext(r -> assertNotNull(r)) + .verifyComplete(); } @Test diff --git a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/specialized/BlockBlobApiTests.java b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/specialized/BlockBlobApiTests.java index 163345d783441..b85eba84de576 100644 --- a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/specialized/BlockBlobApiTests.java +++ b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/specialized/BlockBlobApiTests.java @@ -7,7 +7,6 @@ import com.azure.core.http.HttpHeaderName; import com.azure.core.http.HttpHeaders; import com.azure.core.http.rest.Response; -import com.azure.core.test.utils.MockTokenCredential; import com.azure.core.test.utils.TestUtils; import com.azure.core.util.BinaryData; import com.azure.core.util.Context; @@ -1767,16 +1766,18 @@ public void storageAccountAudience() { assertTrue(aadBlob.exists()); } + @RequiredServiceVersion(clazz = BlobServiceVersion.class, min = "2024-08-04") + @LiveOnly @Test - public void audienceError() { - BlockBlobClient aadBlob = instrument(new SpecializedBlobClientBuilder() - .endpoint(blockBlobClient.getBlobUrl()) - .credential(new MockTokenCredential()) - .audience(BlobAudience.createBlobServiceAccountAudience("badAudience"))) + /* This test tests if the bearer challenge is working properly. A bad audience is passed in, the service returns + the default audience, and the request gets retried with this default audience, making the call function as expected. + */ + public void audienceErrorBearerChallengeRetry() { + BlockBlobClient aadBlob = getSpecializedBuilderWithTokenCredential(blockBlobClient.getBlobUrl()) + .audience(BlobAudience.createBlobServiceAccountAudience("badAudience")) .buildBlockBlobClient(); - BlobStorageException e = assertThrows(BlobStorageException.class, () -> aadBlob.exists()); - assertTrue(e.getErrorCode() == BlobErrorCode.INVALID_AUTHENTICATION_INFO); + assertNotNull(aadBlob.getProperties()); } @Test diff --git a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/specialized/BlockBlobAsyncApiTests.java b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/specialized/BlockBlobAsyncApiTests.java index 4ccf6834d1f60..c818b1ef527bd 100644 --- a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/specialized/BlockBlobAsyncApiTests.java +++ b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/specialized/BlockBlobAsyncApiTests.java @@ -12,7 +12,6 @@ import com.azure.core.http.policy.HttpPipelinePolicy; import com.azure.core.http.rest.Response; import com.azure.core.test.http.MockHttpResponse; -import com.azure.core.test.utils.MockTokenCredential; import com.azure.core.test.utils.TestUtils; import com.azure.core.util.BinaryData; import com.azure.core.util.FluxUtil; @@ -2650,19 +2649,20 @@ public void storageAccountAudience() { .verifyComplete(); } + @RequiredServiceVersion(clazz = BlobServiceVersion.class, min = "2024-08-04") + @LiveOnly @Test - public void audienceError() { - BlockBlobAsyncClient aadBlob = instrument(new SpecializedBlobClientBuilder() - .endpoint(blockBlobAsyncClient.getBlobUrl()) - .credential(new MockTokenCredential()) - .audience(BlobAudience.createBlobServiceAccountAudience("badAudience"))) + /* This test tests if the bearer challenge is working properly. A bad audience is passed in, the service returns + the default audience, and the request gets retried with this default audience, making the call function as expected. + */ + public void audienceErrorBearerChallengeRetry() { + BlockBlobAsyncClient aadBlob = getSpecializedBuilderWithTokenCredential(blockBlobAsyncClient.getBlobUrl()) + .audience(BlobAudience.createBlobServiceAccountAudience("badAudience")) .buildBlockBlobAsyncClient(); - StepVerifier.create(aadBlob.exists()) - .verifyErrorSatisfies(r -> { - BlobStorageException e = assertInstanceOf(BlobStorageException.class, r); - assertTrue(e.getErrorCode() == BlobErrorCode.INVALID_AUTHENTICATION_INFO); - }); + StepVerifier.create(aadBlob.getProperties()) + .assertNext(r -> assertNotNull(r)) + .verifyComplete(); } @Test diff --git a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/specialized/PageBlobApiTests.java b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/specialized/PageBlobApiTests.java index 881c16ab7f8dc..d5f5e15566786 100644 --- a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/specialized/PageBlobApiTests.java +++ b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/specialized/PageBlobApiTests.java @@ -7,7 +7,6 @@ import com.azure.core.http.HttpRange; import com.azure.core.http.rest.PagedResponse; import com.azure.core.http.rest.Response; -import com.azure.core.test.utils.MockTokenCredential; import com.azure.core.test.utils.TestUtils; import com.azure.core.util.CoreUtils; import com.azure.storage.blob.BlobClient; @@ -39,6 +38,7 @@ import com.azure.storage.blob.sas.BlobContainerSasPermission; import com.azure.storage.blob.sas.BlobServiceSasSignatureValues; import com.azure.storage.common.implementation.Constants; +import com.azure.storage.common.test.shared.extensions.LiveOnly; import com.azure.storage.common.test.shared.extensions.RequiredServiceVersion; import com.azure.storage.common.test.shared.policy.TransientFailureInjectingHttpPipelinePolicy; import org.junit.jupiter.api.BeforeEach; @@ -1704,16 +1704,18 @@ public void storageAccountAudience() { assertTrue(aadBlob.exists()); } + @RequiredServiceVersion(clazz = BlobServiceVersion.class, min = "2024-08-04") + @LiveOnly @Test - public void audienceError() { - PageBlobClient aadBlob = instrument(new SpecializedBlobClientBuilder() - .endpoint(bc.getBlobUrl()) - .credential(new MockTokenCredential()) - .audience(BlobAudience.createBlobServiceAccountAudience("badAudience"))) + /* This test tests if the bearer challenge is working properly. A bad audience is passed in, the service returns + the default audience, and the request gets retried with this default audience, making the call function as expected. + */ + public void audienceErrorBearerChallengeRetry() { + PageBlobClient aadBlob = getSpecializedBuilderWithTokenCredential(bc.getBlobUrl()) + .audience(BlobAudience.createBlobServiceAccountAudience("badAudience")) .buildPageBlobClient(); - BlobStorageException e = assertThrows(BlobStorageException.class, () -> aadBlob.exists()); - assertTrue(e.getErrorCode() == BlobErrorCode.INVALID_AUTHENTICATION_INFO); + assertNotNull(aadBlob.getProperties()); } @Test diff --git a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/specialized/PageBlobAsyncApiTests.java b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/specialized/PageBlobAsyncApiTests.java index 2ca3029a475ba..0fb4289b76e0e 100644 --- a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/specialized/PageBlobAsyncApiTests.java +++ b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/specialized/PageBlobAsyncApiTests.java @@ -6,7 +6,6 @@ import com.azure.core.exception.UnexpectedLengthException; import com.azure.core.http.HttpRange; import com.azure.core.http.rest.Response; -import com.azure.core.test.utils.MockTokenCredential; import com.azure.core.test.utils.TestUtils; import com.azure.core.util.CoreUtils; import com.azure.core.util.FluxUtil; @@ -34,6 +33,7 @@ import com.azure.storage.blob.sas.BlobSasPermission; import com.azure.storage.blob.sas.BlobServiceSasSignatureValues; import com.azure.storage.common.implementation.Constants; +import com.azure.storage.common.test.shared.extensions.LiveOnly; import com.azure.storage.common.test.shared.extensions.RequiredServiceVersion; import com.azure.storage.common.test.shared.policy.TransientFailureInjectingHttpPipelinePolicy; import org.junit.jupiter.api.BeforeEach; @@ -1677,19 +1677,20 @@ public void storageAccountAudience() { .verifyComplete(); } + @RequiredServiceVersion(clazz = BlobServiceVersion.class, min = "2024-08-04") + @LiveOnly @Test - public void audienceError() { - PageBlobAsyncClient aadBlob = instrument(new SpecializedBlobClientBuilder() - .endpoint(bc.getBlobUrl()) - .credential(new MockTokenCredential()) - .audience(BlobAudience.createBlobServiceAccountAudience("badAudience"))) + /* This test tests if the bearer challenge is working properly. A bad audience is passed in, the service returns + the default audience, and the request gets retried with this default audience, making the call function as expected. + */ + public void audienceErrorBearerChallengeRetry() { + PageBlobAsyncClient aadBlob = getSpecializedBuilderWithTokenCredential(bc.getBlobUrl()) + .audience(BlobAudience.createBlobServiceAccountAudience("badAudience")) .buildPageBlobAsyncClient(); - StepVerifier.create(aadBlob.exists()) - .verifyErrorSatisfies(r -> { - BlobStorageException e = assertInstanceOf(BlobStorageException.class, r); - assertTrue(e.getErrorCode() == BlobErrorCode.INVALID_AUTHENTICATION_INFO); - }); + StepVerifier.create(aadBlob.getProperties()) + .assertNext(r -> assertNotNull(r)) + .verifyComplete(); } @Test diff --git a/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/policy/StorageBearerTokenChallengeAuthorizationPolicy.java b/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/policy/StorageBearerTokenChallengeAuthorizationPolicy.java new file mode 100644 index 0000000000000..cba7a41b9c066 --- /dev/null +++ b/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/policy/StorageBearerTokenChallengeAuthorizationPolicy.java @@ -0,0 +1,120 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.storage.common.policy; + +import com.azure.core.credential.TokenCredential; +import com.azure.core.credential.TokenRequestContext; +import com.azure.core.http.HttpHeaderName; +import com.azure.core.http.HttpPipelineCallContext; +import com.azure.core.http.HttpResponse; +import com.azure.core.http.policy.BearerTokenAuthenticationPolicy; +import com.azure.core.util.CoreUtils; +import reactor.core.publisher.Mono; + +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import java.util.Locale; + +/** + * The storage authorization policy which supports challenge. + */ +public class StorageBearerTokenChallengeAuthorizationPolicy extends BearerTokenAuthenticationPolicy { + + private static final String DEFAULT_SCOPE = "/.default"; + private static final String BEARER_TOKEN_PREFIX = "Bearer "; + + private String[] scopes; + + /** + * Creates StorageBearerTokenChallengeAuthorizationPolicy. + * + * @param credential the token credential to authenticate the request + * @param scopes the scopes used in credential, using default scopes when empty + */ + public StorageBearerTokenChallengeAuthorizationPolicy(TokenCredential credential, String... scopes) { + super(credential, scopes); + this.scopes = scopes; + } + + @Override + public Mono authorizeRequest(HttpPipelineCallContext context) { + String[] scopes = this.scopes; + scopes = getScopes(context, scopes); + if (scopes == null) { + return Mono.empty(); + } else { + return setAuthorizationHeader(context, new TokenRequestContext().addScopes(scopes)); + } + } + + @Override + public void authorizeRequestSync(HttpPipelineCallContext context) { + String[] scopes = this.scopes; + scopes = getScopes(context, scopes); + + if (scopes != null) { + setAuthorizationHeaderSync(context, new TokenRequestContext().addScopes(scopes)); + } + } + + @Override + public Mono authorizeRequestOnChallenge(HttpPipelineCallContext context, HttpResponse response) { + String authHeader = response.getHeaderValue(HttpHeaderName.WWW_AUTHENTICATE); + Map challenges = extractChallengeAttributes(authHeader, BEARER_TOKEN_PREFIX); + + String scope = challenges.get("resource_id="); + if (scope != null) { + scope += DEFAULT_SCOPE; + scopes = new String[] { scope }; + scopes = getScopes(context, scopes); + return setAuthorizationHeader(context, new TokenRequestContext().addScopes(scopes)).thenReturn(true); + } + return Mono.just(false); + } + + @Override + public boolean authorizeRequestOnChallengeSync(HttpPipelineCallContext context, HttpResponse response) { + String authHeader = response.getHeaderValue(HttpHeaderName.WWW_AUTHENTICATE); + Map challenges = extractChallengeAttributes(authHeader, BEARER_TOKEN_PREFIX); + + String scope = challenges.get("resource_id"); + if (scope != null) { + scope += DEFAULT_SCOPE; + scopes = new String[] { scope }; + scopes = getScopes(context, scopes); + setAuthorizationHeaderSync(context, new TokenRequestContext().addScopes(scopes)); + return true; + } + return false; + } + + String[] getScopes(HttpPipelineCallContext context, String[] scopes) { + return CoreUtils.clone(scopes); + } + + Map extractChallengeAttributes(String header, String authChallengePrefix) { + if (!isBearerChallenge(header, authChallengePrefix)) { + return Collections.emptyMap(); + } + + header = header.toLowerCase(Locale.ROOT).replace(authChallengePrefix.toLowerCase(Locale.ROOT), ""); + + String[] attributes = header.split(" "); + Map attributeMap = new HashMap<>(); + + for (String pair : attributes) { + String[] keyValue = pair.split("="); + + attributeMap.put(keyValue[0].replaceAll("\"", ""), keyValue[1].replaceAll("\"", "")); + } + + return attributeMap; + } + + static boolean isBearerChallenge(String authenticateHeader, String authChallengePrefix) { + return (!CoreUtils.isNullOrEmpty(authenticateHeader) + && authenticateHeader.toLowerCase(Locale.ROOT).startsWith(authChallengePrefix.toLowerCase(Locale.ROOT))); + } +} diff --git a/sdk/storage/azure-storage-file-datalake/assets.json b/sdk/storage/azure-storage-file-datalake/assets.json index 838392a031ec8..32feb87474848 100644 --- a/sdk/storage/azure-storage-file-datalake/assets.json +++ b/sdk/storage/azure-storage-file-datalake/assets.json @@ -2,5 +2,5 @@ "AssetsRepo": "Azure/azure-sdk-assets", "AssetsRepoPrefixPath": "java", "TagPrefix": "java/storage/azure-storage-file-datalake", - "Tag": "java/storage/azure-storage-file-datalake_b6c1c0cf73" + "Tag": "java/storage/azure-storage-file-datalake_7c49e6e39d" } diff --git a/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/implementation/util/BuilderHelper.java b/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/implementation/util/BuilderHelper.java index 47b064437f067..f8cd73d74fa99 100644 --- a/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/implementation/util/BuilderHelper.java +++ b/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/implementation/util/BuilderHelper.java @@ -14,7 +14,6 @@ import com.azure.core.http.policy.AddHeadersFromContextPolicy; import com.azure.core.http.policy.AddHeadersPolicy; import com.azure.core.http.policy.AzureSasCredentialPolicy; -import com.azure.core.http.policy.BearerTokenAuthenticationPolicy; import com.azure.core.http.policy.HttpLogOptions; import com.azure.core.http.policy.HttpLoggingPolicy; import com.azure.core.http.policy.HttpPipelinePolicy; @@ -41,6 +40,7 @@ import com.azure.storage.common.policy.RequestRetryOptions; import com.azure.storage.common.policy.ResponseValidationPolicyBuilder; import com.azure.storage.common.policy.ScrubEtagPolicy; +import com.azure.storage.common.policy.StorageBearerTokenChallengeAuthorizationPolicy; import com.azure.storage.common.policy.StorageSharedKeyCredentialPolicy; import com.azure.storage.file.datalake.models.DataLakeAudience; @@ -128,7 +128,7 @@ public static HttpPipeline buildPipeline( String scope = audience != null ? ((audience.toString().endsWith("/") ? audience + ".default" : audience + "/.default")) : Constants.STORAGE_SCOPE; - credentialPolicy = new BearerTokenAuthenticationPolicy(tokenCredential, scope); + credentialPolicy = new StorageBearerTokenChallengeAuthorizationPolicy(tokenCredential, scope); } else if (azureSasCredential != null) { credentialPolicy = new AzureSasCredentialPolicy(azureSasCredential, false); } else { diff --git a/sdk/storage/azure-storage-file-datalake/src/test/java/com/azure/storage/file/datalake/DirectoryApiTests.java b/sdk/storage/azure-storage-file-datalake/src/test/java/com/azure/storage/file/datalake/DirectoryApiTests.java index 8c49534422a5b..77526ae7d9978 100644 --- a/sdk/storage/azure-storage-file-datalake/src/test/java/com/azure/storage/file/datalake/DirectoryApiTests.java +++ b/sdk/storage/azure-storage-file-datalake/src/test/java/com/azure/storage/file/datalake/DirectoryApiTests.java @@ -22,6 +22,7 @@ import com.azure.storage.common.sas.AccountSasResourceType; import com.azure.storage.common.sas.AccountSasService; import com.azure.storage.common.sas.AccountSasSignatureValues; +import com.azure.storage.common.test.shared.extensions.LiveOnly; import com.azure.storage.common.test.shared.extensions.RequiredServiceVersion; import com.azure.storage.file.datalake.implementation.util.DataLakeImplUtils; import com.azure.storage.file.datalake.models.AccessControlChangeCounters; @@ -3439,16 +3440,20 @@ public void storageAccountAudience() { assertTrue(aadDirClient.exists()); } + @RequiredServiceVersion(clazz = DataLakeServiceVersion.class, min = "2024-08-04") + @LiveOnly @Test - public void audienceError() { + /* This test tests if the bearer challenge is working properly. A bad audience is passed in, the service returns + the default audience, and the request gets retried with this default audience, making the call function as expected. + */ + public void audienceErrorBearerChallengeRetry() { DataLakeDirectoryClient aadDirClient = getPathClientBuilderWithTokenCredential( ENVIRONMENT.getDataLakeAccount().getDataLakeEndpoint(), dc.getDirectoryPath()) .fileSystemName(dataLakeFileSystemClient.getFileSystemName()) .audience(DataLakeAudience.createDataLakeServiceAccountAudience("badAudience")) .buildDirectoryClient(); - DataLakeStorageException e = assertThrows(DataLakeStorageException.class, aadDirClient::exists); - assertEquals(BlobErrorCode.INVALID_AUTHENTICATION_INFO.toString(), e.getErrorCode()); + assertTrue(aadDirClient.exists()); } @Test diff --git a/sdk/storage/azure-storage-file-datalake/src/test/java/com/azure/storage/file/datalake/DirectoryAsyncApiTests.java b/sdk/storage/azure-storage-file-datalake/src/test/java/com/azure/storage/file/datalake/DirectoryAsyncApiTests.java index 94a9755168c85..c6d964a90c627 100644 --- a/sdk/storage/azure-storage-file-datalake/src/test/java/com/azure/storage/file/datalake/DirectoryAsyncApiTests.java +++ b/sdk/storage/azure-storage-file-datalake/src/test/java/com/azure/storage/file/datalake/DirectoryAsyncApiTests.java @@ -20,6 +20,7 @@ import com.azure.storage.common.sas.AccountSasResourceType; import com.azure.storage.common.sas.AccountSasService; import com.azure.storage.common.sas.AccountSasSignatureValues; +import com.azure.storage.common.test.shared.extensions.LiveOnly; import com.azure.storage.common.test.shared.extensions.RequiredServiceVersion; import com.azure.storage.file.datalake.models.AccessControlChangeFailure; import com.azure.storage.file.datalake.models.AccessControlChangeResult; @@ -4141,8 +4142,13 @@ public void storageAccountAudience() { .verifyComplete(); } + @RequiredServiceVersion(clazz = DataLakeServiceVersion.class, min = "2024-08-04") + @LiveOnly @Test - public void audienceError() { + /* This test tests if the bearer challenge is working properly. A bad audience is passed in, the service returns + the default audience, and the request gets retried with this default audience, making the call function as expected. + */ + public void audienceErrorBearerChallengeRetry() { DataLakeDirectoryAsyncClient aadDirClient = getPathClientBuilderWithTokenCredential( ENVIRONMENT.getDataLakeAccount().getDataLakeEndpoint(), dc.getDirectoryPath()) .fileSystemName(dataLakeFileSystemAsyncClient.getFileSystemName()) @@ -4150,10 +4156,8 @@ public void audienceError() { .buildDirectoryAsyncClient(); StepVerifier.create(aadDirClient.exists()) - .verifyErrorSatisfies(r -> { - DataLakeStorageException e = assertInstanceOf(DataLakeStorageException.class, r); - assertEquals(BlobErrorCode.INVALID_AUTHENTICATION_INFO.toString(), e.getErrorCode()); - }); + .expectNext(true) + .verifyComplete(); } @Test diff --git a/sdk/storage/azure-storage-file-datalake/src/test/java/com/azure/storage/file/datalake/FileApiTest.java b/sdk/storage/azure-storage-file-datalake/src/test/java/com/azure/storage/file/datalake/FileApiTest.java index f4b3b982ecad2..3dbcf6acb5617 100644 --- a/sdk/storage/azure-storage-file-datalake/src/test/java/com/azure/storage/file/datalake/FileApiTest.java +++ b/sdk/storage/azure-storage-file-datalake/src/test/java/com/azure/storage/file/datalake/FileApiTest.java @@ -3382,16 +3382,20 @@ public void storageAccountAudience() { assertTrue(aadFileClient.exists()); } + @RequiredServiceVersion(clazz = DataLakeServiceVersion.class, min = "2024-08-04") + @LiveOnly @Test - public void audienceError() { + /* This test tests if the bearer challenge is working properly. A bad audience is passed in, the service returns + the default audience, and the request gets retried with this default audience, making the call function as expected. + */ + public void audienceErrorBearerChallengeRetry() { DataLakeFileClient aadFileClient = getPathClientBuilderWithTokenCredential( ENVIRONMENT.getDataLakeAccount().getDataLakeEndpoint(), fc.getFilePath()) .fileSystemName(dataLakeFileSystemClient.getFileSystemName()) .audience(DataLakeAudience.createDataLakeServiceAccountAudience("badAudience")) .buildFileClient(); - DataLakeStorageException e = assertThrows(DataLakeStorageException.class, aadFileClient::exists); - assertEquals(BlobErrorCode.INVALID_AUTHENTICATION_INFO.toString(), e.getErrorCode()); + assertTrue(aadFileClient.exists()); } @Test diff --git a/sdk/storage/azure-storage-file-datalake/src/test/java/com/azure/storage/file/datalake/FileAsyncApiTests.java b/sdk/storage/azure-storage-file-datalake/src/test/java/com/azure/storage/file/datalake/FileAsyncApiTests.java index 510878bf9e400..10b2056879223 100644 --- a/sdk/storage/azure-storage-file-datalake/src/test/java/com/azure/storage/file/datalake/FileAsyncApiTests.java +++ b/sdk/storage/azure-storage-file-datalake/src/test/java/com/azure/storage/file/datalake/FileAsyncApiTests.java @@ -4594,8 +4594,13 @@ public void storageAccountAudience() { .verifyComplete(); } + @RequiredServiceVersion(clazz = DataLakeServiceVersion.class, min = "2024-08-04") + @LiveOnly @Test - public void audienceError() { + /* This test tests if the bearer challenge is working properly. A bad audience is passed in, the service returns + the default audience, and the request gets retried with this default audience, making the call function as expected. + */ + public void audienceErrorBearerChallengeRetry() { DataLakeFileAsyncClient aadFileClient = getPathClientBuilderWithTokenCredential( ENVIRONMENT.getDataLakeAccount().getDataLakeEndpoint(), fc.getFilePath()) .fileSystemName(dataLakeFileSystemAsyncClient.getFileSystemName()) @@ -4603,10 +4608,8 @@ public void audienceError() { .buildFileAsyncClient(); StepVerifier.create(aadFileClient.exists()) - .verifyErrorSatisfies(r -> { - DataLakeStorageException e = assertInstanceOf(DataLakeStorageException.class, r); - assertEquals(BlobErrorCode.INVALID_AUTHENTICATION_INFO.toString(), e.getErrorCode()); - }); + .expectNext(true) + .verifyComplete(); } @Test diff --git a/sdk/storage/azure-storage-file-datalake/src/test/java/com/azure/storage/file/datalake/FileSystemApiTests.java b/sdk/storage/azure-storage-file-datalake/src/test/java/com/azure/storage/file/datalake/FileSystemApiTests.java index 34828afa616a4..528c87aa10fac 100644 --- a/sdk/storage/azure-storage-file-datalake/src/test/java/com/azure/storage/file/datalake/FileSystemApiTests.java +++ b/sdk/storage/azure-storage-file-datalake/src/test/java/com/azure/storage/file/datalake/FileSystemApiTests.java @@ -11,6 +11,7 @@ import com.azure.storage.blob.BlobUrlParts; import com.azure.storage.blob.models.BlobErrorCode; import com.azure.storage.common.test.shared.TestHttpClientType; +import com.azure.storage.common.test.shared.extensions.LiveOnly; import com.azure.storage.common.test.shared.extensions.RequiredServiceVersion; import com.azure.storage.file.datalake.models.DataLakeAccessPolicy; import com.azure.storage.file.datalake.models.DataLakeAudience; @@ -2294,15 +2295,20 @@ public void storageAccountAudience() { assertTrue(aadFsClient.exists()); } + @RequiredServiceVersion(clazz = DataLakeServiceVersion.class, min = "2024-08-04") + @LiveOnly @Test - public void audienceError() { + /* This test tests if the bearer challenge is working properly. A bad audience is passed in, the service returns + the default audience, and the request gets retried with this default audience, making the call function as expected. + */ + public void audienceErrorBearerChallengeRetry() { DataLakeFileSystemClient aadFsClient = getFileSystemClientBuilderWithTokenCredential(ENVIRONMENT.getDataLakeAccount().getDataLakeEndpoint()) + .fileSystemName(dataLakeFileSystemClient.getFileSystemName()) .audience(DataLakeAudience.createDataLakeServiceAccountAudience("badAudience")) .buildClient(); - DataLakeStorageException e = assertThrows(DataLakeStorageException.class, aadFsClient::exists); - assertEquals(BlobErrorCode.INVALID_AUTHENTICATION_INFO.toString(), e.getErrorCode()); + assertTrue(aadFsClient.exists()); } @Test diff --git a/sdk/storage/azure-storage-file-datalake/src/test/java/com/azure/storage/file/datalake/FileSystemAsyncApiTests.java b/sdk/storage/azure-storage-file-datalake/src/test/java/com/azure/storage/file/datalake/FileSystemAsyncApiTests.java index 43ca6eea44903..32fcf2b466ea5 100644 --- a/sdk/storage/azure-storage-file-datalake/src/test/java/com/azure/storage/file/datalake/FileSystemAsyncApiTests.java +++ b/sdk/storage/azure-storage-file-datalake/src/test/java/com/azure/storage/file/datalake/FileSystemAsyncApiTests.java @@ -10,6 +10,7 @@ import com.azure.storage.blob.BlobUrlParts; import com.azure.storage.blob.models.BlobErrorCode; import com.azure.storage.common.test.shared.TestHttpClientType; +import com.azure.storage.common.test.shared.extensions.LiveOnly; import com.azure.storage.common.test.shared.extensions.RequiredServiceVersion; import com.azure.storage.file.datalake.models.DataLakeAccessPolicy; import com.azure.storage.file.datalake.models.DataLakeAudience; @@ -2676,18 +2677,22 @@ public void storageAccountAudience() { .verifyComplete(); } + @RequiredServiceVersion(clazz = DataLakeServiceVersion.class, min = "2024-08-04") + @LiveOnly @Test - public void audienceError() { + /* This test tests if the bearer challenge is working properly. A bad audience is passed in, the service returns + the default audience, and the request gets retried with this default audience, making the call function as expected. + */ + public void audienceErrorBearerChallengeRetry() { DataLakeFileSystemAsyncClient aadFsClient = getFileSystemClientBuilderWithTokenCredential(ENVIRONMENT.getDataLakeAccount().getDataLakeEndpoint()) + .fileSystemName(dataLakeFileSystemAsyncClient.getFileSystemName()) .audience(DataLakeAudience.createDataLakeServiceAccountAudience("badAudience")) .buildAsyncClient(); StepVerifier.create(aadFsClient.exists()) - .verifyErrorSatisfies(r -> { - DataLakeStorageException e = assertInstanceOf(DataLakeStorageException.class, r); - assertEquals(BlobErrorCode.INVALID_AUTHENTICATION_INFO.toString(), e.getErrorCode()); - }); + .expectNext(true) + .verifyComplete(); } @Test diff --git a/sdk/storage/azure-storage-file-datalake/src/test/java/com/azure/storage/file/datalake/ServiceApiTests.java b/sdk/storage/azure-storage-file-datalake/src/test/java/com/azure/storage/file/datalake/ServiceApiTests.java index 2863bdec94df1..d0fd45d344c41 100644 --- a/sdk/storage/azure-storage-file-datalake/src/test/java/com/azure/storage/file/datalake/ServiceApiTests.java +++ b/sdk/storage/azure-storage-file-datalake/src/test/java/com/azure/storage/file/datalake/ServiceApiTests.java @@ -11,12 +11,12 @@ import com.azure.identity.DefaultAzureCredentialBuilder; import com.azure.storage.blob.BlobContainerClient; import com.azure.storage.blob.BlobUrlParts; -import com.azure.storage.blob.models.BlobErrorCode; import com.azure.storage.common.ParallelTransferOptions; import com.azure.storage.common.sas.AccountSasPermission; import com.azure.storage.common.sas.AccountSasResourceType; import com.azure.storage.common.sas.AccountSasService; import com.azure.storage.common.sas.AccountSasSignatureValues; +import com.azure.storage.common.test.shared.extensions.LiveOnly; import com.azure.storage.common.test.shared.extensions.RequiredServiceVersion; import com.azure.storage.file.datalake.models.DataLakeAnalyticsLogging; import com.azure.storage.file.datalake.models.DataLakeAudience; @@ -715,14 +715,18 @@ public void storageAccountAudience() { assertNotNull(aadServiceClient.getProperties()); } + @RequiredServiceVersion(clazz = DataLakeServiceVersion.class, min = "2024-08-04") + @LiveOnly @Test - public void audienceError() { + /* This test tests if the bearer challenge is working properly. A bad audience is passed in, the service returns + the default audience, and the request gets retried with this default audience, making the call function as expected. + */ + public void audienceErrorBearerChallengeRetry() { DataLakeServiceClient aadServiceClient = getOAuthServiceClientBuilder() .audience(DataLakeAudience.createDataLakeServiceAccountAudience("badAudience")) .buildClient(); - DataLakeStorageException e = assertThrows(DataLakeStorageException.class, aadServiceClient::getProperties); - assertEquals(BlobErrorCode.INVALID_AUTHENTICATION_INFO.toString(), e.getErrorCode()); + assertNotNull(aadServiceClient.getProperties()); } @Test diff --git a/sdk/storage/azure-storage-file-datalake/src/test/java/com/azure/storage/file/datalake/ServiceAsyncApiTests.java b/sdk/storage/azure-storage-file-datalake/src/test/java/com/azure/storage/file/datalake/ServiceAsyncApiTests.java index 382e8a2fdc6be..83d3dd00d4802 100644 --- a/sdk/storage/azure-storage-file-datalake/src/test/java/com/azure/storage/file/datalake/ServiceAsyncApiTests.java +++ b/sdk/storage/azure-storage-file-datalake/src/test/java/com/azure/storage/file/datalake/ServiceAsyncApiTests.java @@ -8,12 +8,12 @@ import com.azure.identity.DefaultAzureCredentialBuilder; import com.azure.storage.blob.BlobContainerClient; import com.azure.storage.blob.BlobUrlParts; -import com.azure.storage.blob.models.BlobErrorCode; import com.azure.storage.common.ParallelTransferOptions; import com.azure.storage.common.sas.AccountSasPermission; import com.azure.storage.common.sas.AccountSasResourceType; import com.azure.storage.common.sas.AccountSasService; import com.azure.storage.common.sas.AccountSasSignatureValues; +import com.azure.storage.common.test.shared.extensions.LiveOnly; import com.azure.storage.common.test.shared.extensions.RequiredServiceVersion; import com.azure.storage.file.datalake.models.DataLakeAnalyticsLogging; import com.azure.storage.file.datalake.models.DataLakeAudience; @@ -55,7 +55,6 @@ import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; -import static org.junit.jupiter.api.Assertions.assertInstanceOf; import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertNull; import static org.junit.jupiter.api.Assertions.assertThrows; @@ -709,17 +708,20 @@ public void storageAccountAudience() { .verifyComplete(); } + @RequiredServiceVersion(clazz = DataLakeServiceVersion.class, min = "2024-08-04") + @LiveOnly @Test - public void audienceError() { + /* This test tests if the bearer challenge is working properly. A bad audience is passed in, the service returns + the default audience, and the request gets retried with this default audience, making the call function as expected. + */ + public void audienceErrorBearerChallengeRetry() { DataLakeServiceAsyncClient aadServiceClient = getOAuthServiceClientBuilder() .audience(DataLakeAudience.createDataLakeServiceAccountAudience("badAudience")) .buildAsyncClient(); StepVerifier.create(aadServiceClient.getProperties()) - .verifyErrorSatisfies(r -> { - DataLakeStorageException e = assertInstanceOf(DataLakeStorageException.class, r); - assertEquals(BlobErrorCode.INVALID_AUTHENTICATION_INFO.toString(), e.getErrorCode()); - }); + .assertNext(Assertions::assertNotNull) + .verifyComplete(); } @Test diff --git a/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/ShareClient.java b/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/ShareClient.java index a0fe7c77b57ce..6b1c5aac4253b 100644 --- a/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/ShareClient.java +++ b/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/ShareClient.java @@ -361,7 +361,8 @@ public Response createWithResponse(ShareCreateOptions options, Durati String finalEnabledProtocol = "".equals(enabledProtocol) ? null : enabledProtocol; Callable> operation = () -> azureFileStorageClient.getShares() .createWithResponse(shareName, null, finalOptions.getMetadata(), finalOptions.getQuotaInGb(), - finalOptions.getAccessTier(), finalEnabledProtocol, finalOptions.getRootSquash(), finalContext); + finalOptions.getAccessTier(), finalEnabledProtocol, finalOptions.getRootSquash(), + finalOptions.isSnapshotVirtualDirectoryAccessEnabled(), finalContext); ResponseBase response = StorageImplUtils.sendRequest(operation, timeout, ShareStorageException.class); @@ -886,7 +887,8 @@ public Response setPropertiesWithResponse(ShareSetPropertiesOptions o Callable> operation = () -> this.azureFileStorageClient.getShares().setPropertiesWithResponse(shareName, null, options.getQuotaInGb(), - options.getAccessTier(), requestConditions.getLeaseId(), options.getRootSquash(), finalContext); + options.getAccessTier(), requestConditions.getLeaseId(), options.getRootSquash(), + options.isSnapshotVirtualDirectoryAccessEnabled(), finalContext); ResponseBase response = StorageImplUtils.sendRequest(operation, timeout, ShareStorageException.class); return ModelHelper.mapToShareInfoResponse(response); diff --git a/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/implementation/DirectoriesImpl.java b/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/implementation/DirectoriesImpl.java index b017ac7b1c0f9..ee5ef0bc64fb1 100644 --- a/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/implementation/DirectoriesImpl.java +++ b/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/implementation/DirectoriesImpl.java @@ -1919,8 +1919,11 @@ public Response setMetadataNoCustomHeadersWithResponse(String shareName, S final String restype = "directory"; final String comp = "list"; final String accept = "application/xml"; - String includeConverted = (include == null) ? null : include.stream() - .map(paramItemValue -> Objects.toString(paramItemValue, "")).collect(Collectors.joining(",")); + String includeConverted = (include == null) + ? null + : include.stream() + .map(paramItemValue -> Objects.toString(paramItemValue, "")) + .collect(Collectors.joining(",")); return FluxUtil.withContext(context -> service.listFilesAndDirectoriesSegment(this.client.getUrl(), shareName, directory, restype, comp, prefix, sharesnapshot, marker, maxresults, timeout, this.client.getVersion(), includeConverted, includeExtendedInfo, this.client.isAllowTrailingDot(), this.client.getFileRequestIntent(), @@ -1962,8 +1965,11 @@ public Response setMetadataNoCustomHeadersWithResponse(String shareName, S final String restype = "directory"; final String comp = "list"; final String accept = "application/xml"; - String includeConverted = (include == null) ? null : include.stream() - .map(paramItemValue -> Objects.toString(paramItemValue, "")).collect(Collectors.joining(",")); + String includeConverted = (include == null) + ? null + : include.stream() + .map(paramItemValue -> Objects.toString(paramItemValue, "")) + .collect(Collectors.joining(",")); return service.listFilesAndDirectoriesSegment(this.client.getUrl(), shareName, directory, restype, comp, prefix, sharesnapshot, marker, maxresults, timeout, this.client.getVersion(), includeConverted, includeExtendedInfo, this.client.isAllowTrailingDot(), this.client.getFileRequestIntent(), accept, context); @@ -2071,8 +2077,11 @@ public Mono listFilesAndDirectoriesSegme final String restype = "directory"; final String comp = "list"; final String accept = "application/xml"; - String includeConverted = (include == null) ? null : include.stream() - .map(paramItemValue -> Objects.toString(paramItemValue, "")).collect(Collectors.joining(",")); + String includeConverted = (include == null) + ? null + : include.stream() + .map(paramItemValue -> Objects.toString(paramItemValue, "")) + .collect(Collectors.joining(",")); return FluxUtil .withContext(context -> service.listFilesAndDirectoriesSegmentNoCustomHeaders(this.client.getUrl(), shareName, directory, restype, comp, prefix, sharesnapshot, marker, maxresults, timeout, @@ -2115,8 +2124,11 @@ public Mono listFilesAndDirectoriesSegme final String restype = "directory"; final String comp = "list"; final String accept = "application/xml"; - String includeConverted = (include == null) ? null : include.stream() - .map(paramItemValue -> Objects.toString(paramItemValue, "")).collect(Collectors.joining(",")); + String includeConverted = (include == null) + ? null + : include.stream() + .map(paramItemValue -> Objects.toString(paramItemValue, "")) + .collect(Collectors.joining(",")); return service.listFilesAndDirectoriesSegmentNoCustomHeaders(this.client.getUrl(), shareName, directory, restype, comp, prefix, sharesnapshot, marker, maxresults, timeout, this.client.getVersion(), includeConverted, includeExtendedInfo, this.client.isAllowTrailingDot(), this.client.getFileRequestIntent(), @@ -2157,8 +2169,11 @@ public Mono listFilesAndDirectoriesSegme final String restype = "directory"; final String comp = "list"; final String accept = "application/xml"; - String includeConverted = (include == null) ? null : include.stream() - .map(paramItemValue -> Objects.toString(paramItemValue, "")).collect(Collectors.joining(",")); + String includeConverted = (include == null) + ? null + : include.stream() + .map(paramItemValue -> Objects.toString(paramItemValue, "")) + .collect(Collectors.joining(",")); return service.listFilesAndDirectoriesSegmentSync(this.client.getUrl(), shareName, directory, restype, comp, prefix, sharesnapshot, marker, maxresults, timeout, this.client.getVersion(), includeConverted, includeExtendedInfo, this.client.isAllowTrailingDot(), this.client.getFileRequestIntent(), accept, context); @@ -2230,8 +2245,11 @@ public Response listFilesAndDirectoriesS final String restype = "directory"; final String comp = "list"; final String accept = "application/xml"; - String includeConverted = (include == null) ? null : include.stream() - .map(paramItemValue -> Objects.toString(paramItemValue, "")).collect(Collectors.joining(",")); + String includeConverted = (include == null) + ? null + : include.stream() + .map(paramItemValue -> Objects.toString(paramItemValue, "")) + .collect(Collectors.joining(",")); return service.listFilesAndDirectoriesSegmentNoCustomHeadersSync(this.client.getUrl(), shareName, directory, restype, comp, prefix, sharesnapshot, marker, maxresults, timeout, this.client.getVersion(), includeConverted, includeExtendedInfo, this.client.isAllowTrailingDot(), this.client.getFileRequestIntent(), diff --git a/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/implementation/FilesImpl.java b/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/implementation/FilesImpl.java index 600c5441c0a99..e98e658ea8e4e 100644 --- a/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/implementation/FilesImpl.java +++ b/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/implementation/FilesImpl.java @@ -88,8 +88,8 @@ public final class FilesImpl { } /** - * The interface defining all the services for AzureFileStorageFiles to be used by the proxy service to perform - * REST calls. + * The interface defining all the services for AzureFileStorageFiles to be used by the proxy service to perform REST + * calls. */ @Host("{url}") @ServiceInterface(name = "AzureFileStorageFile") diff --git a/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/implementation/ServicesImpl.java b/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/implementation/ServicesImpl.java index a58908687635d..96601b0a78f75 100644 --- a/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/implementation/ServicesImpl.java +++ b/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/implementation/ServicesImpl.java @@ -625,8 +625,11 @@ public Mono> listSharesSegmentSinglePageAsync(S Integer maxresults, List include, Integer timeout) { final String comp = "list"; final String accept = "application/xml"; - String includeConverted = (include == null) ? null : include.stream() - .map(paramItemValue -> Objects.toString(paramItemValue, "")).collect(Collectors.joining(",")); + String includeConverted = (include == null) + ? null + : include.stream() + .map(paramItemValue -> Objects.toString(paramItemValue, "")) + .collect(Collectors.joining(",")); return FluxUtil .withContext(context -> service.listSharesSegment(this.client.getUrl(), comp, prefix, marker, maxresults, includeConverted, timeout, this.client.getVersion(), accept, context)) @@ -659,8 +662,11 @@ public Mono> listSharesSegmentSinglePageAsync(S Integer maxresults, List include, Integer timeout, Context context) { final String comp = "list"; final String accept = "application/xml"; - String includeConverted = (include == null) ? null : include.stream() - .map(paramItemValue -> Objects.toString(paramItemValue, "")).collect(Collectors.joining(",")); + String includeConverted = (include == null) + ? null + : include.stream() + .map(paramItemValue -> Objects.toString(paramItemValue, "")) + .collect(Collectors.joining(",")); return service .listSharesSegment(this.client.getUrl(), comp, prefix, marker, maxresults, includeConverted, timeout, this.client.getVersion(), accept, context) @@ -746,8 +752,11 @@ public Mono> listSharesSegmentNoCustomHeadersSi String marker, Integer maxresults, List include, Integer timeout) { final String comp = "list"; final String accept = "application/xml"; - String includeConverted = (include == null) ? null : include.stream() - .map(paramItemValue -> Objects.toString(paramItemValue, "")).collect(Collectors.joining(",")); + String includeConverted = (include == null) + ? null + : include.stream() + .map(paramItemValue -> Objects.toString(paramItemValue, "")) + .collect(Collectors.joining(",")); return FluxUtil .withContext(context -> service.listSharesSegmentNoCustomHeaders(this.client.getUrl(), comp, prefix, marker, maxresults, includeConverted, timeout, this.client.getVersion(), accept, context)) @@ -780,8 +789,11 @@ public Mono> listSharesSegmentNoCustomHeadersSi String marker, Integer maxresults, List include, Integer timeout, Context context) { final String comp = "list"; final String accept = "application/xml"; - String includeConverted = (include == null) ? null : include.stream() - .map(paramItemValue -> Objects.toString(paramItemValue, "")).collect(Collectors.joining(",")); + String includeConverted = (include == null) + ? null + : include.stream() + .map(paramItemValue -> Objects.toString(paramItemValue, "")) + .collect(Collectors.joining(",")); return service .listSharesSegmentNoCustomHeaders(this.client.getUrl(), comp, prefix, marker, maxresults, includeConverted, timeout, this.client.getVersion(), accept, context) @@ -867,8 +879,11 @@ public PagedResponse listSharesSegmentSinglePage(String prefi Integer maxresults, List include, Integer timeout) { final String comp = "list"; final String accept = "application/xml"; - String includeConverted = (include == null) ? null : include.stream() - .map(paramItemValue -> Objects.toString(paramItemValue, "")).collect(Collectors.joining(",")); + String includeConverted = (include == null) + ? null + : include.stream() + .map(paramItemValue -> Objects.toString(paramItemValue, "")) + .collect(Collectors.joining(",")); ResponseBase res = service.listSharesSegmentSync(this.client.getUrl(), comp, prefix, marker, maxresults, includeConverted, timeout, this.client.getVersion(), accept, Context.NONE); @@ -901,8 +916,11 @@ public PagedResponse listSharesSegmentSinglePage(String prefi Integer maxresults, List include, Integer timeout, Context context) { final String comp = "list"; final String accept = "application/xml"; - String includeConverted = (include == null) ? null : include.stream() - .map(paramItemValue -> Objects.toString(paramItemValue, "")).collect(Collectors.joining(",")); + String includeConverted = (include == null) + ? null + : include.stream() + .map(paramItemValue -> Objects.toString(paramItemValue, "")) + .collect(Collectors.joining(",")); ResponseBase res = service.listSharesSegmentSync(this.client.getUrl(), comp, prefix, marker, maxresults, includeConverted, timeout, this.client.getVersion(), accept, context); @@ -989,8 +1007,11 @@ public PagedResponse listSharesSegmentNoCustomHeadersSinglePa Integer maxresults, List include, Integer timeout) { final String comp = "list"; final String accept = "application/xml"; - String includeConverted = (include == null) ? null : include.stream() - .map(paramItemValue -> Objects.toString(paramItemValue, "")).collect(Collectors.joining(",")); + String includeConverted = (include == null) + ? null + : include.stream() + .map(paramItemValue -> Objects.toString(paramItemValue, "")) + .collect(Collectors.joining(",")); Response res = service.listSharesSegmentNoCustomHeadersSync(this.client.getUrl(), comp, prefix, marker, maxresults, includeConverted, timeout, this.client.getVersion(), accept, Context.NONE); return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), @@ -1022,8 +1043,11 @@ public PagedResponse listSharesSegmentNoCustomHeadersSinglePa Integer maxresults, List include, Integer timeout, Context context) { final String comp = "list"; final String accept = "application/xml"; - String includeConverted = (include == null) ? null : include.stream() - .map(paramItemValue -> Objects.toString(paramItemValue, "")).collect(Collectors.joining(",")); + String includeConverted = (include == null) + ? null + : include.stream() + .map(paramItemValue -> Objects.toString(paramItemValue, "")) + .collect(Collectors.joining(",")); Response res = service.listSharesSegmentNoCustomHeadersSync(this.client.getUrl(), comp, prefix, marker, maxresults, includeConverted, timeout, this.client.getVersion(), accept, context); return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), diff --git a/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/implementation/SharesImpl.java b/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/implementation/SharesImpl.java index 74e4e633249a6..1654b3ac9a556 100644 --- a/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/implementation/SharesImpl.java +++ b/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/implementation/SharesImpl.java @@ -25,8 +25,6 @@ import com.azure.core.util.FluxUtil; import com.azure.storage.file.share.implementation.models.DeleteSnapshotsOptionType; import com.azure.storage.file.share.implementation.models.SharePermission; -import com.azure.storage.file.share.implementation.models.ShareSignedIdentifierWrapper; -import com.azure.storage.file.share.implementation.models.ShareStats; import com.azure.storage.file.share.implementation.models.SharesAcquireLeaseHeaders; import com.azure.storage.file.share.implementation.models.SharesBreakLeaseHeaders; import com.azure.storage.file.share.implementation.models.SharesChangeLeaseHeaders; @@ -38,12 +36,14 @@ import com.azure.storage.file.share.implementation.models.SharesGetPermissionHeaders; import com.azure.storage.file.share.implementation.models.SharesGetPropertiesHeaders; import com.azure.storage.file.share.implementation.models.SharesGetStatisticsHeaders; +import com.azure.storage.file.share.implementation.models.ShareSignedIdentifierWrapper; import com.azure.storage.file.share.implementation.models.SharesReleaseLeaseHeaders; import com.azure.storage.file.share.implementation.models.SharesRenewLeaseHeaders; import com.azure.storage.file.share.implementation.models.SharesRestoreHeaders; import com.azure.storage.file.share.implementation.models.SharesSetAccessPolicyHeaders; import com.azure.storage.file.share.implementation.models.SharesSetMetadataHeaders; import com.azure.storage.file.share.implementation.models.SharesSetPropertiesHeaders; +import com.azure.storage.file.share.implementation.models.ShareStats; import com.azure.storage.file.share.models.ShareAccessTier; import com.azure.storage.file.share.models.ShareRootSquash; import com.azure.storage.file.share.models.ShareSignedIdentifier; @@ -69,7 +69,7 @@ public final class SharesImpl { /** * Initializes an instance of SharesImpl. - * + * * @param client the instance of the service client containing this operation class. */ SharesImpl(AzureFileStorageImpl client) { @@ -116,8 +116,9 @@ ResponseBase createSync(@HostParam("url") String url, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-meta-") Map metadata, @HeaderParam("x-ms-share-quota") Integer quota, @HeaderParam("x-ms-access-tier") ShareAccessTier accessTier, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-enabled-protocols") String enabledProtocols, - @HeaderParam("x-ms-root-squash") ShareRootSquash rootSquash, @HeaderParam("Accept") String accept, - Context context); + @HeaderParam("x-ms-root-squash") ShareRootSquash rootSquash, + @HeaderParam("x-ms-enable-snapshot-virtual-directory-access") Boolean enableSnapshotVirtualDirectoryAccess, + @HeaderParam("Accept") String accept, Context context); @Put("/{shareName}") @ExpectedResponses({ 201 }) @@ -127,8 +128,9 @@ Response createNoCustomHeadersSync(@HostParam("url") String url, @PathPara @HeaderParam("x-ms-meta-") Map metadata, @HeaderParam("x-ms-share-quota") Integer quota, @HeaderParam("x-ms-access-tier") ShareAccessTier accessTier, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-enabled-protocols") String enabledProtocols, - @HeaderParam("x-ms-root-squash") ShareRootSquash rootSquash, @HeaderParam("Accept") String accept, - Context context); + @HeaderParam("x-ms-root-squash") ShareRootSquash rootSquash, + @HeaderParam("x-ms-enable-snapshot-virtual-directory-access") Boolean enableSnapshotVirtualDirectoryAccess, + @HeaderParam("Accept") String accept, Context context); @Get("/{shareName}") @ExpectedResponses({ 200 }) @@ -525,30 +527,6 @@ Mono> getPermissionNoCustomHeaders(@HostParam("url") S @HeaderParam("x-ms-file-request-intent") ShareTokenIntent fileRequestIntent, @HeaderParam("Accept") String accept, Context context); - @Put("/{shareName}") - @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(ShareStorageException.class) - Mono> setProperties(@HostParam("url") String url, - @PathParam("shareName") String shareName, @QueryParam("restype") String restype, - @QueryParam("comp") String comp, @QueryParam("timeout") Integer timeout, - @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-share-quota") Integer quota, - @HeaderParam("x-ms-access-tier") ShareAccessTier accessTier, @HeaderParam("x-ms-lease-id") String leaseId, - @HeaderParam("x-ms-root-squash") ShareRootSquash rootSquash, - @HeaderParam("x-ms-enable-snapshot-virtual-directory-access") Boolean enableSnapshotVirtualDirectoryAccess, - @HeaderParam("Accept") String accept, Context context); - - @Put("/{shareName}") - @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(ShareStorageException.class) - Mono> setPropertiesNoCustomHeaders(@HostParam("url") String url, - @PathParam("shareName") String shareName, @QueryParam("restype") String restype, - @QueryParam("comp") String comp, @QueryParam("timeout") Integer timeout, - @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-share-quota") Integer quota, - @HeaderParam("x-ms-access-tier") ShareAccessTier accessTier, @HeaderParam("x-ms-lease-id") String leaseId, - @HeaderParam("x-ms-root-squash") ShareRootSquash rootSquash, - @HeaderParam("x-ms-enable-snapshot-virtual-directory-access") Boolean enableSnapshotVirtualDirectoryAccess, - @HeaderParam("Accept") String accept, Context context); - @Get("/{shareName}") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ShareStorageException.class) @@ -577,8 +555,9 @@ Mono> setProperties(@HostParam("u @QueryParam("comp") String comp, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-share-quota") Integer quota, @HeaderParam("x-ms-access-tier") ShareAccessTier accessTier, @HeaderParam("x-ms-lease-id") String leaseId, - @HeaderParam("x-ms-root-squash") ShareRootSquash rootSquash, @HeaderParam("Accept") String accept, - Context context); + @HeaderParam("x-ms-root-squash") ShareRootSquash rootSquash, + @HeaderParam("x-ms-enable-snapshot-virtual-directory-access") Boolean enableSnapshotVirtualDirectoryAccess, + @HeaderParam("Accept") String accept, Context context); @Put("/{shareName}") @ExpectedResponses({ 200 }) @@ -588,8 +567,9 @@ Mono> setPropertiesNoCustomHeaders(@HostParam("url") String url, @QueryParam("comp") String comp, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-share-quota") Integer quota, @HeaderParam("x-ms-access-tier") ShareAccessTier accessTier, @HeaderParam("x-ms-lease-id") String leaseId, - @HeaderParam("x-ms-root-squash") ShareRootSquash rootSquash, @HeaderParam("Accept") String accept, - Context context); + @HeaderParam("x-ms-root-squash") ShareRootSquash rootSquash, + @HeaderParam("x-ms-enable-snapshot-virtual-directory-access") Boolean enableSnapshotVirtualDirectoryAccess, + @HeaderParam("Accept") String accept, Context context); @Put("/{shareName}") @ExpectedResponses({ 200 }) @@ -599,8 +579,9 @@ ResponseBase setPropertiesSync(@HostParam("url @QueryParam("comp") String comp, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-share-quota") Integer quota, @HeaderParam("x-ms-access-tier") ShareAccessTier accessTier, @HeaderParam("x-ms-lease-id") String leaseId, - @HeaderParam("x-ms-root-squash") ShareRootSquash rootSquash, @HeaderParam("Accept") String accept, - Context context); + @HeaderParam("x-ms-root-squash") ShareRootSquash rootSquash, + @HeaderParam("x-ms-enable-snapshot-virtual-directory-access") Boolean enableSnapshotVirtualDirectoryAccess, + @HeaderParam("Accept") String accept, Context context); @Put("/{shareName}") @ExpectedResponses({ 200 }) @@ -610,8 +591,9 @@ Response setPropertiesNoCustomHeadersSync(@HostParam("url") String url, @QueryParam("comp") String comp, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-share-quota") Integer quota, @HeaderParam("x-ms-access-tier") ShareAccessTier accessTier, @HeaderParam("x-ms-lease-id") String leaseId, - @HeaderParam("x-ms-root-squash") ShareRootSquash rootSquash, @HeaderParam("Accept") String accept, - Context context); + @HeaderParam("x-ms-root-squash") ShareRootSquash rootSquash, + @HeaderParam("x-ms-enable-snapshot-virtual-directory-access") Boolean enableSnapshotVirtualDirectoryAccess, + @HeaderParam("Accept") String accept, Context context); @Put("/{shareName}") @ExpectedResponses({ 200 }) @@ -809,7 +791,7 @@ Response restoreNoCustomHeadersSync(@HostParam("url") String url, /** * Creates a new share under the specified account. If the share with the same name already exists, the operation * fails. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -839,7 +821,7 @@ public Mono> createWithResponseAsync(Str /** * Creates a new share under the specified account. If the share with the same name already exists, the operation * fails. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -870,7 +852,7 @@ public Mono> createWithResponseAsync(Str /** * Creates a new share under the specified account. If the share with the same name already exists, the operation * fails. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -897,7 +879,7 @@ public Mono createAsync(String shareName, Integer timeout, Map createAsync(String shareName, Integer timeout, Map> createNoCustomHeadersWithResponseAsync(String shareN /** * Creates a new share under the specified account. If the share with the same name already exists, the operation * fails. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -986,7 +968,7 @@ public Mono> createNoCustomHeadersWithResponseAsync(String shareN /** * Creates a new share under the specified account. If the share with the same name already exists, the operation * fails. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -996,6 +978,7 @@ public Mono> createNoCustomHeadersWithResponseAsync(String shareN * @param accessTier Specifies the access tier of the share. * @param enabledProtocols Protocols to enable on the share. * @param rootSquash Root squash to set on the share. Only valid for NFS shares. + * @param enableSnapshotVirtualDirectoryAccess The enableSnapshotVirtualDirectoryAccess parameter. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ShareStorageException thrown if the request is rejected by server. @@ -1005,17 +988,18 @@ public Mono> createNoCustomHeadersWithResponseAsync(String shareN @ServiceMethod(returns = ReturnType.SINGLE) public ResponseBase createWithResponse(String shareName, Integer timeout, Map metadata, Integer quota, ShareAccessTier accessTier, String enabledProtocols, - ShareRootSquash rootSquash, Context context) { + ShareRootSquash rootSquash, Boolean enableSnapshotVirtualDirectoryAccess, Context context) { final String restype = "share"; final String accept = "application/xml"; return service.createSync(this.client.getUrl(), shareName, restype, timeout, metadata, quota, accessTier, - this.client.getVersion(), enabledProtocols, rootSquash, accept, context); + this.client.getVersion(), enabledProtocols, rootSquash, enableSnapshotVirtualDirectoryAccess, accept, + context); } /** * Creates a new share under the specified account. If the share with the same name already exists, the operation * fails. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -1025,20 +1009,23 @@ public ResponseBase createWithResponse(String shareNa * @param accessTier Specifies the access tier of the share. * @param enabledProtocols Protocols to enable on the share. * @param rootSquash Root squash to set on the share. Only valid for NFS shares. + * @param enableSnapshotVirtualDirectoryAccess The enableSnapshotVirtualDirectoryAccess parameter. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ShareStorageException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. */ @ServiceMethod(returns = ReturnType.SINGLE) public void create(String shareName, Integer timeout, Map metadata, Integer quota, - ShareAccessTier accessTier, String enabledProtocols, ShareRootSquash rootSquash) { - createWithResponse(shareName, timeout, metadata, quota, accessTier, enabledProtocols, rootSquash, Context.NONE); + ShareAccessTier accessTier, String enabledProtocols, ShareRootSquash rootSquash, + Boolean enableSnapshotVirtualDirectoryAccess) { + createWithResponse(shareName, timeout, metadata, quota, accessTier, enabledProtocols, rootSquash, + enableSnapshotVirtualDirectoryAccess, Context.NONE); } /** * Creates a new share under the specified account. If the share with the same name already exists, the operation * fails. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -1048,6 +1035,7 @@ public void create(String shareName, Integer timeout, Map metada * @param accessTier Specifies the access tier of the share. * @param enabledProtocols Protocols to enable on the share. * @param rootSquash Root squash to set on the share. Only valid for NFS shares. + * @param enableSnapshotVirtualDirectoryAccess The enableSnapshotVirtualDirectoryAccess parameter. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ShareStorageException thrown if the request is rejected by server. @@ -1057,17 +1045,18 @@ public void create(String shareName, Integer timeout, Map metada @ServiceMethod(returns = ReturnType.SINGLE) public Response createNoCustomHeadersWithResponse(String shareName, Integer timeout, Map metadata, Integer quota, ShareAccessTier accessTier, String enabledProtocols, - ShareRootSquash rootSquash, Context context) { + ShareRootSquash rootSquash, Boolean enableSnapshotVirtualDirectoryAccess, Context context) { final String restype = "share"; final String accept = "application/xml"; return service.createNoCustomHeadersSync(this.client.getUrl(), shareName, restype, timeout, metadata, quota, - accessTier, this.client.getVersion(), enabledProtocols, rootSquash, accept, context); + accessTier, this.client.getVersion(), enabledProtocols, rootSquash, enableSnapshotVirtualDirectoryAccess, + accept, context); } /** * Returns all user-defined metadata and system properties for the specified share or share snapshot. The data * returned does not include the share's list of files. - * + * * @param shareName The name of the target share. * @param sharesnapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the share * snapshot to query. @@ -1092,7 +1081,7 @@ public Mono> getPropertiesWithRes /** * Returns all user-defined metadata and system properties for the specified share or share snapshot. The data * returned does not include the share's list of files. - * + * * @param shareName The name of the target share. * @param sharesnapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the share * snapshot to query. @@ -1118,7 +1107,7 @@ public Mono> getPropertiesWithRes /** * Returns all user-defined metadata and system properties for the specified share or share snapshot. The data * returned does not include the share's list of files. - * + * * @param shareName The name of the target share. * @param sharesnapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the share * snapshot to query. @@ -1140,7 +1129,7 @@ public Mono getPropertiesAsync(String shareName, String sharesnapshot, Int /** * Returns all user-defined metadata and system properties for the specified share or share snapshot. The data * returned does not include the share's list of files. - * + * * @param shareName The name of the target share. * @param sharesnapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the share * snapshot to query. @@ -1164,7 +1153,7 @@ public Mono getPropertiesAsync(String shareName, String sharesnapshot, Int /** * Returns all user-defined metadata and system properties for the specified share or share snapshot. The data * returned does not include the share's list of files. - * + * * @param shareName The name of the target share. * @param sharesnapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the share * snapshot to query. @@ -1189,7 +1178,7 @@ public Mono> getPropertiesNoCustomHeadersWithResponseAsync(String /** * Returns all user-defined metadata and system properties for the specified share or share snapshot. The data * returned does not include the share's list of files. - * + * * @param shareName The name of the target share. * @param sharesnapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the share * snapshot to query. @@ -1215,7 +1204,7 @@ public Mono> getPropertiesNoCustomHeadersWithResponseAsync(String /** * Returns all user-defined metadata and system properties for the specified share or share snapshot. The data * returned does not include the share's list of files. - * + * * @param shareName The name of the target share. * @param sharesnapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the share * snapshot to query. @@ -1241,7 +1230,7 @@ public ResponseBase getPropertiesWithResponse( /** * Returns all user-defined metadata and system properties for the specified share or share snapshot. The data * returned does not include the share's list of files. - * + * * @param shareName The name of the target share. * @param sharesnapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the share * snapshot to query. @@ -1261,7 +1250,7 @@ public void getProperties(String shareName, String sharesnapshot, Integer timeou /** * Returns all user-defined metadata and system properties for the specified share or share snapshot. The data * returned does not include the share's list of files. - * + * * @param shareName The name of the target share. * @param sharesnapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the share * snapshot to query. @@ -1287,7 +1276,7 @@ public Response getPropertiesNoCustomHeadersWithResponse(String shareName, /** * Operation marks the specified share or share snapshot for deletion. The share or share snapshot and any files * contained within it are later deleted during garbage collection. - * + * * @param shareName The name of the target share. * @param sharesnapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the share * snapshot to query. @@ -1313,7 +1302,7 @@ public Mono> deleteWithResponseAsync(Str /** * Operation marks the specified share or share snapshot for deletion. The share or share snapshot and any files * contained within it are later deleted during garbage collection. - * + * * @param shareName The name of the target share. * @param sharesnapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the share * snapshot to query. @@ -1340,7 +1329,7 @@ public Mono> deleteWithResponseAsync(Str /** * Operation marks the specified share or share snapshot for deletion. The share or share snapshot and any files * contained within it are later deleted during garbage collection. - * + * * @param shareName The name of the target share. * @param sharesnapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the share * snapshot to query. @@ -1364,7 +1353,7 @@ public Mono deleteAsync(String shareName, String sharesnapshot, Integer ti /** * Operation marks the specified share or share snapshot for deletion. The share or share snapshot and any files * contained within it are later deleted during garbage collection. - * + * * @param shareName The name of the target share. * @param sharesnapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the share * snapshot to query. @@ -1389,7 +1378,7 @@ public Mono deleteAsync(String shareName, String sharesnapshot, Integer ti /** * Operation marks the specified share or share snapshot for deletion. The share or share snapshot and any files * contained within it are later deleted during garbage collection. - * + * * @param shareName The name of the target share. * @param sharesnapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the share * snapshot to query. @@ -1415,7 +1404,7 @@ public Mono> deleteNoCustomHeadersWithResponseAsync(String shareN /** * Operation marks the specified share or share snapshot for deletion. The share or share snapshot and any files * contained within it are later deleted during garbage collection. - * + * * @param shareName The name of the target share. * @param sharesnapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the share * snapshot to query. @@ -1442,7 +1431,7 @@ public Mono> deleteNoCustomHeadersWithResponseAsync(String shareN /** * Operation marks the specified share or share snapshot for deletion. The share or share snapshot and any files * contained within it are later deleted during garbage collection. - * + * * @param shareName The name of the target share. * @param sharesnapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the share * snapshot to query. @@ -1469,7 +1458,7 @@ public ResponseBase deleteWithResponse(String shareNa /** * Operation marks the specified share or share snapshot for deletion. The share or share snapshot and any files * contained within it are later deleted during garbage collection. - * + * * @param shareName The name of the target share. * @param sharesnapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the share * snapshot to query. @@ -1491,7 +1480,7 @@ public void delete(String shareName, String sharesnapshot, Integer timeout, /** * Operation marks the specified share or share snapshot for deletion. The share or share snapshot and any files * contained within it are later deleted during garbage collection. - * + * * @param shareName The name of the target share. * @param sharesnapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the share * snapshot to query. @@ -1518,7 +1507,7 @@ public Response deleteNoCustomHeadersWithResponse(String shareName, String /** * The Lease Share operation establishes and manages a lock on a share, or the specified snapshot for set and delete * share operations. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -1553,7 +1542,7 @@ public Mono> acquireLeaseWithRespo /** * The Lease Share operation establishes and manages a lock on a share, or the specified snapshot for set and delete * share operations. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -1589,7 +1578,7 @@ public Mono> acquireLeaseWithRespo /** * The Lease Share operation establishes and manages a lock on a share, or the specified snapshot for set and delete * share operations. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -1619,7 +1608,7 @@ public Mono acquireLeaseAsync(String shareName, Integer timeout, Integer d /** * The Lease Share operation establishes and manages a lock on a share, or the specified snapshot for set and delete * share operations. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -1650,7 +1639,7 @@ public Mono acquireLeaseAsync(String shareName, Integer timeout, Integer d /** * The Lease Share operation establishes and manages a lock on a share, or the specified snapshot for set and delete * share operations. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -1685,7 +1674,7 @@ public Mono> acquireLeaseNoCustomHeadersWithResponseAsync(String /** * The Lease Share operation establishes and manages a lock on a share, or the specified snapshot for set and delete * share operations. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -1720,7 +1709,7 @@ public Mono> acquireLeaseNoCustomHeadersWithResponseAsync(String /** * The Lease Share operation establishes and manages a lock on a share, or the specified snapshot for set and delete * share operations. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -1755,7 +1744,7 @@ public ResponseBase acquireLeaseWithResponse(St /** * The Lease Share operation establishes and manages a lock on a share, or the specified snapshot for set and delete * share operations. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -1783,7 +1772,7 @@ public void acquireLease(String shareName, Integer timeout, Integer duration, St /** * The Lease Share operation establishes and manages a lock on a share, or the specified snapshot for set and delete * share operations. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -1818,7 +1807,7 @@ public Response acquireLeaseNoCustomHeadersWithResponse(String shareName, /** * The Lease Share operation establishes and manages a lock on a share, or the specified snapshot for set and delete * share operations. - * + * * @param shareName The name of the target share. * @param leaseId Specifies the current lease ID on the resource. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -1847,7 +1836,7 @@ public Mono> releaseLeaseWithRespo /** * The Lease Share operation establishes and manages a lock on a share, or the specified snapshot for set and delete * share operations. - * + * * @param shareName The name of the target share. * @param leaseId Specifies the current lease ID on the resource. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -1877,7 +1866,7 @@ public Mono> releaseLeaseWithRespo /** * The Lease Share operation establishes and manages a lock on a share, or the specified snapshot for set and delete * share operations. - * + * * @param shareName The name of the target share. * @param leaseId Specifies the current lease ID on the resource. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -1902,7 +1891,7 @@ public Mono releaseLeaseAsync(String shareName, String leaseId, Integer ti /** * The Lease Share operation establishes and manages a lock on a share, or the specified snapshot for set and delete * share operations. - * + * * @param shareName The name of the target share. * @param leaseId Specifies the current lease ID on the resource. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -1928,7 +1917,7 @@ public Mono releaseLeaseAsync(String shareName, String leaseId, Integer ti /** * The Lease Share operation establishes and manages a lock on a share, or the specified snapshot for set and delete * share operations. - * + * * @param shareName The name of the target share. * @param leaseId Specifies the current lease ID on the resource. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -1958,7 +1947,7 @@ public Mono> releaseLeaseNoCustomHeadersWithResponseAsync(String /** * The Lease Share operation establishes and manages a lock on a share, or the specified snapshot for set and delete * share operations. - * + * * @param shareName The name of the target share. * @param leaseId Specifies the current lease ID on the resource. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -1988,7 +1977,7 @@ public Mono> releaseLeaseNoCustomHeadersWithResponseAsync(String /** * The Lease Share operation establishes and manages a lock on a share, or the specified snapshot for set and delete * share operations. - * + * * @param shareName The name of the target share. * @param leaseId Specifies the current lease ID on the resource. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -2018,7 +2007,7 @@ public ResponseBase releaseLeaseWithResponse(St /** * The Lease Share operation establishes and manages a lock on a share, or the specified snapshot for set and delete * share operations. - * + * * @param shareName The name of the target share. * @param leaseId Specifies the current lease ID on the resource. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -2041,7 +2030,7 @@ public void releaseLease(String shareName, String leaseId, Integer timeout, Stri /** * The Lease Share operation establishes and manages a lock on a share, or the specified snapshot for set and delete * share operations. - * + * * @param shareName The name of the target share. * @param leaseId Specifies the current lease ID on the resource. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -2071,7 +2060,7 @@ public Response releaseLeaseNoCustomHeadersWithResponse(String shareName, /** * The Lease Share operation establishes and manages a lock on a share, or the specified snapshot for set and delete * share operations. - * + * * @param shareName The name of the target share. * @param leaseId Specifies the current lease ID on the resource. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -2104,7 +2093,7 @@ public Mono> changeLeaseWithRespons /** * The Lease Share operation establishes and manages a lock on a share, or the specified snapshot for set and delete * share operations. - * + * * @param shareName The name of the target share. * @param leaseId Specifies the current lease ID on the resource. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -2138,7 +2127,7 @@ public Mono> changeLeaseWithRespons /** * The Lease Share operation establishes and manages a lock on a share, or the specified snapshot for set and delete * share operations. - * + * * @param shareName The name of the target share. * @param leaseId Specifies the current lease ID on the resource. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -2166,7 +2155,7 @@ public Mono changeLeaseAsync(String shareName, String leaseId, Integer tim /** * The Lease Share operation establishes and manages a lock on a share, or the specified snapshot for set and delete * share operations. - * + * * @param shareName The name of the target share. * @param leaseId Specifies the current lease ID on the resource. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -2195,7 +2184,7 @@ public Mono changeLeaseAsync(String shareName, String leaseId, Integer tim /** * The Lease Share operation establishes and manages a lock on a share, or the specified snapshot for set and delete * share operations. - * + * * @param shareName The name of the target share. * @param leaseId Specifies the current lease ID on the resource. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -2228,7 +2217,7 @@ public Mono> changeLeaseNoCustomHeadersWithResponseAsync(String s /** * The Lease Share operation establishes and manages a lock on a share, or the specified snapshot for set and delete * share operations. - * + * * @param shareName The name of the target share. * @param leaseId Specifies the current lease ID on the resource. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -2261,7 +2250,7 @@ public Mono> changeLeaseNoCustomHeadersWithResponseAsync(String s /** * The Lease Share operation establishes and manages a lock on a share, or the specified snapshot for set and delete * share operations. - * + * * @param shareName The name of the target share. * @param leaseId Specifies the current lease ID on the resource. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -2294,7 +2283,7 @@ public ResponseBase changeLeaseWithResponse(Stri /** * The Lease Share operation establishes and manages a lock on a share, or the specified snapshot for set and delete * share operations. - * + * * @param shareName The name of the target share. * @param leaseId Specifies the current lease ID on the resource. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -2320,7 +2309,7 @@ public void changeLease(String shareName, String leaseId, Integer timeout, Strin /** * The Lease Share operation establishes and manages a lock on a share, or the specified snapshot for set and delete * share operations. - * + * * @param shareName The name of the target share. * @param leaseId Specifies the current lease ID on the resource. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -2353,7 +2342,7 @@ public Response changeLeaseNoCustomHeadersWithResponse(String shareName, S /** * The Lease Share operation establishes and manages a lock on a share, or the specified snapshot for set and delete * share operations. - * + * * @param shareName The name of the target share. * @param leaseId Specifies the current lease ID on the resource. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -2382,7 +2371,7 @@ public Mono> renewLeaseWithResponseA /** * The Lease Share operation establishes and manages a lock on a share, or the specified snapshot for set and delete * share operations. - * + * * @param shareName The name of the target share. * @param leaseId Specifies the current lease ID on the resource. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -2412,7 +2401,7 @@ public Mono> renewLeaseWithResponseA /** * The Lease Share operation establishes and manages a lock on a share, or the specified snapshot for set and delete * share operations. - * + * * @param shareName The name of the target share. * @param leaseId Specifies the current lease ID on the resource. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -2437,7 +2426,7 @@ public Mono renewLeaseAsync(String shareName, String leaseId, Integer time /** * The Lease Share operation establishes and manages a lock on a share, or the specified snapshot for set and delete * share operations. - * + * * @param shareName The name of the target share. * @param leaseId Specifies the current lease ID on the resource. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -2463,7 +2452,7 @@ public Mono renewLeaseAsync(String shareName, String leaseId, Integer time /** * The Lease Share operation establishes and manages a lock on a share, or the specified snapshot for set and delete * share operations. - * + * * @param shareName The name of the target share. * @param leaseId Specifies the current lease ID on the resource. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -2492,7 +2481,7 @@ public Mono> renewLeaseNoCustomHeadersWithResponseAsync(String sh /** * The Lease Share operation establishes and manages a lock on a share, or the specified snapshot for set and delete * share operations. - * + * * @param shareName The name of the target share. * @param leaseId Specifies the current lease ID on the resource. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -2522,7 +2511,7 @@ public Mono> renewLeaseNoCustomHeadersWithResponseAsync(String sh /** * The Lease Share operation establishes and manages a lock on a share, or the specified snapshot for set and delete * share operations. - * + * * @param shareName The name of the target share. * @param leaseId Specifies the current lease ID on the resource. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -2552,7 +2541,7 @@ public ResponseBase renewLeaseWithResponse(String /** * The Lease Share operation establishes and manages a lock on a share, or the specified snapshot for set and delete * share operations. - * + * * @param shareName The name of the target share. * @param leaseId Specifies the current lease ID on the resource. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -2574,7 +2563,7 @@ public void renewLease(String shareName, String leaseId, Integer timeout, String /** * The Lease Share operation establishes and manages a lock on a share, or the specified snapshot for set and delete * share operations. - * + * * @param shareName The name of the target share. * @param leaseId Specifies the current lease ID on the resource. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -2604,7 +2593,7 @@ public Response renewLeaseNoCustomHeadersWithResponse(String shareName, St /** * The Lease Share operation establishes and manages a lock on a share, or the specified snapshot for set and delete * share operations. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -2640,7 +2629,7 @@ public Mono> breakLeaseWithResponseA /** * The Lease Share operation establishes and manages a lock on a share, or the specified snapshot for set and delete * share operations. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -2676,7 +2665,7 @@ public Mono> breakLeaseWithResponseA /** * The Lease Share operation establishes and manages a lock on a share, or the specified snapshot for set and delete * share operations. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -2707,7 +2696,7 @@ public Mono breakLeaseAsync(String shareName, Integer timeout, Integer bre /** * The Lease Share operation establishes and manages a lock on a share, or the specified snapshot for set and delete * share operations. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -2739,7 +2728,7 @@ public Mono breakLeaseAsync(String shareName, Integer timeout, Integer bre /** * The Lease Share operation establishes and manages a lock on a share, or the specified snapshot for set and delete * share operations. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -2775,7 +2764,7 @@ public Mono> breakLeaseNoCustomHeadersWithResponseAsync(String sh /** * The Lease Share operation establishes and manages a lock on a share, or the specified snapshot for set and delete * share operations. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -2811,7 +2800,7 @@ public Mono> breakLeaseNoCustomHeadersWithResponseAsync(String sh /** * The Lease Share operation establishes and manages a lock on a share, or the specified snapshot for set and delete * share operations. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -2847,7 +2836,7 @@ public ResponseBase breakLeaseWithResponse(String /** * The Lease Share operation establishes and manages a lock on a share, or the specified snapshot for set and delete * share operations. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -2876,7 +2865,7 @@ public void breakLease(String shareName, Integer timeout, Integer breakPeriod, S /** * The Lease Share operation establishes and manages a lock on a share, or the specified snapshot for set and delete * share operations. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -2911,7 +2900,7 @@ public Response breakLeaseNoCustomHeadersWithResponse(String shareName, In /** * Creates a read-only snapshot of a share. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -2934,7 +2923,7 @@ public Mono> createSnapshotWithR /** * Creates a read-only snapshot of a share. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -2958,7 +2947,7 @@ public Mono> createSnapshotWithR /** * Creates a read-only snapshot of a share. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -2976,7 +2965,7 @@ public Mono createSnapshotAsync(String shareName, Integer timeout, Map createSnapshotAsync(String shareName, Integer timeout, Map> createSnapshotNoCustomHeadersWithResponseAsync(Strin /** * Creates a read-only snapshot of a share. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -3043,7 +3032,7 @@ public Mono> createSnapshotNoCustomHeadersWithResponseAsync(Strin /** * Creates a read-only snapshot of a share. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -3067,7 +3056,7 @@ public ResponseBase createSnapshotWithRespons /** * Creates a read-only snapshot of a share. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -3084,7 +3073,7 @@ public void createSnapshot(String shareName, Integer timeout, Map createSnapshotNoCustomHeadersWithResponse(String shareName /** * Create a permission (a security descriptor). - * + * * @param shareName The name of the target share. * @param sharePermission A permission (a security descriptor) at the share level. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -3131,7 +3120,7 @@ public Mono> createPermissionW /** * Create a permission (a security descriptor). - * + * * @param shareName The name of the target share. * @param sharePermission A permission (a security descriptor) at the share level. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -3155,7 +3144,7 @@ public Mono> createPermissionW /** * Create a permission (a security descriptor). - * + * * @param shareName The name of the target share. * @param sharePermission A permission (a security descriptor) at the share level. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -3173,7 +3162,7 @@ public Mono createPermissionAsync(String shareName, SharePermission shareP /** * Create a permission (a security descriptor). - * + * * @param shareName The name of the target share. * @param sharePermission A permission (a security descriptor) at the share level. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -3194,7 +3183,7 @@ public Mono createPermissionAsync(String shareName, SharePermission shareP /** * Create a permission (a security descriptor). - * + * * @param shareName The name of the target share. * @param sharePermission A permission (a security descriptor) at the share level. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -3218,7 +3207,7 @@ public Mono> createPermissionNoCustomHeadersWithResponseAsync(Str /** * Create a permission (a security descriptor). - * + * * @param shareName The name of the target share. * @param sharePermission A permission (a security descriptor) at the share level. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -3242,7 +3231,7 @@ public Mono> createPermissionNoCustomHeadersWithResponseAsync(Str /** * Create a permission (a security descriptor). - * + * * @param shareName The name of the target share. * @param sharePermission A permission (a security descriptor) at the share level. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -3266,7 +3255,7 @@ public ResponseBase createPermissionWithRes /** * Create a permission (a security descriptor). - * + * * @param shareName The name of the target share. * @param sharePermission A permission (a security descriptor) at the share level. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -3283,7 +3272,7 @@ public void createPermission(String shareName, SharePermission sharePermission, /** * Create a permission (a security descriptor). - * + * * @param shareName The name of the target share. * @param sharePermission A permission (a security descriptor) at the share level. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -3307,7 +3296,7 @@ public Response createPermissionNoCustomHeadersWithResponse(String shareNa /** * Returns the permission (security descriptor) for a given key. - * + * * @param shareName The name of the target share. * @param filePermissionKey Key of the permission to be set for the directory/file. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -3331,7 +3320,7 @@ public Response createPermissionNoCustomHeadersWithResponse(String shareNa /** * Returns the permission (security descriptor) for a given key. - * + * * @param shareName The name of the target share. * @param filePermissionKey Key of the permission to be set for the directory/file. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -3356,7 +3345,7 @@ public Response createPermissionNoCustomHeadersWithResponse(String shareNa /** * Returns the permission (security descriptor) for a given key. - * + * * @param shareName The name of the target share. * @param filePermissionKey Key of the permission to be set for the directory/file. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -3375,7 +3364,7 @@ public Mono getPermissionAsync(String shareName, String filePer /** * Returns the permission (security descriptor) for a given key. - * + * * @param shareName The name of the target share. * @param filePermissionKey Key of the permission to be set for the directory/file. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -3396,7 +3385,7 @@ public Mono getPermissionAsync(String shareName, String filePer /** * Returns the permission (security descriptor) for a given key. - * + * * @param shareName The name of the target share. * @param filePermissionKey Key of the permission to be set for the directory/file. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -3421,7 +3410,7 @@ public Mono> getPermissionNoCustomHeadersWithResponseA /** * Returns the permission (security descriptor) for a given key. - * + * * @param shareName The name of the target share. * @param filePermissionKey Key of the permission to be set for the directory/file. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -3446,7 +3435,7 @@ public Mono> getPermissionNoCustomHeadersWithResponseA /** * Returns the permission (security descriptor) for a given key. - * + * * @param shareName The name of the target share. * @param filePermissionKey Key of the permission to be set for the directory/file. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -3470,7 +3459,7 @@ public ResponseBase getPermissionWi /** * Returns the permission (security descriptor) for a given key. - * + * * @param shareName The name of the target share. * @param filePermissionKey Key of the permission to be set for the directory/file. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -3488,7 +3477,7 @@ public SharePermission getPermission(String shareName, String filePermissionKey, /** * Returns the permission (security descriptor) for a given key. - * + * * @param shareName The name of the target share. * @param filePermissionKey Key of the permission to be set for the directory/file. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a @@ -3512,7 +3501,7 @@ public Response getPermissionNoCustomHeadersWithResponse(String /** * Sets properties for the specified share. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -3541,7 +3530,7 @@ public Mono> setPropertiesWithRes /** * Sets properties for the specified share. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -3570,7 +3559,7 @@ public Mono> setPropertiesWithRes /** * Sets properties for the specified share. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -3594,7 +3583,7 @@ public Mono setPropertiesAsync(String shareName, Integer timeout, Integer /** * Sets properties for the specified share. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -3619,7 +3608,7 @@ public Mono setPropertiesAsync(String shareName, Integer timeout, Integer /** * Sets properties for the specified share. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -3648,7 +3637,7 @@ public Mono> setPropertiesNoCustomHeadersWithResponseAsync(String /** * Sets properties for the specified share. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -3678,7 +3667,7 @@ public Mono> setPropertiesNoCustomHeadersWithResponseAsync(String /** * Sets properties for the specified share. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -3687,6 +3676,7 @@ public Mono> setPropertiesNoCustomHeadersWithResponseAsync(String * @param accessTier Specifies the access tier of the share. * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. * @param rootSquash Root squash to set on the share. Only valid for NFS shares. + * @param enableSnapshotVirtualDirectoryAccess The enableSnapshotVirtualDirectoryAccess parameter. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ShareStorageException thrown if the request is rejected by server. @@ -3695,17 +3685,19 @@ public Mono> setPropertiesNoCustomHeadersWithResponseAsync(String */ @ServiceMethod(returns = ReturnType.SINGLE) public ResponseBase setPropertiesWithResponse(String shareName, Integer timeout, - Integer quota, ShareAccessTier accessTier, String leaseId, ShareRootSquash rootSquash, Context context) { + Integer quota, ShareAccessTier accessTier, String leaseId, ShareRootSquash rootSquash, + Boolean enableSnapshotVirtualDirectoryAccess, Context context) { final String restype = "share"; final String comp = "properties"; final String accept = "application/xml"; return service.setPropertiesSync(this.client.getUrl(), shareName, restype, comp, timeout, - this.client.getVersion(), quota, accessTier, leaseId, rootSquash, accept, context); + this.client.getVersion(), quota, accessTier, leaseId, rootSquash, enableSnapshotVirtualDirectoryAccess, + accept, context); } /** * Sets properties for the specified share. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -3714,19 +3706,21 @@ public ResponseBase setPropertiesWithResponse( * @param accessTier Specifies the access tier of the share. * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. * @param rootSquash Root squash to set on the share. Only valid for NFS shares. + * @param enableSnapshotVirtualDirectoryAccess The enableSnapshotVirtualDirectoryAccess parameter. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ShareStorageException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. */ @ServiceMethod(returns = ReturnType.SINGLE) public void setProperties(String shareName, Integer timeout, Integer quota, ShareAccessTier accessTier, - String leaseId, ShareRootSquash rootSquash) { - setPropertiesWithResponse(shareName, timeout, quota, accessTier, leaseId, rootSquash, Context.NONE); + String leaseId, ShareRootSquash rootSquash, Boolean enableSnapshotVirtualDirectoryAccess) { + setPropertiesWithResponse(shareName, timeout, quota, accessTier, leaseId, rootSquash, + enableSnapshotVirtualDirectoryAccess, Context.NONE); } /** * Sets properties for the specified share. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -3735,6 +3729,7 @@ public void setProperties(String shareName, Integer timeout, Integer quota, Shar * @param accessTier Specifies the access tier of the share. * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. * @param rootSquash Root squash to set on the share. Only valid for NFS shares. + * @param enableSnapshotVirtualDirectoryAccess The enableSnapshotVirtualDirectoryAccess parameter. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ShareStorageException thrown if the request is rejected by server. @@ -3743,17 +3738,19 @@ public void setProperties(String shareName, Integer timeout, Integer quota, Shar */ @ServiceMethod(returns = ReturnType.SINGLE) public Response setPropertiesNoCustomHeadersWithResponse(String shareName, Integer timeout, Integer quota, - ShareAccessTier accessTier, String leaseId, ShareRootSquash rootSquash, Context context) { + ShareAccessTier accessTier, String leaseId, ShareRootSquash rootSquash, + Boolean enableSnapshotVirtualDirectoryAccess, Context context) { final String restype = "share"; final String comp = "properties"; final String accept = "application/xml"; return service.setPropertiesNoCustomHeadersSync(this.client.getUrl(), shareName, restype, comp, timeout, - this.client.getVersion(), quota, accessTier, leaseId, rootSquash, accept, context); + this.client.getVersion(), quota, accessTier, leaseId, rootSquash, enableSnapshotVirtualDirectoryAccess, + accept, context); } /** * Sets one or more user-defined name-value pairs for the specified share. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -3777,7 +3774,7 @@ public Mono> setMetadataWithRespons /** * Sets one or more user-defined name-value pairs for the specified share. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -3802,7 +3799,7 @@ public Mono> setMetadataWithRespons /** * Sets one or more user-defined name-value pairs for the specified share. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -3822,7 +3819,7 @@ public Mono setMetadataAsync(String shareName, Integer timeout, Map setMetadataAsync(String shareName, Integer timeout, Map> setMetadataNoCustomHeadersWithResponseAsync(String s /** * Sets one or more user-defined name-value pairs for the specified share. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -3893,7 +3890,7 @@ public Mono> setMetadataNoCustomHeadersWithResponseAsync(String s /** * Sets one or more user-defined name-value pairs for the specified share. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -3918,7 +3915,7 @@ public ResponseBase setMetadataWithResponse(Stri /** * Sets one or more user-defined name-value pairs for the specified share. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -3936,7 +3933,7 @@ public void setMetadata(String shareName, Integer timeout, Map m /** * Sets one or more user-defined name-value pairs for the specified share. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -3961,7 +3958,7 @@ public Response setMetadataNoCustomHeadersWithResponse(String shareName, I /** * Returns information about stored access policies specified on the share. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -3985,7 +3982,7 @@ public Response setMetadataNoCustomHeadersWithResponse(String shareName, I /** * Returns information about stored access policies specified on the share. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -4010,7 +4007,7 @@ public Response setMetadataNoCustomHeadersWithResponse(String shareName, I /** * Returns information about stored access policies specified on the share. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -4029,7 +4026,7 @@ public Mono getAccessPolicyAsync(String shareName, /** * Returns information about stored access policies specified on the share. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -4050,7 +4047,7 @@ public Mono getAccessPolicyAsync(String shareName, /** * Returns information about stored access policies specified on the share. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -4073,7 +4070,7 @@ public Mono getAccessPolicyAsync(String shareName, /** * Returns information about stored access policies specified on the share. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -4097,7 +4094,7 @@ public Mono> getAccessPolicyNoCustomHeade /** * Returns information about stored access policies specified on the share. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -4121,7 +4118,7 @@ public Mono> getAccessPolicyNoCustomHeade /** * Returns information about stored access policies specified on the share. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -4139,7 +4136,7 @@ public ShareSignedIdentifierWrapper getAccessPolicy(String shareName, Integer ti /** * Returns information about stored access policies specified on the share. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -4163,7 +4160,7 @@ public Response getAccessPolicyNoCustomHeadersWith /** * Sets a stored access policy for use with shared access signatures. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -4188,7 +4185,7 @@ public Mono> setAccessPolicyWit /** * Sets a stored access policy for use with shared access signatures. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -4214,7 +4211,7 @@ public Mono> setAccessPolicyWit /** * Sets a stored access policy for use with shared access signatures. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -4234,7 +4231,7 @@ public Mono setAccessPolicyAsync(String shareName, Integer timeout, String /** * Sets a stored access policy for use with shared access signatures. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -4256,7 +4253,7 @@ public Mono setAccessPolicyAsync(String shareName, Integer timeout, String /** * Sets a stored access policy for use with shared access signatures. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -4281,7 +4278,7 @@ public Mono> setAccessPolicyNoCustomHeadersWithResponseAsync(Stri /** * Sets a stored access policy for use with shared access signatures. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -4307,7 +4304,7 @@ public Mono> setAccessPolicyNoCustomHeadersWithResponseAsync(Stri /** * Sets a stored access policy for use with shared access signatures. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -4333,7 +4330,7 @@ public ResponseBase setAccessPolicyWithRespo /** * Sets a stored access policy for use with shared access signatures. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -4352,7 +4349,7 @@ public void setAccessPolicy(String shareName, Integer timeout, String leaseId, /** * Sets a stored access policy for use with shared access signatures. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -4378,7 +4375,7 @@ public Response setAccessPolicyNoCustomHeadersWithResponse(String shareNam /** * Retrieves statistics related to the share. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -4401,7 +4398,7 @@ public Mono> getStatisticsW /** * Retrieves statistics related to the share. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -4425,7 +4422,7 @@ public Mono> getStatisticsW /** * Retrieves statistics related to the share. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -4444,7 +4441,7 @@ public Mono getStatisticsAsync(String shareName, Integer timeout, St /** * Retrieves statistics related to the share. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -4464,7 +4461,7 @@ public Mono getStatisticsAsync(String shareName, Integer timeout, St /** * Retrieves statistics related to the share. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -4487,7 +4484,7 @@ public Mono> getStatisticsNoCustomHeadersWithResponseAsync( /** * Retrieves statistics related to the share. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -4511,7 +4508,7 @@ public Mono> getStatisticsNoCustomHeadersWithResponseAsync( /** * Retrieves statistics related to the share. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -4535,7 +4532,7 @@ public ResponseBase getStatisticsWithRes /** * Retrieves statistics related to the share. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -4553,7 +4550,7 @@ public ShareStats getStatistics(String shareName, Integer timeout, String leaseI /** * Retrieves statistics related to the share. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -4577,7 +4574,7 @@ public Response getStatisticsNoCustomHeadersWithResponse(String shar /** * Restores a previously deleted Share. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -4603,7 +4600,7 @@ public Mono> restoreWithResponseAsync(S /** * Restores a previously deleted Share. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -4630,7 +4627,7 @@ public Mono> restoreWithResponseAsync(S /** * Restores a previously deleted Share. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -4653,7 +4650,7 @@ public Mono restoreAsync(String shareName, Integer timeout, String request /** * Restores a previously deleted Share. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -4677,7 +4674,7 @@ public Mono restoreAsync(String shareName, Integer timeout, String request /** * Restores a previously deleted Share. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -4704,7 +4701,7 @@ public Mono> restoreNoCustomHeadersWithResponseAsync(String share /** * Restores a previously deleted Share. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -4731,7 +4728,7 @@ public Mono> restoreNoCustomHeadersWithResponseAsync(String share /** * Restores a previously deleted Share. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -4758,7 +4755,7 @@ public ResponseBase restoreWithResponse(String share /** * Restores a previously deleted Share. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting @@ -4779,7 +4776,7 @@ public void restore(String shareName, Integer timeout, String requestId, String /** * Restores a previously deleted Share. - * + * * @param shareName The name of the target share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a * href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting diff --git a/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/implementation/models/CopyFileSmbInfo.java b/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/implementation/models/CopyFileSmbInfo.java index ced2ec5ddea09..2cd46aff29b7b 100644 --- a/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/implementation/models/CopyFileSmbInfo.java +++ b/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/implementation/models/CopyFileSmbInfo.java @@ -5,45 +5,35 @@ package com.azure.storage.file.share.implementation.models; import com.azure.core.annotation.Fluent; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; import com.azure.storage.file.share.models.PermissionCopyModeType; -import java.io.IOException; /** * Parameter group. */ @Fluent -public final class CopyFileSmbInfo implements JsonSerializable { +public final class CopyFileSmbInfo { /* - * Specifies either the option to copy file attributes from a source file(source) to a target file or a list of - * attributes to set on a target file. + * Specifies either the option to copy file attributes from a source file(source) to a target file or a list of attributes to set on a target file. */ private String fileAttributes; /* - * Specifies either the option to copy file creation time from a source file(source) to a target file or a time - * value in ISO 8601 format to set as creation time on a target file. + * Specifies either the option to copy file creation time from a source file(source) to a target file or a time value in ISO 8601 format to set as creation time on a target file. */ private String fileCreationTime; /* - * Specifies either the option to copy file last write time from a source file(source) to a target file or a time - * value in ISO 8601 format to set as last write time on a target file. + * Specifies either the option to copy file last write time from a source file(source) to a target file or a time value in ISO 8601 format to set as last write time on a target file. */ private String fileLastWriteTime; /* - * Specifies either the option to copy file last write time from a source file(source) to a target file or a time - * value in ISO 8601 format to set as last write time on a target file. + * Specifies either the option to copy file last write time from a source file(source) to a target file or a time value in ISO 8601 format to set as last write time on a target file. */ private String fileChangeTime; /* - * Specifies the option to copy file security descriptor from source file or to set it using the value which is - * defined by the header value of x-ms-file-permission or x-ms-file-permission-key. + * Specifies the option to copy file security descriptor from source file or to set it using the value which is defined by the header value of x-ms-file-permission or x-ms-file-permission-key. */ private PermissionCopyModeType filePermissionCopyMode; @@ -53,8 +43,7 @@ public final class CopyFileSmbInfo implements JsonSerializable private Boolean ignoreReadOnly; /* - * Specifies the option to set archive attribute on a target file. True means archive attribute will be set on a - * target file despite attribute overrides or a source file state. + * Specifies the option to set archive attribute on a target file. True means archive attribute will be set on a target file despite attribute overrides or a source file state. */ private Boolean setArchiveAttribute; @@ -219,57 +208,4 @@ public CopyFileSmbInfo setSetArchiveAttribute(Boolean setArchiveAttribute) { this.setArchiveAttribute = setArchiveAttribute; return this; } - - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("fileAttributes", this.fileAttributes); - jsonWriter.writeStringField("fileCreationTime", this.fileCreationTime); - jsonWriter.writeStringField("fileLastWriteTime", this.fileLastWriteTime); - jsonWriter.writeStringField("fileChangeTime", this.fileChangeTime); - jsonWriter.writeStringField("filePermissionCopyMode", - this.filePermissionCopyMode == null ? null : this.filePermissionCopyMode.toString()); - jsonWriter.writeBooleanField("ignoreReadOnly", this.ignoreReadOnly); - jsonWriter.writeBooleanField("setArchiveAttribute", this.setArchiveAttribute); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of CopyFileSmbInfo from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of CopyFileSmbInfo if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IOException If an error occurs while reading the CopyFileSmbInfo. - */ - public static CopyFileSmbInfo fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - CopyFileSmbInfo deserializedCopyFileSmbInfo = new CopyFileSmbInfo(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("fileAttributes".equals(fieldName)) { - deserializedCopyFileSmbInfo.fileAttributes = reader.getString(); - } else if ("fileCreationTime".equals(fieldName)) { - deserializedCopyFileSmbInfo.fileCreationTime = reader.getString(); - } else if ("fileLastWriteTime".equals(fieldName)) { - deserializedCopyFileSmbInfo.fileLastWriteTime = reader.getString(); - } else if ("fileChangeTime".equals(fieldName)) { - deserializedCopyFileSmbInfo.fileChangeTime = reader.getString(); - } else if ("filePermissionCopyMode".equals(fieldName)) { - deserializedCopyFileSmbInfo.filePermissionCopyMode - = PermissionCopyModeType.fromString(reader.getString()); - } else if ("ignoreReadOnly".equals(fieldName)) { - deserializedCopyFileSmbInfo.ignoreReadOnly = reader.getNullable(JsonReader::getBoolean); - } else if ("setArchiveAttribute".equals(fieldName)) { - deserializedCopyFileSmbInfo.setArchiveAttribute = reader.getNullable(JsonReader::getBoolean); - } else { - reader.skipChildren(); - } - } - - return deserializedCopyFileSmbInfo; - }); - } } diff --git a/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/implementation/models/DestinationLeaseAccessConditions.java b/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/implementation/models/DestinationLeaseAccessConditions.java index d2eb7e78df732..89bd375d9520c 100644 --- a/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/implementation/models/DestinationLeaseAccessConditions.java +++ b/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/implementation/models/DestinationLeaseAccessConditions.java @@ -5,23 +5,14 @@ package com.azure.storage.file.share.implementation.models; import com.azure.core.annotation.Fluent; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; /** * Parameter group. */ @Fluent -public final class DestinationLeaseAccessConditions implements JsonSerializable { +public final class DestinationLeaseAccessConditions { /* - * Required if the destination file has an active infinite lease. The lease ID specified for this header must match - * the lease ID of the destination file. If the request does not include the lease ID or it is not valid, the - * operation fails with status code 412 (Precondition Failed). If this header is specified and the destination file - * does not currently have an active lease, the operation will also fail with status code 412 (Precondition - * Failed). + * Required if the destination file has an active infinite lease. The lease ID specified for this header must match the lease ID of the destination file. If the request does not include the lease ID or it is not valid, the operation fails with status code 412 (Precondition Failed). If this header is specified and the destination file does not currently have an active lease, the operation will also fail with status code 412 (Precondition Failed). */ private String destinationLeaseId; @@ -58,38 +49,4 @@ public DestinationLeaseAccessConditions setDestinationLeaseId(String destination this.destinationLeaseId = destinationLeaseId; return this; } - - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("destinationLeaseId", this.destinationLeaseId); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of DestinationLeaseAccessConditions from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of DestinationLeaseAccessConditions if the JsonReader was pointing to an instance of it, or - * null if it was pointing to JSON null. - * @throws IOException If an error occurs while reading the DestinationLeaseAccessConditions. - */ - public static DestinationLeaseAccessConditions fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - DestinationLeaseAccessConditions deserializedDestinationLeaseAccessConditions - = new DestinationLeaseAccessConditions(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("destinationLeaseId".equals(fieldName)) { - deserializedDestinationLeaseAccessConditions.destinationLeaseId = reader.getString(); - } else { - reader.skipChildren(); - } - } - - return deserializedDestinationLeaseAccessConditions; - }); - } } diff --git a/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/implementation/models/FileProperty.java b/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/implementation/models/FileProperty.java index d4d06d99e8fb4..63e1943aad356 100644 --- a/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/implementation/models/FileProperty.java +++ b/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/implementation/models/FileProperty.java @@ -23,9 +23,7 @@ @Fluent public final class FileProperty implements XmlSerializable { /* - * Content length of the file. This value may not be up-to-date since an SMB client may have modified the file - * locally. The value of Content-Length may not reflect that fact until the handle is closed or the op-lock is - * broken. To retrieve current property values, call Get File Properties. + * Content length of the file. This value may not be up-to-date since an SMB client may have modified the file locally. The value of Content-Length may not reflect that fact until the handle is closed or the op-lock is broken. To retrieve current property values, call Get File Properties. */ private long contentLength; diff --git a/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/implementation/models/SharePermission.java b/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/implementation/models/SharePermission.java index 580e70e318357..19b764acd76a9 100644 --- a/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/implementation/models/SharePermission.java +++ b/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/implementation/models/SharePermission.java @@ -47,6 +47,9 @@ public SharePermission setPermission(String permission) { return this; } + /** + * {@inheritDoc} + */ @Override public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { jsonWriter.writeStartObject(); diff --git a/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/implementation/models/SharePropertiesInternal.java b/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/implementation/models/SharePropertiesInternal.java index 35c0cbd10b0ed..de71e99475ed4 100644 --- a/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/implementation/models/SharePropertiesInternal.java +++ b/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/implementation/models/SharePropertiesInternal.java @@ -135,7 +135,7 @@ public SharePropertiesInternal() { /** * Get the lastModified property: The Last-Modified property. - * + * * @return the lastModified value. */ public OffsetDateTime getLastModified() { @@ -147,7 +147,7 @@ public OffsetDateTime getLastModified() { /** * Set the lastModified property: The Last-Modified property. - * + * * @param lastModified the lastModified value to set. * @return the SharePropertiesInternal object itself. */ @@ -162,7 +162,7 @@ public SharePropertiesInternal setLastModified(OffsetDateTime lastModified) { /** * Get the eTag property: The Etag property. - * + * * @return the eTag value. */ public String getETag() { @@ -171,7 +171,7 @@ public String getETag() { /** * Set the eTag property: The Etag property. - * + * * @param eTag the eTag value to set. * @return the SharePropertiesInternal object itself. */ @@ -182,7 +182,7 @@ public SharePropertiesInternal setETag(String eTag) { /** * Get the quota property: The Quota property. - * + * * @return the quota value. */ public int getQuota() { @@ -191,7 +191,7 @@ public int getQuota() { /** * Set the quota property: The Quota property. - * + * * @param quota the quota value to set. * @return the SharePropertiesInternal object itself. */ @@ -202,7 +202,7 @@ public SharePropertiesInternal setQuota(int quota) { /** * Get the provisionedIops property: The ProvisionedIops property. - * + * * @return the provisionedIops value. */ public Integer getProvisionedIops() { @@ -211,7 +211,7 @@ public Integer getProvisionedIops() { /** * Set the provisionedIops property: The ProvisionedIops property. - * + * * @param provisionedIops the provisionedIops value to set. * @return the SharePropertiesInternal object itself. */ @@ -222,7 +222,7 @@ public SharePropertiesInternal setProvisionedIops(Integer provisionedIops) { /** * Get the provisionedIngressMBps property: The ProvisionedIngressMBps property. - * + * * @return the provisionedIngressMBps value. */ public Integer getProvisionedIngressMBps() { @@ -231,7 +231,7 @@ public Integer getProvisionedIngressMBps() { /** * Set the provisionedIngressMBps property: The ProvisionedIngressMBps property. - * + * * @param provisionedIngressMBps the provisionedIngressMBps value to set. * @return the SharePropertiesInternal object itself. */ @@ -242,7 +242,7 @@ public SharePropertiesInternal setProvisionedIngressMBps(Integer provisionedIngr /** * Get the provisionedEgressMBps property: The ProvisionedEgressMBps property. - * + * * @return the provisionedEgressMBps value. */ public Integer getProvisionedEgressMBps() { @@ -251,7 +251,7 @@ public Integer getProvisionedEgressMBps() { /** * Set the provisionedEgressMBps property: The ProvisionedEgressMBps property. - * + * * @param provisionedEgressMBps the provisionedEgressMBps value to set. * @return the SharePropertiesInternal object itself. */ @@ -262,7 +262,7 @@ public SharePropertiesInternal setProvisionedEgressMBps(Integer provisionedEgres /** * Get the provisionedBandwidthMiBps property: The ProvisionedBandwidthMiBps property. - * + * * @return the provisionedBandwidthMiBps value. */ public Integer getProvisionedBandwidthMiBps() { @@ -271,7 +271,7 @@ public Integer getProvisionedBandwidthMiBps() { /** * Set the provisionedBandwidthMiBps property: The ProvisionedBandwidthMiBps property. - * + * * @param provisionedBandwidthMiBps the provisionedBandwidthMiBps value to set. * @return the SharePropertiesInternal object itself. */ @@ -282,7 +282,7 @@ public SharePropertiesInternal setProvisionedBandwidthMiBps(Integer provisionedB /** * Get the nextAllowedQuotaDowngradeTime property: The NextAllowedQuotaDowngradeTime property. - * + * * @return the nextAllowedQuotaDowngradeTime value. */ public OffsetDateTime getNextAllowedQuotaDowngradeTime() { @@ -294,7 +294,7 @@ public OffsetDateTime getNextAllowedQuotaDowngradeTime() { /** * Set the nextAllowedQuotaDowngradeTime property: The NextAllowedQuotaDowngradeTime property. - * + * * @param nextAllowedQuotaDowngradeTime the nextAllowedQuotaDowngradeTime value to set. * @return the SharePropertiesInternal object itself. */ @@ -309,7 +309,7 @@ public SharePropertiesInternal setNextAllowedQuotaDowngradeTime(OffsetDateTime n /** * Get the deletedTime property: The DeletedTime property. - * + * * @return the deletedTime value. */ public OffsetDateTime getDeletedTime() { @@ -321,7 +321,7 @@ public OffsetDateTime getDeletedTime() { /** * Set the deletedTime property: The DeletedTime property. - * + * * @param deletedTime the deletedTime value to set. * @return the SharePropertiesInternal object itself. */ @@ -336,7 +336,7 @@ public SharePropertiesInternal setDeletedTime(OffsetDateTime deletedTime) { /** * Get the remainingRetentionDays property: The RemainingRetentionDays property. - * + * * @return the remainingRetentionDays value. */ public Integer getRemainingRetentionDays() { @@ -345,7 +345,7 @@ public Integer getRemainingRetentionDays() { /** * Set the remainingRetentionDays property: The RemainingRetentionDays property. - * + * * @param remainingRetentionDays the remainingRetentionDays value to set. * @return the SharePropertiesInternal object itself. */ @@ -356,7 +356,7 @@ public SharePropertiesInternal setRemainingRetentionDays(Integer remainingRetent /** * Get the accessTier property: The AccessTier property. - * + * * @return the accessTier value. */ public String getAccessTier() { @@ -365,7 +365,7 @@ public String getAccessTier() { /** * Set the accessTier property: The AccessTier property. - * + * * @param accessTier the accessTier value to set. * @return the SharePropertiesInternal object itself. */ @@ -376,7 +376,7 @@ public SharePropertiesInternal setAccessTier(String accessTier) { /** * Get the accessTierChangeTime property: The AccessTierChangeTime property. - * + * * @return the accessTierChangeTime value. */ public OffsetDateTime getAccessTierChangeTime() { @@ -388,7 +388,7 @@ public OffsetDateTime getAccessTierChangeTime() { /** * Set the accessTierChangeTime property: The AccessTierChangeTime property. - * + * * @param accessTierChangeTime the accessTierChangeTime value to set. * @return the SharePropertiesInternal object itself. */ @@ -403,7 +403,7 @@ public SharePropertiesInternal setAccessTierChangeTime(OffsetDateTime accessTier /** * Get the accessTierTransitionState property: The AccessTierTransitionState property. - * + * * @return the accessTierTransitionState value. */ public String getAccessTierTransitionState() { @@ -412,7 +412,7 @@ public String getAccessTierTransitionState() { /** * Set the accessTierTransitionState property: The AccessTierTransitionState property. - * + * * @param accessTierTransitionState the accessTierTransitionState value to set. * @return the SharePropertiesInternal object itself. */ @@ -423,7 +423,7 @@ public SharePropertiesInternal setAccessTierTransitionState(String accessTierTra /** * Get the leaseStatus property: The current lease status of the share. - * + * * @return the leaseStatus value. */ public LeaseStatusType getLeaseStatus() { @@ -432,7 +432,7 @@ public LeaseStatusType getLeaseStatus() { /** * Set the leaseStatus property: The current lease status of the share. - * + * * @param leaseStatus the leaseStatus value to set. * @return the SharePropertiesInternal object itself. */ @@ -443,7 +443,7 @@ public SharePropertiesInternal setLeaseStatus(LeaseStatusType leaseStatus) { /** * Get the leaseState property: Lease state of the share. - * + * * @return the leaseState value. */ public LeaseStateType getLeaseState() { @@ -452,7 +452,7 @@ public LeaseStateType getLeaseState() { /** * Set the leaseState property: Lease state of the share. - * + * * @param leaseState the leaseState value to set. * @return the SharePropertiesInternal object itself. */ @@ -464,7 +464,7 @@ public SharePropertiesInternal setLeaseState(LeaseStateType leaseState) { /** * Get the leaseDuration property: When a share is leased, specifies whether the lease is of infinite or fixed * duration. - * + * * @return the leaseDuration value. */ public LeaseDurationType getLeaseDuration() { @@ -474,7 +474,7 @@ public LeaseDurationType getLeaseDuration() { /** * Set the leaseDuration property: When a share is leased, specifies whether the lease is of infinite or fixed * duration. - * + * * @param leaseDuration the leaseDuration value to set. * @return the SharePropertiesInternal object itself. */ @@ -485,7 +485,7 @@ public SharePropertiesInternal setLeaseDuration(LeaseDurationType leaseDuration) /** * Get the enabledProtocols property: The EnabledProtocols property. - * + * * @return the enabledProtocols value. */ public String getEnabledProtocols() { @@ -494,7 +494,7 @@ public String getEnabledProtocols() { /** * Set the enabledProtocols property: The EnabledProtocols property. - * + * * @param enabledProtocols the enabledProtocols value to set. * @return the SharePropertiesInternal object itself. */ @@ -505,7 +505,7 @@ public SharePropertiesInternal setEnabledProtocols(String enabledProtocols) { /** * Get the rootSquash property: The RootSquash property. - * + * * @return the rootSquash value. */ public ShareRootSquash getRootSquash() { @@ -514,7 +514,7 @@ public ShareRootSquash getRootSquash() { /** * Set the rootSquash property: The RootSquash property. - * + * * @param rootSquash the rootSquash value to set. * @return the SharePropertiesInternal object itself. */ @@ -525,7 +525,7 @@ public SharePropertiesInternal setRootSquash(ShareRootSquash rootSquash) { /** * Get the enableSnapshotVirtualDirectoryAccess property: The EnableSnapshotVirtualDirectoryAccess property. - * + * * @return the enableSnapshotVirtualDirectoryAccess value. */ public Boolean isEnableSnapshotVirtualDirectoryAccess() { @@ -534,19 +534,19 @@ public Boolean isEnableSnapshotVirtualDirectoryAccess() { /** * Set the enableSnapshotVirtualDirectoryAccess property: The EnableSnapshotVirtualDirectoryAccess property. - * + * * @param enableSnapshotVirtualDirectoryAccess the enableSnapshotVirtualDirectoryAccess value to set. * @return the SharePropertiesInternal object itself. */ - public SharePropertiesInternal setEnableSnapshotVirtualDirectoryAccess( - Boolean enableSnapshotVirtualDirectoryAccess) { + public SharePropertiesInternal + setEnableSnapshotVirtualDirectoryAccess(Boolean enableSnapshotVirtualDirectoryAccess) { this.enableSnapshotVirtualDirectoryAccess = enableSnapshotVirtualDirectoryAccess; return this; } /** * Get the metadata property: Dictionary of <string>. - * + * * @return the metadata value. */ public Map getMetadata() { @@ -555,7 +555,7 @@ public Map getMetadata() { /** * Set the metadata property: Dictionary of <string>. - * + * * @param metadata the metadata value to set. * @return the SharePropertiesInternal object itself. */ @@ -593,6 +593,8 @@ public XmlWriter toXml(XmlWriter xmlWriter, String rootElementName) throws XMLSt this.leaseDuration == null ? null : this.leaseDuration.toString()); xmlWriter.writeStringElement("EnabledProtocols", this.enabledProtocols); xmlWriter.writeStringElement("RootSquash", this.rootSquash == null ? null : this.rootSquash.toString()); + xmlWriter.writeBooleanElement("EnableSnapshotVirtualDirectoryAccess", + this.enableSnapshotVirtualDirectoryAccess); if (this.metadata != null) { xmlWriter.writeStartElement("Metadata"); for (Map.Entry entry : this.metadata.entrySet()) { @@ -605,7 +607,7 @@ public XmlWriter toXml(XmlWriter xmlWriter, String rootElementName) throws XMLSt /** * Reads an instance of SharePropertiesInternal from the XmlReader. - * + * * @param xmlReader The XmlReader being read. * @return An instance of SharePropertiesInternal if the XmlReader was pointing to an instance of it, or null if it * was pointing to XML null. @@ -618,7 +620,7 @@ public static SharePropertiesInternal fromXml(XmlReader xmlReader) throws XMLStr /** * Reads an instance of SharePropertiesInternal from the XmlReader. - * + * * @param xmlReader The XmlReader being read. * @param rootElementName Optional root element name to override the default defined by the model. Used to support * cases where the model can deserialize from different root element names. @@ -682,6 +684,9 @@ public static SharePropertiesInternal fromXml(XmlReader xmlReader, String rootEl } else if ("RootSquash".equals(elementName.getLocalPart())) { deserializedSharePropertiesInternal.rootSquash = ShareRootSquash.fromString(reader.getStringElement()); + } else if ("EnableSnapshotVirtualDirectoryAccess".equals(elementName.getLocalPart())) { + deserializedSharePropertiesInternal.enableSnapshotVirtualDirectoryAccess + = reader.getNullableElement(Boolean::parseBoolean); } else if ("Metadata".equals(elementName.getLocalPart())) { while (reader.nextElement() != XmlToken.END_ELEMENT) { if (deserializedSharePropertiesInternal.metadata == null) { diff --git a/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/implementation/models/ShareSignedIdentifierWrapper.java b/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/implementation/models/ShareSignedIdentifierWrapper.java index e67e816b08d3d..6c5d643b3360b 100644 --- a/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/implementation/models/ShareSignedIdentifierWrapper.java +++ b/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/implementation/models/ShareSignedIdentifierWrapper.java @@ -4,14 +4,15 @@ package com.azure.storage.file.share.implementation.models; -import com.azure.core.util.CoreUtils; import com.azure.storage.file.share.models.ShareSignedIdentifier; +import java.util.List; + +import com.azure.core.util.CoreUtils; import com.azure.xml.XmlReader; import com.azure.xml.XmlSerializable; import com.azure.xml.XmlToken; import com.azure.xml.XmlWriter; import java.util.ArrayList; -import java.util.List; import javax.xml.namespace.QName; import javax.xml.stream.XMLStreamException; diff --git a/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/implementation/models/ShareStats.java b/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/implementation/models/ShareStats.java index 569ddddeefb63..85dfe7f8ff3d5 100644 --- a/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/implementation/models/ShareStats.java +++ b/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/implementation/models/ShareStats.java @@ -19,8 +19,7 @@ @Fluent public final class ShareStats implements XmlSerializable { /* - * The approximate size of the data stored in bytes, rounded up to the nearest gigabyte. Note that this value may - * not include all recently created or recently resized files. + * The approximate size of the data stored in bytes, rounded up to the nearest gigabyte. Note that this value may not include all recently created or recently resized files. */ private long shareUsageBytes; diff --git a/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/implementation/models/SharesGetPropertiesHeaders.java b/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/implementation/models/SharesGetPropertiesHeaders.java index 869b20dab7639..4ba3472358e3e 100644 --- a/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/implementation/models/SharesGetPropertiesHeaders.java +++ b/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/implementation/models/SharesGetPropertiesHeaders.java @@ -138,17 +138,17 @@ public final class SharesGetPropertiesHeaders { private static final HttpHeaderName X_MS_ROOT_SQUASH = HttpHeaderName.fromString("x-ms-root-squash"); - private static final HttpHeaderName X_MS_ACCESS_TIER_CHANGE_TIME = - HttpHeaderName.fromString("x-ms-access-tier-change-time"); + private static final HttpHeaderName X_MS_ACCESS_TIER_CHANGE_TIME + = HttpHeaderName.fromString("x-ms-access-tier-change-time"); - private static final HttpHeaderName X_MS_ENABLE_SNAPSHOT_VIRTUAL_DIRECTORY_ACCESS = - HttpHeaderName.fromString("x-ms-enable-snapshot-virtual-directory-access"); + private static final HttpHeaderName X_MS_ENABLE_SNAPSHOT_VIRTUAL_DIRECTORY_ACCESS + = HttpHeaderName.fromString("x-ms-enable-snapshot-virtual-directory-access"); - private static final HttpHeaderName X_MS_SHARE_PROVISIONED_INGRESS_MBPS = - HttpHeaderName.fromString("x-ms-share-provisioned-ingress-mbps"); + private static final HttpHeaderName X_MS_SHARE_PROVISIONED_INGRESS_MBPS + = HttpHeaderName.fromString("x-ms-share-provisioned-ingress-mbps"); - private static final HttpHeaderName X_MS_SHARE_PROVISIONED_BANDWIDTH_MIBPS = - HttpHeaderName.fromString("x-ms-share-provisioned-bandwidth-mibps"); + private static final HttpHeaderName X_MS_SHARE_PROVISIONED_BANDWIDTH_MIBPS + = HttpHeaderName.fromString("x-ms-share-provisioned-bandwidth-mibps"); private static final HttpHeaderName X_MS_SHARE_QUOTA = HttpHeaderName.fromString("x-ms-share-quota"); @@ -170,7 +170,7 @@ public final class SharesGetPropertiesHeaders { // HttpHeaders containing the raw property values. /** * Creates an instance of SharesGetPropertiesHeaders class. - * + * * @param rawHeaders The raw HttpHeaders that will be used to create the property values. */ public SharesGetPropertiesHeaders(HttpHeaders rawHeaders) { @@ -199,11 +199,11 @@ public SharesGetPropertiesHeaders(HttpHeaders rawHeaders) { if (xMsAccessTierChangeTime != null) { this.xMsAccessTierChangeTime = new DateTimeRfc1123(xMsAccessTierChangeTime); } - String xMsEnableSnapshotVirtualDirectoryAccess = - rawHeaders.getValue(X_MS_ENABLE_SNAPSHOT_VIRTUAL_DIRECTORY_ACCESS); + String xMsEnableSnapshotVirtualDirectoryAccess + = rawHeaders.getValue(X_MS_ENABLE_SNAPSHOT_VIRTUAL_DIRECTORY_ACCESS); if (xMsEnableSnapshotVirtualDirectoryAccess != null) { - this.xMsEnableSnapshotVirtualDirectoryAccess = - Boolean.parseBoolean(xMsEnableSnapshotVirtualDirectoryAccess); + this.xMsEnableSnapshotVirtualDirectoryAccess + = Boolean.parseBoolean(xMsEnableSnapshotVirtualDirectoryAccess); } String date = rawHeaders.getValue(HttpHeaderName.DATE); if (date != null) { @@ -253,7 +253,7 @@ public SharesGetPropertiesHeaders(HttpHeaders rawHeaders) { /** * Get the xMsShareProvisionedIops property: The x-ms-share-provisioned-iops property. - * + * * @return the xMsShareProvisionedIops value. */ public Integer getXMsShareProvisionedIops() { @@ -262,7 +262,7 @@ public Integer getXMsShareProvisionedIops() { /** * Set the xMsShareProvisionedIops property: The x-ms-share-provisioned-iops property. - * + * * @param xMsShareProvisionedIops the xMsShareProvisionedIops value to set. * @return the SharesGetPropertiesHeaders object itself. */ @@ -273,7 +273,7 @@ public SharesGetPropertiesHeaders setXMsShareProvisionedIops(Integer xMsSharePro /** * Get the xMsVersion property: The x-ms-version property. - * + * * @return the xMsVersion value. */ public String getXMsVersion() { @@ -282,7 +282,7 @@ public String getXMsVersion() { /** * Set the xMsVersion property: The x-ms-version property. - * + * * @param xMsVersion the xMsVersion value to set. * @return the SharesGetPropertiesHeaders object itself. */ @@ -293,7 +293,7 @@ public SharesGetPropertiesHeaders setXMsVersion(String xMsVersion) { /** * Get the xMsLeaseStatus property: The x-ms-lease-status property. - * + * * @return the xMsLeaseStatus value. */ public LeaseStatusType getXMsLeaseStatus() { @@ -302,7 +302,7 @@ public LeaseStatusType getXMsLeaseStatus() { /** * Set the xMsLeaseStatus property: The x-ms-lease-status property. - * + * * @param xMsLeaseStatus the xMsLeaseStatus value to set. * @return the SharesGetPropertiesHeaders object itself. */ @@ -313,7 +313,7 @@ public SharesGetPropertiesHeaders setXMsLeaseStatus(LeaseStatusType xMsLeaseStat /** * Get the xMsLeaseState property: The x-ms-lease-state property. - * + * * @return the xMsLeaseState value. */ public LeaseStateType getXMsLeaseState() { @@ -322,7 +322,7 @@ public LeaseStateType getXMsLeaseState() { /** * Set the xMsLeaseState property: The x-ms-lease-state property. - * + * * @param xMsLeaseState the xMsLeaseState value to set. * @return the SharesGetPropertiesHeaders object itself. */ @@ -333,7 +333,7 @@ public SharesGetPropertiesHeaders setXMsLeaseState(LeaseStateType xMsLeaseState) /** * Get the xMsRootSquash property: The x-ms-root-squash property. - * + * * @return the xMsRootSquash value. */ public ShareRootSquash getXMsRootSquash() { @@ -342,7 +342,7 @@ public ShareRootSquash getXMsRootSquash() { /** * Set the xMsRootSquash property: The x-ms-root-squash property. - * + * * @param xMsRootSquash the xMsRootSquash value to set. * @return the SharesGetPropertiesHeaders object itself. */ @@ -353,7 +353,7 @@ public SharesGetPropertiesHeaders setXMsRootSquash(ShareRootSquash xMsRootSquash /** * Get the lastModified property: The Last-Modified property. - * + * * @return the lastModified value. */ public OffsetDateTime getLastModified() { @@ -365,7 +365,7 @@ public OffsetDateTime getLastModified() { /** * Set the lastModified property: The Last-Modified property. - * + * * @param lastModified the lastModified value to set. * @return the SharesGetPropertiesHeaders object itself. */ @@ -380,7 +380,7 @@ public SharesGetPropertiesHeaders setLastModified(OffsetDateTime lastModified) { /** * Get the xMsAccessTierChangeTime property: The x-ms-access-tier-change-time property. - * + * * @return the xMsAccessTierChangeTime value. */ public OffsetDateTime getXMsAccessTierChangeTime() { @@ -392,7 +392,7 @@ public OffsetDateTime getXMsAccessTierChangeTime() { /** * Set the xMsAccessTierChangeTime property: The x-ms-access-tier-change-time property. - * + * * @param xMsAccessTierChangeTime the xMsAccessTierChangeTime value to set. * @return the SharesGetPropertiesHeaders object itself. */ @@ -408,7 +408,7 @@ public SharesGetPropertiesHeaders setXMsAccessTierChangeTime(OffsetDateTime xMsA /** * Get the xMsEnableSnapshotVirtualDirectoryAccess property: The x-ms-enable-snapshot-virtual-directory-access * property. - * + * * @return the xMsEnableSnapshotVirtualDirectoryAccess value. */ public Boolean isXMsEnableSnapshotVirtualDirectoryAccess() { @@ -418,19 +418,19 @@ public Boolean isXMsEnableSnapshotVirtualDirectoryAccess() { /** * Set the xMsEnableSnapshotVirtualDirectoryAccess property: The x-ms-enable-snapshot-virtual-directory-access * property. - * + * * @param xMsEnableSnapshotVirtualDirectoryAccess the xMsEnableSnapshotVirtualDirectoryAccess value to set. * @return the SharesGetPropertiesHeaders object itself. */ - public SharesGetPropertiesHeaders setXMsEnableSnapshotVirtualDirectoryAccess( - Boolean xMsEnableSnapshotVirtualDirectoryAccess) { + public SharesGetPropertiesHeaders + setXMsEnableSnapshotVirtualDirectoryAccess(Boolean xMsEnableSnapshotVirtualDirectoryAccess) { this.xMsEnableSnapshotVirtualDirectoryAccess = xMsEnableSnapshotVirtualDirectoryAccess; return this; } /** * Get the xMsMeta property: The x-ms-meta- property. - * + * * @return the xMsMeta value. */ public Map getXMsMeta() { @@ -439,7 +439,7 @@ public Map getXMsMeta() { /** * Set the xMsMeta property: The x-ms-meta- property. - * + * * @param xMsMeta the xMsMeta value to set. * @return the SharesGetPropertiesHeaders object itself. */ @@ -450,7 +450,7 @@ public SharesGetPropertiesHeaders setXMsMeta(Map xMsMeta) { /** * Get the date property: The Date property. - * + * * @return the date value. */ public OffsetDateTime getDate() { @@ -462,7 +462,7 @@ public OffsetDateTime getDate() { /** * Set the date property: The Date property. - * + * * @param date the date value to set. * @return the SharesGetPropertiesHeaders object itself. */ @@ -477,7 +477,7 @@ public SharesGetPropertiesHeaders setDate(OffsetDateTime date) { /** * Get the xMsShareProvisionedIngressMbps property: The x-ms-share-provisioned-ingress-mbps property. - * + * * @return the xMsShareProvisionedIngressMbps value. */ public Integer getXMsShareProvisionedIngressMbps() { @@ -486,7 +486,7 @@ public Integer getXMsShareProvisionedIngressMbps() { /** * Set the xMsShareProvisionedIngressMbps property: The x-ms-share-provisioned-ingress-mbps property. - * + * * @param xMsShareProvisionedIngressMbps the xMsShareProvisionedIngressMbps value to set. * @return the SharesGetPropertiesHeaders object itself. */ @@ -497,7 +497,7 @@ public SharesGetPropertiesHeaders setXMsShareProvisionedIngressMbps(Integer xMsS /** * Get the xMsShareProvisionedBandwidthMibps property: The x-ms-share-provisioned-bandwidth-mibps property. - * + * * @return the xMsShareProvisionedBandwidthMibps value. */ public Integer getXMsShareProvisionedBandwidthMibps() { @@ -506,7 +506,7 @@ public Integer getXMsShareProvisionedBandwidthMibps() { /** * Set the xMsShareProvisionedBandwidthMibps property: The x-ms-share-provisioned-bandwidth-mibps property. - * + * * @param xMsShareProvisionedBandwidthMibps the xMsShareProvisionedBandwidthMibps value to set. * @return the SharesGetPropertiesHeaders object itself. */ @@ -517,7 +517,7 @@ public SharesGetPropertiesHeaders setXMsShareProvisionedBandwidthMibps(Integer x /** * Get the xMsShareQuota property: The x-ms-share-quota property. - * + * * @return the xMsShareQuota value. */ public Integer getXMsShareQuota() { @@ -526,7 +526,7 @@ public Integer getXMsShareQuota() { /** * Set the xMsShareQuota property: The x-ms-share-quota property. - * + * * @param xMsShareQuota the xMsShareQuota value to set. * @return the SharesGetPropertiesHeaders object itself. */ @@ -537,7 +537,7 @@ public SharesGetPropertiesHeaders setXMsShareQuota(Integer xMsShareQuota) { /** * Get the xMsAccessTier property: The x-ms-access-tier property. - * + * * @return the xMsAccessTier value. */ public String getXMsAccessTier() { @@ -546,7 +546,7 @@ public String getXMsAccessTier() { /** * Set the xMsAccessTier property: The x-ms-access-tier property. - * + * * @param xMsAccessTier the xMsAccessTier value to set. * @return the SharesGetPropertiesHeaders object itself. */ @@ -557,7 +557,7 @@ public SharesGetPropertiesHeaders setXMsAccessTier(String xMsAccessTier) { /** * Get the eTag property: The ETag property. - * + * * @return the eTag value. */ public String getETag() { @@ -566,7 +566,7 @@ public String getETag() { /** * Set the eTag property: The ETag property. - * + * * @param eTag the eTag value to set. * @return the SharesGetPropertiesHeaders object itself. */ @@ -577,7 +577,7 @@ public SharesGetPropertiesHeaders setETag(String eTag) { /** * Get the xMsEnabledProtocols property: The x-ms-enabled-protocols property. - * + * * @return the xMsEnabledProtocols value. */ public String getXMsEnabledProtocols() { @@ -586,7 +586,7 @@ public String getXMsEnabledProtocols() { /** * Set the xMsEnabledProtocols property: The x-ms-enabled-protocols property. - * + * * @param xMsEnabledProtocols the xMsEnabledProtocols value to set. * @return the SharesGetPropertiesHeaders object itself. */ @@ -597,7 +597,7 @@ public SharesGetPropertiesHeaders setXMsEnabledProtocols(String xMsEnabledProtoc /** * Get the xMsLeaseDuration property: The x-ms-lease-duration property. - * + * * @return the xMsLeaseDuration value. */ public LeaseDurationType getXMsLeaseDuration() { @@ -606,7 +606,7 @@ public LeaseDurationType getXMsLeaseDuration() { /** * Set the xMsLeaseDuration property: The x-ms-lease-duration property. - * + * * @param xMsLeaseDuration the xMsLeaseDuration value to set. * @return the SharesGetPropertiesHeaders object itself. */ @@ -617,7 +617,7 @@ public SharesGetPropertiesHeaders setXMsLeaseDuration(LeaseDurationType xMsLease /** * Get the xMsRequestId property: The x-ms-request-id property. - * + * * @return the xMsRequestId value. */ public String getXMsRequestId() { @@ -626,7 +626,7 @@ public String getXMsRequestId() { /** * Set the xMsRequestId property: The x-ms-request-id property. - * + * * @param xMsRequestId the xMsRequestId value to set. * @return the SharesGetPropertiesHeaders object itself. */ @@ -637,7 +637,7 @@ public SharesGetPropertiesHeaders setXMsRequestId(String xMsRequestId) { /** * Get the xMsAccessTierTransitionState property: The x-ms-access-tier-transition-state property. - * + * * @return the xMsAccessTierTransitionState value. */ public String getXMsAccessTierTransitionState() { @@ -646,7 +646,7 @@ public String getXMsAccessTierTransitionState() { /** * Set the xMsAccessTierTransitionState property: The x-ms-access-tier-transition-state property. - * + * * @param xMsAccessTierTransitionState the xMsAccessTierTransitionState value to set. * @return the SharesGetPropertiesHeaders object itself. */ @@ -657,7 +657,7 @@ public SharesGetPropertiesHeaders setXMsAccessTierTransitionState(String xMsAcce /** * Get the xMsShareProvisionedEgressMbps property: The x-ms-share-provisioned-egress-mbps property. - * + * * @return the xMsShareProvisionedEgressMbps value. */ public Integer getXMsShareProvisionedEgressMbps() { @@ -666,7 +666,7 @@ public Integer getXMsShareProvisionedEgressMbps() { /** * Set the xMsShareProvisionedEgressMbps property: The x-ms-share-provisioned-egress-mbps property. - * + * * @param xMsShareProvisionedEgressMbps the xMsShareProvisionedEgressMbps value to set. * @return the SharesGetPropertiesHeaders object itself. */ @@ -678,7 +678,7 @@ public SharesGetPropertiesHeaders setXMsShareProvisionedEgressMbps(Integer xMsSh /** * Get the xMsShareNextAllowedQuotaDowngradeTime property: The x-ms-share-next-allowed-quota-downgrade-time * property. - * + * * @return the xMsShareNextAllowedQuotaDowngradeTime value. */ public OffsetDateTime getXMsShareNextAllowedQuotaDowngradeTime() { @@ -691,7 +691,7 @@ public OffsetDateTime getXMsShareNextAllowedQuotaDowngradeTime() { /** * Set the xMsShareNextAllowedQuotaDowngradeTime property: The x-ms-share-next-allowed-quota-downgrade-time * property. - * + * * @param xMsShareNextAllowedQuotaDowngradeTime the xMsShareNextAllowedQuotaDowngradeTime value to set. * @return the SharesGetPropertiesHeaders object itself. */ diff --git a/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/implementation/models/SourceLeaseAccessConditions.java b/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/implementation/models/SourceLeaseAccessConditions.java index f95ab4265ec9f..db0a3de691d47 100644 --- a/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/implementation/models/SourceLeaseAccessConditions.java +++ b/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/implementation/models/SourceLeaseAccessConditions.java @@ -5,17 +5,12 @@ package com.azure.storage.file.share.implementation.models; import com.azure.core.annotation.Fluent; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; /** * Parameter group. */ @Fluent -public final class SourceLeaseAccessConditions implements JsonSerializable { +public final class SourceLeaseAccessConditions { /* * Required if the source file has an active infinite lease. */ @@ -46,37 +41,4 @@ public SourceLeaseAccessConditions setSourceLeaseId(String sourceLeaseId) { this.sourceLeaseId = sourceLeaseId; return this; } - - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("sourceLeaseId", this.sourceLeaseId); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of SourceLeaseAccessConditions from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of SourceLeaseAccessConditions if the JsonReader was pointing to an instance of it, or null - * if it was pointing to JSON null. - * @throws IOException If an error occurs while reading the SourceLeaseAccessConditions. - */ - public static SourceLeaseAccessConditions fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - SourceLeaseAccessConditions deserializedSourceLeaseAccessConditions = new SourceLeaseAccessConditions(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("sourceLeaseId".equals(fieldName)) { - deserializedSourceLeaseAccessConditions.sourceLeaseId = reader.getString(); - } else { - reader.skipChildren(); - } - } - - return deserializedSourceLeaseAccessConditions; - }); - } } diff --git a/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/implementation/models/StorageError.java b/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/implementation/models/StorageError.java index 13a2d15d37682..6afb2e2f2c28e 100644 --- a/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/implementation/models/StorageError.java +++ b/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/implementation/models/StorageError.java @@ -43,12 +43,15 @@ public final class StorageError implements XmlSerializable { */ private String authenticationErrorDetail; - /** Creates an instance of StorageError class. */ - public StorageError() {} + /** + * Creates an instance of StorageError class. + */ + public StorageError() { + } /** * Get the message property: The Message property. - * + * * @return the message value. */ public String getMessage() { @@ -57,7 +60,7 @@ public String getMessage() { /** * Set the message property: The Message property. - * + * * @param message the message value to set. * @return the StorageError object itself. */ @@ -68,7 +71,7 @@ public StorageError setMessage(String message) { /** * Get the copySourceStatusCode property: The CopySourceStatusCode property. - * + * * @return the copySourceStatusCode value. */ public Long getCopySourceStatusCode() { @@ -77,7 +80,7 @@ public Long getCopySourceStatusCode() { /** * Set the copySourceStatusCode property: The CopySourceStatusCode property. - * + * * @param copySourceStatusCode the copySourceStatusCode value to set. * @return the StorageError object itself. */ @@ -88,7 +91,7 @@ public StorageError setCopySourceStatusCode(Long copySourceStatusCode) { /** * Get the copySourceErrorCode property: The CopySourceErrorCode property. - * + * * @return the copySourceErrorCode value. */ public String getCopySourceErrorCode() { @@ -97,7 +100,7 @@ public String getCopySourceErrorCode() { /** * Set the copySourceErrorCode property: The CopySourceErrorCode property. - * + * * @param copySourceErrorCode the copySourceErrorCode value to set. * @return the StorageError object itself. */ @@ -108,7 +111,7 @@ public StorageError setCopySourceErrorCode(String copySourceErrorCode) { /** * Get the copySourceErrorMessage property: The CopySourceErrorMessage property. - * + * * @return the copySourceErrorMessage value. */ public String getCopySourceErrorMessage() { @@ -117,7 +120,7 @@ public String getCopySourceErrorMessage() { /** * Set the copySourceErrorMessage property: The CopySourceErrorMessage property. - * + * * @param copySourceErrorMessage the copySourceErrorMessage value to set. * @return the StorageError object itself. */ @@ -128,7 +131,7 @@ public StorageError setCopySourceErrorMessage(String copySourceErrorMessage) { /** * Get the authenticationErrorDetail property: The AuthenticationErrorDetail property. - * + * * @return the authenticationErrorDetail value. */ public String getAuthenticationErrorDetail() { @@ -137,7 +140,7 @@ public String getAuthenticationErrorDetail() { /** * Set the authenticationErrorDetail property: The AuthenticationErrorDetail property. - * + * * @param authenticationErrorDetail the authenticationErrorDetail value to set. * @return the StorageError object itself. */ @@ -156,12 +159,16 @@ public XmlWriter toXml(XmlWriter xmlWriter, String rootElementName) throws XMLSt rootElementName = CoreUtils.isNullOrEmpty(rootElementName) ? "StorageError" : rootElementName; xmlWriter.writeStartElement(rootElementName); xmlWriter.writeStringElement("Message", this.message); + xmlWriter.writeNumberElement("CopySourceStatusCode", this.copySourceStatusCode); + xmlWriter.writeStringElement("CopySourceErrorCode", this.copySourceErrorCode); + xmlWriter.writeStringElement("CopySourceErrorMessage", this.copySourceErrorMessage); + xmlWriter.writeStringElement("AuthenticationErrorDetail", this.authenticationErrorDetail); return xmlWriter.writeEndElement(); } /** * Reads an instance of StorageError from the XmlReader. - * + * * @param xmlReader The XmlReader being read. * @return An instance of StorageError if the XmlReader was pointing to an instance of it, or null if it was * pointing to XML null. @@ -173,7 +180,7 @@ public static StorageError fromXml(XmlReader xmlReader) throws XMLStreamExceptio /** * Reads an instance of StorageError from the XmlReader. - * + * * @param xmlReader The XmlReader being read. * @param rootElementName Optional root element name to override the default defined by the model. Used to support * cases where the model can deserialize from different root element names. @@ -190,6 +197,14 @@ public static StorageError fromXml(XmlReader xmlReader, String rootElementName) if ("Message".equals(elementName.getLocalPart())) { deserializedStorageError.message = reader.getStringElement(); + } else if ("CopySourceStatusCode".equals(elementName.getLocalPart())) { + deserializedStorageError.copySourceStatusCode = reader.getNullableElement(Long::parseLong); + } else if ("CopySourceErrorCode".equals(elementName.getLocalPart())) { + deserializedStorageError.copySourceErrorCode = reader.getStringElement(); + } else if ("CopySourceErrorMessage".equals(elementName.getLocalPart())) { + deserializedStorageError.copySourceErrorMessage = reader.getStringElement(); + } else if ("AuthenticationErrorDetail".equals(elementName.getLocalPart())) { + deserializedStorageError.authenticationErrorDetail = reader.getStringElement(); } else { reader.skipElement(); } diff --git a/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/implementation/util/ModelHelper.java b/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/implementation/util/ModelHelper.java index 6d5c53efbfff9..9457d48c2a2ed 100644 --- a/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/implementation/util/ModelHelper.java +++ b/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/implementation/util/ModelHelper.java @@ -206,7 +206,7 @@ public static ShareProperties populateShareProperties(SharePropertiesInternal sh properties.setRootSquash(sharePropertiesInternal.getRootSquash()); properties.setMetadata(sharePropertiesInternal.getMetadata()); properties.setProvisionedBandwidthMiBps(sharePropertiesInternal.getProvisionedBandwidthMiBps()); - properties.setEnableSnapshotVirtualDirectoryAccess(sharePropertiesInternal.isEnableSnapshotVirtualDirectoryAccess()); + properties.setSnapshotVirtualDirectoryAccessEnabled(sharePropertiesInternal.isEnableSnapshotVirtualDirectoryAccess()); return properties; } @@ -464,6 +464,7 @@ public static Response mapGetPropertiesResponse(ResponseBase(response, shareProperties); diff --git a/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/models/ShareCorsRule.java b/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/models/ShareCorsRule.java index aa8ab5b2f4769..ddc9ed1bb769e 100644 --- a/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/models/ShareCorsRule.java +++ b/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/models/ShareCorsRule.java @@ -22,10 +22,7 @@ @Fluent public final class ShareCorsRule implements XmlSerializable { /* - * The origin domains that are permitted to make a request against the storage service via CORS. The origin domain - * is the domain from which the request originates. Note that the origin must be an exact case-sensitive match with - * the origin that the user age sends to the service. You can also use the wildcard character '*' to allow all - * origin domains to make requests via CORS. + * The origin domains that are permitted to make a request against the storage service via CORS. The origin domain is the domain from which the request originates. Note that the origin must be an exact case-sensitive match with the origin that the user age sends to the service. You can also use the wildcard character '*' to allow all origin domains to make requests via CORS. */ private String allowedOrigins; @@ -40,8 +37,7 @@ public final class ShareCorsRule implements XmlSerializable { private String allowedHeaders; /* - * The response headers that may be sent in the response to the CORS request and exposed by the browser to the - * request issuer. + * The response headers that may be sent in the response to the CORS request and exposed by the browser to the request issuer. */ private String exposedHeaders; @@ -58,8 +54,8 @@ public ShareCorsRule() { /** * Get the allowedOrigins property: The origin domains that are permitted to make a request against the storage - * service via CORS. The origin domain is the domain from which the request originates. Note that the origin must - * be an exact case-sensitive match with the origin that the user age sends to the service. You can also use the + * service via CORS. The origin domain is the domain from which the request originates. Note that the origin must be + * an exact case-sensitive match with the origin that the user age sends to the service. You can also use the * wildcard character '*' to allow all origin domains to make requests via CORS. * * @return the allowedOrigins value. @@ -70,8 +66,8 @@ public String getAllowedOrigins() { /** * Set the allowedOrigins property: The origin domains that are permitted to make a request against the storage - * service via CORS. The origin domain is the domain from which the request originates. Note that the origin must - * be an exact case-sensitive match with the origin that the user age sends to the service. You can also use the + * service via CORS. The origin domain is the domain from which the request originates. Note that the origin must be + * an exact case-sensitive match with the origin that the user age sends to the service. You can also use the * wildcard character '*' to allow all origin domains to make requests via CORS. * * @param allowedOrigins the allowedOrigins value to set. diff --git a/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/models/ShareFileHttpHeaders.java b/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/models/ShareFileHttpHeaders.java index f99cc7fd5b39c..7554d2724a67a 100644 --- a/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/models/ShareFileHttpHeaders.java +++ b/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/models/ShareFileHttpHeaders.java @@ -6,17 +6,12 @@ import com.azure.core.annotation.Fluent; import com.azure.core.util.CoreUtils; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; /** * Parameter group. */ @Fluent -public final class ShareFileHttpHeaders implements JsonSerializable { +public final class ShareFileHttpHeaders { /* * Sets the MIME content type of the file. The default type is 'application/octet-stream'. */ @@ -116,8 +111,8 @@ public ShareFileHttpHeaders setContentLanguage(String contentLanguage) { } /** - * Get the cacheControl property: Sets the file's cache control. The File service stores this value but does not - * use or modify it. + * Get the cacheControl property: Sets the file's cache control. The File service stores this value but does not use + * or modify it. * * @return the cacheControl value. */ @@ -126,8 +121,8 @@ public String getCacheControl() { } /** - * Set the cacheControl property: Sets the file's cache control. The File service stores this value but does not - * use or modify it. + * Set the cacheControl property: Sets the file's cache control. The File service stores this value but does not use + * or modify it. * * @param cacheControl the cacheControl value to set. * @return the ShareFileHttpHeaders object itself. @@ -176,52 +171,4 @@ public ShareFileHttpHeaders setContentDisposition(String contentDisposition) { this.contentDisposition = contentDisposition; return this; } - - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeStringField("contentType", this.contentType); - jsonWriter.writeStringField("contentEncoding", this.contentEncoding); - jsonWriter.writeStringField("contentLanguage", this.contentLanguage); - jsonWriter.writeStringField("cacheControl", this.cacheControl); - jsonWriter.writeBinaryField("contentMd5", this.contentMd5); - jsonWriter.writeStringField("contentDisposition", this.contentDisposition); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of ShareFileHttpHeaders from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of ShareFileHttpHeaders if the JsonReader was pointing to an instance of it, or null if it - * was pointing to JSON null. - * @throws IOException If an error occurs while reading the ShareFileHttpHeaders. - */ - public static ShareFileHttpHeaders fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - ShareFileHttpHeaders deserializedShareFileHttpHeaders = new ShareFileHttpHeaders(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("contentType".equals(fieldName)) { - deserializedShareFileHttpHeaders.contentType = reader.getString(); - } else if ("contentEncoding".equals(fieldName)) { - deserializedShareFileHttpHeaders.contentEncoding = reader.getString(); - } else if ("contentLanguage".equals(fieldName)) { - deserializedShareFileHttpHeaders.contentLanguage = reader.getString(); - } else if ("cacheControl".equals(fieldName)) { - deserializedShareFileHttpHeaders.cacheControl = reader.getString(); - } else if ("contentMd5".equals(fieldName)) { - deserializedShareFileHttpHeaders.contentMd5 = reader.getBinary(); - } else if ("contentDisposition".equals(fieldName)) { - deserializedShareFileHttpHeaders.contentDisposition = reader.getString(); - } else { - reader.skipChildren(); - } - } - - return deserializedShareFileHttpHeaders; - }); - } } diff --git a/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/models/ShareProperties.java b/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/models/ShareProperties.java index a63d43ed760d8..1bd992f7f4969 100644 --- a/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/models/ShareProperties.java +++ b/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/models/ShareProperties.java @@ -572,7 +572,7 @@ public ShareProperties setMetadata(Map metadata) { * * @return the enableSnapshotVirtualDirectoryAccess value. */ - public Boolean isEnableSnapshotVirtualDirectoryAccess() { + public Boolean isSnapshotVirtualDirectoryAccessEnabled() { return this.enableSnapshotVirtualDirectoryAccess; } @@ -585,7 +585,7 @@ public Boolean isEnableSnapshotVirtualDirectoryAccess() { * @param enableSnapshotVirtualDirectoryAccess the enableSnapshotVirtualDirectoryAccess value to set. * @return the ShareProperties object itself. */ - public ShareProperties setEnableSnapshotVirtualDirectoryAccess( + public ShareProperties setSnapshotVirtualDirectoryAccessEnabled( Boolean enableSnapshotVirtualDirectoryAccess) { this.enableSnapshotVirtualDirectoryAccess = enableSnapshotVirtualDirectoryAccess; return this; diff --git a/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/models/ShareRetentionPolicy.java b/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/models/ShareRetentionPolicy.java index 750410ea6bdba..5f10bec648823 100644 --- a/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/models/ShareRetentionPolicy.java +++ b/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/models/ShareRetentionPolicy.java @@ -19,14 +19,12 @@ @Fluent public final class ShareRetentionPolicy implements XmlSerializable { /* - * Indicates whether a retention policy is enabled for the File service. If false, metrics data is retained, and - * the user is responsible for deleting it. + * Indicates whether a retention policy is enabled for the File service. If false, metrics data is retained, and the user is responsible for deleting it. */ private boolean enabled; /* - * Indicates the number of days that metrics data should be retained. All data older than this value will be - * deleted. Metrics data is deleted on a best-effort basis after the retention period expires. + * Indicates the number of days that metrics data should be retained. All data older than this value will be deleted. Metrics data is deleted on a best-effort basis after the retention period expires. */ private Integer days; @@ -37,8 +35,8 @@ public ShareRetentionPolicy() { } /** - * Get the enabled property: Indicates whether a retention policy is enabled for the File service. If false, - * metrics data is retained, and the user is responsible for deleting it. + * Get the enabled property: Indicates whether a retention policy is enabled for the File service. If false, metrics + * data is retained, and the user is responsible for deleting it. * * @return the enabled value. */ @@ -47,8 +45,8 @@ public boolean isEnabled() { } /** - * Set the enabled property: Indicates whether a retention policy is enabled for the File service. If false, - * metrics data is retained, and the user is responsible for deleting it. + * Set the enabled property: Indicates whether a retention policy is enabled for the File service. If false, metrics + * data is retained, and the user is responsible for deleting it. * * @param enabled the enabled value to set. * @return the ShareRetentionPolicy object itself. diff --git a/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/models/SourceModifiedAccessConditions.java b/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/models/SourceModifiedAccessConditions.java index c5181f9792888..5520e0b45557a 100644 --- a/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/models/SourceModifiedAccessConditions.java +++ b/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/models/SourceModifiedAccessConditions.java @@ -6,17 +6,12 @@ import com.azure.core.annotation.Fluent; import com.azure.core.util.CoreUtils; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; /** * Parameter group. */ @Fluent -public final class SourceModifiedAccessConditions implements JsonSerializable { +public final class SourceModifiedAccessConditions { /* * Specify the crc64 value to operate only on range with a matching crc64 checksum. */ @@ -76,41 +71,4 @@ public SourceModifiedAccessConditions setSourceIfNoneMatchCrc64(byte[] sourceIfN this.sourceIfNoneMatchCrc64 = CoreUtils.clone(sourceIfNoneMatchCrc64); return this; } - - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeBinaryField("sourceIfMatchCrc64", this.sourceIfMatchCrc64); - jsonWriter.writeBinaryField("sourceIfNoneMatchCrc64", this.sourceIfNoneMatchCrc64); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of SourceModifiedAccessConditions from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of SourceModifiedAccessConditions if the JsonReader was pointing to an instance of it, or - * null if it was pointing to JSON null. - * @throws IOException If an error occurs while reading the SourceModifiedAccessConditions. - */ - public static SourceModifiedAccessConditions fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - SourceModifiedAccessConditions deserializedSourceModifiedAccessConditions - = new SourceModifiedAccessConditions(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("sourceIfMatchCrc64".equals(fieldName)) { - deserializedSourceModifiedAccessConditions.sourceIfMatchCrc64 = reader.getBinary(); - } else if ("sourceIfNoneMatchCrc64".equals(fieldName)) { - deserializedSourceModifiedAccessConditions.sourceIfNoneMatchCrc64 = reader.getBinary(); - } else { - reader.skipChildren(); - } - } - - return deserializedSourceModifiedAccessConditions; - }); - } } diff --git a/sdk/storage/azure-storage-file-share/src/test/java/com/azure/storage/file/share/FileServiceApiTests.java b/sdk/storage/azure-storage-file-share/src/test/java/com/azure/storage/file/share/FileServiceApiTests.java index 4ec0d3ab8afcb..90a078dbfed0c 100644 --- a/sdk/storage/azure-storage-file-share/src/test/java/com/azure/storage/file/share/FileServiceApiTests.java +++ b/sdk/storage/azure-storage-file-share/src/test/java/com/azure/storage/file/share/FileServiceApiTests.java @@ -432,6 +432,6 @@ public void listSharesEnableSnapshotVirtualDirectoryAccess() { ShareItem share = primaryFileServiceClient.listShares().iterator().next(); assertEquals(protocols.toString(), share.getProperties().getProtocols().toString()); - assertTrue(share.getProperties().isEnableSnapshotVirtualDirectoryAccess()); + assertTrue(share.getProperties().isSnapshotVirtualDirectoryAccessEnabled()); } } diff --git a/sdk/storage/azure-storage-file-share/src/test/java/com/azure/storage/file/share/FileServiceAsyncApiTests.java b/sdk/storage/azure-storage-file-share/src/test/java/com/azure/storage/file/share/FileServiceAsyncApiTests.java index c75f3cb39fdc5..86d4bdf2aa903 100644 --- a/sdk/storage/azure-storage-file-share/src/test/java/com/azure/storage/file/share/FileServiceAsyncApiTests.java +++ b/sdk/storage/azure-storage-file-share/src/test/java/com/azure/storage/file/share/FileServiceAsyncApiTests.java @@ -320,8 +320,9 @@ public void listSharesEnableSnapshotVirtualDirectoryAccess() { .assertNext(r -> { ShareProperties properties = r.getProperties(); assertEquals(protocols.toString(), properties.getProtocols().toString()); - assertTrue(properties.isEnableSnapshotVirtualDirectoryAccess()); + assertTrue(properties.isSnapshotVirtualDirectoryAccessEnabled()); }) + .thenConsumeWhile(x -> true) .verifyComplete(); } } diff --git a/sdk/storage/azure-storage-file-share/src/test/java/com/azure/storage/file/share/ShareApiTests.java b/sdk/storage/azure-storage-file-share/src/test/java/com/azure/storage/file/share/ShareApiTests.java index 9c8d326da3973..37c9226d95df8 100644 --- a/sdk/storage/azure-storage-file-share/src/test/java/com/azure/storage/file/share/ShareApiTests.java +++ b/sdk/storage/azure-storage-file-share/src/test/java/com/azure/storage/file/share/ShareApiTests.java @@ -1268,9 +1268,9 @@ public void createEnableSnapshotVirtualDirectoryAccess(Boolean enableSnapshotVir ShareProperties response = primaryShareClient.getProperties(); assertEquals(protocols.toString(), response.getProtocols().toString()); if (enableSnapshotVirtualDirectoryAccess == null || enableSnapshotVirtualDirectoryAccess) { - assertTrue(response.isEnableSnapshotVirtualDirectoryAccess()); + assertTrue(response.isSnapshotVirtualDirectoryAccessEnabled()); } else { - assertFalse(response.isEnableSnapshotVirtualDirectoryAccess()); + assertFalse(response.isSnapshotVirtualDirectoryAccessEnabled()); } } @@ -1300,9 +1300,9 @@ public void setPropertiesEnableSnapshotVirtualDirectoryAccess(Boolean enableSnap ShareProperties response = primaryShareClient.getProperties(); assertEquals(protocols.toString(), response.getProtocols().toString()); if (enableSnapshotVirtualDirectoryAccess == null || enableSnapshotVirtualDirectoryAccess) { - assertTrue(response.isEnableSnapshotVirtualDirectoryAccess()); + assertTrue(response.isSnapshotVirtualDirectoryAccessEnabled()); } else { - assertFalse(response.isEnableSnapshotVirtualDirectoryAccess()); + assertFalse(response.isSnapshotVirtualDirectoryAccessEnabled()); } } } diff --git a/sdk/storage/azure-storage-file-share/src/test/java/com/azure/storage/file/share/ShareAsyncApiTests.java b/sdk/storage/azure-storage-file-share/src/test/java/com/azure/storage/file/share/ShareAsyncApiTests.java index 602ff6bfeaaf4..78b11476d3344 100644 --- a/sdk/storage/azure-storage-file-share/src/test/java/com/azure/storage/file/share/ShareAsyncApiTests.java +++ b/sdk/storage/azure-storage-file-share/src/test/java/com/azure/storage/file/share/ShareAsyncApiTests.java @@ -831,9 +831,9 @@ public void createEnableSnapshotVirtualDirectoryAccess(Boolean enableSnapshotVir .assertNext(r -> { assertEquals(protocols.toString(), r.getProtocols().toString()); if (enableSnapshotVirtualDirectoryAccess == null || enableSnapshotVirtualDirectoryAccess) { - assertTrue(r.isEnableSnapshotVirtualDirectoryAccess()); + assertTrue(r.isSnapshotVirtualDirectoryAccessEnabled()); } else { - assertFalse(r.isEnableSnapshotVirtualDirectoryAccess()); + assertFalse(r.isSnapshotVirtualDirectoryAccessEnabled()); } }) .verifyComplete(); @@ -866,9 +866,9 @@ public void setPropertiesEnableSnapshotVirtualDirectoryAccess(Boolean enableSnap .assertNext(r -> { assertEquals(protocols.toString(), r.getProtocols().toString()); if (enableSnapshotVirtualDirectoryAccess == null || enableSnapshotVirtualDirectoryAccess) { - assertTrue(r.isEnableSnapshotVirtualDirectoryAccess()); + assertTrue(r.isSnapshotVirtualDirectoryAccessEnabled()); } else { - assertFalse(r.isEnableSnapshotVirtualDirectoryAccess()); + assertFalse(r.isSnapshotVirtualDirectoryAccessEnabled()); } }) .verifyComplete(); diff --git a/sdk/storage/azure-storage-file-share/swagger/README.md b/sdk/storage/azure-storage-file-share/swagger/README.md index e195ef2ae98ae..446f77e69a183 100644 --- a/sdk/storage/azure-storage-file-share/swagger/README.md +++ b/sdk/storage/azure-storage-file-share/swagger/README.md @@ -15,8 +15,8 @@ autorest ### Code generation settings ``` yaml -use: '@autorest/java@4.1.16' -input-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/ccefad16baad361096d997888ef8ff8503118fac/specification/storage/data-plane/Microsoft.FileStorage/stable/2024-08-04/file.json +use: '@autorest/java@4.1.29' +input-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/feature/storage/stg94base/specification/storage/data-plane/Microsoft.FileStorage/stable/2024-08-04/file.json java: true output-folder: ../ namespace: com.azure.storage.file.share diff --git a/sdk/storage/azure-storage-queue/assets.json b/sdk/storage/azure-storage-queue/assets.json index 8098acb007e06..9d98ffe0076a4 100644 --- a/sdk/storage/azure-storage-queue/assets.json +++ b/sdk/storage/azure-storage-queue/assets.json @@ -2,5 +2,5 @@ "AssetsRepo": "Azure/azure-sdk-assets", "AssetsRepoPrefixPath": "java", "TagPrefix": "java/storage/azure-storage-queue", - "Tag": "java/storage/azure-storage-queue_3f94b8446e" + "Tag": "java/storage/azure-storage-queue_762b1b570a" } diff --git a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/util/BuilderHelper.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/util/BuilderHelper.java index 585cf86259e57..17f3f28944494 100644 --- a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/util/BuilderHelper.java +++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/util/BuilderHelper.java @@ -12,7 +12,6 @@ import com.azure.core.http.policy.AddDatePolicy; import com.azure.core.http.policy.AddHeadersPolicy; import com.azure.core.http.policy.AzureSasCredentialPolicy; -import com.azure.core.http.policy.BearerTokenAuthenticationPolicy; import com.azure.core.http.policy.HttpLogOptions; import com.azure.core.http.policy.HttpLoggingPolicy; import com.azure.core.http.policy.HttpPipelinePolicy; @@ -36,6 +35,7 @@ import com.azure.storage.common.policy.RequestRetryOptions; import com.azure.storage.common.policy.ResponseValidationPolicyBuilder; import com.azure.storage.common.policy.ScrubEtagPolicy; +import com.azure.storage.common.policy.StorageBearerTokenChallengeAuthorizationPolicy; import com.azure.storage.common.policy.StorageSharedKeyCredentialPolicy; import com.azure.storage.common.sas.CommonSasQueryParameters; import com.azure.storage.queue.models.QueueAudience; @@ -199,7 +199,7 @@ public static HttpPipeline buildPipeline( httpsValidation(tokenCredential, "bearer token", endpoint, logger); String scope = audience != null ? ((audience.toString().endsWith("/") ? audience + ".default" : audience + "/.default")) : Constants.STORAGE_SCOPE; - credentialPolicy = new BearerTokenAuthenticationPolicy(tokenCredential, scope); + credentialPolicy = new StorageBearerTokenChallengeAuthorizationPolicy(tokenCredential, scope); } else if (azureSasCredential != null) { credentialPolicy = new AzureSasCredentialPolicy(azureSasCredential, false); } else if (sasToken != null) { diff --git a/sdk/storage/azure-storage-queue/src/test/java/com/azure/storage/queue/QueueApiTests.java b/sdk/storage/azure-storage-queue/src/test/java/com/azure/storage/queue/QueueApiTests.java index a82c6ac067c3f..58e813de70fbf 100644 --- a/sdk/storage/azure-storage-queue/src/test/java/com/azure/storage/queue/QueueApiTests.java +++ b/sdk/storage/azure-storage-queue/src/test/java/com/azure/storage/queue/QueueApiTests.java @@ -8,6 +8,8 @@ import com.azure.core.util.Context; import com.azure.identity.DefaultAzureCredentialBuilder; import com.azure.storage.common.StorageSharedKeyCredential; +import com.azure.storage.common.test.shared.extensions.LiveOnly; +import com.azure.storage.common.test.shared.extensions.RequiredServiceVersion; import com.azure.storage.queue.models.PeekedMessageItem; import com.azure.storage.queue.models.QueueAccessPolicy; import com.azure.storage.queue.models.QueueAudience; @@ -866,17 +868,20 @@ public void storageAccountAudience() { assertNotNull(aadQueue.getProperties()); } - + @RequiredServiceVersion(clazz = QueueServiceVersion.class, min = "2024-08-04") + @LiveOnly @Test - public void audienceError() { + /* This test tests if the bearer challenge is working properly. A bad audience is passed in, the service returns + the default audience, and the request gets retried with this default audience, making the call function as expected. + */ + public void audienceErrorBearerChallengeRetry() { queueClient.createIfNotExists(); QueueClient aadQueue = getOAuthQueueClientBuilder(primaryQueueServiceClient.getQueueServiceUrl()) .queueName(queueClient.getQueueName()) .audience(QueueAudience.createQueueServiceAccountAudience("badaudience")) .buildClient(); - QueueStorageException e = assertThrows(QueueStorageException.class, aadQueue::getProperties); - assertEquals(QueueErrorCode.INVALID_AUTHENTICATION_INFO, e.getErrorCode()); + assertNotNull(aadQueue.getProperties()); } @Test diff --git a/sdk/storage/azure-storage-queue/src/test/java/com/azure/storage/queue/QueueAsyncApiTests.java b/sdk/storage/azure-storage-queue/src/test/java/com/azure/storage/queue/QueueAsyncApiTests.java index 764f68c2c41cb..efe5e772770d6 100644 --- a/sdk/storage/azure-storage-queue/src/test/java/com/azure/storage/queue/QueueAsyncApiTests.java +++ b/sdk/storage/azure-storage-queue/src/test/java/com/azure/storage/queue/QueueAsyncApiTests.java @@ -6,13 +6,14 @@ import com.azure.core.util.BinaryData; import com.azure.identity.DefaultAzureCredentialBuilder; import com.azure.storage.common.StorageSharedKeyCredential; +import com.azure.storage.common.test.shared.extensions.LiveOnly; +import com.azure.storage.common.test.shared.extensions.RequiredServiceVersion; import com.azure.storage.queue.models.PeekedMessageItem; import com.azure.storage.queue.models.QueueAccessPolicy; import com.azure.storage.queue.models.QueueAudience; import com.azure.storage.queue.models.QueueErrorCode; import com.azure.storage.queue.models.QueueMessageItem; import com.azure.storage.queue.models.QueueSignedIdentifier; -import com.azure.storage.queue.models.QueueStorageException; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.params.ParameterizedTest; @@ -42,7 +43,6 @@ import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; -import static org.junit.jupiter.api.Assertions.assertInstanceOf; import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertNull; import static org.junit.jupiter.api.Assertions.assertThrows; @@ -861,8 +861,13 @@ public void storageAccountAudience() { .verifyComplete(); } + @RequiredServiceVersion(clazz = QueueServiceVersion.class, min = "2024-08-04") + @LiveOnly @Test - public void audienceError() { + /* This test tests if the bearer challenge is working properly. A bad audience is passed in, the service returns + the default audience, and the request gets retried with this default audience, making the call function as expected. + */ + public void audienceErrorBearerChallengeRetry() { queueAsyncClient.createIfNotExists().block(); QueueAsyncClient aadQueue = getOAuthQueueClientBuilder(primaryQueueServiceAsyncClient.getQueueServiceUrl()) .queueName(queueAsyncClient.getQueueName()) @@ -870,10 +875,8 @@ public void audienceError() { .buildAsyncClient(); StepVerifier.create(aadQueue.getProperties()) - .verifyErrorSatisfies(r -> { - QueueStorageException e = assertInstanceOf(QueueStorageException.class, r); - assertEquals(QueueErrorCode.INVALID_AUTHENTICATION_INFO, e.getErrorCode()); - }); + .assertNext(r -> assertNotNull(r)) + .verifyComplete(); } @Test diff --git a/sdk/storage/azure-storage-queue/src/test/java/com/azure/storage/queue/QueueServiceApiTests.java b/sdk/storage/azure-storage-queue/src/test/java/com/azure/storage/queue/QueueServiceApiTests.java index 48cc6533294c3..e1990aa131026 100644 --- a/sdk/storage/azure-storage-queue/src/test/java/com/azure/storage/queue/QueueServiceApiTests.java +++ b/sdk/storage/azure-storage-queue/src/test/java/com/azure/storage/queue/QueueServiceApiTests.java @@ -7,6 +7,8 @@ import com.azure.core.http.rest.PagedResponse; import com.azure.core.http.rest.Response; import com.azure.identity.DefaultAzureCredentialBuilder; +import com.azure.storage.common.test.shared.extensions.LiveOnly; +import com.azure.storage.common.test.shared.extensions.RequiredServiceVersion; import com.azure.storage.queue.models.QueueAnalyticsLogging; import com.azure.storage.queue.models.QueueAudience; import com.azure.storage.queue.models.QueueErrorCode; @@ -246,14 +248,18 @@ public void storageAccountAudience() { assertNotNull(aadService.getProperties()); } + @RequiredServiceVersion(clazz = QueueServiceVersion.class, min = "2024-08-04") + @LiveOnly @Test - public void audienceError() { + /* This test tests if the bearer challenge is working properly. A bad audience is passed in, the service returns + the default audience, and the request gets retried with this default audience, making the call function as expected. + */ + public void audienceErrorBearerChallengeRetry() { QueueServiceClient aadService = getOAuthServiceClientBuilder(primaryQueueServiceClient.getQueueServiceUrl()) .audience(QueueAudience.createQueueServiceAccountAudience("badaudience")) .buildClient(); - QueueStorageException e = assertThrows(QueueStorageException.class, aadService::getProperties); - assertEquals(QueueErrorCode.INVALID_AUTHENTICATION_INFO, e.getErrorCode()); + assertNotNull(aadService.getProperties()); } @Test diff --git a/sdk/storage/azure-storage-queue/src/test/java/com/azure/storage/queue/QueueServiceAsyncApiTests.java b/sdk/storage/azure-storage-queue/src/test/java/com/azure/storage/queue/QueueServiceAsyncApiTests.java index 38239e057f4b5..3e3868104d8b7 100644 --- a/sdk/storage/azure-storage-queue/src/test/java/com/azure/storage/queue/QueueServiceAsyncApiTests.java +++ b/sdk/storage/azure-storage-queue/src/test/java/com/azure/storage/queue/QueueServiceAsyncApiTests.java @@ -5,6 +5,8 @@ import com.azure.core.http.rest.PagedResponse; import com.azure.identity.DefaultAzureCredentialBuilder; +import com.azure.storage.common.test.shared.extensions.LiveOnly; +import com.azure.storage.common.test.shared.extensions.RequiredServiceVersion; import com.azure.storage.queue.models.QueueAnalyticsLogging; import com.azure.storage.queue.models.QueueAudience; import com.azure.storage.queue.models.QueueErrorCode; @@ -12,7 +14,6 @@ import com.azure.storage.queue.models.QueueMetrics; import com.azure.storage.queue.models.QueueRetentionPolicy; import com.azure.storage.queue.models.QueueServiceProperties; -import com.azure.storage.queue.models.QueueStorageException; import com.azure.storage.queue.models.QueuesSegmentOptions; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -226,17 +227,20 @@ public void storageAccountAudience() { .verifyComplete(); } + @RequiredServiceVersion(clazz = QueueServiceVersion.class, min = "2024-08-04") + @LiveOnly @Test - public void audienceError() { + /* This test tests if the bearer challenge is working properly. A bad audience is passed in, the service returns + the default audience, and the request gets retried with this default audience, making the call function as expected. + */ + public void audienceErrorBearerChallengeRetry() { QueueServiceAsyncClient aadService = getOAuthServiceClientBuilder(primaryQueueServiceAsyncClient.getQueueServiceUrl()) .audience(QueueAudience.createQueueServiceAccountAudience("badaudience")) .buildAsyncClient(); StepVerifier.create(aadService.getProperties()) - .verifyErrorSatisfies(r -> { - QueueStorageException e = assertInstanceOf(QueueStorageException.class, r); - assertEquals(QueueErrorCode.INVALID_AUTHENTICATION_INFO, e.getErrorCode()); - }); + .assertNext(r -> assertNotNull(r)) + .verifyComplete(); } @Test From 05b843058f546ed370e9fcd6d4aa7652eb676235 Mon Sep 17 00:00:00 2001 From: Isabelle Date: Thu, 30 May 2024 15:24:37 -0700 Subject: [PATCH 10/17] changelogs --- sdk/storage/azure-storage-blob/CHANGELOG.md | 2 ++ sdk/storage/azure-storage-file-datalake/CHANGELOG.md | 1 + sdk/storage/azure-storage-file-share/CHANGELOG.md | 2 ++ sdk/storage/azure-storage-queue/CHANGELOG.md | 1 + 4 files changed, 6 insertions(+) diff --git a/sdk/storage/azure-storage-blob/CHANGELOG.md b/sdk/storage/azure-storage-blob/CHANGELOG.md index 4909f52b297ae..ad87397dacf0a 100644 --- a/sdk/storage/azure-storage-blob/CHANGELOG.md +++ b/sdk/storage/azure-storage-blob/CHANGELOG.md @@ -1,6 +1,8 @@ # Release History ## 12.27.0-beta.1 (Unreleased) +- Added support for getting account info on blob container clients and the blob base client. +- Added support for bearer token challenges. ### Features Added diff --git a/sdk/storage/azure-storage-file-datalake/CHANGELOG.md b/sdk/storage/azure-storage-file-datalake/CHANGELOG.md index 4076cc4d1c124..b9bdbe06ac221 100644 --- a/sdk/storage/azure-storage-file-datalake/CHANGELOG.md +++ b/sdk/storage/azure-storage-file-datalake/CHANGELOG.md @@ -1,6 +1,7 @@ # Release History ## 12.20.0-beta.1 (Unreleased) +- Added support for bearer token challenges. ### Features Added diff --git a/sdk/storage/azure-storage-file-share/CHANGELOG.md b/sdk/storage/azure-storage-file-share/CHANGELOG.md index 2df06a16aa3f2..348db90719cf5 100644 --- a/sdk/storage/azure-storage-file-share/CHANGELOG.md +++ b/sdk/storage/azure-storage-file-share/CHANGELOG.md @@ -1,6 +1,8 @@ # Release History ## 12.23.0-beta.1 (Unreleased) +- Added support for snapshot management on NFS shares. +- Added authorization error details in responses. ### Features Added diff --git a/sdk/storage/azure-storage-queue/CHANGELOG.md b/sdk/storage/azure-storage-queue/CHANGELOG.md index f69cd0dd67ede..66cbf450561e2 100644 --- a/sdk/storage/azure-storage-queue/CHANGELOG.md +++ b/sdk/storage/azure-storage-queue/CHANGELOG.md @@ -1,6 +1,7 @@ # Release History ## 12.22.0-beta.1 (Unreleased) +- Added support for bearer token challenges. ### Features Added From 17a827d70e5d6c42db86f8a7be6c24cf51936160 Mon Sep 17 00:00:00 2001 From: Isabelle Date: Thu, 30 May 2024 15:36:44 -0700 Subject: [PATCH 11/17] disabling error code for copy blob --- .../blob/specialized/AppendBlobApiTests.java | 4 +- .../specialized/AppendBlobAsyncApiTests.java | 4 +- .../blob/specialized/BlobBaseApiTests.java | 4 +- .../specialized/BlobBaseAsyncApiTests.java | 4 +- .../blob/specialized/BlockBlobApiTests.java | 4 +- .../specialized/BlockBlobAsyncApiTests.java | 4 +- .../blob/specialized/PageBlobApiTests.java | 4 +- .../specialized/PageBlobAsyncApiTests.java | 4 +- .../common/policy/RequestRetryPolicy.java | 37 ++++++++++++------- .../common/policy/RequestRetryPolicyTest.java | 9 ++++- .../storage/file/share/FileApiTests.java | 8 ++-- .../storage/file/share/FileAsyncApiTests.java | 8 ++-- 12 files changed, 54 insertions(+), 40 deletions(-) diff --git a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/specialized/AppendBlobApiTests.java b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/specialized/AppendBlobApiTests.java index c767dc7828047..b3285d4ea50a7 100644 --- a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/specialized/AppendBlobApiTests.java +++ b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/specialized/AppendBlobApiTests.java @@ -530,7 +530,7 @@ public void appendBlockFromURLMin() { validateBasicHeaders(response.getHeaders()); } - @RequiredServiceVersion(clazz = BlobServiceVersion.class, min = "2024-08-04") + /*@RequiredServiceVersion(clazz = BlobServiceVersion.class, min = "2024-08-04") @Test public void appendBlockFromURLSourceErrorAndStatusCodeNewTest() { AppendBlobClient destBlob = cc.getBlobClient(generateBlobName()).getAppendBlobClient(); @@ -541,7 +541,7 @@ public void appendBlockFromURLSourceErrorAndStatusCodeNewTest() { assertTrue(e.getStatusCode() == 409); assertTrue(e.getServiceMessage().contains("PublicAccessNotPermitted")); assertTrue(e.getServiceMessage().contains("Public access is not permitted on this storage account.")); - } + }*/ @Test public void appendBlockFromURLRange() { diff --git a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/specialized/AppendBlobAsyncApiTests.java b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/specialized/AppendBlobAsyncApiTests.java index ab46ea9799da7..5235280646e23 100644 --- a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/specialized/AppendBlobAsyncApiTests.java +++ b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/specialized/AppendBlobAsyncApiTests.java @@ -558,7 +558,7 @@ public void appendBlockFromURLMin() { .verifyComplete(); } - @RequiredServiceVersion(clazz = BlobServiceVersion.class, min = "2024-08-04") + /*@RequiredServiceVersion(clazz = BlobServiceVersion.class, min = "2024-08-04") @Test public void appendBlockFromURLSourceErrorAndStatusCodeNewTest() { AppendBlobAsyncClient destBlob = ccAsync.getBlobAsyncClient(generateBlobName()).getAppendBlobAsyncClient(); @@ -570,7 +570,7 @@ public void appendBlockFromURLSourceErrorAndStatusCodeNewTest() { assertTrue(e.getServiceMessage().contains("PublicAccessNotPermitted")); assertTrue(e.getServiceMessage().contains("Public access is not permitted on this storage account.")); }); - } + }*/ @Test public void appendBlockFromURLRange() { diff --git a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/specialized/BlobBaseApiTests.java b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/specialized/BlobBaseApiTests.java index 9de37d1f93b65..5a512b5252cfd 100644 --- a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/specialized/BlobBaseApiTests.java +++ b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/specialized/BlobBaseApiTests.java @@ -812,7 +812,7 @@ public void queryACFail(OffsetDateTime modified, OffsetDateTime unmodified, Stri () -> bc.queryWithResponse(optionsOs, null, null)); } - @RequiredServiceVersion(clazz = BlobServiceVersion.class, min = "2024-08-04") + /*@RequiredServiceVersion(clazz = BlobServiceVersion.class, min = "2024-08-04") @Test public void copyFromURLSourceErrorAndStatusCode() { BlockBlobClient destBlob = cc.getBlobClient(generateBlobName()).getBlockBlobClient(); @@ -822,7 +822,7 @@ public void copyFromURLSourceErrorAndStatusCode() { assertTrue(e.getStatusCode() == 409); assertTrue(e.getServiceMessage().contains("PublicAccessNotPermitted")); assertTrue(e.getServiceMessage().contains("Public access is not permitted on this storage account.")); - } + }*/ static class MockProgressConsumer implements Consumer { diff --git a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/specialized/BlobBaseAsyncApiTests.java b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/specialized/BlobBaseAsyncApiTests.java index 79ab6cb0f9045..62b5c06057f89 100644 --- a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/specialized/BlobBaseAsyncApiTests.java +++ b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/specialized/BlobBaseAsyncApiTests.java @@ -585,7 +585,7 @@ public void queryACFail(OffsetDateTime modified, OffsetDateTime unmodified, Stri .verifyError(BlobStorageException.class); } - @RequiredServiceVersion(clazz = BlobServiceVersion.class, min = "2024-08-04") + /*@RequiredServiceVersion(clazz = BlobServiceVersion.class, min = "2024-08-04") @Test public void copyFromURLSourceErrorAndStatusCode() { BlockBlobAsyncClient destBlob = ccAsync.getBlobAsyncClient(generateBlobName()).getBlockBlobAsyncClient(); @@ -597,7 +597,7 @@ public void copyFromURLSourceErrorAndStatusCode() { assertTrue(e.getServiceMessage().contains("PublicAccessNotPermitted")); assertTrue(e.getServiceMessage().contains("Public access is not permitted on this storage account.")); }); - } + }*/ static class MockProgressConsumer implements Consumer { diff --git a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/specialized/BlockBlobApiTests.java b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/specialized/BlockBlobApiTests.java index b85eba84de576..fe19fd86fbf65 100644 --- a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/specialized/BlockBlobApiTests.java +++ b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/specialized/BlockBlobApiTests.java @@ -375,7 +375,7 @@ public void stageBlockFromUrl() { assertEquals(ByteBuffer.wrap(outputStream.toByteArray()), DATA.getDefaultData()); } - @RequiredServiceVersion(clazz = BlobServiceVersion.class, min = "2024-08-04") + /*@RequiredServiceVersion(clazz = BlobServiceVersion.class, min = "2024-08-04") @Test public void stageBlockFromUrlSourceErrorAndStatusCode() { BlockBlobClient destBlob = cc.getBlobClient(generateBlobName()).getBlockBlobClient(); @@ -387,7 +387,7 @@ public void stageBlockFromUrlSourceErrorAndStatusCode() { assertTrue(e.getStatusCode() == 409); assertTrue(e.getServiceMessage().contains("PublicAccessNotPermitted")); assertTrue(e.getServiceMessage().contains("Public access is not permitted on this storage account.")); - } + }*/ @Test public void stageBlockFromUrlMin() { diff --git a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/specialized/BlockBlobAsyncApiTests.java b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/specialized/BlockBlobAsyncApiTests.java index c818b1ef527bd..a39e0d08c29d1 100644 --- a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/specialized/BlockBlobAsyncApiTests.java +++ b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/specialized/BlockBlobAsyncApiTests.java @@ -421,7 +421,7 @@ public void stageBlockFromUrl() { .verifyComplete(); } - @RequiredServiceVersion(clazz = BlobServiceVersion.class, min = "2024-08-04") + /*@RequiredServiceVersion(clazz = BlobServiceVersion.class, min = "2024-08-04") @Test public void stageBlockFromUrlSourceErrorAndStatusCode() { BlockBlobAsyncClient destBlob = ccAsync.getBlobAsyncClient(generateBlobName()).getBlockBlobAsyncClient(); @@ -435,7 +435,7 @@ public void stageBlockFromUrlSourceErrorAndStatusCode() { assertTrue(e.getServiceMessage().contains("PublicAccessNotPermitted")); assertTrue(e.getServiceMessage().contains("Public access is not permitted on this storage account.")); }); - } + }*/ @Test public void stageBlockFromUrlMin() { diff --git a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/specialized/PageBlobApiTests.java b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/specialized/PageBlobApiTests.java index d5f5e15566786..22f4a0e2f9b12 100644 --- a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/specialized/PageBlobApiTests.java +++ b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/specialized/PageBlobApiTests.java @@ -537,7 +537,7 @@ public void uploadPageFromURLMin() { assertTrue(validateBasicHeaders(response.getHeaders())); } - @RequiredServiceVersion(clazz = BlobServiceVersion.class, min = "2024-08-04") + /*@RequiredServiceVersion(clazz = BlobServiceVersion.class, min = "2024-08-04") @Test public void uploadPageFromURLSourceErrorAndStatusCode() { PageBlobClient destBlob = cc.getBlobClient(generateBlobName()).getPageBlobClient(); @@ -550,7 +550,7 @@ public void uploadPageFromURLSourceErrorAndStatusCode() { assertTrue(e.getStatusCode() == 409); assertTrue(e.getServiceMessage().contains("PublicAccessNotPermitted")); assertTrue(e.getServiceMessage().contains("Public access is not permitted on this storage account.")); - } + }*/ @Test public void uploadPageFromURLRange() { diff --git a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/specialized/PageBlobAsyncApiTests.java b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/specialized/PageBlobAsyncApiTests.java index 0fb4289b76e0e..644ceb5e27351 100644 --- a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/specialized/PageBlobAsyncApiTests.java +++ b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/specialized/PageBlobAsyncApiTests.java @@ -547,7 +547,7 @@ public void uploadPageFromURLMin() { .verifyComplete(); } - @RequiredServiceVersion(clazz = BlobServiceVersion.class, min = "2024-08-04") + /*@RequiredServiceVersion(clazz = BlobServiceVersion.class, min = "2024-08-04") @Test public void uploadPageFromURLSourceErrorAndStatusCode() { PageBlobAsyncClient destBlob = ccAsync.getBlobAsyncClient(generateBlobName()).getPageBlobAsyncClient(); @@ -561,7 +561,7 @@ public void uploadPageFromURLSourceErrorAndStatusCode() { assertTrue(e.getServiceMessage().contains("PublicAccessNotPermitted")); assertTrue(e.getServiceMessage().contains("Public access is not permitted on this storage account.")); }); - } + }*/ @Test public void uploadPageFromURLRange() { diff --git a/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/policy/RequestRetryPolicy.java b/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/policy/RequestRetryPolicy.java index 693c863e0bb73..efa12a821d4d4 100644 --- a/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/policy/RequestRetryPolicy.java +++ b/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/policy/RequestRetryPolicy.java @@ -153,7 +153,8 @@ private Mono attemptAsync(HttpPipelineCallContext context, HttpPip boolean newConsiderSecondary = considerSecondary; int statusCode = response.getStatusCode(); - boolean retry = shouldResponseBeRetried(statusCode, tryingPrimary, response); + //boolean retry = shouldResponseBeRetried(statusCode, tryingPrimary, response); + boolean retry = shouldStatusCodeBeRetried(statusCode, tryingPrimary); if (!tryingPrimary && statusCode == 404) { newConsiderSecondary = false; } @@ -268,7 +269,8 @@ private HttpResponse attemptSync(final HttpPipelineCallContext context, HttpPipe boolean newConsiderSecondary = considerSecondary; int statusCode = response.getStatusCode(); - boolean retry = shouldResponseBeRetried(statusCode, tryingPrimary, response); + boolean retry = shouldStatusCodeBeRetried(statusCode, tryingPrimary); + //boolean retry = shouldResponseBeRetried(statusCode, tryingPrimary, response); if (!tryingPrimary && statusCode == 404) { newConsiderSecondary = false; } @@ -379,25 +381,32 @@ static ExceptionRetryStatus shouldErrorBeRetried(Throwable error, int attempt, i return new ExceptionRetryStatus(false, unwrappedThrowable); } - static boolean shouldResponseBeRetried(int statusCode, boolean isPrimary, HttpResponse response) { + + //static boolean shouldResponseBeRetried(int statusCode, boolean isPrimary, HttpResponse response) { /* * Retry the request if the server had an error (500), was unavailable (503), or requested a backoff (429), * or if the secondary was being tried and the resources didn't exist there (404). Only the secondary can retry * if the resource wasn't found as there may be a delay in replication from the primary. */ - boolean headerRetry = false; - boolean statusCodeRetry = (statusCode == 429 || statusCode == 500 || statusCode == 503) || (!isPrimary && statusCode == 404); - if (response != null && response.getHeaders() != null) { - String headerValue = response.getHeaders().getValue(X_MS_COPY_SOURCE_ERROR_CODE); - if (headerValue != null) { - headerRetry = ("429".equals(headerValue) || "500".equals(headerValue) || "503".equals(headerValue)) - || (!isPrimary && "404".equals(headerValue)); - } - - } - return statusCodeRetry || headerRetry; + //boolean headerRetry = false; + //boolean statusCodeRetry = (statusCode == 429 || statusCode == 500 || statusCode == 503) || (!isPrimary && statusCode == 404); + //if (response != null && response.getHeaders() != null) { + //String headerValue = response.getHeaders().getValue(X_MS_COPY_SOURCE_ERROR_CODE); + //if (headerValue != null) { + //headerRetry = ("429".equals(headerValue) || "500".equals(headerValue) || "503".equals(headerValue)) + //|| (!isPrimary && "404".equals(headerValue)); + //} + + //} + //return statusCodeRetry || headerRetry; + //} + + static boolean shouldStatusCodeBeRetried(int statusCode, boolean isPrimary) { + return (statusCode == 429 || statusCode == 500 || statusCode == 503) + || (!isPrimary && statusCode == 404); } + static final class ExceptionRetryStatus { final boolean canBeRetried; final Throwable unwrappedThrowable; diff --git a/sdk/storage/azure-storage-common/src/test/java/com/azure/storage/common/policy/RequestRetryPolicyTest.java b/sdk/storage/azure-storage-common/src/test/java/com/azure/storage/common/policy/RequestRetryPolicyTest.java index 0ae71287a7993..21a99e2072992 100644 --- a/sdk/storage/azure-storage-common/src/test/java/com/azure/storage/common/policy/RequestRetryPolicyTest.java +++ b/sdk/storage/azure-storage-common/src/test/java/com/azure/storage/common/policy/RequestRetryPolicyTest.java @@ -3,7 +3,6 @@ package com.azure.storage.common.policy; -import com.azure.core.http.HttpHeaderName; import com.azure.core.http.HttpHeaders; import com.azure.core.http.HttpMethod; import com.azure.core.http.HttpPipeline; @@ -248,7 +247,7 @@ public void retryPolicyRetriesExceptions(Throwable throwable, boolean shouldBeRe assertEquals(shouldBeRetried, RequestRetryPolicy.shouldErrorBeRetried(throwable, 0, 1).canBeRetried); } - @ParameterizedTest + /*@ParameterizedTest @MethodSource("retryPolicyRetriesStatusCodeSupplier") public void retryPolicyRetriesStatusCode(int statusCode, boolean isPrimary, boolean shouldBeRetried) { assertEquals(shouldBeRetried, RequestRetryPolicy.shouldResponseBeRetried(statusCode, isPrimary, null)); @@ -262,6 +261,12 @@ public void retryPolicyRetriesResponse(int statusCode, boolean isPrimary, boolea assertEquals(shouldBeRetried, RequestRetryPolicy.shouldResponseBeRetried(0, isPrimary, response)); + }*/ + + @ParameterizedTest + @MethodSource("retryPolicyRetriesStatusCodeSupplier") + public void retryPolicyRetriesStatusCode(int statusCode, boolean isPrimary, boolean shouldBeRetried) { + assertEquals(shouldBeRetried, RequestRetryPolicy.shouldStatusCodeBeRetried(statusCode, isPrimary)); } private static Mono sendRequest(HttpPipeline pipeline) { diff --git a/sdk/storage/azure-storage-file-share/src/test/java/com/azure/storage/file/share/FileApiTests.java b/sdk/storage/azure-storage-file-share/src/test/java/com/azure/storage/file/share/FileApiTests.java index f1f5d5ebc1186..b535a1c2cf5e2 100644 --- a/sdk/storage/azure-storage-file-share/src/test/java/com/azure/storage/file/share/FileApiTests.java +++ b/sdk/storage/azure-storage-file-share/src/test/java/com/azure/storage/file/share/FileApiTests.java @@ -1070,7 +1070,7 @@ public void uploadRangeFromURL(String pathSuffix) { } } - @RequiredServiceVersion(clazz = ShareServiceVersion.class, min = "2024-08-04") + /*@RequiredServiceVersion(clazz = ShareServiceVersion.class, min = "2024-08-04") @Test public void uploadRangeFromURLSourceErrorAndStatusCode() { primaryFileClient.create(1024); @@ -1083,7 +1083,7 @@ public void uploadRangeFromURLSourceErrorAndStatusCode() { assertTrue(e.getStatusCode() == 401); assertTrue(e.getServiceMessage().contains("NoAuthenticationInformation")); assertTrue(e.getServiceMessage().contains("Server failed to authenticate the request. Please refer to the information in the www-authenticate header.")); - } + }*/ @RequiredServiceVersion(clazz = ShareServiceVersion.class, min = "2021-04-10") @Test @@ -1331,7 +1331,7 @@ public void startCopyError() { FileShareTestHelper.assertExceptionStatusCodeAndMessage(e, 400, ShareErrorCode.INVALID_HEADER_VALUE); } - @RequiredServiceVersion(clazz = ShareServiceVersion.class, min = "2024-08-04") + /*@RequiredServiceVersion(clazz = ShareServiceVersion.class, min = "2024-08-04") @Test public void startCopySourceErrorAndStatusCode() { primaryFileClient.create(1024); @@ -1344,7 +1344,7 @@ public void startCopySourceErrorAndStatusCode() { assertTrue(e.getStatusCode() == 400); assertTrue(e.getServiceMessage().contains("InvalidUri")); assertTrue(e.getServiceMessage().contains("The requested URI does not represent any resource on the server.")); - } + }*/ @ParameterizedTest @MethodSource("com.azure.storage.file.share.FileShareTestHelper#startCopyArgumentsSupplier") diff --git a/sdk/storage/azure-storage-file-share/src/test/java/com/azure/storage/file/share/FileAsyncApiTests.java b/sdk/storage/azure-storage-file-share/src/test/java/com/azure/storage/file/share/FileAsyncApiTests.java index f261406670681..be1b552a9887c 100644 --- a/sdk/storage/azure-storage-file-share/src/test/java/com/azure/storage/file/share/FileAsyncApiTests.java +++ b/sdk/storage/azure-storage-file-share/src/test/java/com/azure/storage/file/share/FileAsyncApiTests.java @@ -608,7 +608,7 @@ public void uploadRangeFromURL() { }).verifyComplete(); } - @RequiredServiceVersion(clazz = ShareServiceVersion.class, min = "2024-08-04") + /*@RequiredServiceVersion(clazz = ShareServiceVersion.class, min = "2024-08-04") @Test public void uploadRangeFromURLSourceErrorAndStatusCode() { ShareFileAsyncClient destinationClient = shareAsyncClient.getFileClient(generatePathName()); @@ -621,7 +621,7 @@ public void uploadRangeFromURLSourceErrorAndStatusCode() { assertTrue(e.getServiceMessage().contains("NoAuthenticationInformation")); assertTrue(e.getServiceMessage().contains("Server failed to authenticate the request. Please refer to the information in the www-authenticate header.")); }); - } + }*/ @RequiredServiceVersion(clazz = ShareServiceVersion.class, min = "2021-04-10") @Test @@ -793,7 +793,7 @@ public void startCopyError() { .verify(Duration.ofMinutes(1)); } - @RequiredServiceVersion(clazz = ShareServiceVersion.class, min = "2024-08-04") + /*@RequiredServiceVersion(clazz = ShareServiceVersion.class, min = "2024-08-04") @Test public void startCopySourceErrorAndStatusCode() { primaryFileAsyncClient.create(1024); @@ -808,7 +808,7 @@ public void startCopySourceErrorAndStatusCode() { assertTrue(e.getServiceMessage().contains("InvalidUri")); assertTrue(e.getServiceMessage().contains("The requested URI does not represent any resource on the server.")); }); - } + }*/ @Disabled("There is a race condition in Poller where it misses the first observed event if there is a gap " + "between the time subscribed and the time we start observing events.") From 19762ad98b3c14c0b3cdd4418287ca3eaa6b4092 Mon Sep 17 00:00:00 2001 From: Isabelle Date: Thu, 30 May 2024 15:46:07 -0700 Subject: [PATCH 12/17] making nfs feature tests premium accounts --- .../storage/file/share/models/ShareProperties.java | 4 ++-- .../storage/file/share/options/ShareCreateOptions.java | 4 ++-- .../file/share/options/ShareSetPropertiesOptions.java | 4 ++-- .../azure/storage/file/share/FileServiceApiTests.java | 4 ++-- .../storage/file/share/FileServiceAsyncApiTests.java | 4 ++-- .../com/azure/storage/file/share/ShareApiTests.java | 10 +++++----- .../azure/storage/file/share/ShareAsyncApiTests.java | 10 +++++----- 7 files changed, 20 insertions(+), 20 deletions(-) diff --git a/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/models/ShareProperties.java b/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/models/ShareProperties.java index 1bd992f7f4969..161729a5a7663 100644 --- a/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/models/ShareProperties.java +++ b/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/models/ShareProperties.java @@ -566,7 +566,7 @@ public ShareProperties setMetadata(Map metadata) { /** * Get the enableSnapshotVirtualDirectoryAccess property: - * Optional. Supported in version 2023-08-03 and above. + * Optional. Supported in version 2023-08-03 and above. Only applicable for premium file storage accounts. * Specifies whether the snapshot virtual directory should be accessible at the root of share mount point when NFS is enabled. * If not specified, the default is true. * @@ -578,7 +578,7 @@ public Boolean isSnapshotVirtualDirectoryAccessEnabled() { /** * Set the enableSnapshotVirtualDirectoryAccess property: - * Optional. Supported in version 2023-08-03 and above. + * Optional. Supported in version 2023-08-03 and above. Only applicable for premium file storage accounts. * Specifies whether the snapshot virtual directory should be accessible at the root of share mount point when NFS is enabled. * If not specified, the default is true. * diff --git a/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/options/ShareCreateOptions.java b/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/options/ShareCreateOptions.java index 3b3095d9005c6..b0fff0a403ac2 100644 --- a/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/options/ShareCreateOptions.java +++ b/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/options/ShareCreateOptions.java @@ -131,7 +131,7 @@ public ShareCreateOptions setRootSquash(ShareRootSquash rootSquash) { /** * Get the enableSnapshotVirtualDirectoryAccess property: The EnableSnapshotVirtualDirectoryAccess property. - * Optional. Supported in version 2023-08-03 and above. + * Optional. Supported in version 2023-08-03 and above. Only applicable for premium file storage accounts. * Specifies whether the snapshot virtual directory should be accessible at the root of share mount point when NFS is enabled. * If not specified, the default is true. * @return the enableSnapshotVirtualDirectoryAccess value. @@ -142,7 +142,7 @@ public Boolean isSnapshotVirtualDirectoryAccessEnabled() { /** * Set the enableSnapshotVirtualDirectoryAccess property: - * Optional. Supported in version 2023-08-03 and above. + * Optional. Supported in version 2023-08-03 and above. Only applicable for premium file storage accounts. * Specifies whether the snapshot virtual directory should be accessible at the root of share mount point when NFS is enabled. * If not specified, the default is true. * @param snapshotVirtualDirectoryAccessEnabled the enableSnapshotVirtualDirectoryAccess value to set. diff --git a/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/options/ShareSetPropertiesOptions.java b/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/options/ShareSetPropertiesOptions.java index fb5d3b7f67ebc..9fae36f74782a 100644 --- a/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/options/ShareSetPropertiesOptions.java +++ b/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/options/ShareSetPropertiesOptions.java @@ -86,7 +86,7 @@ public ShareSetPropertiesOptions setRequestConditions(ShareRequestConditions req /** * Get the enableSnapshotVirtualDirectoryAccess property: The EnableSnapshotVirtualDirectoryAccess property. - * Optional. Supported in version 2023-08-03 and above. + * Optional. Supported in version 2023-08-03 and above. Only applicable for premium file storage accounts. * Specifies whether the snapshot virtual directory should be accessible at the root of share mount point when NFS is enabled. * If not specified, the default is true. * @@ -98,7 +98,7 @@ public Boolean isSnapshotVirtualDirectoryAccessEnabled() { /** * Set the enableSnapshotVirtualDirectoryAccess property: The EnableSnapshotVirtualDirectoryAccess property. - * Optional. Supported in version 2023-08-03 and above. + * Optional. Supported in version 2023-08-03 and above. Only applicable for premium file storage accounts. * Specifies whether the snapshot virtual directory should be accessible at the root of share mount point when NFS is enabled. * If not specified, the default is true. * diff --git a/sdk/storage/azure-storage-file-share/src/test/java/com/azure/storage/file/share/FileServiceApiTests.java b/sdk/storage/azure-storage-file-share/src/test/java/com/azure/storage/file/share/FileServiceApiTests.java index 90a078dbfed0c..6994288d30b69 100644 --- a/sdk/storage/azure-storage-file-share/src/test/java/com/azure/storage/file/share/FileServiceApiTests.java +++ b/sdk/storage/azure-storage-file-share/src/test/java/com/azure/storage/file/share/FileServiceApiTests.java @@ -427,10 +427,10 @@ public void listSharesEnableSnapshotVirtualDirectoryAccess() { options.setProtocols(protocols); options.setSnapshotVirtualDirectoryAccessEnabled(true); - ShareClient shareClient = primaryFileServiceClient.getShareClient(generateShareName()); + ShareClient shareClient = premiumFileServiceClient.getShareClient(generateShareName()); shareClient.createWithResponse(options, null, null); - ShareItem share = primaryFileServiceClient.listShares().iterator().next(); + ShareItem share = premiumFileServiceClient.listShares().iterator().next(); assertEquals(protocols.toString(), share.getProperties().getProtocols().toString()); assertTrue(share.getProperties().isSnapshotVirtualDirectoryAccessEnabled()); } diff --git a/sdk/storage/azure-storage-file-share/src/test/java/com/azure/storage/file/share/FileServiceAsyncApiTests.java b/sdk/storage/azure-storage-file-share/src/test/java/com/azure/storage/file/share/FileServiceAsyncApiTests.java index 86d4bdf2aa903..6cbb23c90f6ab 100644 --- a/sdk/storage/azure-storage-file-share/src/test/java/com/azure/storage/file/share/FileServiceAsyncApiTests.java +++ b/sdk/storage/azure-storage-file-share/src/test/java/com/azure/storage/file/share/FileServiceAsyncApiTests.java @@ -313,10 +313,10 @@ public void listSharesEnableSnapshotVirtualDirectoryAccess() { options.setProtocols(protocols); options.setSnapshotVirtualDirectoryAccessEnabled(true); - ShareAsyncClient shareClient = primaryFileServiceAsyncClient.getShareAsyncClient(generateShareName()); + ShareAsyncClient shareClient = premiumFileServiceAsyncClient.getShareAsyncClient(generateShareName()); shareClient.createWithResponse(options).block(); - StepVerifier.create(primaryFileServiceAsyncClient.listShares()) + StepVerifier.create(premiumFileServiceAsyncClient.listShares()) .assertNext(r -> { ShareProperties properties = r.getProperties(); assertEquals(protocols.toString(), properties.getProtocols().toString()); diff --git a/sdk/storage/azure-storage-file-share/src/test/java/com/azure/storage/file/share/ShareApiTests.java b/sdk/storage/azure-storage-file-share/src/test/java/com/azure/storage/file/share/ShareApiTests.java index 37c9226d95df8..6bcb13e535031 100644 --- a/sdk/storage/azure-storage-file-share/src/test/java/com/azure/storage/file/share/ShareApiTests.java +++ b/sdk/storage/azure-storage-file-share/src/test/java/com/azure/storage/file/share/ShareApiTests.java @@ -1263,9 +1263,9 @@ public void createEnableSnapshotVirtualDirectoryAccess(Boolean enableSnapshotVir options.setProtocols(protocols); options.setSnapshotVirtualDirectoryAccessEnabled(enableSnapshotVirtualDirectoryAccess); - primaryShareClient.createWithResponse(options, null, null); + premiumFileServiceClient.getShareClient(shareName).createWithResponse(options, null, null); - ShareProperties response = primaryShareClient.getProperties(); + ShareProperties response = premiumFileServiceClient.getShareClient(shareName).getProperties(); assertEquals(protocols.toString(), response.getProtocols().toString()); if (enableSnapshotVirtualDirectoryAccess == null || enableSnapshotVirtualDirectoryAccess) { assertTrue(response.isSnapshotVirtualDirectoryAccessEnabled()); @@ -1289,15 +1289,15 @@ public void setPropertiesEnableSnapshotVirtualDirectoryAccess(Boolean enableSnap ShareProtocols protocols = ModelHelper.parseShareProtocols(Constants.HeaderConstants.NFS_PROTOCOL); options.setProtocols(protocols); - primaryShareClient.createWithResponse(options, null, null); + premiumFileServiceClient.getShareClient(shareName).createWithResponse(options, null, null); ShareSetPropertiesOptions setPropertiesOptions = new ShareSetPropertiesOptions(); setPropertiesOptions.setSnapshotVirtualDirectoryAccessEnabled(enableSnapshotVirtualDirectoryAccess); setPropertiesOptions.setAccessTier(ShareAccessTier.TRANSACTION_OPTIMIZED); - primaryShareClient.setProperties(setPropertiesOptions); + premiumFileServiceClient.getShareClient(shareName).setProperties(setPropertiesOptions); - ShareProperties response = primaryShareClient.getProperties(); + ShareProperties response = premiumFileServiceClient.getShareClient(shareName).getProperties(); assertEquals(protocols.toString(), response.getProtocols().toString()); if (enableSnapshotVirtualDirectoryAccess == null || enableSnapshotVirtualDirectoryAccess) { assertTrue(response.isSnapshotVirtualDirectoryAccessEnabled()); diff --git a/sdk/storage/azure-storage-file-share/src/test/java/com/azure/storage/file/share/ShareAsyncApiTests.java b/sdk/storage/azure-storage-file-share/src/test/java/com/azure/storage/file/share/ShareAsyncApiTests.java index 78b11476d3344..847ae9eca5e44 100644 --- a/sdk/storage/azure-storage-file-share/src/test/java/com/azure/storage/file/share/ShareAsyncApiTests.java +++ b/sdk/storage/azure-storage-file-share/src/test/java/com/azure/storage/file/share/ShareAsyncApiTests.java @@ -825,9 +825,9 @@ public void createEnableSnapshotVirtualDirectoryAccess(Boolean enableSnapshotVir options.setProtocols(protocols); options.setSnapshotVirtualDirectoryAccessEnabled(enableSnapshotVirtualDirectoryAccess); - primaryShareAsyncClient.createWithResponse(options).block(); + premiumFileServiceAsyncClient.getShareAsyncClient(shareName).createWithResponse(options).block(); - StepVerifier.create(primaryShareAsyncClient.getProperties()) + StepVerifier.create(premiumFileServiceAsyncClient.getShareAsyncClient(shareName).getProperties()) .assertNext(r -> { assertEquals(protocols.toString(), r.getProtocols().toString()); if (enableSnapshotVirtualDirectoryAccess == null || enableSnapshotVirtualDirectoryAccess) { @@ -854,15 +854,15 @@ public void setPropertiesEnableSnapshotVirtualDirectoryAccess(Boolean enableSnap ShareProtocols protocols = ModelHelper.parseShareProtocols(Constants.HeaderConstants.NFS_PROTOCOL); options.setProtocols(protocols); - primaryShareAsyncClient.createWithResponse(options).block(); + premiumFileServiceAsyncClient.getShareAsyncClient(shareName).createWithResponse(options).block(); ShareSetPropertiesOptions setPropertiesOptions = new ShareSetPropertiesOptions(); setPropertiesOptions.setSnapshotVirtualDirectoryAccessEnabled(enableSnapshotVirtualDirectoryAccess); setPropertiesOptions.setAccessTier(ShareAccessTier.TRANSACTION_OPTIMIZED); - primaryShareAsyncClient.setProperties(setPropertiesOptions).block(); + premiumFileServiceAsyncClient.getShareAsyncClient(shareName).setProperties(setPropertiesOptions).block(); - StepVerifier.create(primaryShareAsyncClient.getProperties()) + StepVerifier.create(premiumFileServiceAsyncClient.getShareAsyncClient(shareName).getProperties()) .assertNext(r -> { assertEquals(protocols.toString(), r.getProtocols().toString()); if (enableSnapshotVirtualDirectoryAccess == null || enableSnapshotVirtualDirectoryAccess) { From 2bed375c501eb1c036df1fbeac84654ed21f336b Mon Sep 17 00:00:00 2001 From: Isabelle Date: Mon, 3 Jun 2024 11:05:22 -0700 Subject: [PATCH 13/17] analyze --- .../azure/storage/blob/specialized/BlobBaseAsyncApiTests.java | 1 - 1 file changed, 1 deletion(-) diff --git a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/specialized/BlobBaseAsyncApiTests.java b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/specialized/BlobBaseAsyncApiTests.java index 62b5c06057f89..b9ec8cc3cf97b 100644 --- a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/specialized/BlobBaseAsyncApiTests.java +++ b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/specialized/BlobBaseAsyncApiTests.java @@ -47,7 +47,6 @@ import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; -import static org.junit.jupiter.api.Assertions.assertInstanceOf; import static org.junit.jupiter.api.Assertions.assertTrue; public class BlobBaseAsyncApiTests extends BlobTestBase { From 475e61054a6207ac660e1a433b9b82c9b4b4b0eb Mon Sep 17 00:00:00 2001 From: Isabelle Date: Mon, 10 Jun 2024 13:39:38 -0700 Subject: [PATCH 14/17] fixing async bearer challenge --- .../policy/StorageBearerTokenChallengeAuthorizationPolicy.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/policy/StorageBearerTokenChallengeAuthorizationPolicy.java b/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/policy/StorageBearerTokenChallengeAuthorizationPolicy.java index cba7a41b9c066..1304665c36837 100644 --- a/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/policy/StorageBearerTokenChallengeAuthorizationPolicy.java +++ b/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/policy/StorageBearerTokenChallengeAuthorizationPolicy.java @@ -64,7 +64,7 @@ public Mono authorizeRequestOnChallenge(HttpPipelineCallContext context String authHeader = response.getHeaderValue(HttpHeaderName.WWW_AUTHENTICATE); Map challenges = extractChallengeAttributes(authHeader, BEARER_TOKEN_PREFIX); - String scope = challenges.get("resource_id="); + String scope = challenges.get("resource_id"); if (scope != null) { scope += DEFAULT_SCOPE; scopes = new String[] { scope }; From 2886d156e53b8c7cdc4930c38819208c47d5712a Mon Sep 17 00:00:00 2001 From: Isabelle Date: Mon, 10 Jun 2024 13:44:14 -0700 Subject: [PATCH 15/17] commenting out missed tests from the copy blob error code removal --- .../com/azure/storage/blob/specialized/BlockBlobApiTests.java | 4 ++-- .../storage/blob/specialized/BlockBlobAsyncApiTests.java | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/specialized/BlockBlobApiTests.java b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/specialized/BlockBlobApiTests.java index fe19fd86fbf65..1cfbff4aa819d 100644 --- a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/specialized/BlockBlobApiTests.java +++ b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/specialized/BlockBlobApiTests.java @@ -1498,7 +1498,7 @@ public void uploadFromUrlMin() { TestUtils.assertArraysEqual(DATA.getDefaultBytes(), os.toByteArray()); } - @RequiredServiceVersion(clazz = BlobServiceVersion.class, min = "2024-08-04") + /*@RequiredServiceVersion(clazz = BlobServiceVersion.class, min = "2024-08-04") @Test public void uploadFromUrlSourceErrorAndStatusCode() { BlockBlobClient destBlob = cc.getBlobClient(generateBlobName()).getBlockBlobClient(); @@ -1508,7 +1508,7 @@ public void uploadFromUrlSourceErrorAndStatusCode() { assertTrue(e.getStatusCode() == 409); assertTrue(e.getServiceMessage().contains("PublicAccessNotPermitted")); assertTrue(e.getServiceMessage().contains("Public access is not permitted on this storage account.")); - } + }*/ @RequiredServiceVersion(clazz = BlobServiceVersion.class, min = "2020-04-08") @Test diff --git a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/specialized/BlockBlobAsyncApiTests.java b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/specialized/BlockBlobAsyncApiTests.java index a39e0d08c29d1..c9d387549edf6 100644 --- a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/specialized/BlockBlobAsyncApiTests.java +++ b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/specialized/BlockBlobAsyncApiTests.java @@ -2368,7 +2368,7 @@ public void uploadFromUrlMin() { .verifyComplete(); } - @RequiredServiceVersion(clazz = BlobServiceVersion.class, min = "2024-08-04") + /*@RequiredServiceVersion(clazz = BlobServiceVersion.class, min = "2024-08-04") @Test public void uploadFromUrlSourceErrorAndStatusCode() { BlockBlobAsyncClient destBlob = ccAsync.getBlobAsyncClient(generateBlobName()).getBlockBlobAsyncClient(); @@ -2380,7 +2380,7 @@ public void uploadFromUrlSourceErrorAndStatusCode() { assertTrue(e.getServiceMessage().contains("PublicAccessNotPermitted")); assertTrue(e.getServiceMessage().contains("Public access is not permitted on this storage account.")); }); - } + }*/ @RequiredServiceVersion(clazz = BlobServiceVersion.class, min = "2020-04-08") @Test From 2e5db0cae95be617de53982dd33a394a8d7a770f Mon Sep 17 00:00:00 2001 From: Isabelle Date: Tue, 11 Jun 2024 11:00:56 -0700 Subject: [PATCH 16/17] fixing headers for one of the NFS tests --- sdk/storage/azure-storage-file-share/assets.json | 2 +- .../test/java/com/azure/storage/file/share/ShareApiTests.java | 1 - .../java/com/azure/storage/file/share/ShareAsyncApiTests.java | 1 - 3 files changed, 1 insertion(+), 3 deletions(-) diff --git a/sdk/storage/azure-storage-file-share/assets.json b/sdk/storage/azure-storage-file-share/assets.json index 32b43ca6269c3..f98447b88900b 100644 --- a/sdk/storage/azure-storage-file-share/assets.json +++ b/sdk/storage/azure-storage-file-share/assets.json @@ -2,5 +2,5 @@ "AssetsRepo": "Azure/azure-sdk-assets", "AssetsRepoPrefixPath": "java", "TagPrefix": "java/storage/azure-storage-file-share", - "Tag": "java/storage/azure-storage-file-share_d57444c858" + "Tag": "java/storage/azure-storage-file-share_79245de015" } diff --git a/sdk/storage/azure-storage-file-share/src/test/java/com/azure/storage/file/share/ShareApiTests.java b/sdk/storage/azure-storage-file-share/src/test/java/com/azure/storage/file/share/ShareApiTests.java index 6bcb13e535031..7878bf426a1be 100644 --- a/sdk/storage/azure-storage-file-share/src/test/java/com/azure/storage/file/share/ShareApiTests.java +++ b/sdk/storage/azure-storage-file-share/src/test/java/com/azure/storage/file/share/ShareApiTests.java @@ -1293,7 +1293,6 @@ public void setPropertiesEnableSnapshotVirtualDirectoryAccess(Boolean enableSnap ShareSetPropertiesOptions setPropertiesOptions = new ShareSetPropertiesOptions(); setPropertiesOptions.setSnapshotVirtualDirectoryAccessEnabled(enableSnapshotVirtualDirectoryAccess); - setPropertiesOptions.setAccessTier(ShareAccessTier.TRANSACTION_OPTIMIZED); premiumFileServiceClient.getShareClient(shareName).setProperties(setPropertiesOptions); diff --git a/sdk/storage/azure-storage-file-share/src/test/java/com/azure/storage/file/share/ShareAsyncApiTests.java b/sdk/storage/azure-storage-file-share/src/test/java/com/azure/storage/file/share/ShareAsyncApiTests.java index 847ae9eca5e44..c0d15ffe388fb 100644 --- a/sdk/storage/azure-storage-file-share/src/test/java/com/azure/storage/file/share/ShareAsyncApiTests.java +++ b/sdk/storage/azure-storage-file-share/src/test/java/com/azure/storage/file/share/ShareAsyncApiTests.java @@ -858,7 +858,6 @@ public void setPropertiesEnableSnapshotVirtualDirectoryAccess(Boolean enableSnap ShareSetPropertiesOptions setPropertiesOptions = new ShareSetPropertiesOptions(); setPropertiesOptions.setSnapshotVirtualDirectoryAccessEnabled(enableSnapshotVirtualDirectoryAccess); - setPropertiesOptions.setAccessTier(ShareAccessTier.TRANSACTION_OPTIMIZED); premiumFileServiceAsyncClient.getShareAsyncClient(shareName).setProperties(setPropertiesOptions).block(); From f98857501f2ce4463c076bc18fb9f143781bd1ce Mon Sep 17 00:00:00 2001 From: Isabelle Date: Tue, 11 Jun 2024 11:23:49 -0700 Subject: [PATCH 17/17] linting --- .../java/com/azure/storage/file/share/ShareAsyncApiTests.java | 1 - 1 file changed, 1 deletion(-) diff --git a/sdk/storage/azure-storage-file-share/src/test/java/com/azure/storage/file/share/ShareAsyncApiTests.java b/sdk/storage/azure-storage-file-share/src/test/java/com/azure/storage/file/share/ShareAsyncApiTests.java index c0d15ffe388fb..9caaff8516200 100644 --- a/sdk/storage/azure-storage-file-share/src/test/java/com/azure/storage/file/share/ShareAsyncApiTests.java +++ b/sdk/storage/azure-storage-file-share/src/test/java/com/azure/storage/file/share/ShareAsyncApiTests.java @@ -10,7 +10,6 @@ import com.azure.storage.common.test.shared.extensions.RequiredServiceVersion; import com.azure.storage.file.share.implementation.util.ModelHelper; import com.azure.storage.file.share.models.NtfsFileAttributes; -import com.azure.storage.file.share.models.ShareAccessTier; import com.azure.storage.file.share.models.ShareAudience; import com.azure.storage.file.share.models.ShareErrorCode; import com.azure.storage.file.share.models.ShareFileHttpHeaders;