Skip to content

Commit f32d8a6

Browse files
STG100 - Files Encryption in Transit (#46444)
* encryption in transit changes * adding tests * fixing review comments
1 parent 12ccb88 commit f32d8a6

File tree

15 files changed

+642
-217
lines changed

15 files changed

+642
-217
lines changed

sdk/storage/azure-storage-file-share/assets.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
"AssetsRepo": "Azure/azure-sdk-assets",
33
"AssetsRepoPrefixPath": "java",
44
"TagPrefix": "java/storage/azure-storage-file-share",
5-
"Tag": "java/storage/azure-storage-file-share_e7a870d29a"
5+
"Tag": "java/storage/azure-storage-file-share_2a1cf9c25b"
66
}

sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/ShareAsyncClient.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -369,8 +369,7 @@ Mono<Response<ShareInfo>> createWithResponse(ShareCreateOptions options, Context
369369
options.getAccessTier(), enabledProtocol, options.getRootSquash(),
370370
options.isSnapshotVirtualDirectoryAccessEnabled(), options.isPaidBurstingEnabled(),
371371
options.getPaidBurstingMaxBandwidthMibps(), options.getPaidBurstingMaxIops(),
372-
options.getProvisionedMaxIops(), options.getProvisionedMaxBandwidthMibps(),
373-
options.isEnableSmbDirectoryLease())
372+
options.getProvisionedMaxIops(), options.getProvisionedMaxBandwidthMibps()) //todo : removing temporarily due to swagger
374373
.map(ModelHelper::mapToShareInfoResponse);
375374
}
376375

@@ -938,8 +937,7 @@ Mono<Response<ShareInfo>> setPropertiesWithResponse(ShareSetPropertiesOptions op
938937
options.getAccessTier(), requestConditions.getLeaseId(), options.getRootSquash(),
939938
options.isSnapshotVirtualDirectoryAccessEnabled(), options.isPaidBurstingEnabled(),
940939
options.getPaidBurstingMaxBandwidthMibps(), options.getPaidBurstingMaxIops(),
941-
options.getProvisionedMaxIops(), options.getProvisionedMaxBandwidthMibps(),
942-
options.isEnableSmbDirectoryLease())
940+
options.getProvisionedMaxIops(), options.getProvisionedMaxBandwidthMibps())//todo : remove temporarily swagger
943941
.map(ModelHelper::mapToShareInfoResponse);
944942
}
945943

sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/ShareClient.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -367,8 +367,7 @@ public Response<ShareInfo> createWithResponse(ShareCreateOptions options, Durati
367367
finalOptions.getAccessTier(), finalEnabledProtocol, finalOptions.getRootSquash(),
368368
finalOptions.isSnapshotVirtualDirectoryAccessEnabled(), finalOptions.isPaidBurstingEnabled(),
369369
finalOptions.getPaidBurstingMaxBandwidthMibps(), finalOptions.getPaidBurstingMaxIops(),
370-
finalOptions.getProvisionedMaxIops(), finalOptions.getProvisionedMaxBandwidthMibps(),
371-
finalOptions.isEnableSmbDirectoryLease(), finalContext);
370+
finalOptions.getProvisionedMaxIops(), finalOptions.getProvisionedMaxBandwidthMibps(), finalContext); //todo: removing temporarily
372371

373372
return ModelHelper.mapToShareInfoResponse(sendRequest(operation, timeout, ShareStorageException.class));
374373
}
@@ -898,8 +897,7 @@ public Response<ShareInfo> setPropertiesWithResponse(ShareSetPropertiesOptions o
898897
requestConditions.getLeaseId(), options.getRootSquash(),
899898
options.isSnapshotVirtualDirectoryAccessEnabled(), options.isPaidBurstingEnabled(),
900899
options.getPaidBurstingMaxBandwidthMibps(), options.getPaidBurstingMaxIops(),
901-
options.getProvisionedMaxIops(), options.getProvisionedMaxBandwidthMibps(),
902-
options.isEnableSmbDirectoryLease(), finalContext);
900+
options.getProvisionedMaxIops(), options.getProvisionedMaxBandwidthMibps(), finalContext); //todo: removing temporarliy
903901

904902
return ModelHelper.mapToShareInfoResponse(sendRequest(operation, timeout, ShareStorageException.class));
905903
}

sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/implementation/SharesImpl.java

Lines changed: 42 additions & 134 deletions
Large diffs are not rendered by default.

sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/implementation/models/SharePropertiesInternal.java

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -183,12 +183,6 @@ public final class SharePropertiesInternal implements XmlSerializable<SharePrope
183183
@Generated
184184
private DateTimeRfc1123 nextAllowedProvisionedBandwidthDowngradeTime;
185185

186-
/*
187-
* The EnableSmbDirectoryLease property.
188-
*/
189-
@Generated
190-
private Boolean enableSmbDirectoryLease;
191-
192186
/*
193187
* Dictionary of <string>
194188
*/
@@ -825,28 +819,6 @@ public OffsetDateTime getNextAllowedProvisionedBandwidthDowngradeTime() {
825819
return this;
826820
}
827821

828-
/**
829-
* Get the enableSmbDirectoryLease property: The EnableSmbDirectoryLease property.
830-
*
831-
* @return the enableSmbDirectoryLease value.
832-
*/
833-
@Generated
834-
public Boolean isEnableSmbDirectoryLease() {
835-
return this.enableSmbDirectoryLease;
836-
}
837-
838-
/**
839-
* Set the enableSmbDirectoryLease property: The EnableSmbDirectoryLease property.
840-
*
841-
* @param enableSmbDirectoryLease the enableSmbDirectoryLease value to set.
842-
* @return the SharePropertiesInternal object itself.
843-
*/
844-
@Generated
845-
public SharePropertiesInternal setEnableSmbDirectoryLease(Boolean enableSmbDirectoryLease) {
846-
this.enableSmbDirectoryLease = enableSmbDirectoryLease;
847-
return this;
848-
}
849-
850822
/**
851823
* Get the metadata property: Dictionary of &lt;string&gt;.
852824
*
@@ -912,7 +884,6 @@ public XmlWriter toXml(XmlWriter xmlWriter, String rootElementName) throws XMLSt
912884
Objects.toString(this.nextAllowedProvisionedIopsDowngradeTime, null));
913885
xmlWriter.writeStringElement("NextAllowedProvisionedBandwidthDowngradeTime",
914886
Objects.toString(this.nextAllowedProvisionedBandwidthDowngradeTime, null));
915-
xmlWriter.writeBooleanElement("EnableSmbDirectoryLease", this.enableSmbDirectoryLease);
916887
if (this.metadata != null) {
917888
xmlWriter.writeStartElement("Metadata");
918889
for (Map.Entry<String, String> entry : this.metadata.entrySet()) {
@@ -1025,9 +996,6 @@ public static SharePropertiesInternal fromXml(XmlReader xmlReader, String rootEl
1025996
} else if ("NextAllowedProvisionedBandwidthDowngradeTime".equals(elementName.getLocalPart())) {
1026997
deserializedSharePropertiesInternal.nextAllowedProvisionedBandwidthDowngradeTime
1027998
= reader.getNullableElement(DateTimeRfc1123::new);
1028-
} else if ("EnableSmbDirectoryLease".equals(elementName.getLocalPart())) {
1029-
deserializedSharePropertiesInternal.enableSmbDirectoryLease
1030-
= reader.getNullableElement(Boolean::parseBoolean);
1031999
} else if ("Metadata".equals(elementName.getLocalPart())) {
10321000
while (reader.nextElement() != XmlToken.END_ELEMENT) {
10331001
if (deserializedSharePropertiesInternal.metadata == null) {

sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/implementation/models/SharesGetPropertiesHeaders.java

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -106,12 +106,6 @@ public final class SharesGetPropertiesHeaders {
106106
@Generated
107107
private LeaseDurationType xMsLeaseDuration;
108108

109-
/*
110-
* The x-ms-enable-smb-directory-lease property.
111-
*/
112-
@Generated
113-
private Boolean xMsEnableSmbDirectoryLease;
114-
115109
/*
116110
* The x-ms-request-id property.
117111
*/
@@ -229,9 +223,6 @@ public final class SharesGetPropertiesHeaders {
229223

230224
private static final HttpHeaderName X_MS_LEASE_DURATION = HttpHeaderName.fromString("x-ms-lease-duration");
231225

232-
private static final HttpHeaderName X_MS_ENABLE_SMB_DIRECTORY_LEASE
233-
= HttpHeaderName.fromString("x-ms-enable-smb-directory-lease");
234-
235226
private static final HttpHeaderName X_MS_ACCESS_TIER_TRANSITION_STATE
236227
= HttpHeaderName.fromString("x-ms-access-tier-transition-state");
237228

@@ -342,12 +333,6 @@ public SharesGetPropertiesHeaders(HttpHeaders rawHeaders) {
342333
} else {
343334
this.xMsLeaseDuration = null;
344335
}
345-
String xMsEnableSmbDirectoryLease = rawHeaders.getValue(X_MS_ENABLE_SMB_DIRECTORY_LEASE);
346-
if (xMsEnableSmbDirectoryLease != null) {
347-
this.xMsEnableSmbDirectoryLease = Boolean.parseBoolean(xMsEnableSmbDirectoryLease);
348-
} else {
349-
this.xMsEnableSmbDirectoryLease = null;
350-
}
351336
this.xMsRequestId = rawHeaders.getValue(HttpHeaderName.X_MS_REQUEST_ID);
352337
this.xMsAccessTierTransitionState = rawHeaders.getValue(X_MS_ACCESS_TIER_TRANSITION_STATE);
353338
String xMsShareNextAllowedQuotaDowngradeTime
@@ -749,28 +734,6 @@ public SharesGetPropertiesHeaders setXMsLeaseDuration(LeaseDurationType xMsLease
749734
return this;
750735
}
751736

752-
/**
753-
* Get the xMsEnableSmbDirectoryLease property: The x-ms-enable-smb-directory-lease property.
754-
*
755-
* @return the xMsEnableSmbDirectoryLease value.
756-
*/
757-
@Generated
758-
public Boolean isXMsEnableSmbDirectoryLease() {
759-
return this.xMsEnableSmbDirectoryLease;
760-
}
761-
762-
/**
763-
* Set the xMsEnableSmbDirectoryLease property: The x-ms-enable-smb-directory-lease property.
764-
*
765-
* @param xMsEnableSmbDirectoryLease the xMsEnableSmbDirectoryLease value to set.
766-
* @return the SharesGetPropertiesHeaders object itself.
767-
*/
768-
@Generated
769-
public SharesGetPropertiesHeaders setXMsEnableSmbDirectoryLease(Boolean xMsEnableSmbDirectoryLease) {
770-
this.xMsEnableSmbDirectoryLease = xMsEnableSmbDirectoryLease;
771-
return this;
772-
}
773-
774737
/**
775738
* Get the xMsRequestId property: The x-ms-request-id property.
776739
*

sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/implementation/util/ModelHelper.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ public static ShareProperties populateShareProperties(SharePropertiesInternal sh
238238
sharePropertiesInternal.getNextAllowedProvisionedIopsDowngradeTime());
239239
properties.setNextAllowedProvisionedBandwidthDowngradeTime(
240240
sharePropertiesInternal.getNextAllowedProvisionedBandwidthDowngradeTime());
241-
properties.setEnableSmbDirectoryLease(sharePropertiesInternal.isEnableSmbDirectoryLease());
241+
//properties.setEnableSmbDirectoryLease(sharePropertiesInternal.isEnableSmbDirectoryLease()); //todo : removing temporarily
242242

243243
return properties;
244244
}
@@ -518,8 +518,8 @@ public static Response<ShareInfo> mapToShareInfoResponse(Response<?> response) {
518518
.setMaxBurstCreditsForIops(headers.getXMsShareMaxBurstCreditsForIops())
519519
.setNextAllowedProvisionedIopsDowngradeTime(headers.getXMsShareNextAllowedProvisionedIopsDowngradeTime())
520520
.setNextAllowedProvisionedBandwidthDowngradeTime(
521-
headers.getXMsShareNextAllowedProvisionedBandwidthDowngradeTime())
522-
.setEnableSmbDirectoryLease(headers.isXMsEnableSmbDirectoryLease());
521+
headers.getXMsShareNextAllowedProvisionedBandwidthDowngradeTime());
522+
// .setEnableSmbDirectoryLease(headers.isXMsEnableSmbDirectoryLease()); //todo : removing temporarily
523523

524524
return new SimpleResponse<>(response, shareProperties);
525525
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
2+
// Licensed under the MIT License.
3+
// Code generated by Microsoft (R) AutoRest Code Generator.
4+
5+
package com.azure.storage.file.share.models;
6+
7+
import com.azure.core.annotation.Fluent;
8+
import com.azure.core.annotation.Generated;
9+
import com.azure.xml.XmlReader;
10+
import com.azure.xml.XmlSerializable;
11+
import com.azure.xml.XmlToken;
12+
import com.azure.xml.XmlWriter;
13+
import javax.xml.namespace.QName;
14+
import javax.xml.stream.XMLStreamException;
15+
16+
/**
17+
* Settings for SMB protocol.
18+
*/
19+
@Fluent
20+
public final class ShareNfsSettings implements XmlSerializable<ShareNfsSettings> {
21+
/*
22+
* Enable or disable encryption in transit.
23+
*/
24+
@Generated
25+
private ShareNfsSettingsEncryptionInTransit encryptionInTransit;
26+
27+
/**
28+
* Creates an instance of ShareNfsSettings class.
29+
*/
30+
@Generated
31+
public ShareNfsSettings() {
32+
}
33+
34+
/**
35+
* Get the encryptionInTransit property: Enable or disable encryption in transit.
36+
*
37+
* @return the encryptionInTransit value.
38+
*/
39+
@Generated
40+
public ShareNfsSettingsEncryptionInTransit getEncryptionInTransit() {
41+
return this.encryptionInTransit;
42+
}
43+
44+
/**
45+
* Set the encryptionInTransit property: Enable or disable encryption in transit.
46+
*
47+
* @param encryptionInTransit the encryptionInTransit value to set.
48+
* @return the ShareNfsSettings object itself.
49+
*/
50+
@Generated
51+
public ShareNfsSettings setEncryptionInTransit(ShareNfsSettingsEncryptionInTransit encryptionInTransit) {
52+
this.encryptionInTransit = encryptionInTransit;
53+
return this;
54+
}
55+
56+
@Generated
57+
@Override
58+
public XmlWriter toXml(XmlWriter xmlWriter) throws XMLStreamException {
59+
return toXml(xmlWriter, null);
60+
}
61+
62+
@Generated
63+
@Override
64+
public XmlWriter toXml(XmlWriter xmlWriter, String rootElementName) throws XMLStreamException {
65+
rootElementName = rootElementName == null || rootElementName.isEmpty() ? "NFS" : rootElementName;
66+
xmlWriter.writeStartElement(rootElementName);
67+
xmlWriter.writeXml(this.encryptionInTransit, "EncryptionInTransit");
68+
return xmlWriter.writeEndElement();
69+
}
70+
71+
/**
72+
* Reads an instance of ShareNfsSettings from the XmlReader.
73+
*
74+
* @param xmlReader The XmlReader being read.
75+
* @return An instance of ShareNfsSettings if the XmlReader was pointing to an instance of it, or null if it was
76+
* pointing to XML null.
77+
* @throws XMLStreamException If an error occurs while reading the ShareNfsSettings.
78+
*/
79+
@Generated
80+
public static ShareNfsSettings fromXml(XmlReader xmlReader) throws XMLStreamException {
81+
return fromXml(xmlReader, null);
82+
}
83+
84+
/**
85+
* Reads an instance of ShareNfsSettings from the XmlReader.
86+
*
87+
* @param xmlReader The XmlReader being read.
88+
* @param rootElementName Optional root element name to override the default defined by the model. Used to support
89+
* cases where the model can deserialize from different root element names.
90+
* @return An instance of ShareNfsSettings if the XmlReader was pointing to an instance of it, or null if it was
91+
* pointing to XML null.
92+
* @throws XMLStreamException If an error occurs while reading the ShareNfsSettings.
93+
*/
94+
@Generated
95+
public static ShareNfsSettings fromXml(XmlReader xmlReader, String rootElementName) throws XMLStreamException {
96+
String finalRootElementName = rootElementName == null || rootElementName.isEmpty() ? "NFS" : rootElementName;
97+
return xmlReader.readObject(finalRootElementName, reader -> {
98+
ShareNfsSettings deserializedShareNfsSettings = new ShareNfsSettings();
99+
while (reader.nextElement() != XmlToken.END_ELEMENT) {
100+
QName elementName = reader.getElementName();
101+
102+
if ("EncryptionInTransit".equals(elementName.getLocalPart())) {
103+
deserializedShareNfsSettings.encryptionInTransit
104+
= ShareNfsSettingsEncryptionInTransit.fromXml(reader, "EncryptionInTransit");
105+
} else {
106+
reader.skipElement();
107+
}
108+
}
109+
110+
return deserializedShareNfsSettings;
111+
});
112+
}
113+
}

0 commit comments

Comments
 (0)