< Summary

Class:Azure.ResourceManager.Storage.Models.BlobContainer
Assembly:Azure.ResourceManager.Storage
File(s):C:\Git\azure-sdk-for-net\sdk\storage\Azure.ResourceManager.Storage\src\Generated\Models\BlobContainer.cs
C:\Git\azure-sdk-for-net\sdk\storage\Azure.ResourceManager.Storage\src\Generated\Models\BlobContainer.Serialization.cs
Covered lines:172
Uncovered lines:42
Coverable lines:214
Total lines:454
Line coverage:80.3% (172 of 214)
Covered branches:109
Total branches:132
Branch coverage:82.5% (109 of 132)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor()-100%100%
.ctor(...)-100%100%
get_Version()-100%100%
get_Deleted()-100%100%
get_DeletedTime()-100%100%
get_RemainingRetentionDays()-100%100%
get_DefaultEncryptionScope()-100%100%
get_DenyEncryptionScopeOverride()-100%100%
get_PublicAccess()-100%100%
get_LastModifiedTime()-100%100%
get_LeaseStatus()-100%100%
get_LeaseState()-100%100%
get_LeaseDuration()-100%100%
get_Metadata()-100%100%
get_ImmutabilityPolicy()-100%100%
get_LegalHold()-100%100%
get_HasLegalHold()-100%100%
get_HasImmutabilityPolicy()-100%100%
Azure.Core.IUtf8JsonSerializable.Write(...)-54.29%61.9%
DeserializeBlobContainer(...)-90.74%92.22%

File(s)

C:\Git\azure-sdk-for-net\sdk\storage\Azure.ResourceManager.Storage\src\Generated\Models\BlobContainer.cs

#LineLine coverage
 1// Copyright (c) Microsoft Corporation. All rights reserved.
 2// Licensed under the MIT License.
 3
 4// <auto-generated/>
 5
 6#nullable disable
 7
 8using System;
 9using System.Collections.Generic;
 10
 11namespace Azure.ResourceManager.Storage.Models
 12{
 13    /// <summary> Properties of the blob container, including Id, resource name, resource type, Etag. </summary>
 14    public partial class BlobContainer : AzureEntityResource
 15    {
 16        /// <summary> Initializes a new instance of BlobContainer. </summary>
 8017        public BlobContainer()
 18        {
 8019        }
 20
 21        /// <summary> Initializes a new instance of BlobContainer. </summary>
 22        /// <param name="id"> Fully qualified resource Id for the resource. Ex - /subscriptions/{subscriptionId}/resourc
 23        /// <param name="name"> The name of the resource. </param>
 24        /// <param name="type"> The type of the resource. Ex- Microsoft.Compute/virtualMachines or Microsoft.Storage/sto
 25        /// <param name="etag"> Resource Etag. </param>
 26        /// <param name="version"> The version of the deleted blob container. </param>
 27        /// <param name="deleted"> Indicates whether the blob container was deleted. </param>
 28        /// <param name="deletedTime"> Blob container deletion time. </param>
 29        /// <param name="remainingRetentionDays"> Remaining retention days for soft deleted blob container. </param>
 30        /// <param name="defaultEncryptionScope"> Default the container to use specified encryption scope for all writes
 31        /// <param name="denyEncryptionScopeOverride"> Block override of encryption scope from the container default. </
 32        /// <param name="publicAccess"> Specifies whether data in the container may be accessed publicly and the level o
 33        /// <param name="lastModifiedTime"> Returns the date and time the container was last modified. </param>
 34        /// <param name="leaseStatus"> The lease status of the container. </param>
 35        /// <param name="leaseState"> Lease state of the container. </param>
 36        /// <param name="leaseDuration"> Specifies whether the lease on a container is of infinite or fixed duration, on
 37        /// <param name="metadata"> A name-value pair to associate with the container as metadata. </param>
 38        /// <param name="immutabilityPolicy"> The ImmutabilityPolicy property of the container. </param>
 39        /// <param name="legalHold"> The LegalHold property of the container. </param>
 40        /// <param name="hasLegalHold"> The hasLegalHold public property is set to true by SRP if there are at least one
 41        /// <param name="hasImmutabilityPolicy"> The hasImmutabilityPolicy public property is set to true by SRP if Immu
 9242        internal BlobContainer(string id, string name, string type, string etag, string version, bool? deleted, DateTime
 43        {
 9244            Version = version;
 9245            Deleted = deleted;
 9246            DeletedTime = deletedTime;
 9247            RemainingRetentionDays = remainingRetentionDays;
 9248            DefaultEncryptionScope = defaultEncryptionScope;
 9249            DenyEncryptionScopeOverride = denyEncryptionScopeOverride;
 9250            PublicAccess = publicAccess;
 9251            LastModifiedTime = lastModifiedTime;
 9252            LeaseStatus = leaseStatus;
 9253            LeaseState = leaseState;
 9254            LeaseDuration = leaseDuration;
 9255            Metadata = metadata;
 9256            ImmutabilityPolicy = immutabilityPolicy;
 9257            LegalHold = legalHold;
 9258            HasLegalHold = hasLegalHold;
 9259            HasImmutabilityPolicy = hasImmutabilityPolicy;
 9260        }
 61
 62        /// <summary> The version of the deleted blob container. </summary>
 8063        public string Version { get; }
 64        /// <summary> Indicates whether the blob container was deleted. </summary>
 8065        public bool? Deleted { get; }
 66        /// <summary> Blob container deletion time. </summary>
 8067        public DateTimeOffset? DeletedTime { get; }
 68        /// <summary> Remaining retention days for soft deleted blob container. </summary>
 8069        public int? RemainingRetentionDays { get; }
 70        /// <summary> Default the container to use specified encryption scope for all writes. </summary>
 19671        public string DefaultEncryptionScope { get; set; }
 72        /// <summary> Block override of encryption scope from the container default. </summary>
 19673        public bool? DenyEncryptionScopeOverride { get; set; }
 74        /// <summary> Specifies whether data in the container may be accessed publicly and the level of access. </summar
 29275        public PublicAccess? PublicAccess { get; set; }
 76        /// <summary> Returns the date and time the container was last modified. </summary>
 8077        public DateTimeOffset? LastModifiedTime { get; }
 78        /// <summary> The lease status of the container. </summary>
 8079        public LeaseStatus? LeaseStatus { get; }
 80        /// <summary> Lease state of the container. </summary>
 8081        public LeaseState? LeaseState { get; }
 82        /// <summary> Specifies whether the lease on a container is of infinite or fixed duration, only when the contain
 8083        public LeaseDuration? LeaseDuration { get; }
 84        /// <summary> A name-value pair to associate with the container as metadata. </summary>
 29285        public IDictionary<string, string> Metadata { get; set; }
 86        /// <summary> The ImmutabilityPolicy property of the container. </summary>
 9687        public ImmutabilityPolicyProperties ImmutabilityPolicy { get; }
 88        /// <summary> The LegalHold property of the container. </summary>
 10089        public LegalHoldProperties LegalHold { get; }
 90        /// <summary> The hasLegalHold public property is set to true by SRP if there are at least one existing tag. The
 9691        public bool? HasLegalHold { get; }
 92        /// <summary> The hasImmutabilityPolicy public property is set to true by SRP if ImmutabilityPolicy has been cre
 9693        public bool? HasImmutabilityPolicy { get; }
 94    }
 95}

C:\Git\azure-sdk-for-net\sdk\storage\Azure.ResourceManager.Storage\src\Generated\Models\BlobContainer.Serialization.cs

#LineLine coverage
 1// Copyright (c) Microsoft Corporation. All rights reserved.
 2// Licensed under the MIT License.
 3
 4// <auto-generated/>
 5
 6#nullable disable
 7
 8using System;
 9using System.Collections.Generic;
 10using System.Text.Json;
 11using Azure.Core;
 12
 13namespace Azure.ResourceManager.Storage.Models
 14{
 15    public partial class BlobContainer : IUtf8JsonSerializable
 16    {
 17        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 18        {
 8019            writer.WriteStartObject();
 8020            if (Etag != null)
 21            {
 022                writer.WritePropertyName("etag");
 023                writer.WriteStringValue(Etag);
 24            }
 8025            if (Id != null)
 26            {
 027                writer.WritePropertyName("id");
 028                writer.WriteStringValue(Id);
 29            }
 8030            if (Name != null)
 31            {
 032                writer.WritePropertyName("name");
 033                writer.WriteStringValue(Name);
 34            }
 8035            if (Type != null)
 36            {
 037                writer.WritePropertyName("type");
 038                writer.WriteStringValue(Type);
 39            }
 8040            writer.WritePropertyName("properties");
 8041            writer.WriteStartObject();
 8042            if (Version != null)
 43            {
 044                writer.WritePropertyName("version");
 045                writer.WriteStringValue(Version);
 46            }
 8047            if (Deleted != null)
 48            {
 049                writer.WritePropertyName("deleted");
 050                writer.WriteBooleanValue(Deleted.Value);
 51            }
 8052            if (DeletedTime != null)
 53            {
 054                writer.WritePropertyName("deletedTime");
 055                writer.WriteStringValue(DeletedTime.Value, "O");
 56            }
 8057            if (RemainingRetentionDays != null)
 58            {
 059                writer.WritePropertyName("remainingRetentionDays");
 060                writer.WriteNumberValue(RemainingRetentionDays.Value);
 61            }
 8062            if (DefaultEncryptionScope != null)
 63            {
 864                writer.WritePropertyName("defaultEncryptionScope");
 865                writer.WriteStringValue(DefaultEncryptionScope);
 66            }
 8067            if (DenyEncryptionScopeOverride != null)
 68            {
 869                writer.WritePropertyName("denyEncryptionScopeOverride");
 870                writer.WriteBooleanValue(DenyEncryptionScopeOverride.Value);
 71            }
 8072            if (PublicAccess != null)
 73            {
 874                writer.WritePropertyName("publicAccess");
 875                writer.WriteStringValue(PublicAccess.Value.ToSerialString());
 76            }
 8077            if (LastModifiedTime != null)
 78            {
 079                writer.WritePropertyName("lastModifiedTime");
 080                writer.WriteStringValue(LastModifiedTime.Value, "O");
 81            }
 8082            if (LeaseStatus != null)
 83            {
 084                writer.WritePropertyName("leaseStatus");
 085                writer.WriteStringValue(LeaseStatus.Value.ToString());
 86            }
 8087            if (LeaseState != null)
 88            {
 089                writer.WritePropertyName("leaseState");
 090                writer.WriteStringValue(LeaseState.Value.ToString());
 91            }
 8092            if (LeaseDuration != null)
 93            {
 094                writer.WritePropertyName("leaseDuration");
 095                writer.WriteStringValue(LeaseDuration.Value.ToString());
 96            }
 8097            if (Metadata != null)
 98            {
 899                writer.WritePropertyName("metadata");
 8100                writer.WriteStartObject();
 32101                foreach (var item in Metadata)
 102                {
 8103                    writer.WritePropertyName(item.Key);
 8104                    writer.WriteStringValue(item.Value);
 105                }
 8106                writer.WriteEndObject();
 107            }
 80108            if (ImmutabilityPolicy != null)
 109            {
 0110                writer.WritePropertyName("immutabilityPolicy");
 0111                writer.WriteObjectValue(ImmutabilityPolicy);
 112            }
 80113            if (LegalHold != null)
 114            {
 0115                writer.WritePropertyName("legalHold");
 0116                writer.WriteObjectValue(LegalHold);
 117            }
 80118            if (HasLegalHold != null)
 119            {
 0120                writer.WritePropertyName("hasLegalHold");
 0121                writer.WriteBooleanValue(HasLegalHold.Value);
 122            }
 80123            if (HasImmutabilityPolicy != null)
 124            {
 0125                writer.WritePropertyName("hasImmutabilityPolicy");
 0126                writer.WriteBooleanValue(HasImmutabilityPolicy.Value);
 127            }
 80128            writer.WriteEndObject();
 80129            writer.WriteEndObject();
 80130        }
 131
 132        internal static BlobContainer DeserializeBlobContainer(JsonElement element)
 133        {
 92134            string etag = default;
 92135            string id = default;
 92136            string name = default;
 92137            string type = default;
 92138            string version = default;
 92139            bool? deleted = default;
 92140            DateTimeOffset? deletedTime = default;
 92141            int? remainingRetentionDays = default;
 92142            string defaultEncryptionScope = default;
 92143            bool? denyEncryptionScopeOverride = default;
 92144            PublicAccess? publicAccess = default;
 92145            DateTimeOffset? lastModifiedTime = default;
 92146            LeaseStatus? leaseStatus = default;
 92147            LeaseState? leaseState = default;
 92148            LeaseDuration? leaseDuration = default;
 92149            IDictionary<string, string> metadata = default;
 92150            ImmutabilityPolicyProperties immutabilityPolicy = default;
 92151            LegalHoldProperties legalHold = default;
 92152            bool? hasLegalHold = default;
 92153            bool? hasImmutabilityPolicy = default;
 944154            foreach (var property in element.EnumerateObject())
 155            {
 380156                if (property.NameEquals("etag"))
 157                {
 12158                    if (property.Value.ValueKind == JsonValueKind.Null)
 159                    {
 160                        continue;
 161                    }
 12162                    etag = property.Value.GetString();
 12163                    continue;
 164                }
 368165                if (property.NameEquals("id"))
 166                {
 92167                    if (property.Value.ValueKind == JsonValueKind.Null)
 168                    {
 169                        continue;
 170                    }
 92171                    id = property.Value.GetString();
 92172                    continue;
 173                }
 276174                if (property.NameEquals("name"))
 175                {
 92176                    if (property.Value.ValueKind == JsonValueKind.Null)
 177                    {
 178                        continue;
 179                    }
 92180                    name = property.Value.GetString();
 92181                    continue;
 182                }
 184183                if (property.NameEquals("type"))
 184                {
 92185                    if (property.Value.ValueKind == JsonValueKind.Null)
 186                    {
 187                        continue;
 188                    }
 92189                    type = property.Value.GetString();
 92190                    continue;
 191                }
 92192                if (property.NameEquals("properties"))
 193                {
 1168194                    foreach (var property0 in property.Value.EnumerateObject())
 195                    {
 492196                        if (property0.NameEquals("version"))
 197                        {
 0198                            if (property0.Value.ValueKind == JsonValueKind.Null)
 199                            {
 200                                continue;
 201                            }
 0202                            version = property0.Value.GetString();
 0203                            continue;
 204                        }
 492205                        if (property0.NameEquals("deleted"))
 206                        {
 92207                            if (property0.Value.ValueKind == JsonValueKind.Null)
 208                            {
 209                                continue;
 210                            }
 92211                            deleted = property0.Value.GetBoolean();
 92212                            continue;
 213                        }
 400214                        if (property0.NameEquals("deletedTime"))
 215                        {
 0216                            if (property0.Value.ValueKind == JsonValueKind.Null)
 217                            {
 218                                continue;
 219                            }
 0220                            deletedTime = property0.Value.GetDateTimeOffset("O");
 0221                            continue;
 222                        }
 400223                        if (property0.NameEquals("remainingRetentionDays"))
 224                        {
 92225                            if (property0.Value.ValueKind == JsonValueKind.Null)
 226                            {
 227                                continue;
 228                            }
 92229                            remainingRetentionDays = property0.Value.GetInt32();
 92230                            continue;
 231                        }
 308232                        if (property0.NameEquals("defaultEncryptionScope"))
 233                        {
 20234                            if (property0.Value.ValueKind == JsonValueKind.Null)
 235                            {
 236                                continue;
 237                            }
 20238                            defaultEncryptionScope = property0.Value.GetString();
 20239                            continue;
 240                        }
 288241                        if (property0.NameEquals("denyEncryptionScopeOverride"))
 242                        {
 20243                            if (property0.Value.ValueKind == JsonValueKind.Null)
 244                            {
 245                                continue;
 246                            }
 20247                            denyEncryptionScopeOverride = property0.Value.GetBoolean();
 20248                            continue;
 249                        }
 268250                        if (property0.NameEquals("publicAccess"))
 251                        {
 20252                            if (property0.Value.ValueKind == JsonValueKind.Null)
 253                            {
 254                                continue;
 255                            }
 20256                            publicAccess = property0.Value.GetString().ToPublicAccess();
 20257                            continue;
 258                        }
 248259                        if (property0.NameEquals("lastModifiedTime"))
 260                        {
 12261                            if (property0.Value.ValueKind == JsonValueKind.Null)
 262                            {
 263                                continue;
 264                            }
 12265                            lastModifiedTime = property0.Value.GetDateTimeOffset("O");
 12266                            continue;
 267                        }
 236268                        if (property0.NameEquals("leaseStatus"))
 269                        {
 12270                            if (property0.Value.ValueKind == JsonValueKind.Null)
 271                            {
 272                                continue;
 273                            }
 12274                            leaseStatus = new LeaseStatus(property0.Value.GetString());
 12275                            continue;
 276                        }
 224277                        if (property0.NameEquals("leaseState"))
 278                        {
 12279                            if (property0.Value.ValueKind == JsonValueKind.Null)
 280                            {
 281                                continue;
 282                            }
 12283                            leaseState = new LeaseState(property0.Value.GetString());
 12284                            continue;
 285                        }
 212286                        if (property0.NameEquals("leaseDuration"))
 287                        {
 0288                            if (property0.Value.ValueKind == JsonValueKind.Null)
 289                            {
 290                                continue;
 291                            }
 0292                            leaseDuration = new LeaseDuration(property0.Value.GetString());
 0293                            continue;
 294                        }
 212295                        if (property0.NameEquals("metadata"))
 296                        {
 12297                            if (property0.Value.ValueKind == JsonValueKind.Null)
 298                            {
 299                                continue;
 300                            }
 12301                            Dictionary<string, string> dictionary = new Dictionary<string, string>();
 48302                            foreach (var property1 in property0.Value.EnumerateObject())
 303                            {
 12304                                if (property1.Value.ValueKind == JsonValueKind.Null)
 305                                {
 0306                                    dictionary.Add(property1.Name, null);
 307                                }
 308                                else
 309                                {
 12310                                    dictionary.Add(property1.Name, property1.Value.GetString());
 311                                }
 312                            }
 12313                            metadata = dictionary;
 12314                            continue;
 315                        }
 200316                        if (property0.NameEquals("immutabilityPolicy"))
 317                        {
 4318                            if (property0.Value.ValueKind == JsonValueKind.Null)
 319                            {
 320                                continue;
 321                            }
 4322                            immutabilityPolicy = ImmutabilityPolicyProperties.DeserializeImmutabilityPolicyProperties(pr
 4323                            continue;
 324                        }
 196325                        if (property0.NameEquals("legalHold"))
 326                        {
 12327                            if (property0.Value.ValueKind == JsonValueKind.Null)
 328                            {
 329                                continue;
 330                            }
 12331                            legalHold = LegalHoldProperties.DeserializeLegalHoldProperties(property0.Value);
 12332                            continue;
 333                        }
 184334                        if (property0.NameEquals("hasLegalHold"))
 335                        {
 92336                            if (property0.Value.ValueKind == JsonValueKind.Null)
 337                            {
 338                                continue;
 339                            }
 92340                            hasLegalHold = property0.Value.GetBoolean();
 92341                            continue;
 342                        }
 92343                        if (property0.NameEquals("hasImmutabilityPolicy"))
 344                        {
 92345                            if (property0.Value.ValueKind == JsonValueKind.Null)
 346                            {
 347                                continue;
 348                            }
 92349                            hasImmutabilityPolicy = property0.Value.GetBoolean();
 350                            continue;
 351                        }
 352                    }
 353                    continue;
 354                }
 355            }
 92356            return new BlobContainer(id, name, type, etag, version, deleted, deletedTime, remainingRetentionDays, defaul
 357        }
 358    }
 359}