From 0fc71177d4cff71bb33150a425f4745f3934c763 Mon Sep 17 00:00:00 2001 From: Gauri Prasad Date: Mon, 17 Aug 2020 09:28:49 -0700 Subject: [PATCH 1/4] Added code for smb multi channel --- .../file/share/ShareFileAsyncClient.java | 2 +- .../file/share/implementation/FilesImpl.java | 10 +-- .../file/share/models/ProtocolSettings.java | 42 +++++++++ .../azure/storage/file/share/models/SMB.java | 42 +++++++++ .../share/models/ShareServiceProperties.java | 26 ++++++ .../file/share/models/SmbMultichannel.java | 42 +++++++++ .../file/share/FileServiceAPITests.groovy | 27 ++++++ ...iceAPITestsSetAndGetPropertiesPremium.json | 87 +++++++++++++++++++ .../swagger/README.md | 2 +- 9 files changed, 272 insertions(+), 8 deletions(-) create mode 100644 sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/models/ProtocolSettings.java create mode 100644 sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/models/SMB.java create mode 100644 sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/models/SmbMultichannel.java create mode 100644 sdk/storage/azure-storage-file-share/src/test/resources/session-records/FileServiceAPITestsSetAndGetPropertiesPremium.json diff --git a/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/ShareFileAsyncClient.java b/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/ShareFileAsyncClient.java index 975bde0032630..4865e49307319 100644 --- a/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/ShareFileAsyncClient.java +++ b/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/ShareFileAsyncClient.java @@ -1653,7 +1653,7 @@ PagedFlux listRangesWithOptionalTimeout(ShareFileListRangeOption String rangeString = finalOptions.getRange() == null ? null : finalOptions.getRange().toString(); Function>> retriever = marker -> StorageImplUtils.applyOptionalTimeout(this.azureFileStorageClient.files() - .getRangeListWithRestResponseAsync(shareName, filePath, snapshot, finalOptions.getPreviousSnapshot(), + .getRangeListWithRestResponseAsync(shareName, filePath, snapshot, null, rangeString, finalRequestConditions.getLeaseId(), context), timeout) .map(response -> new PagedResponseBase<>(response.getRequest(), response.getStatusCode(), 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 c36a37b221c1b..04bc7e433dd14 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 @@ -124,7 +124,7 @@ private interface FilesService { @Get("{shareName}/{filePath}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ShareStorageException.class) - Mono getRangeList(@PathParam("shareName") String shareName, @PathParam("filePath") String filePath, @HostParam("url") String url, @QueryParam("sharesnapshot") String sharesnapshot, @QueryParam("prevsharesnapshot") String prevsharesnapshot, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-range") String range, @HeaderParam("x-ms-lease-id") String leaseId, @QueryParam("comp") String comp, Context context); + Mono getRangeList(@PathParam("shareName") String shareName, @PathParam("filePath") String filePath, @HostParam("url") String url, @QueryParam("sharesnapshot") String sharesnapshot, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-range") String range, @HeaderParam("x-ms-lease-id") String leaseId, @QueryParam("comp") String comp, Context context); @Put("{shareName}/{filePath}") @ExpectedResponses({202}) @@ -580,12 +580,11 @@ public Mono uploadRangeFromURLWithRestResponseA @ServiceMethod(returns = ReturnType.SINGLE) public Mono getRangeListWithRestResponseAsync(String shareName, String filePath, Context context) { final String sharesnapshot = null; - final String prevsharesnapshot = null; final Integer timeout = null; final String range = null; final String leaseId = null; final String comp = "rangelist"; - return service.getRangeList(shareName, filePath, this.client.getUrl(), sharesnapshot, prevsharesnapshot, timeout, this.client.getVersion(), range, leaseId, comp, context); + return service.getRangeList(shareName, filePath, this.client.getUrl(), sharesnapshot, timeout, this.client.getVersion(), range, leaseId, comp, context); } /** @@ -594,7 +593,6 @@ public Mono getRangeListWithRestResponseAsync(String * @param shareName The name of the target share. * @param filePath The path of the target file. * @param sharesnapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the share snapshot to query. - * @param prevsharesnapshot The previous snapshot parameter is an opaque DateTime value that, when present, specifies the previous snapshot. * @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 Timeouts for File Service Operations.</a>. * @param range Specifies the range of bytes over which to list ranges, inclusively. * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. @@ -603,9 +601,9 @@ public Mono getRangeListWithRestResponseAsync(String * @return a Mono which performs the network request upon subscription. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getRangeListWithRestResponseAsync(String shareName, String filePath, String sharesnapshot, String prevsharesnapshot, Integer timeout, String range, String leaseId, Context context) { + public Mono getRangeListWithRestResponseAsync(String shareName, String filePath, String sharesnapshot, Integer timeout, String range, String leaseId, Context context) { final String comp = "rangelist"; - return service.getRangeList(shareName, filePath, this.client.getUrl(), sharesnapshot, prevsharesnapshot, timeout, this.client.getVersion(), range, leaseId, comp, context); + return service.getRangeList(shareName, filePath, this.client.getUrl(), sharesnapshot, timeout, this.client.getVersion(), range, leaseId, comp, context); } /** diff --git a/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/models/ProtocolSettings.java b/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/models/ProtocolSettings.java new file mode 100644 index 0000000000000..389a47c3ba93b --- /dev/null +++ b/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/models/ProtocolSettings.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.storage.file.share.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; + +/** + * Protocol settings. + */ +@JacksonXmlRootElement(localName = "ProtocolSettings") +@Fluent +public final class ProtocolSettings { + /* + * Settings for SMB protocol. + */ + @JsonProperty(value = "SMB") + private SMB sMB; + + /** + * Get the sMB property: Settings for SMB protocol. + * + * @return the sMB value. + */ + public SMB getSMB() { + return this.sMB; + } + + /** + * Set the sMB property: Settings for SMB protocol. + * + * @param sMB the sMB value to set. + * @return the ProtocolSettings object itself. + */ + public ProtocolSettings setSMB(SMB sMB) { + this.sMB = sMB; + return this; + } +} diff --git a/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/models/SMB.java b/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/models/SMB.java new file mode 100644 index 0000000000000..422ba4c46e9a0 --- /dev/null +++ b/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/models/SMB.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.storage.file.share.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; + +/** + * Settings for SMB protocol. + */ +@JacksonXmlRootElement(localName = "SMB") +@Fluent +public final class SMB { + /* + * Settings for SMB Multichannel. + */ + @JsonProperty(value = "Multichannel") + private SmbMultichannel multichannel; + + /** + * Get the multichannel property: Settings for SMB Multichannel. + * + * @return the multichannel value. + */ + public SmbMultichannel getMultichannel() { + return this.multichannel; + } + + /** + * Set the multichannel property: Settings for SMB Multichannel. + * + * @param multichannel the multichannel value to set. + * @return the SMB object itself. + */ + public SMB setMultichannel(SmbMultichannel multichannel) { + this.multichannel = multichannel; + return this; + } +} diff --git a/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/models/ShareServiceProperties.java b/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/models/ShareServiceProperties.java index b22b75b03c6c8..3095dae9dbcd3 100644 --- a/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/models/ShareServiceProperties.java +++ b/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/models/ShareServiceProperties.java @@ -48,6 +48,12 @@ private CorsWrapper(@JacksonXmlProperty(localName = "CorsRule") List cors) { this.cors = new CorsWrapper(cors); return this; } + + /** + * Get the protocolSettings property: Protocol settings. + * + * @return the protocolSettings value. + */ + public ProtocolSettings getProtocolSettings() { + return this.protocolSettings; + } + + /** + * Set the protocolSettings property: Protocol settings. + * + * @param protocolSettings the protocolSettings value to set. + * @return the ShareServiceProperties object itself. + */ + public ShareServiceProperties setProtocolSettings(ProtocolSettings protocolSettings) { + this.protocolSettings = protocolSettings; + return this; + } } diff --git a/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/models/SmbMultichannel.java b/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/models/SmbMultichannel.java new file mode 100644 index 0000000000000..4f921c6c781f0 --- /dev/null +++ b/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/models/SmbMultichannel.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.storage.file.share.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; + +/** + * Settings for SMB multichannel. + */ +@JacksonXmlRootElement(localName = "Multichannel") +@Fluent +public final class SmbMultichannel { + /* + * If SMB multichannel is enabled. + */ + @JsonProperty(value = "Enabled") + private Boolean enabled; + + /** + * Get the enabled property: If SMB multichannel is enabled. + * + * @return the enabled value. + */ + public Boolean isEnabled() { + return this.enabled; + } + + /** + * Set the enabled property: If SMB multichannel is enabled. + * + * @param enabled the enabled value to set. + * @return the SmbMultichannel object itself. + */ + public SmbMultichannel setEnabled(Boolean enabled) { + this.enabled = enabled; + return this; + } +} diff --git a/sdk/storage/azure-storage-file-share/src/test/java/com/azure/storage/file/share/FileServiceAPITests.groovy b/sdk/storage/azure-storage-file-share/src/test/java/com/azure/storage/file/share/FileServiceAPITests.groovy index fef1cab385767..bee7a6e2b1faf 100644 --- a/sdk/storage/azure-storage-file-share/src/test/java/com/azure/storage/file/share/FileServiceAPITests.groovy +++ b/sdk/storage/azure-storage-file-share/src/test/java/com/azure/storage/file/share/FileServiceAPITests.groovy @@ -7,6 +7,8 @@ import com.azure.core.test.TestMode import com.azure.core.util.Context import com.azure.storage.common.StorageSharedKeyCredential import com.azure.storage.file.share.models.ListSharesOptions +import com.azure.storage.file.share.models.ProtocolSettings +import com.azure.storage.file.share.models.SMB import com.azure.storage.file.share.models.ShareCorsRule import com.azure.storage.file.share.models.ShareErrorCode import com.azure.storage.file.share.models.ShareItem @@ -15,6 +17,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.ShareStorageException +import com.azure.storage.file.share.models.SmbMultichannel import spock.lang.Unroll import java.time.OffsetDateTime @@ -228,6 +231,30 @@ class FileServiceAPITests extends APISpec { FileTestHelper.assertFileServicePropertiesAreEqual(updatedProperties, getPropertiesAfterResponse.getValue()) } + def "Set and get properties premium"() { + given: + def originalProperties = premiumFileServiceClient.getProperties() + def retentionPolicy = new ShareRetentionPolicy().setEnabled(true).setDays(3) + def metrics = new ShareMetrics().setEnabled(true).setIncludeApis(false) + .setRetentionPolicy(retentionPolicy).setVersion("1.0") + def protocolSettings = new ProtocolSettings().setSMB(new SMB().setMultichannel(new SmbMultichannel().setEnabled(true))) + def updatedProperties = new ShareServiceProperties().setHourMetrics(metrics) + .setMinuteMetrics(metrics).setCors(new ArrayList<>()) + .setProtocolSettings(protocolSettings) + + when: + def getPropertiesBeforeResponse = premiumFileServiceClient.getPropertiesWithResponse(null, null) + def setPropertiesResponse = premiumFileServiceClient.setPropertiesWithResponse(updatedProperties, null, null) + def getPropertiesAfterResponse = premiumFileServiceClient.getPropertiesWithResponse(null, null) + + then: + FileTestHelper.assertResponseStatusCode(getPropertiesBeforeResponse, 200) + FileTestHelper.assertFileServicePropertiesAreEqual(originalProperties, getPropertiesBeforeResponse.getValue()) + FileTestHelper.assertResponseStatusCode(setPropertiesResponse, 202) + FileTestHelper.assertResponseStatusCode(getPropertiesAfterResponse, 200) + FileTestHelper.assertFileServicePropertiesAreEqual(updatedProperties, getPropertiesAfterResponse.getValue()) + } + @Unroll def "Set and get properties with invalid args"() { given: diff --git a/sdk/storage/azure-storage-file-share/src/test/resources/session-records/FileServiceAPITestsSetAndGetPropertiesPremium.json b/sdk/storage/azure-storage-file-share/src/test/resources/session-records/FileServiceAPITestsSetAndGetPropertiesPremium.json new file mode 100644 index 0000000000000..be94f8bc78b68 --- /dev/null +++ b/sdk/storage/azure-storage-file-share/src/test/resources/session-records/FileServiceAPITestsSetAndGetPropertiesPremium.json @@ -0,0 +1,87 @@ +{ + "networkCallRecords" : [ { + "Method" : "GET", + "Uri" : "https://REDACTED.file.core.windows.net?restype=service&comp=properties", + "Headers" : { + "x-ms-version" : "2020-02-10", + "User-Agent" : "azsdk-java-azure-storage-file-share/12.7.0-beta.1 (11.0.7; Windows 10; 10.0)", + "x-ms-client-request-id" : "1493300c-6c92-45ac-983d-897f5d510465" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2020-02-10", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "14e86749-801a-0039-64b1-74cd50000000", + "Body" : "1.0truefalsetrue31.0truefalsetrue3true", + "Date" : "Mon, 17 Aug 2020 16:16:07 GMT", + "x-ms-client-request-id" : "1493300c-6c92-45ac-983d-897f5d510465", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.file.core.windows.net?restype=service&comp=properties", + "Headers" : { + "x-ms-version" : "2020-02-10", + "User-Agent" : "azsdk-java-azure-storage-file-share/12.7.0-beta.1 (11.0.7; Windows 10; 10.0)", + "x-ms-client-request-id" : "428cbd57-be09-4658-a928-f0db5e7af213" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2020-02-10", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "14e8674b-801a-0039-65b1-74cd50000000", + "Body" : "1.0truefalsetrue31.0truefalsetrue3true", + "Date" : "Mon, 17 Aug 2020 16:16:08 GMT", + "x-ms-client-request-id" : "428cbd57-be09-4658-a928-f0db5e7af213", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://REDACTED.file.core.windows.net?restype=service&comp=properties", + "Headers" : { + "x-ms-version" : "2020-02-10", + "User-Agent" : "azsdk-java-azure-storage-file-share/12.7.0-beta.1 (11.0.7; Windows 10; 10.0)", + "x-ms-client-request-id" : "444aef59-433e-4d3b-9f8c-33e4fba5f487", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2020-02-10", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "14e8674c-801a-0039-66b1-74cd50000000", + "Date" : "Mon, 17 Aug 2020 16:16:09 GMT", + "x-ms-client-request-id" : "444aef59-433e-4d3b-9f8c-33e4fba5f487" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.file.core.windows.net?restype=service&comp=properties", + "Headers" : { + "x-ms-version" : "2020-02-10", + "User-Agent" : "azsdk-java-azure-storage-file-share/12.7.0-beta.1 (11.0.7; Windows 10; 10.0)", + "x-ms-client-request-id" : "133639c3-65b7-4e48-be28-a59ac37db768" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2020-02-10", + "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "14e86751-801a-0039-67b1-74cd50000000", + "Body" : "1.0truefalsetrue31.0truefalsetrue3true", + "Date" : "Mon, 17 Aug 2020 16:16:09 GMT", + "x-ms-client-request-id" : "133639c3-65b7-4e48-be28-a59ac37db768", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "fileserviceapitestssetandgetpropertiespremium2845717046" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-file-share/swagger/README.md b/sdk/storage/azure-storage-file-share/swagger/README.md index c1a7818518907..114c943b1b645 100644 --- a/sdk/storage/azure-storage-file-share/swagger/README.md +++ b/sdk/storage/azure-storage-file-share/swagger/README.md @@ -15,7 +15,7 @@ autorest --use=@microsoft.azure/autorest.java@3.0.4 --use=jianghaolu/autorest.mo ### Code generation settings ``` yaml -input-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/storage-dataplane-preview/specification/storage/data-plane/Microsoft.FileStorage/preview/2020-02-10/file.json +input-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/467d3ca51bb715fea928251f1003515aee67919a/specification/storage/data-plane/Microsoft.FileStorage/preview/2019-12-12/file.json java: true output-folder: ../ namespace: com.azure.storage.file.share From 5638d1ebe4afc83e7dafa6b5a1c6ab5b7b82479d Mon Sep 17 00:00:00 2001 From: Gauri Prasad Date: Mon, 17 Aug 2020 12:20:32 -0700 Subject: [PATCH 2/4] Added changelof --- sdk/storage/azure-storage-file-share/CHANGELOG.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sdk/storage/azure-storage-file-share/CHANGELOG.md b/sdk/storage/azure-storage-file-share/CHANGELOG.md index cf93a43f617c5..2d8ea195a5df9 100644 --- a/sdk/storage/azure-storage-file-share/CHANGELOG.md +++ b/sdk/storage/azure-storage-file-share/CHANGELOG.md @@ -1,7 +1,9 @@ # Release History ## 12.7.0-beta.1 (Unreleased) - +- Added support for the 2020-02-10 service version. +- Added support to getFileRanges on a previous snapshot. +- Added support to set whether or not smb multichannel is enabled. ## 12.6.0 (2020-08-13) - GA release for 2019-12-12 service version From e5b367e837240f6c8b959e28c75009c5b1ce49bb Mon Sep 17 00:00:00 2001 From: Gauri Prasad Date: Tue, 18 Aug 2020 09:59:55 -0700 Subject: [PATCH 3/4] regenerated --- .../file/share/models/ProtocolSettings.java | 18 +++++++++--------- .../models/{SMB.java => SmbSettings.java} | 8 ++++---- .../file/share/FileServiceAPITests.groovy | 7 ++++--- .../azure-storage-file-share/swagger/README.md | 2 +- 4 files changed, 18 insertions(+), 17 deletions(-) rename sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/models/{SMB.java => SmbSettings.java} (83%) diff --git a/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/models/ProtocolSettings.java b/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/models/ProtocolSettings.java index 389a47c3ba93b..2124ea135f9a6 100644 --- a/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/models/ProtocolSettings.java +++ b/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/models/ProtocolSettings.java @@ -18,25 +18,25 @@ public final class ProtocolSettings { * Settings for SMB protocol. */ @JsonProperty(value = "SMB") - private SMB sMB; + private SmbSettings smbSettings; /** - * Get the sMB property: Settings for SMB protocol. + * Get the smbSettings property: Settings for SMB protocol. * - * @return the sMB value. + * @return the smbSettings value. */ - public SMB getSMB() { - return this.sMB; + public SmbSettings getSmbSettings() { + return this.smbSettings; } /** - * Set the sMB property: Settings for SMB protocol. + * Set the smbSettings property: Settings for SMB protocol. * - * @param sMB the sMB value to set. + * @param smbSettings the smbSettings value to set. * @return the ProtocolSettings object itself. */ - public ProtocolSettings setSMB(SMB sMB) { - this.sMB = sMB; + public ProtocolSettings setSmbSettings(SmbSettings smbSettings) { + this.smbSettings = smbSettings; return this; } } diff --git a/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/models/SMB.java b/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/models/SmbSettings.java similarity index 83% rename from sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/models/SMB.java rename to sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/models/SmbSettings.java index 422ba4c46e9a0..9c2f66cfe8a4e 100644 --- a/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/models/SMB.java +++ b/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/models/SmbSettings.java @@ -11,9 +11,9 @@ /** * Settings for SMB protocol. */ -@JacksonXmlRootElement(localName = "SMB") +@JacksonXmlRootElement(localName = "SmbSettings") @Fluent -public final class SMB { +public final class SmbSettings { /* * Settings for SMB Multichannel. */ @@ -33,9 +33,9 @@ public SmbMultichannel getMultichannel() { * Set the multichannel property: Settings for SMB Multichannel. * * @param multichannel the multichannel value to set. - * @return the SMB object itself. + * @return the SmbSettings object itself. */ - public SMB setMultichannel(SmbMultichannel multichannel) { + public SmbSettings setMultichannel(SmbMultichannel multichannel) { this.multichannel = multichannel; return this; } diff --git a/sdk/storage/azure-storage-file-share/src/test/java/com/azure/storage/file/share/FileServiceAPITests.groovy b/sdk/storage/azure-storage-file-share/src/test/java/com/azure/storage/file/share/FileServiceAPITests.groovy index bee7a6e2b1faf..b612f884e2656 100644 --- a/sdk/storage/azure-storage-file-share/src/test/java/com/azure/storage/file/share/FileServiceAPITests.groovy +++ b/sdk/storage/azure-storage-file-share/src/test/java/com/azure/storage/file/share/FileServiceAPITests.groovy @@ -3,12 +3,12 @@ package com.azure.storage.file.share -import com.azure.core.test.TestMode + import com.azure.core.util.Context import com.azure.storage.common.StorageSharedKeyCredential import com.azure.storage.file.share.models.ListSharesOptions import com.azure.storage.file.share.models.ProtocolSettings -import com.azure.storage.file.share.models.SMB + import com.azure.storage.file.share.models.ShareCorsRule import com.azure.storage.file.share.models.ShareErrorCode import com.azure.storage.file.share.models.ShareItem @@ -18,6 +18,7 @@ import com.azure.storage.file.share.models.ShareRetentionPolicy import com.azure.storage.file.share.models.ShareServiceProperties import com.azure.storage.file.share.models.ShareStorageException import com.azure.storage.file.share.models.SmbMultichannel +import com.azure.storage.file.share.models.SmbSettings import spock.lang.Unroll import java.time.OffsetDateTime @@ -237,7 +238,7 @@ class FileServiceAPITests extends APISpec { def retentionPolicy = new ShareRetentionPolicy().setEnabled(true).setDays(3) def metrics = new ShareMetrics().setEnabled(true).setIncludeApis(false) .setRetentionPolicy(retentionPolicy).setVersion("1.0") - def protocolSettings = new ProtocolSettings().setSMB(new SMB().setMultichannel(new SmbMultichannel().setEnabled(true))) + def protocolSettings = new ProtocolSettings().setSmbSettings(new SmbSettings().setMultichannel(new SmbMultichannel().setEnabled(true))) def updatedProperties = new ShareServiceProperties().setHourMetrics(metrics) .setMinuteMetrics(metrics).setCors(new ArrayList<>()) .setProtocolSettings(protocolSettings) diff --git a/sdk/storage/azure-storage-file-share/swagger/README.md b/sdk/storage/azure-storage-file-share/swagger/README.md index 114c943b1b645..b73ae913117d8 100644 --- a/sdk/storage/azure-storage-file-share/swagger/README.md +++ b/sdk/storage/azure-storage-file-share/swagger/README.md @@ -15,7 +15,7 @@ autorest --use=@microsoft.azure/autorest.java@3.0.4 --use=jianghaolu/autorest.mo ### Code generation settings ``` yaml -input-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/467d3ca51bb715fea928251f1003515aee67919a/specification/storage/data-plane/Microsoft.FileStorage/preview/2019-12-12/file.json +input-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/953d16abf7717aacdc0ca9f90e8690630de07e58/specification/storage/data-plane/Microsoft.FileStorage/preview/2020-02-10/file.json java: true output-folder: ../ namespace: com.azure.storage.file.share From 70b7a6696bd6721d5be1d359c77b9cc2fe790dcd Mon Sep 17 00:00:00 2001 From: Gauri Prasad Date: Tue, 18 Aug 2020 10:05:33 -0700 Subject: [PATCH 4/4] regenerated --- .../azure/storage/file/share/ShareFileAsyncClient.java | 2 +- .../storage/file/share/implementation/FilesImpl.java | 10 ++++++---- sdk/storage/azure-storage-file-share/swagger/README.md | 2 +- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/ShareFileAsyncClient.java b/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/ShareFileAsyncClient.java index 4865e49307319..975bde0032630 100644 --- a/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/ShareFileAsyncClient.java +++ b/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/ShareFileAsyncClient.java @@ -1653,7 +1653,7 @@ PagedFlux listRangesWithOptionalTimeout(ShareFileListRangeOption String rangeString = finalOptions.getRange() == null ? null : finalOptions.getRange().toString(); Function>> retriever = marker -> StorageImplUtils.applyOptionalTimeout(this.azureFileStorageClient.files() - .getRangeListWithRestResponseAsync(shareName, filePath, snapshot, + .getRangeListWithRestResponseAsync(shareName, filePath, snapshot, finalOptions.getPreviousSnapshot(), null, rangeString, finalRequestConditions.getLeaseId(), context), timeout) .map(response -> new PagedResponseBase<>(response.getRequest(), response.getStatusCode(), 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 04bc7e433dd14..c36a37b221c1b 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 @@ -124,7 +124,7 @@ private interface FilesService { @Get("{shareName}/{filePath}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ShareStorageException.class) - Mono getRangeList(@PathParam("shareName") String shareName, @PathParam("filePath") String filePath, @HostParam("url") String url, @QueryParam("sharesnapshot") String sharesnapshot, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-range") String range, @HeaderParam("x-ms-lease-id") String leaseId, @QueryParam("comp") String comp, Context context); + Mono getRangeList(@PathParam("shareName") String shareName, @PathParam("filePath") String filePath, @HostParam("url") String url, @QueryParam("sharesnapshot") String sharesnapshot, @QueryParam("prevsharesnapshot") String prevsharesnapshot, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-range") String range, @HeaderParam("x-ms-lease-id") String leaseId, @QueryParam("comp") String comp, Context context); @Put("{shareName}/{filePath}") @ExpectedResponses({202}) @@ -580,11 +580,12 @@ public Mono uploadRangeFromURLWithRestResponseA @ServiceMethod(returns = ReturnType.SINGLE) public Mono getRangeListWithRestResponseAsync(String shareName, String filePath, Context context) { final String sharesnapshot = null; + final String prevsharesnapshot = null; final Integer timeout = null; final String range = null; final String leaseId = null; final String comp = "rangelist"; - return service.getRangeList(shareName, filePath, this.client.getUrl(), sharesnapshot, timeout, this.client.getVersion(), range, leaseId, comp, context); + return service.getRangeList(shareName, filePath, this.client.getUrl(), sharesnapshot, prevsharesnapshot, timeout, this.client.getVersion(), range, leaseId, comp, context); } /** @@ -593,6 +594,7 @@ public Mono getRangeListWithRestResponseAsync(String * @param shareName The name of the target share. * @param filePath The path of the target file. * @param sharesnapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the share snapshot to query. + * @param prevsharesnapshot The previous snapshot parameter is an opaque DateTime value that, when present, specifies the previous snapshot. * @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 Timeouts for File Service Operations.</a>. * @param range Specifies the range of bytes over which to list ranges, inclusively. * @param leaseId If specified, the operation only succeeds if the resource's lease is active and matches this ID. @@ -601,9 +603,9 @@ public Mono getRangeListWithRestResponseAsync(String * @return a Mono which performs the network request upon subscription. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getRangeListWithRestResponseAsync(String shareName, String filePath, String sharesnapshot, Integer timeout, String range, String leaseId, Context context) { + public Mono getRangeListWithRestResponseAsync(String shareName, String filePath, String sharesnapshot, String prevsharesnapshot, Integer timeout, String range, String leaseId, Context context) { final String comp = "rangelist"; - return service.getRangeList(shareName, filePath, this.client.getUrl(), sharesnapshot, timeout, this.client.getVersion(), range, leaseId, comp, context); + return service.getRangeList(shareName, filePath, this.client.getUrl(), sharesnapshot, prevsharesnapshot, timeout, this.client.getVersion(), range, leaseId, comp, context); } /** diff --git a/sdk/storage/azure-storage-file-share/swagger/README.md b/sdk/storage/azure-storage-file-share/swagger/README.md index b73ae913117d8..c1a7818518907 100644 --- a/sdk/storage/azure-storage-file-share/swagger/README.md +++ b/sdk/storage/azure-storage-file-share/swagger/README.md @@ -15,7 +15,7 @@ autorest --use=@microsoft.azure/autorest.java@3.0.4 --use=jianghaolu/autorest.mo ### Code generation settings ``` yaml -input-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/953d16abf7717aacdc0ca9f90e8690630de07e58/specification/storage/data-plane/Microsoft.FileStorage/preview/2020-02-10/file.json +input-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/storage-dataplane-preview/specification/storage/data-plane/Microsoft.FileStorage/preview/2020-02-10/file.json java: true output-folder: ../ namespace: com.azure.storage.file.share