diff --git a/sdk/storage/Azure.Storage.Queues/src/Generated/QueueRestClient.cs b/sdk/storage/Azure.Storage.Queues/src/Generated/QueueRestClient.cs index aca386039230..20348428e2ad 100644 --- a/sdk/storage/Azure.Storage.Queues/src/Generated/QueueRestClient.cs +++ b/sdk/storage/Azure.Storage.Queues/src/Generated/QueueRestClient.cs @@ -2585,7 +2585,7 @@ internal static Azure.Storage.Queues.Models.GeoReplication FromXml(System.Xml.Li _child = element.Element(System.Xml.Linq.XName.Get("Status", "")); if (_child != null && !string.IsNullOrEmpty(_child.Value)) { - _value.Status = _child.Value; + _value.Status = Azure.Storage.Queues.QueueRestClient.Serialization.ParseGeoReplicationStatus(_child.Value); } _child = element.Element(System.Xml.Linq.XName.Get("LastSyncTime", "")); if (_child != null) @@ -2621,93 +2621,64 @@ public static GeoReplication GeoReplication( } #endregion class GeoReplication -#region enum strings GeoReplicationStatus +#region enum GeoReplicationStatus namespace Azure.Storage.Queues.Models { /// /// The status of the secondary location /// - public readonly struct GeoReplicationStatus : System.IEquatable + #pragma warning disable CA1717 // Only FlagsAttribute enums should have plural names + public enum GeoReplicationStatus + #pragma warning restore CA1717 // Only FlagsAttribute enums should have plural names { - /// - /// The GeoReplicationStatus value. - /// - private readonly string _value; - - /// - /// Initializes a new instance of the structure. - /// - /// The string value of the instance. - public GeoReplicationStatus(string value) { _value = value ?? throw new System.ArgumentNullException(nameof(value)); } - /// /// live /// - public static readonly Azure.Storage.Queues.Models.GeoReplicationStatus Live = new GeoReplicationStatus(@"live"); + Live, /// /// bootstrap /// - public static readonly Azure.Storage.Queues.Models.GeoReplicationStatus Bootstrap = new GeoReplicationStatus(@"bootstrap"); + Bootstrap, /// /// unavailable /// - public static readonly Azure.Storage.Queues.Models.GeoReplicationStatus Unavailable = new GeoReplicationStatus(@"unavailable"); - - /// - /// Determines if two values are the same. - /// - /// The first to compare. - /// The second to compare. - /// True if and are the same; otherwise, false. - public static bool operator ==(Azure.Storage.Queues.Models.GeoReplicationStatus left, Azure.Storage.Queues.Models.GeoReplicationStatus right) => left.Equals(right); - - /// - /// Determines if two values are different. - /// - /// The first to compare. - /// The second to compare. - /// True if and are different; otherwise, false. - public static bool operator !=(Azure.Storage.Queues.Models.GeoReplicationStatus left, Azure.Storage.Queues.Models.GeoReplicationStatus right) => !left.Equals(right); - - /// - /// Converts a string to a . - /// - /// The string value to convert. - /// The GeoReplicationStatus value. - public static implicit operator GeoReplicationStatus(string value) => new Azure.Storage.Queues.Models.GeoReplicationStatus(value); - - /// - /// Check if two instances are equal. - /// - /// The instance to compare to. - /// True if they're equal, false otherwise. - [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is Azure.Storage.Queues.Models.GeoReplicationStatus other && Equals(other); - - /// - /// Check if two instances are equal. - /// - /// The instance to compare to. - /// True if they're equal, false otherwise. - public bool Equals(Azure.Storage.Queues.Models.GeoReplicationStatus other) => string.Equals(_value, other._value, System.StringComparison.Ordinal); + Unavailable + } +} - /// - /// Get a hash code for the . - /// - /// Hash code for the GeoReplicationStatus. - [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - public override int GetHashCode() => _value?.GetHashCode() ?? 0; +namespace Azure.Storage.Queues +{ + internal static partial class QueueRestClient + { + public static partial class Serialization + { + public static string ToString(Azure.Storage.Queues.Models.GeoReplicationStatus value) + { + return value switch + { + Azure.Storage.Queues.Models.GeoReplicationStatus.Live => "live", + Azure.Storage.Queues.Models.GeoReplicationStatus.Bootstrap => "bootstrap", + Azure.Storage.Queues.Models.GeoReplicationStatus.Unavailable => "unavailable", + _ => throw new System.ArgumentOutOfRangeException(nameof(value), value, "Unknown Azure.Storage.Queues.Models.GeoReplicationStatus value.") + }; + } - /// - /// Convert the to a string. - /// - /// String representation of the GeoReplicationStatus. - public override string ToString() => _value; + public static Azure.Storage.Queues.Models.GeoReplicationStatus ParseGeoReplicationStatus(string value) + { + return value switch + { + "live" => Azure.Storage.Queues.Models.GeoReplicationStatus.Live, + "bootstrap" => Azure.Storage.Queues.Models.GeoReplicationStatus.Bootstrap, + "unavailable" => Azure.Storage.Queues.Models.GeoReplicationStatus.Unavailable, + _ => throw new System.ArgumentOutOfRangeException(nameof(value), value, "Unknown Azure.Storage.Queues.Models.GeoReplicationStatus value.") + }; + } + } } } -#endregion enum strings GeoReplicationStatus +#endregion enum GeoReplicationStatus #region enum ListQueuesIncludeType namespace Azure.Storage.Queues.Models diff --git a/sdk/storage/Azure.Storage.Queues/swagger/readme.md b/sdk/storage/Azure.Storage.Queues/swagger/readme.md index 826614e79c01..e96ad63edd38 100644 --- a/sdk/storage/Azure.Storage.Queues/swagger/readme.md +++ b/sdk/storage/Azure.Storage.Queues/swagger/readme.md @@ -185,6 +185,7 @@ directive: where: $.definitions.GeoReplication.properties.Status transform: > $["x-ms-enum"].name = "GeoReplicationStatus"; + $["x-ms-enum"].modelAsString = false; ``` ### StorageError