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

Feature/storage/share enable protocol share squash root #16123

Merged
Show file tree
Hide file tree
Changes from 5 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.Common/src/Shared/Constants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,9 @@ internal static class File
public const string FileTimeFormat = "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffff'Z'";
public const string SnapshotParameterName = "sharesnapshot";

public const string SmbProtocol = "SMB";
public const string NfsProtocol = "NFS";

internal static class Lease
{
/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -438,8 +438,10 @@ public partial class ShareCreateOptions
{
public ShareCreateOptions() { }
public Azure.Storage.Files.Shares.Models.ShareAccessTier? AccessTier { get { throw null; } set { } }
public Azure.Storage.Files.Shares.Models.ShareEnabledProtocols? EnabledProtocols { get { throw null; } set { } }
public System.Collections.Generic.IDictionary<string, string> Metadata { get { throw null; } set { } }
public int? QuotaInGB { get { throw null; } set { } }
public Azure.Storage.Files.Shares.Models.ShareRootSquash? RootSquash { get { throw null; } set { } }
}
public partial class ShareDeleteOptions
{
Expand All @@ -463,6 +465,12 @@ internal ShareDirectoryProperties() { }
public System.Collections.Generic.IDictionary<string, string> Metadata { get { throw null; } }
public Azure.Storage.Files.Shares.Models.FileSmbProperties SmbProperties { get { throw null; } set { } }
}
[System.FlagsAttribute]
public enum ShareEnabledProtocols
{
Smb = 0,
Nfs = 1,
}
[System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
public readonly partial struct ShareErrorCode : System.IEquatable<Azure.Storage.Files.Shares.Models.ShareErrorCode>
{
Expand Down Expand Up @@ -780,7 +788,7 @@ public static partial class ShareModelFactory
public static Azure.Storage.Files.Shares.Models.ShareProperties ShareProperties(System.DateTimeOffset? lastModified, Azure.ETag? eTag, int? provisionedIops, int? provisionedIngressMBps, int? provisionedEgressMBps, System.DateTimeOffset? nextAllowedQuotaDowngradeTime, System.DateTimeOffset? deletedOn, int? remainingRetentionDays, int? quotaInGB, System.Collections.Generic.IDictionary<string, string> metadata) { throw null; }
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
public static Azure.Storage.Files.Shares.Models.ShareProperties ShareProperties(System.DateTimeOffset? lastModified, Azure.ETag? eTag, int? provisionedIops, int? provisionedIngressMBps, int? provisionedEgressMBps, System.DateTimeOffset? nextAllowedQuotaDowngradeTime, int? quotaInGB, System.Collections.Generic.IDictionary<string, string> metadata) { throw null; }
public static Azure.Storage.Files.Shares.Models.ShareProperties ShareProperties(string accessTier = null, System.DateTimeOffset? lastModified = default(System.DateTimeOffset?), int? provisionedIops = default(int?), int? provisionedIngressMBps = default(int?), int? provisionedEgressMBps = default(int?), System.DateTimeOffset? nextAllowedQuotaDowngradeTime = default(System.DateTimeOffset?), System.DateTimeOffset? deletedOn = default(System.DateTimeOffset?), int? remainingRetentionDays = default(int?), Azure.ETag? eTag = default(Azure.ETag?), System.DateTimeOffset? accessTierChangeTime = default(System.DateTimeOffset?), string accessTierTransitionState = null, Azure.Storage.Files.Shares.Models.ShareLeaseStatus? leaseStatus = default(Azure.Storage.Files.Shares.Models.ShareLeaseStatus?), Azure.Storage.Files.Shares.Models.ShareLeaseState? leaseState = default(Azure.Storage.Files.Shares.Models.ShareLeaseState?), Azure.Storage.Files.Shares.Models.ShareLeaseDuration? leaseDuration = default(Azure.Storage.Files.Shares.Models.ShareLeaseDuration?), int? quotaInGB = default(int?), System.Collections.Generic.IDictionary<string, string> metadata = null) { throw null; }
public static Azure.Storage.Files.Shares.Models.ShareProperties ShareProperties(System.DateTimeOffset? accessTierChangeTime = default(System.DateTimeOffset?), System.DateTimeOffset? lastModified = default(System.DateTimeOffset?), int? provisionedIops = default(int?), int? provisionedIngressMBps = default(int?), int? provisionedEgressMBps = default(int?), System.DateTimeOffset? nextAllowedQuotaDowngradeTime = default(System.DateTimeOffset?), System.DateTimeOffset? deletedOn = default(System.DateTimeOffset?), int? remainingRetentionDays = default(int?), string accessTier = null, Azure.ETag? eTag = default(Azure.ETag?), string accessTierTransitionState = null, Azure.Storage.Files.Shares.Models.ShareLeaseStatus? leaseStatus = default(Azure.Storage.Files.Shares.Models.ShareLeaseStatus?), Azure.Storage.Files.Shares.Models.ShareLeaseState? leaseState = default(Azure.Storage.Files.Shares.Models.ShareLeaseState?), Azure.Storage.Files.Shares.Models.ShareLeaseDuration? leaseDuration = default(Azure.Storage.Files.Shares.Models.ShareLeaseDuration?), string enabledProtocols = null, Azure.Storage.Files.Shares.Models.ShareRootSquash? rootSquash = default(Azure.Storage.Files.Shares.Models.ShareRootSquash?), int? quotaInGB = default(int?), System.Collections.Generic.IDictionary<string, string> metadata = null) { throw null; }
public static Azure.Storage.Files.Shares.Models.ShareSnapshotInfo ShareSnapshotInfo(string snapshot, Azure.ETag eTag, System.DateTimeOffset lastModified) { throw null; }
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
public static Azure.Storage.Files.Shares.Models.ShareStatistics ShareStatistics(int shareUsageBytes) { throw null; }
Expand All @@ -796,6 +804,7 @@ internal ShareProperties() { }
public System.DateTimeOffset? AccessTierChangeTime { get { throw null; } }
public string AccessTierTransitionState { get { throw null; } }
public System.DateTimeOffset? DeletedOn { get { throw null; } }
public string EnabledProtocols { get { throw null; } }
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that EnabledProtocols is a string, but RootSquash is an enum. I did this because it is not possible to create a Flags enum in swagger, and in the future, it will be possible enable multiple protocols on a share. I manually created a Flags Enum ShareEnabledProtocols to be used in ShareCreateOptions. To use the flag enum here, we would have to make the original generated ShareProperties class internal, and hand-write a new one and the conversion between. This would also break swagger for the other platforms. We can do this, but it would be more work.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think enum here would be better experience. Otherwise we're asking customer to parse the property themselves - it really contains a list - maybe this should be list of enums?
I.e. in Java this probably would be something like https://github.com/Azure/azure-sdk-for-java/blob/52bd42b258c242af24fe59a80fb2bed9a324b201/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ArchiveStatus.java#L14

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think use string in generated code is fine and we should do some wrapping in the convenience layer.
Note that in the future, the possible values for the EnabledProtocols could be

"SMB;NFS"
"SMBv2;SMBv3;NFSv4"

"SMB"/"NFS" without version is to support all versions. And "SMBv2;SMBv3;" is to support both SMB v2 and v3.

To me, this is similar to the include option of List Blob except that the service is accepting a joined string instead of an array.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ljian3377, we are going to leave this as a string in the generated code, but we are going to make it a flags enum in the ShareItem that is actually returned to the customer.

public Azure.ETag? ETag { get { throw null; } }
public System.DateTimeOffset? LastModified { get { throw null; } }
public Azure.Storage.Files.Shares.Models.ShareLeaseDuration? LeaseDuration { get { throw null; } }
Expand All @@ -808,6 +817,7 @@ internal ShareProperties() { }
public int? ProvisionedIops { get { throw null; } }
public int? QuotaInGB { get { throw null; } }
public int? RemainingRetentionDays { get { throw null; } }
public Azure.Storage.Files.Shares.Models.ShareRootSquash? RootSquash { get { throw null; } }
}
public partial class ShareProtocolSettings
{
Expand All @@ -820,6 +830,12 @@ public ShareRetentionPolicy() { }
public int? Days { get { throw null; } set { } }
public bool Enabled { get { throw null; } set { } }
}
public enum ShareRootSquash
{
NoRootSquash = 0,
RootSquash = 1,
AllSquash = 2,
}
public partial class ShareServiceProperties
{
public ShareServiceProperties() { }
Expand All @@ -834,6 +850,7 @@ public ShareSetPropertiesOptions() { }
public Azure.Storage.Files.Shares.Models.ShareAccessTier? AccessTier { get { throw null; } set { } }
public Azure.Storage.Files.Shares.Models.ShareFileRequestConditions Conditions { get { throw null; } set { } }
public int? QuotaInGB { get { throw null; } set { } }
public Azure.Storage.Files.Shares.Models.ShareRootSquash? RootSquash { get { throw null; } set { } }
}
public partial class ShareSignedIdentifier
{
Expand Down
Loading