Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added code for smb multi channel #14180

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions sdk/storage/azure-storage-file-share/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,12 @@ private CorsWrapper(@JacksonXmlProperty(localName = "CorsRule") List<ShareCorsRu
@JsonProperty(value = "Cors")
private CorsWrapper cors;

/*
* Protocol settings
*/
@JsonProperty(value = "ProtocolSettings")
private ProtocolSettings protocolSettings;

/**
* Get the hourMetrics property: A summary of request statistics grouped by
* API in hourly aggregates for files.
Expand Down Expand Up @@ -114,4 +120,24 @@ public ShareServiceProperties setCors(List<ShareCorsRule> 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;
}
}
Original file line number Diff line number Diff line change
@@ -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;
}
}
Original file line number Diff line number Diff line change
@@ -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;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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:
Expand Down
Original file line number Diff line number Diff line change
@@ -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" : "<?xml version=\"1.0\" encoding=\"utf-8\"?><StorageServiceProperties><HourMetrics><Version>1.0</Version><Enabled>true</Enabled><IncludeAPIs>false</IncludeAPIs><RetentionPolicy><Enabled>true</Enabled><Days>3</Days></RetentionPolicy></HourMetrics><MinuteMetrics><Version>1.0</Version><Enabled>true</Enabled><IncludeAPIs>false</IncludeAPIs><RetentionPolicy><Enabled>true</Enabled><Days>3</Days></RetentionPolicy></MinuteMetrics><Cors /><ProtocolSettings><SMB><Multichannel><Enabled>true</Enabled></Multichannel></SMB></ProtocolSettings></StorageServiceProperties>",
"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" : "<?xml version=\"1.0\" encoding=\"utf-8\"?><StorageServiceProperties><HourMetrics><Version>1.0</Version><Enabled>true</Enabled><IncludeAPIs>false</IncludeAPIs><RetentionPolicy><Enabled>true</Enabled><Days>3</Days></RetentionPolicy></HourMetrics><MinuteMetrics><Version>1.0</Version><Enabled>true</Enabled><IncludeAPIs>false</IncludeAPIs><RetentionPolicy><Enabled>true</Enabled><Days>3</Days></RetentionPolicy></MinuteMetrics><Cors /><ProtocolSettings><SMB><Multichannel><Enabled>true</Enabled></Multichannel></SMB></ProtocolSettings></StorageServiceProperties>",
"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" : "<?xml version=\"1.0\" encoding=\"utf-8\"?><StorageServiceProperties><HourMetrics><Version>1.0</Version><Enabled>true</Enabled><IncludeAPIs>false</IncludeAPIs><RetentionPolicy><Enabled>true</Enabled><Days>3</Days></RetentionPolicy></HourMetrics><MinuteMetrics><Version>1.0</Version><Enabled>true</Enabled><IncludeAPIs>false</IncludeAPIs><RetentionPolicy><Enabled>true</Enabled><Days>3</Days></RetentionPolicy></MinuteMetrics><Cors /><ProtocolSettings><SMB><Multichannel><Enabled>true</Enabled></Multichannel></SMB></ProtocolSettings></StorageServiceProperties>",
"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" ]
}