diff --git a/sdk/storage/Azure.Storage.Blobs/src/Generated/BlobRestClient.cs b/sdk/storage/Azure.Storage.Blobs/src/Generated/BlobRestClient.cs index e652b731f623..49619f6dd0bd 100644 --- a/sdk/storage/Azure.Storage.Blobs/src/Generated/BlobRestClient.cs +++ b/sdk/storage/Azure.Storage.Blobs/src/Generated/BlobRestClient.cs @@ -13176,29 +13176,79 @@ internal BlobBatchResult() { } } #endregion class BlobBatchResult -#region class BlobBlock +#region struct BlobBlock namespace Azure.Storage.Blobs.Models { /// /// Represents a single block in a block blob. It describes the block's ID and size. /// - public partial class BlobBlock + public readonly partial struct BlobBlock: System.IEquatable { /// /// The base64 encoded block ID. /// - public string Name { get; internal set; } + public string Name { get; } /// /// The block size in bytes. /// - public int Size { get; internal set; } + public int Size { get; } /// /// Prevent direct instantiation of BlobBlock instances. /// You can use BlobsModelFactory.BlobBlock instead. /// - internal BlobBlock() { } + internal BlobBlock( + string name, + int size) + { + Name = name; + Size = size; + } + + /// + /// Check if two BlobBlock instances are equal. + /// + /// The instance to compare to. + /// True if they're equal, false otherwise. + [System.ComponentModel.EditorBrowsable((System.ComponentModel.EditorBrowsableState.Never))] + public bool Equals(BlobBlock other) + { + if (!System.StringComparer.Ordinal.Equals(Name, other.Name)) + { + return false; + } + if (!Size.Equals(other.Size)) + { + return false; + } + + return true; + } + + /// + /// Check if two BlobBlock 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 BlobBlock && Equals((BlobBlock)obj); + + /// + /// Get a hash code for the BlobBlock. + /// + [System.ComponentModel.EditorBrowsable((System.ComponentModel.EditorBrowsableState.Never))] + public override int GetHashCode() + { + var hashCode = new Azure.Core.HashCodeBuilder(); + if (Name != null) + { + hashCode.Add(Name, System.StringComparer.Ordinal); + } + hashCode.Add(Size); + + return hashCode.ToHashCode(); + } /// /// Deserializes XML into a new BlobBlock instance. @@ -13209,17 +13259,19 @@ internal static Azure.Storage.Blobs.Models.BlobBlock FromXml(System.Xml.Linq.XEl { System.Diagnostics.Debug.Assert(element != null); System.Xml.Linq.XElement _child; - Azure.Storage.Blobs.Models.BlobBlock _value = new Azure.Storage.Blobs.Models.BlobBlock(); + string name = default; + int size = default; _child = element.Element(System.Xml.Linq.XName.Get("Name", "")); if (_child != null) { - _value.Name = _child.Value; + name = _child.Value; } _child = element.Element(System.Xml.Linq.XName.Get("Size", "")); if (_child != null) { - _value.Size = int.Parse(_child.Value, System.Globalization.CultureInfo.InvariantCulture); + size = int.Parse(_child.Value, System.Globalization.CultureInfo.InvariantCulture); } + Azure.Storage.Blobs.Models.BlobBlock _value = new Azure.Storage.Blobs.Models.BlobBlock(name, size); CustomizeFromXml(element, _value); return _value; } @@ -13239,15 +13291,11 @@ public static BlobBlock BlobBlock( string name, int size) { - return new BlobBlock() - { - Name = name, - Size = size, - }; + return new BlobBlock(name, size); } } } -#endregion class BlobBlock +#endregion struct BlobBlock #region class BlobContainerAccessPolicy namespace Azure.Storage.Blobs.Models diff --git a/sdk/storage/Azure.Storage.Blobs/swagger/readme.md b/sdk/storage/Azure.Storage.Blobs/swagger/readme.md index 129d0a0962ba..57fa90db4fa7 100644 --- a/sdk/storage/Azure.Storage.Blobs/swagger/readme.md +++ b/sdk/storage/Azure.Storage.Blobs/swagger/readme.md @@ -1305,6 +1305,7 @@ directive: $.BlobBlock = $.Block; delete $.Block; $.BlobBlock.xml = { "name": "Block" }; + $.BlobBlock["x-az-struct"] = true; const path = $.BlockList.properties.CommittedBlocks.items.$ref.replace(/[#].*$/, "#/definitions/BlobBlock"); $.BlockList.properties.CommittedBlocks.items.$ref = path; $.BlockList.properties.CommittedBlocks.xml.name = "CommittedBlocks"; @@ -1338,6 +1339,7 @@ directive: $.PageList["x-az-public"] = false; $.PageRange["x-az-public"] = false; $.ClearRange["x-az-public"] = false; +``` ### Access Policy properties renaming ``` yaml