diff --git a/sdk/storage/azure-storage-file-share/CHANGELOG.md b/sdk/storage/azure-storage-file-share/CHANGELOG.md index a46c2f26468df..7bf451f80cb16 100644 --- a/sdk/storage/azure-storage-file-share/CHANGELOG.md +++ b/sdk/storage/azure-storage-file-share/CHANGELOG.md @@ -2,6 +2,9 @@ ## 12.7.0-beta.1 (Unreleased) - Fixed a bug that would cause auth failures when building a client by passing an endpoint which had a sas token with protocol set to https,http +- 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 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..2124ea135f9a6 --- /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 SmbSettings smbSettings; + + /** + * Get the smbSettings property: Settings for SMB protocol. + * + * @return the smbSettings value. + */ + public SmbSettings getSmbSettings() { + return this.smbSettings; + } + + /** + * Set the smbSettings property: Settings for SMB protocol. + * + * @param smbSettings the smbSettings value to set. + * @return the ProtocolSettings object itself. + */ + 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/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/main/java/com/azure/storage/file/share/models/SmbSettings.java b/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/models/SmbSettings.java new file mode 100644 index 0000000000000..9c2f66cfe8a4e --- /dev/null +++ b/sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/models/SmbSettings.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 = "SmbSettings") +@Fluent +public final class SmbSettings { + /* + * 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 SmbSettings object itself. + */ + 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 fef1cab385767..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,10 +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.ShareCorsRule import com.azure.storage.file.share.models.ShareErrorCode import com.azure.storage.file.share.models.ShareItem @@ -15,6 +17,8 @@ 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 com.azure.storage.file.share.models.SmbSettings import spock.lang.Unroll import java.time.OffsetDateTime @@ -228,6 +232,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().setSmbSettings(new SmbSettings().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